This commit is contained in:
2025-12-09 18:55:28 +08:00
parent 8d00d67540
commit c23ab8338b
209 changed files with 5445 additions and 3963 deletions

View File

@@ -1,64 +1,68 @@
# 设置输出编码为UTF-8
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$OutputEncoding = [System.Text.Encoding]::UTF8
chcp.com 65001 | Out-Null
# 目录配置
$OUTPUT_DIR = "./model"
$TARGET_DIR = "../../app/main/model"
$HOME_DIR = Join-Path $PSScriptRoot "..\template"
# 表名列表
$tables = @(
# ============================================
# 新代理系统表
# ============================================
"admin_api",
"admin_dict_data",
"admin_dict_type",
"admin_menu",
"admin_promotion_link",
"admin_promotion_link_stats_history",
"admin_promotion_link_stats_total",
"admin_promotion_order",
"admin_role",
"admin_role_api",
"admin_role_menu",
"admin_user",
"admin_user_role",
"agent",
"agent_commission",
"agent_config",
"agent_freeze_task",
"agent_invite_code",
"agent_invite_code_usage",
"agent_link",
"agent_order",
"agent_product_config",
"agent_real_name",
"agent_rebate",
"agent_relation",
"agent_short_link",
"agent_upgrade",
"agent_wallet",
"agent_withdrawal",
"agent_withdrawal_tax",
"authorization_document",
"example",
"feature",
"global_notifications",
"order",
"order_refund",
"product",
"product_feature",
"query",
"query_cleanup_config",
"query_cleanup_detail",
"query_cleanup_log",
"user",
"user_auth"
# "admin_api",
# "admin_dict_data",
# "admin_dict_type",
# "admin_menu",
# "admin_promotion_link",
# "admin_promotion_link_stats_history",
# "admin_promotion_link_stats_total",
# "admin_promotion_order",
# "admin_role",
# "admin_role_api",
# "admin_role_menu",
# "admin_user",
# "admin_user_role",
# "agent",
# "agent_commission",
"agent_config"
# "agent_freeze_task",
# "agent_invite_code",
# "agent_invite_code_usage",
# "agent_link",
# "agent_order",
# "agent_product_config",
# "agent_real_name",
# "agent_rebate",
# "agent_relation",
# "agent_short_link",
# "agent_upgrade",
# "agent_wallet",
# "agent_withdrawal",
# "agent_withdrawal_tax",
# "authorization_document",
# "example",
# "feature",
# "global_notifications",
# "order",
# "order_refund",
# "product",
# "product_feature",
# "query",
# "query_cleanup_config",
# "query_cleanup_detail",
# "query_cleanup_log",
# "user",
# "user_auth"
)
# 为每个表生成模型
foreach ($table in $tables) {
Write-Host "正在生成表: $table" -ForegroundColor Green
goctl model mysql datasource -url="ycc:5vg67b3UNHu8@tcp(127.0.0.1:21001)/ycc" -table="$table" -dir="./model" --home="../template" -cache=true --style=goZero
goctl model mysql datasource -url="ycc:5vg67b3UNHu8@tcp(127.0.0.1:21001)/ycc" -table="$table" -dir="./model" --home="$HOME_DIR" -cache=true --style=goZero
# 移动生成的文件到目标目录
if (Test-Path $OUTPUT_DIR) {
@@ -122,3 +126,6 @@ foreach ($table in $tables) {
Write-Host ""
Write-Host '所有模型文件生成并移动完成!' -ForegroundColor Green
if (Test-Path $OUTPUT_DIR) {
Get-ChildItem -Path $OUTPUT_DIR -File | Remove-Item -Force
}

View File

@@ -1,9 +0,0 @@
package model
import (
"errors"
"github.com/zeromicro/go-zero/core/stores/sqlx"
)
var ErrNotFound = sqlx.ErrNotFound
var ErrNoRowsUpdate = errors.New("update db no rows change")