# 项目名称 - 冷链物流系统 ## 功能特性 - 用户端下单 - 司机端装货 - 平台管理仓库,订单,车辆 ## 快速开始 ### 依赖检查 - 本项目使用`golang`开发,安装版本>= 1.21 - 本项目使用`Mysql`数据库,安装版本>= ### 构建 - 本项目使用Makefile进行构建 - 在项目目录下执行`make`,将在`./cmd`目录下生成对应二进制执行文件(以项目目录名命名) - 也可使用命令构建 `go build -ldflags "-X gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/version.Version=1.0 -X gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/version.BuildTime=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" -o ./cmd/cclogisticserver/cclogistic_6270 -v ./cmd/cclogisticserver/main.go` - Linux运行需要加 `GOOS=linux GOARCH=amd64 go bulid ` ### 运行 ```shell script # 项目目录下执行 # 编译 make # 查看版本 ./cmd/<执行文件> version # 启动api服务 ./cmd/<执行文件> run --profile=./configs/test.yml ``` - [配置文件请参考](configs/test.yaml) - 前后端整体部署时需安装Nginx,相关conf文件参考如下: ```text upstream cold-logistic { server fail_timeout=0; } server { listen 443 ssl http2; server_name cold.coldbaozhida.com; ssl_certificate ; ssl_certificate_key ; error_log /var/log/nginx/error_Cold_Logistic.log; access_log /var/log/nginx/access_Cold_Logistic.log main; location /iblfront/Cold_Logistic { if ($request_filename ~* .*\.(?:htm|html|exe|yaml|yml|exe.blockmap|json|mp3)$){ add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate"; } alias <前端静态文件目录>; } location /Cold_Logistic/download/ { add_header Access-Control-Allow-Methods *; add_header Access-Control-Max-Age 3600; add_header Access-Control-Allow-Credentials true; add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers $http_access_control_request_headers; if ($request_method = OPTIONS){ return 200; } # add_header Content-Type "application/octet-stream"; alias <配置文件中storage.localstorage.rootFilepath>; } location /Cold_Logistic/api/ { if ($request_method = OPTIONS){ return 200; } proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240; proxy_pass http://Cold_Logistic; } } location / { client_max_body_size 10m; add_header Access-Control-Allow-Methods *; add_header Access-Control-Max-Age 3600; add_header Access-Control-Allow-Credentials true; add_header Access-Control-Allow-Origin $http_origin; add_header Access-Control-Allow-Headers $http_access_control_request_headers; if ($request_method = OPTIONS){ return 200; } proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240; proxy_pass http://Cold_Logistic; } } ``` ## 使用指南 ```shell script # 查看命令帮助信息 ./cmd/<二进制执行文件> --help ``` - [项目框架说明文档](./doc/develop/framework.md) - [项目开发规范](./doc/develop/standards.md) ## 【内部项目/非开源】 - **未经授权严禁公开** ## 引入本地包 配置ssh ssh-keygen -t rsa -b 4096 -C "example@example.com" git config --global url."git@gogs.baozhida.cn/Cold_Logistic_libs.git".insteadof "https://gogs.baozhida.cn/zoie/Cold_Logistic_libs.git" go get "gogs.baozhida.cn/zoie/Cold_Logistic_libs.git@master"