新增后台管理

This commit is contained in:
2025-06-08 15:14:34 +08:00
parent 7762ad46fe
commit e75c7b3dd3
488 changed files with 20273 additions and 15879 deletions

View File

@@ -23,16 +23,34 @@ $tables = @(
# "agent_rewards",
# "agent_wallet",
# "agent_withdrawal",
"agent_real_name"
# "agent_real_name"
# "feature",
# "global_notifications",
# "global_notifications"
# "order",
# "order_refund"
# "product",
# "product_feature",
# "query",
# "query_cleanup_log"
# "query_cleanup_detail"
"query_cleanup_config"
# "user"
# "user_auth"
# "example"
# "admin_user"
# "admin_user_role"
# "admin_api",
# "admin_menu"
# "admin_role",
# "admin_role_api",
# "admin_role_menu",
# "admin_dict_data"
# "admin_dict_type"
# "admin_promotion_link"
# "admin_promotion_link_stats_total"
# "admin_promotion_link_stats_history"
# "admin_promotion_order"
)
# 为每个表生成模型

View File

@@ -1,3 +1,8 @@
module script
go 1.23.4
require (
github.com/samber/lo v1.50.0 // indirect
golang.org/x/text v0.22.0 // indirect
)

4
deploy/script/go.sum Normal file
View File

@@ -0,0 +1,4 @@
github.com/samber/lo v1.50.0 h1:XrG0xOeHs+4FQ8gJR97zDz5uOFMW7OwFWiFVzqopKgY=
github.com/samber/lo v1.50.0/go.mod h1:RjZyNk6WSnUFRKK6EyOhsRJMqft3G+pg7dCWHQCWvsc=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=

View File

@@ -1,25 +1,41 @@
CREATE TABLE `order` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`order_no` varchar(32) NOT NULL COMMENT '自生成的订单号',
`user_id` bigint NOT NULL COMMENT '用户ID',
`product_id` bigint NOT NULL COMMENT '产品ID软关联到产品表',
`payment_platform` enum('alipay', 'wechat', 'appleiap','other') NOT NULL COMMENT '支付平台(支付宝、微信、苹果内购、其他)',
`payment_scene` enum('app', 'h5', 'mini_program', 'public_account') NOT NULL COMMENT '支付场景App、H5、微信小程序、公众号',
`platform_order_id` varchar(64) DEFAULT NULL COMMENT '支付平台订单号',
`amount` decimal(10, 2) NOT NULL COMMENT '支付金额',
`status` enum('pending', 'paid', 'failed', 'refunded', 'closed') NOT NULL DEFAULT 'pending' COMMENT '支付状态',
`del_state` tinyint NOT NULL DEFAULT '0' COMMENT '删除状态',
`version` bigint NOT NULL DEFAULT '0' COMMENT '版本号',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`pay_time` datetime DEFAULT NULL COMMENT '支付时间',
`refund_time` datetime DEFAULT NULL COMMENT '退款时间',
`close_time` datetime DEFAULT NULL COMMENT '订单关闭时间',
`delete_time` datetime DEFAULT NULL COMMENT '删除时间',
PRIMARY KEY (`id`),
UNIQUE KEY `unique_order_no` (`order_no`),
KEY `idx_user_id` (`user_id`),
KEY `idx_product_id` (`product_id`),
KEY `idx_payment_platform` (`payment_platform`),
KEY `idx_payment_scene` (`payment_scene`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='订单表';
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`order_no` varchar(32) NOT NULL COMMENT '自生成的订单号',
`user_id` bigint NOT NULL COMMENT '用户ID',
`product_id` bigint NOT NULL COMMENT '产品ID软关联到产品表',
`payment_platform` enum(
'alipay',
'wechat',
'appleiap',
'other'
) NOT NULL COMMENT '支付平台(支付宝、微信、苹果内购、其他)',
`payment_scene` enum(
'app',
'h5',
'mini_program',
'public_account'
) NOT NULL COMMENT '支付场景App、H5、微信小程序、公众号',
`platform_order_id` varchar(64) DEFAULT NULL COMMENT '支付平台订单号',
`amount` decimal(10, 2) NOT NULL COMMENT '支付金额',
`status` enum(
'pending',
'paid',
'failed',
'refunded',
'closed'
) NOT NULL DEFAULT 'pending' COMMENT '支付状态',
`del_state` tinyint NOT NULL DEFAULT '0' COMMENT '删除状态',
`version` bigint NOT NULL DEFAULT '0' COMMENT '版本号',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`pay_time` datetime DEFAULT NULL COMMENT '支付时间',
`refund_time` datetime DEFAULT NULL COMMENT '退款时间',
`close_time` datetime DEFAULT NULL COMMENT '订单关闭时间',
`delete_time` datetime DEFAULT NULL COMMENT '删除时间',
PRIMARY KEY (`id`),
UNIQUE KEY `unique_order_no` (`order_no`),
KEY `idx_user_id` (`user_id`),
KEY `idx_product_id` (`product_id`),
KEY `idx_payment_platform` (`payment_platform`),
KEY `idx_payment_scene` (`payment_scene`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单表';

20
deploy/sql/template.sql Normal file
View File

@@ -0,0 +1,20 @@
CREATE TABLE `` (
`id` bigint NOT NULL AUTO_INCREMENT,
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`delete_time` datetime DEFAULT NULL COMMENT '删除时间',
`del_state` tinyint NOT NULL DEFAULT '0',
`version` bigint NOT NULL DEFAULT '0' COMMENT '版本号',
/* 业务字段开始 */
`1` [] [DEFAULT ] [COMMENT '字段说明'],
`2` [] [DEFAULT ] [COMMENT '字段说明'],
/* 关联字段 - 软关联 */
`id` bigint [NOT NULL] [DEFAULT '0'] COMMENT '关联到XX表的id',
/* 业务字段结束 */
PRIMARY KEY (`id`),
/* 索引定义 */
UNIQUE KEY `` (``),
KEY `idx_关联字段` (`id`) COMMENT '优化关联查询'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='表说明';

View File

@@ -2,7 +2,7 @@ SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for user
-- Table structure for main
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (