Files
ycc-proxy-server/deploy/sql/generate_tianyuanapi_models.sh
2026-01-13 18:30:10 +08:00

36 lines
1.3 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 天元API调用记录表 - Model生成脚本
# 数据库配置从main.yaml中提取
DB_HOST="ycc_mysql:3306"
DB_USER="ycc"
DB_PASS="5vg67b3UNHu8"
DB_NAME="ycc"
MODEL_DIR="../../app/main/model"
TEMPLATE_DIR="./template"
# 生成feature表已添加cost_price字段
echo "正在生成 feature 表Model..."
goctl model mysql datasource -url="$DB_USER:$DB_PASS@tcp($DB_HOST)/$DB_NAME" -table="feature" -dir="$MODEL_DIR" -cache=true --style=goZero --home="$TEMPLATE_DIR"
# 生成tianyuanapi_call_log表
echo "正在生成 tianyuanapi_call_log 表Model..."
goctl model mysql datasource -url="$DB_USER:$DB_PASS@tcp($DB_HOST)/$DB_NAME" -table="tianyuanapi_call_log" -dir="$MODEL_DIR" -cache=true --style=goZero --home="$TEMPLATE_DIR"
echo "========================================="
echo "Model生成完成"
echo "========================================="
echo "生成的文件:"
echo " 1. featureModel_gen.go (已更新)"
echo " 2. featureModel.go (已更新)"
echo " 3. tianyuanapiCallLogModel_gen.go (新建)"
echo " 4. tianyuanapiCallLogModel.go (新建)"
echo "========================================="
echo "下一步:"
echo " 1. 检查生成的Model文件"
echo " 2. 更新svc/servicecontext.go添加新Model的初始化"
echo " 3. 在apirequestService.go中添加调用记录逻辑"
echo "========================================="