宝塔部署说明.md 1.9 KB

抖音物流系统 - 宝塔部署说明

一、环境要求

  • 宝塔面板
  • .NET 8.0 运行时
  • MySQL 5.7+ 或 8.0

二、部署步骤

1. 安装 .NET 8 运行时

宝塔 → 软件商店 → 搜索「.NET」→ 安装 .NET 8 运行时

或命令行:

# CentOS/RHEL
sudo dnf install dotnet-runtime-8.0

# Ubuntu
sudo apt install dotnet-runtime-8.0

2. 创建 MySQL 数据库

  • 数据库名:DouyinLogistics
  • 字符集:utf8mb4

3. 修改配置文件

编辑 appsettings.json

  • ConnectionStrings.DefaultConnection:改为你的 MySQL 连接串
  • Douyin:抖音应用配置(AppKey、AppSecret、CallbackUrl 等)
  • ErpApi.BaseUrl:ERP(NCC)API 地址,如 http://你的服务器:2015

4. 上传并运行

  1. 将整个 douyin-deploy 目录上传到服务器(如 /www/wwwroot/douyin)
  2. 宝塔 → 网站 → 添加站点(或使用已有站点)
  3. 宝塔 → 软件商店 → 安装「PM2」或使用「Supervisor」
  4. 添加进程守护:
    • 启动命令:dotnet DouyinLogistics.API.dll
    • 运行目录:/www/wwwroot/douyin(你的实际路径)

5. Nginx 反向代理(推荐)

location / {
    proxy_pass http://127.0.0.1:5070;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection keep-alive;
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}

或直接运行在 80 端口:修改 DouyinLogistics.API 启动参数 --urls "http://0.0.0.0:80"

三、首次运行

  1. 启动后访问:http://你的域名/
  2. 首次需完成抖音 OAuth 授权获取 Token
  3. 点击「同步订单」拉取抖音订单

四、环境变量(可选)

可通过环境变量覆盖配置,便于 Docker/宝塔:

  • DB_CONNECTION:数据库连接串
  • DY_APP_KEY、DY_APP_SECRET:抖音应用
  • DY_CALLBACK_URL:授权回调地址
  • ErpApi 等见 appsettings.json