This commit is contained in:
2026-01-16 03:33:02 +08:00
parent 3090cd62c8
commit 23ad0477b2
16 changed files with 1943 additions and 56 deletions

View File

@@ -44,7 +44,7 @@ $tables = @(
# "example", # 示例
# "feature", # 功能
# "global_notifications", # 全局通知
"order" # 订单
# "order" # 订单
# "order_refund", # 订单退款
# "product", # 产品
# "product_feature", # 产品功能
@@ -55,7 +55,7 @@ $tables = @(
# "user", # 用户
# "user_auth", # 用户认证
# "user_temp" # 临时用户
"yunyin_sign_pay_order" # 云印签签署流程
)
# 为每个表生成模型
@@ -64,63 +64,63 @@ foreach ($table in $tables) {
goctl model mysql datasource -url="jnc:5vg67b3UNHu8@tcp(127.0.0.1:21301)/jnc" -table="$table" -dir="./model" --home="$HOME_DIR" -cache=true --style=goZero
# 移动生成的文件到目标目录
if (Test-Path $OUTPUT_DIR) {
$sourceFiles = Get-ChildItem -Path $OUTPUT_DIR -File
# if (Test-Path $OUTPUT_DIR) {
# $sourceFiles = Get-ChildItem -Path $OUTPUT_DIR -File
foreach ($file in $sourceFiles) {
$fileName = $file.Name
$targetPath = Join-Path $TARGET_DIR $fileName
$sourcePath = $file.FullName
# foreach ($file in $sourceFiles) {
# $fileName = $file.Name
# $targetPath = Join-Path $TARGET_DIR $fileName
# $sourcePath = $file.FullName
# 检查文件类型并决定是否移动
$shouldMove = $false
$shouldOverwrite = $false
# # 检查文件类型并决定是否移动
# $shouldMove = $false
# $shouldOverwrite = $false
if ($fileName -eq "vars.go") {
# vars.go: 如果目标目录不存在才移动
if (-not (Test-Path $targetPath)) {
$shouldMove = $true
Write-Host " 移动 $fileName (vars.go 不存在于目标目录)" -ForegroundColor Yellow
}
else {
Write-Host " 跳过 $fileName (vars.go 已存在于目标目录,防止覆盖)" -ForegroundColor Cyan
}
}
elseif ($fileName -match "_gen\.go$") {
# 带 _gen 后缀的文件: 直接覆盖
$shouldMove = $true
$shouldOverwrite = $true
Write-Host " 移动 $fileName (覆盖 _gen 文件)" -ForegroundColor Yellow
}
else {
# 不带 _gen 后缀的文件: 如果目标目录不存在才移动
if (-not (Test-Path $targetPath)) {
$shouldMove = $true
Write-Host " 移动 $fileName (非 _gen 文件不存在于目标目录)" -ForegroundColor Yellow
}
else {
Write-Host " 跳过 $fileName (非 _gen 文件已存在于目标目录,防止覆盖)" -ForegroundColor Cyan
}
}
# if ($fileName -eq "vars.go") {
# # vars.go: 如果目标目录不存在才移动
# if (-not (Test-Path $targetPath)) {
# $shouldMove = $true
# Write-Host " 移动 $fileName (vars.go 不存在于目标目录)" -ForegroundColor Yellow
# }
# else {
# Write-Host " 跳过 $fileName (vars.go 已存在于目标目录,防止覆盖)" -ForegroundColor Cyan
# }
# }
# elseif ($fileName -match "_gen\.go$") {
# # 带 _gen 后缀的文件: 直接覆盖
# $shouldMove = $true
# $shouldOverwrite = $true
# Write-Host " 移动 $fileName (覆盖 _gen 文件)" -ForegroundColor Yellow
# }
# else {
# # 不带 _gen 后缀的文件: 如果目标目录不存在才移动
# if (-not (Test-Path $targetPath)) {
# $shouldMove = $true
# Write-Host " 移动 $fileName (非 _gen 文件不存在于目标目录)" -ForegroundColor Yellow
# }
# else {
# Write-Host " 跳过 $fileName (非 _gen 文件已存在于目标目录,防止覆盖)" -ForegroundColor Cyan
# }
# }
# 执行移动操作
if ($shouldMove) {
# 确保目标目录存在
if (-not (Test-Path $TARGET_DIR)) {
New-Item -ItemType Directory -Path $TARGET_DIR -Force | Out-Null
}
# # 执行移动操作
# if ($shouldMove) {
# # 确保目标目录存在
# if (-not (Test-Path $TARGET_DIR)) {
# New-Item -ItemType Directory -Path $TARGET_DIR -Force | Out-Null
# }
# 如果目标文件存在且需要覆盖,先删除
if ($shouldOverwrite -and (Test-Path $targetPath)) {
Remove-Item -Path $targetPath -Force
}
# # 如果目标文件存在且需要覆盖,先删除
# if ($shouldOverwrite -and (Test-Path $targetPath)) {
# Remove-Item -Path $targetPath -Force
# }
# 移动文件
Move-Item -Path $sourcePath -Destination $targetPath -Force
Write-Host " ✓ 已移动到: $targetPath" -ForegroundColor Green
}
}
}
# # 移动文件
# Move-Item -Path $sourcePath -Destination $targetPath -Force
# Write-Host " ✓ 已移动到: $targetPath" -ForegroundColor Green
# }
# }
# }
}
Write-Host ""

View File

@@ -0,0 +1,5 @@
package model
import "github.com/zeromicro/go-zero/core/stores/sqlx"
var ErrNotFound = sqlx.ErrNotFound

View File

@@ -0,0 +1,33 @@
-- ============================================
-- 云印签支付订单表
-- ============================================
CREATE TABLE `yunyin_sign_pay_order` (
`id` CHAR(36) NOT NULL COMMENT '主键IDUUID',
`order_id` CHAR(36) NOT NULL COMMENT '订单ID关联order表',
`user_id` CHAR(36) NOT NULL COMMENT '用户ID用于查询该用户是否有未完成的签署',
`task_id` VARCHAR(100) NOT NULL COMMENT '任务ID/流程IDflowId',
`participant_id` VARCHAR(100) NOT NULL COMMENT '参与者ID签署方2的participantId',
`amount` DECIMAL(10,2) NOT NULL COMMENT '支付金额',
`pay_type` TINYINT NOT NULL COMMENT '支付类型0=微信支付1=支付宝支付',
`sign_status` TINYINT NOT NULL DEFAULT 0 COMMENT '签署状态0=待签署1=已签署2=已取消',
`pay_status` TINYINT NOT NULL DEFAULT 0 COMMENT '支付状态0=待支付1=已支付2=已退款',
`source_order_code` VARCHAR(100) NOT NULL COMMENT '源订单号(我们平台的订单号,用于关联)',
`user_mobile` VARCHAR(20) DEFAULT NULL COMMENT '用户手机号(冗余字段,方便查询)',
`user_name` VARCHAR(100) DEFAULT NULL COMMENT '用户姓名(冗余字段,方便查询)',
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`delete_time` DATETIME DEFAULT NULL COMMENT '删除时间',
`del_state` TINYINT NOT NULL DEFAULT 0 COMMENT '删除状态0=未删除1=已删除',
`version` BIGINT NOT NULL DEFAULT 0 COMMENT '版本号(乐观锁)',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_order_id` (`order_id`),
UNIQUE KEY `uk_task_id` (`task_id`),
KEY `idx_user_id` (`user_id`),
KEY `idx_participant_id` (`participant_id`),
KEY `idx_source_order_code` (`source_order_code`),
KEY `idx_sign_status` (`sign_status`),
KEY `idx_pay_status` (`pay_status`),
KEY `idx_user_mobile` (`user_mobile`),
KEY `idx_create_time` (`create_time`),
KEY `idx_del_state` (`del_state`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='云印签支付订单表';