This commit is contained in:
2025-09-30 17:44:18 +08:00
parent 898339fd5d
commit f4b7e6e2df
393 changed files with 4530 additions and 2061 deletions

View File

@@ -1,7 +1,7 @@
# 设置输出编码为UTF-8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
# 数据库连接信息 - 修改了URL格式
$DB_URL = "hm:5vg67b3UNHu8@(127.0.0.1:21001)/hm"
$DB_URL = "tydata:5vg67b3UNHu8@(127.0.0.1:21001)/hm"
$OUTPUT_DIR = "./model"
$TEMPLATE_DIR = "../template"
@@ -58,5 +58,5 @@ $tables = @(
# 为每个表生成模型
foreach ($table in $tables) {
goctl model mysql datasource -url="hm:5vg67b3UNHu8@tcp(127.0.0.1:21001)/hm" -table="$table" -dir="./model" --home="../template" -cache=true --style=goZero
goctl model mysql datasource -url="tydata:5vg67b3UNHu8@tcp(127.0.0.1:21001)/hm" -table="$table" -dir="./model" --home="../template" -cache=true --style=goZero
}

View File

@@ -1,41 +0,0 @@
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 = '订单表';

View File

@@ -1,116 +0,0 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for product
-- ----------------------------
DROP TABLE IF EXISTS `product`;
CREATE TABLE `product` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`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 '删除状态',
`version` bigint NOT NULL DEFAULT '0' COMMENT '版本号',
`product_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '服务名',
`product_en` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '英文名',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '描述',
`notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '备注',
`cost_price` DECIMAL(10, 2) NOT NULL DEFAULT '1.00' COMMENT '成本',
`sell_price` DECIMAL(10, 2) NOT NULL DEFAULT '1.00' COMMENT '售价',
PRIMARY KEY (`id`),
UNIQUE KEY `unique_product_en` (`product_en`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='产品表';
-- ----------------------------
-- Records for product
-- ----------------------------
INSERT INTO `product` (`product_name`, `product_en`, `description`, `notes`, `cost_price`, `sell_price`) VALUES
('背景调查', 'backgroundchecklogic', '', '', 1, 1),
('企业报告', 'companyinfologic', '', '', 1, 1),
('家政服务', 'homeservicelogic', '', '', 1, 1),
('婚姻状态', 'marriagelogic', '', '', 1, 1),
('贷前背调', 'preloanbackgroundchecklogic', '', '', 1, 1),
('租赁服务', 'rentalinfologic', '', '', 1, 1),
('个人风险评估', 'riskassessmentlogic', '', '', 1, 1),
('手机三要素', 'toc_PhoneThreeElements', '', '', 1, 1),
('银行卡黑名单', 'toc_BankCardBlacklist', '', '', 1, 1),
('身份证二要素', 'toc_IDCardTwoElements', '', '', 1, 1),
('手机二要素', 'toc_PhoneTwoElements', '', '', 1, 1),
('在网时长', 'toc_NetworkDuration', '', '', 1, 1),
('手机二次卡', 'toc_PhoneSecondaryCard', '', '', 1, 1),
('手机号码风险', 'toc_PhoneNumberRisk', '', '', 1, 1),
('银行卡四要素', 'toc_BankCardFourElements', '', '', 1, 1),
('银行卡三要素', 'toc_BankCardThreeElements', '', '', 1, 1),
('自然人生存状态', 'toc_NaturalLifeStatus', '', '', 1, 1),
('学历核验', 'toc_EducationVerification', '', '', 1, 1),
('人车核验', 'toc_PersonVehicleVerification', '', '', 1, 1),
('名下车辆', 'toc_VehiclesUnderName', '', '', 1, 1),
('双人婚姻', 'toc_DualMarriage', '', '', 1, 1),
('个人不良', 'toc_PersonalBadRecord', '', '', 1, 1),
('股东人企关系', 'toc_ShareholderBusinessRelation', '', '', 1, 1),
('个人涉诉', 'toc_PersonalLawsuit', '', '', 1, 1),
('企业涉诉', 'toc_EnterpriseLawsuit', '', '', 1, 1),
('婚姻评估', 'toc_MarriageAssessment', '', '', 1, 1);
SET FOREIGN_KEY_CHECKS = 1;
-- ----------------------------
-- Table structure for feature
-- ----------------------------
DROP TABLE IF EXISTS `feature`;
CREATE TABLE `feature` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`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 '删除状态',
`version` bigint NOT NULL DEFAULT '0' COMMENT '版本号',
`api_id` varchar kujmio,5(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'API标识',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '描述',
PRIMARY KEY (`id`),
UNIQUE KEY `unique_api_id` (`api_id`)``
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='功能表';
-- ----------------------------
-- Table structure for product_feature
-- ----------------------------
DROP TABLE IF EXISTS `product_feature`;
CREATE TABLE `product_feature` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`product_id` bigint NOT NULL COMMENT '产品ID',
`feature_id` bigint NOT NULL COMMENT '功能ID',
`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 '删除状态',
`version` bigint NOT NULL DEFAULT '0' COMMENT '版本号',
PRIMARY KEY (`id`),
UNIQUE KEY `unique_product_feature` (`product_id`, `feature_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='产品与功能关联表';
-- ----------------------------
-- Records for feature
-- ----------------------------
INSERT INTO `feature` (`api_id`, `name`) VALUES
('G09SC02', '单人婚姻'),
('G27BJ05', '借贷意向'),
('G28BJ05', '借贷行为'),
('G26BJ05', '特殊名单'),
('G34BJ03', '个人不良'),
('G35SC01', '个人涉诉'),
('G05HZ01', '股东人企关系');
-- ----------------------------
-- 插入每个产品与每个功能的对应关系
-- ----------------------------
INSERT INTO `product_feature` (`product_id`, `feature_id`)
SELECT
p.id AS product_id,
f.id AS feature_id
FROM
product p
CROSS JOIN
feature f;

View File

@@ -1,18 +0,0 @@
CREATE TABLE `query` (
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`order_id` BIGINT NOT NULL COMMENT '订单ID软关联到订单表',
`user_id` BIGINT NOT NULL COMMENT '用户ID直接关联到用户',
`product_id` BIGINT NOT NULL COMMENT '产品ID直接关联到产品',
`query_params` TEXT NOT NULL COMMENT '查询params数据',
`query_data` LONGTEXT COMMENT '查询结果数据',
`query_state` ENUM('pending', 'success', 'failed') 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 '更新时间',
`delete_time` DATETIME DEFAULT NULL COMMENT '删除时间',
PRIMARY KEY (`id`),
UNIQUE KEY `unique_order_id` (`order_id`),
KEY `idx_user_id` (`user_id`),
KEY `idx_product_id` (`product_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='查询结果表,存储关联订单的查询数据';

View File

@@ -1,43 +0,0 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for main
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`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 '版本号',
`mobile` char(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`info` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`inside` tinyint NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `unique_mobile` (`mobile`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户表';
-- ----------------------------
-- Table structure for user_auth
-- ----------------------------
DROP TABLE IF EXISTS `user_auth`;
CREATE TABLE `user_auth` (
`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 '版本号',
`user_id` bigint NOT NULL DEFAULT '0',
`auth_key` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '平台唯一id',
`auth_type` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '平台类型',
PRIMARY KEY (`id`),
UNIQUE KEY `unique_type_key` (`auth_type`,`auth_key`) USING BTREE,
UNIQUE KEY `unique_userId_key` (`user_id`,`auth_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户授权表';
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -3,8 +3,8 @@ package {{.PkgName}}
import (
"net/http"
"hm-server/common/result"
"hm-server/pkg/lzkit/validator"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
"github.com/zeromicro/go-zero/rest/httpx"
{{.ImportPackages}}
)

View File

@@ -5,7 +5,7 @@ import (
"fmt"
{{.importPackages}}
"hm-server/common/middleware"
"tydata-server/common/middleware"
)
var configFile = flag.String("f", "etc/{{.serviceName}}.yaml", "the config file")

View File

@@ -6,7 +6,7 @@ import (
{{if .time}}"time"{{end}}
"hm-server/common/globalkey"
"tydata-server/common/globalkey"
"github.com/Masterminds/squirrel"
"github.com/pkg/errors"
"github.com/zeromicro/go-zero/core/stores/builder"

View File

@@ -6,7 +6,7 @@ import (
{{if .time}}"time"{{end}}
"hm-server/common/globalkey"
"tydata-server/common/globalkey"
"github.com/Masterminds/squirrel"
"github.com/pkg/errors"
"github.com/zeromicro/go-zero/core/stores/builder"

View File

@@ -5,7 +5,7 @@ import (
"fmt"
{{.imports}}
"hm-server/common/interceptor/rpcserver"
"tydata-server/common/interceptor/rpcserver"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/service"