| 
				
					 | 
			il y a 1 an | |
|---|---|---|
| configs | il y a 1 an | |
| doc | il y a 1 an | |
| docs | il y a 1 an | |
| internal | il y a 1 an | |
| tools | il y a 1 an | |
| .gitignore | il y a 1 an | |
| Makefile | il y a 1 an | |
| README.md | il y a 1 an | |
| go.mod | il y a 1 an | |
| go.sum | il y a 1 an | |
| main.go | il y a 1 an | 
golang开发,安装版本>= 1.21Mysql数据库,安装版本>=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.goLinux运行需要加 GOOS=linux GOARCH=amd64 go bulid
# 项目目录下执行
# 编译
make
# 查看版本
./cmd/<执行文件> version
# 启动api服务
./cmd/<执行文件> run --profile=./configs/test.yml
前后端整体部署时需安装Nginx,相关conf文件参考如下:
upstream cold-logistic {
   server <cold-logistic进程ip:port> fail_timeout=0;
}
server {
listen       443 ssl http2;
server_name  cold.coldbaozhida.com;
ssl_certificate     <xxxxx.cn_bundle.crt>;
ssl_certificate_key  <xxxxx..cn.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;
}
}
# 查看命令帮助信息
./cmd/<二进制执行文件> --help 
配置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"