This commit is contained in:
Mrx
2026-02-04 17:09:17 +08:00
parent 1a44eab144
commit bfbdf983b0
38 changed files with 1719 additions and 1725 deletions

View File

@@ -42,6 +42,7 @@ type (
Mobile string `form:"mobile,optional"` // 手机号
Nickname string `form:"nickname,optional"` // 昵称
Inside int64 `form:"inside,optional"` // 是否内部用户 1-是 0-否
Disable int64 `form:"disable,optional"` // 是否封禁 0-正常 1-封禁
CreateTimeStart string `form:"create_time_start,optional"` // 创建时间开始
CreateTimeEnd string `form:"create_time_end,optional"` // 创建时间结束
OrderBy string `form:"order_by,optional"` // 排序字段
@@ -59,6 +60,7 @@ type (
Nickname string `json:"nickname"` // 昵称
Info string `json:"info"` // 备注信息
Inside int64 `json:"inside"` // 是否内部用户 1-是 0-否
Disable int64 `json:"disable"` // 是否封禁 0-正常 1-封禁
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
@@ -73,6 +75,7 @@ type (
Nickname string `json:"nickname"` // 昵称
Info string `json:"info"` // 备注信息
Inside int64 `json:"inside"` // 是否内部用户 1-是 0-否
Disable int64 `json:"disable"` // 是否封禁 0-正常 1-封禁
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
@@ -96,6 +99,7 @@ type (
Nickname *string `json:"nickname,optional"` // 昵称
Info *string `json:"info,optional"` // 备注信息
Inside *int64 `json:"inside,optional"` // 是否内部用户 1-是 0-否
Disable *int64 `json:"disable,optional"` // 是否封禁 0-正常 1-封禁
}
// 更新响应
AdminUpdatePlatformUserResp {

View File

@@ -2,9 +2,9 @@ Name: main
Host: 0.0.0.0
Port: 8888
Timeout: 0
DataSource: "zac:5vg67b3UNHu8@tcp(127.0.0.1:21201)/zac?charset=utf8mb4&parseTime=True&loc=Local"
DataSource: "zac:5vg67b3UNHu8@tcp(127.0.0.1:23221)/zac?charset=utf8mb4&parseTime=True&loc=Local"
CacheRedis:
- Host: "127.0.0.1:21202"
- Host: "127.0.0.1:23222"
Pass: "3m3WsgyCKWqz" # Redis 密码,如果未设置则留空
Type: "node" # 单节点模式
JwtAuth:

View File

@@ -43,6 +43,7 @@ func (l *AdminGetPlatformUserDetailLogic) AdminGetPlatformUserDetail(req *types.
Nickname: "",
Info: user.Info,
Inside: user.Inside,
Disable: user.Disable,
CreateTime: user.CreateTime.Format("2006-01-02 15:04:05"),
UpdateTime: user.UpdateTime.Format("2006-01-02 15:04:05"),
}

View File

@@ -29,9 +29,14 @@ func NewAdminGetPlatformUserListLogic(ctx context.Context, svcCtx *svc.ServiceCo
}
func (l *AdminGetPlatformUserListLogic) AdminGetPlatformUserList(req *types.AdminGetPlatformUserListReq) (resp *types.AdminGetPlatformUserListResp, err error) {
secretKey := l.svcCtx.Config.Encrypt.SecretKey
builder := l.svcCtx.UserModel.SelectBuilder()
if req.Mobile != "" {
builder = builder.Where("mobile = ?", req.Mobile)
encryptedMobile, encErr := crypto.EncryptMobile(req.Mobile, secretKey)
if encErr != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "手机号加密失败: %v", encErr)
}
builder = builder.Where("mobile = ?", encryptedMobile)
}
if req.Nickname != "" {
builder = builder.Where("nickname = ?", req.Nickname)
@@ -39,6 +44,9 @@ func (l *AdminGetPlatformUserListLogic) AdminGetPlatformUserList(req *types.Admi
if req.Inside != 0 {
builder = builder.Where("inside = ?", req.Inside)
}
if req.Disable != 0 {
builder = builder.Where("disable = ?", req.Disable)
}
if req.CreateTimeStart != "" {
builder = builder.Where("create_time >= ?", req.CreateTimeStart)
}
@@ -55,7 +63,6 @@ func (l *AdminGetPlatformUserListLogic) AdminGetPlatformUserList(req *types.Admi
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查询用户分页失败: %v", err)
}
var items []types.PlatformUserListItem
secretKey := l.svcCtx.Config.Encrypt.SecretKey
for _, user := range users {
mobile := user.Mobile
@@ -72,6 +79,7 @@ func (l *AdminGetPlatformUserListLogic) AdminGetPlatformUserList(req *types.Admi
Nickname: "",
Info: user.Info,
Inside: user.Inside,
Disable: user.Disable,
CreateTime: user.CreateTime.Format("2006-01-02 15:04:05"),
UpdateTime: user.UpdateTime.Format("2006-01-02 15:04:05"),
}

View File

@@ -52,6 +52,12 @@ func (l *AdminUpdatePlatformUserLogic) AdminUpdatePlatformUser(req *types.AdminU
}
user.Inside = *req.Inside
}
if req.Disable != nil {
if *req.Disable != 1 && *req.Disable != 0 {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "封禁状态错误: %d", *req.Disable)
}
user.Disable = *req.Disable
}
if req.Password != nil {
user.Password = sql.NullString{String: *req.Password, Valid: *req.Password != ""}
}

View File

@@ -68,6 +68,9 @@ func (l *MobileCodeLoginLogic) MobileCodeLogin(req *types.MobileCodeLoginReq) (r
userID = registeredUserID
l.Infof("手机登录, 自动注册用户成功, userId: %s, mobile: %s", userID, encryptedMobile)
} else {
if user.Disable == 1 {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.USER_DISABLED), "用户已被封禁")
}
userID = user.Id
}
token, err := l.svcCtx.UserService.GeneralUserToken(l.ctx, userID)

View File

@@ -0,0 +1,70 @@
package middleware
import (
"net/http"
"strings"
"qnc-server/app/main/model"
jwtx "qnc-server/common/jwt"
"qnc-server/common/result"
"qnc-server/common/xerr"
"github.com/zeromicro/go-zero/rest/httpx"
)
// 登录/注册等建立新会话的接口,不进行封禁检查(避免旧 token 导致误拦)
var authPathSuffixes = []string{
"/user/auth",
"/user/mobileCodeLogin",
"/user/wxMiniAuth",
"/user/wxh5Auth",
}
// UserDisableInterceptor 全局中间件:拦截封禁用户的请求
// 仅对携带 JWT 的前端用户请求进行封禁检查,管理员请求跳过
func UserDisableInterceptor(userModel model.UserModel, accessSecret string) func(next http.HandlerFunc) http.HandlerFunc {
return func(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
path := r.URL.Path
for _, suffix := range authPathSuffixes {
if path == suffix || strings.HasSuffix(path, suffix) {
next(w, r)
return
}
}
authHeader := r.Header.Get("Authorization")
if authHeader == "" {
next(w, r)
return
}
claims, err := jwtx.ParseJwtToken(authHeader, accessSecret)
if err != nil {
// JWT 解析失败交给下游 AuthInterceptor 处理
next(w, r)
return
}
// 管理员跳过封禁检查
if claims.UserType == model.UserTypeAdmin {
next(w, r)
return
}
user, err := userModel.FindOne(r.Context(), claims.UserId)
if err != nil {
// 用户不存在,交给下游处理
next(w, r)
return
}
if user.Disable == 1 {
httpx.WriteJson(w, http.StatusOK, result.Error(xerr.USER_DISABLED, xerr.MapErrMsg(xerr.USER_DISABLED)))
return
}
next(w, r)
}
}
}

View File

@@ -1,204 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AdminAuditAgentReq struct {
AuditId int64 `json:"audit_id"` // 审核记录ID
Status int64 `json:"status"` // 审核状态1=通过2=拒绝
AuditReason string `json:"audit_reason"` // 审核原因(拒绝时必填)
}
type AdminAuditAgentResp struct {
Success bool `json:"success"`
}
type AdminAuditWithdrawalReq struct {
WithdrawalId string `json:"withdrawal_id"` // 提现记录ID
Status int64 `json:"status"` // 审核状态2=通过3=拒绝
Remark string `json:"remark"` // 备注
}
type AdminAuditWithdrawalResp struct {
Success bool `json:"success"`
}
type AdminGenerateDiamondInviteCodeReq struct {
Count int64 `json:"count"` // 生成数量
ExpireDays int64 `json:"expire_days,optional"` // 过期天数可选0表示不过期
Remark string `json:"remark,optional"` // 备注(可选)
}
type AdminGenerateDiamondInviteCodeResp struct {
Codes []string `json:"codes"` // 生成的邀请码列表
}
type AdminGetAgentCommissionListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *string `form:"agent_id,optional"` // 代理ID可选
OrderId *string `form:"order_id,optional"` // 订单ID可选
Status *int64 `form:"status,optional"` // 状态(可选)
}
type AdminGetAgentCommissionListResp struct {
Total int64 `json:"total"` // 总数
Items []AgentCommissionListItem `json:"items"` // 列表数据
}
type AdminGetAgentConfigResp struct {
LevelBonus LevelBonusConfig `json:"level_bonus"` // 等级加成配置
UpgradeFee UpgradeFeeConfig `json:"upgrade_fee"` // 升级费用配置
UpgradeRebate UpgradeRebateConfig `json:"upgrade_rebate"` // 升级返佣配置
DirectParentRebate DirectParentRebateConfig `json:"direct_parent_rebate"` // 直接上级返佣配置
MaxGoldRebateAmount float64 `json:"max_gold_rebate_amount"` // 黄金代理最大返佣金额
CommissionFreeze CommissionFreezeConfig `json:"commission_freeze"` // 佣金冻结配置
TaxRate float64 `json:"tax_rate"` // 税率
TaxExemptionAmount float64 `json:"tax_exemption_amount"` // 免税额度
GoldMaxUpliftAmount float64 `json:"gold_max_uplift_amount"`
DiamondMaxUpliftAmount float64 `json:"diamond_max_uplift_amount"`
}
type AdminGetAgentLinkListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *string `form:"agent_id,optional"` // 代理ID可选
ProductId *string `form:"product_id,optional"` // 产品ID可选
LinkIdentifier *string `form:"link_identifier,optional"` // 推广码(可选)
}
type AdminGetAgentLinkListResp struct {
Total int64 `json:"total"` // 总数
Items []AgentLinkListItem `json:"items"` // 列表数据
}
type AdminGetAgentListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
Mobile *string `form:"mobile,optional"` // 手机号(可选)
Region *string `form:"region,optional"` // 区域(可选)
Level *int64 `form:"level,optional"` // 等级(可选)
TeamLeaderId *string `form:"team_leader_id,optional"` // 团队首领ID可选
}
type AdminGetAgentListResp struct {
Total int64 `json:"total"` // 总数
Items []AgentListItem `json:"items"` // 列表数据
}
type AdminGetAgentOrderListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *string `form:"agent_id,optional"` // 代理ID可选
OrderId *string `form:"order_id,optional"` // 订单ID可选
ProcessStatus *int64 `form:"process_status,optional"` // 处理状态(可选)
}
type AdminGetAgentOrderListResp struct {
Total int64 `json:"total"` // 总数
Items []AgentOrderListItem `json:"items"` // 列表数据
}
type AdminGetAgentProductConfigListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
ProductId *string `form:"product_id,optional"` // 产品ID可选
ProductName *string `form:"product_name,optional"` // 产品名称(可选,用于搜索)
}
type AdminGetAgentProductConfigListResp struct {
Total int64 `json:"total"` // 总数
Items []AgentProductConfigItem `json:"items"` // 列表数据
}
type AdminGetAgentRealNameListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *string `form:"agent_id,optional"` // 代理ID可选
Status *int64 `form:"status,optional"` // 状态可选1=未验证2=已通过
}
type AdminGetAgentRealNameListResp struct {
Total int64 `json:"total"` // 总数
Items []AgentRealNameListItem `json:"items"` // 列表数据
}
type AdminGetAgentRebateListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *string `form:"agent_id,optional"` // 代理ID可选
SourceAgentId *string `form:"source_agent_id,optional"` // 来源代理ID可选
RebateType *int64 `form:"rebate_type,optional"` // 返佣类型(可选)
}
type AdminGetAgentRebateListResp struct {
Total int64 `json:"total"` // 总数
Items []AgentRebateListItem `json:"items"` // 列表数据
}
type AdminGetAgentUpgradeListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *string `form:"agent_id,optional"` // 代理ID可选
UpgradeType *int64 `form:"upgrade_type,optional"` // 升级类型(可选)
Status *int64 `form:"status,optional"` // 状态(可选)
}
type AdminGetAgentUpgradeListResp struct {
Total int64 `json:"total"` // 总数
Items []AgentUpgradeListItem `json:"items"` // 列表数据
}
type AdminGetAgentWithdrawalListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *string `form:"agent_id,optional"` // 代理ID可选
Status *int64 `form:"status,optional"` // 状态(可选)
WithdrawNo *string `form:"withdraw_no,optional"` // 提现单号(可选)
}
type AdminGetAgentWithdrawalListResp struct {
Total int64 `json:"total"` // 总数
Items []AgentWithdrawalListItem `json:"items"` // 列表数据
}
type AdminGetInviteCodeListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
Code *string `form:"code,optional"` // 邀请码(可选)
AgentId *string `form:"agent_id,optional"` // 发放代理ID可选NULL表示平台发放
TargetLevel *int64 `form:"target_level,optional"` // 目标等级(可选)
Status *int64 `form:"status,optional"` // 状态(可选)
}
type AdminGetInviteCodeListResp struct {
Total int64 `json:"total"` // 总数
Items []InviteCodeListItem `json:"items"` // 列表数据
}
type AdminUpdateAgentConfigReq struct {
LevelBonus *LevelBonusConfig `json:"level_bonus,optional"` // 等级加成配置
UpgradeFee *UpgradeFeeConfig `json:"upgrade_fee,optional"` // 升级费用配置
UpgradeRebate *UpgradeRebateConfig `json:"upgrade_rebate,optional"` // 升级返佣配置
DirectParentRebate *DirectParentRebateConfig `json:"direct_parent_rebate,optional"` // 直接上级返佣配置
MaxGoldRebateAmount *float64 `json:"max_gold_rebate_amount,optional"` // 黄金代理最大返佣金额
CommissionFreeze *CommissionFreezeConfig `json:"commission_freeze,optional"` // 佣金冻结配置
TaxRate *float64 `json:"tax_rate,optional"` // 税率
TaxExemptionAmount *float64 `json:"tax_exemption_amount,optional"` // 免税额度
GoldMaxUpliftAmount *float64 `json:"gold_max_uplift_amount,optional"`
DiamondMaxUpliftAmount *float64 `json:"diamond_max_uplift_amount,optional"`
}
type AdminUpdateAgentConfigResp struct {
Success bool `json:"success"`
}
type AdminUpdateAgentProductConfigReq struct {
Id string `json:"id"` // 主键
BasePrice float64 `json:"base_price"` // 基础底价
PriceRangeMax float64 `json:"price_range_max"` // 最高定价(对应数据库 system_max_price
PriceThreshold *float64 `json:"price_threshold,optional"` // 提价标准阈值(可选)
PriceFeeRate *float64 `json:"price_fee_rate,optional"` // 提价手续费比例(可选)
}
type AdminUpdateAgentProductConfigResp struct {
Success bool `json:"success"`
}

View File

@@ -1,67 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AdminBatchUpdateApiStatusReq struct {
Ids []string `json:"ids"`
Status int64 `json:"status"`
}
type AdminBatchUpdateApiStatusResp struct {
Success bool `json:"success"`
}
type AdminCreateApiReq struct {
ApiName string `json:"api_name"`
ApiCode string `json:"api_code"`
Method string `json:"method"`
Url string `json:"url"`
Status int64 `json:"status,default=1"`
Description string `json:"description,optional"`
}
type AdminCreateApiResp struct {
Id string `json:"id"`
}
type AdminDeleteApiReq struct {
Id string `path:"id"`
}
type AdminDeleteApiResp struct {
Success bool `json:"success"`
}
type AdminGetApiDetailReq struct {
Id string `path:"id"`
}
type AdminGetApiDetailResp struct {
AdminApiInfo
}
type AdminGetApiListReq struct {
Page int64 `form:"page,default=1"`
PageSize int64 `form:"page_size,default=20"`
ApiName string `form:"api_name,optional"`
Method string `form:"method,optional"`
Status int64 `form:"status,optional"`
}
type AdminGetApiListResp struct {
Items []AdminApiInfo `json:"items"`
Total int64 `json:"total"`
}
type AdminUpdateApiReq struct {
Id string `path:"id"`
ApiName string `json:"api_name"`
ApiCode string `json:"api_code"`
Method string `json:"method"`
Url string `json:"url"`
Status int64 `json:"status"`
Description string `json:"description,optional"`
}
type AdminUpdateApiResp struct {
Success bool `json:"success"`
}

View File

@@ -1,15 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AdminLoginReq struct {
Username string `json:"username" validate:"required"`
Password string `json:"password" validate:"required"`
Captcha bool `json:"captcha" validate:"required"`
}
type AdminLoginResp struct {
AccessToken string `json:"access_token"`
AccessExpire int64 `json:"access_expire"`
RefreshAfter int64 `json:"refresh_after"`
Roles []string `json:"roles"`
}

View File

@@ -1,75 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AdminConfigFeatureExampleReq struct {
FeatureId string `json:"feature_id"` // 功能ID
Data string `json:"data"` // 示例数据JSON
}
type AdminConfigFeatureExampleResp struct {
Success bool `json:"success"` // 是否成功
}
type AdminCreateFeatureReq struct {
ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述
}
type AdminCreateFeatureResp struct {
Id string `json:"id"` // 功能ID
}
type AdminDeleteFeatureReq struct {
Id string `path:"id"` // 功能ID
}
type AdminDeleteFeatureResp struct {
Success bool `json:"success"` // 是否成功
}
type AdminGetFeatureDetailReq struct {
Id string `path:"id"` // 功能ID
}
type AdminGetFeatureDetailResp struct {
Id string `json:"id"` // 功能ID
ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
type AdminGetFeatureExampleReq struct {
FeatureId string `path:"feature_id"` // 功能ID
}
type AdminGetFeatureExampleResp struct {
Id string `json:"id"` // 示例数据ID
FeatureId string `json:"feature_id"` // 功能ID
ApiId string `json:"api_id"` // API标识
Data string `json:"data"` // 示例数据JSON
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
type AdminGetFeatureListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
ApiId *string `form:"api_id,optional"` // API标识
Name *string `form:"name,optional"` // 描述
}
type AdminGetFeatureListResp struct {
Total int64 `json:"total"` // 总数
Items []FeatureListItem `json:"items"` // 列表数据
}
type AdminUpdateFeatureReq struct {
Id string `path:"id"` // 功能ID
ApiId *string `json:"api_id,optional"` // API标识
Name *string `json:"name,optional"` // 描述
}
type AdminUpdateFeatureResp struct {
Success bool `json:"success"` // 是否成功
}

View File

@@ -1,97 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type CreateMenuReq struct {
Pid string `json:"pid,optional"` // 父菜单ID
Name string `json:"name"` // 路由名称
Path string `json:"path,optional"` // 路由路径
Component string `json:"component,optional"` // 组件路径
Redirect string `json:"redirect,optional"` // 重定向路径
Meta map[string]interface{} `json:"meta"` // 路由元数据
Status int64 `json:"status,optional,default=1"` // 状态0-禁用1-启用
Type string `json:"type"` // 类型
Sort int64 `json:"sort,optional"` // 排序
}
type CreateMenuResp struct {
Id string `json:"id"` // 菜单ID
}
type DeleteMenuReq struct {
Id string `path:"id"` // 菜单ID
}
type DeleteMenuResp struct {
Success bool `json:"success"` // 是否成功
}
type GetMenuAllReq struct {
}
type GetMenuAllResp struct {
Name string `json:"name"`
Path string `json:"path"`
Redirect string `json:"redirect,omitempty"`
Component string `json:"component,omitempty"`
Sort int64 `json:"sort"`
Meta map[string]interface{} `json:"meta"`
Children []GetMenuAllResp `json:"children"`
}
type GetMenuDetailReq struct {
Id string `path:"id"` // 菜单ID
}
type GetMenuDetailResp struct {
Id string `json:"id"` // 菜单ID
Pid string `json:"pid"` // 父菜单ID
Name string `json:"name"` // 路由名称
Path string `json:"path"` // 路由路径
Component string `json:"component"` // 组件路径
Redirect string `json:"redirect"` // 重定向路径
Meta map[string]interface{} `json:"meta"` // 路由元数据
Status int64 `json:"status"` // 状态0-禁用1-启用
Type string `json:"type"` // 类型
Sort int64 `json:"sort"` // 排序
CreateTime string `json:"createTime"` // 创建时间
UpdateTime string `json:"updateTime"` // 更新时间
}
type GetMenuListReq struct {
Name string `form:"name,optional"` // 菜单名称
Path string `form:"path,optional"` // 路由路径
Status int64 `form:"status,optional,default=-1"` // 状态0-禁用1-启用
Type string `form:"type,optional"` // 类型
}
type MenuListItem struct {
Id string `json:"id"` // 菜单ID
Pid string `json:"pid"` // 父菜单ID
Name string `json:"name"` // 路由名称
Path string `json:"path"` // 路由路径
Component string `json:"component"` // 组件路径
Redirect string `json:"redirect"` // 重定向路径
Meta map[string]interface{} `json:"meta"` // 路由元数据
Status int64 `json:"status"` // 状态0-禁用1-启用
Type string `json:"type"` // 类型
Sort int64 `json:"sort"` // 排序
CreateTime string `json:"createTime"` // 创建时间
Children []MenuListItem `json:"children"` // 子菜单
}
type UpdateMenuReq struct {
Id string `path:"id"` // 菜单ID
Pid *string `json:"pid,optional"` // 父菜单ID
Name string `json:"name"` // 路由名称
Path string `json:"path,optional"` // 路由路径
Component string `json:"component,optional"` // 组件路径
Redirect string `json:"redirect,optional"` // 重定向路径
Meta map[string]interface{} `json:"meta"` // 路由元数据
Status int64 `json:"status,optional"` // 状态0-禁用1-启用
Type string `json:"type"` // 类型
Sort int64 `json:"sort,optional"` // 排序
}
type UpdateMenuResp struct {
Success bool `json:"success"` // 是否成功
}

View File

@@ -1,74 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AdminCreateNotificationReq struct {
Title string `json:"title"` // 通知标题
NotificationPage string `json:"notification_page"` // 通知页面
Content string `json:"content"` // 通知内容
StartDate string `json:"start_date"` // 生效开始日期yyyy-MM-dd
StartTime string `json:"start_time"` // 生效开始时间HH:mm:ss
EndDate string `json:"end_date"` // 生效结束日期yyyy-MM-dd
EndTime string `json:"end_time"` // 生效结束时间HH:mm:ss
Status int64 `json:"status"` // 状态1-启用0-禁用
}
type AdminCreateNotificationResp struct {
Id string `json:"id"` // 通知ID
}
type AdminDeleteNotificationReq struct {
Id string `path:"id"` // 通知ID
}
type AdminDeleteNotificationResp struct {
Success bool `json:"success"` // 是否成功
}
type AdminGetNotificationDetailReq struct {
Id string `path:"id"` // 通知ID
}
type AdminGetNotificationDetailResp struct {
Id string `json:"id"` // 通知ID
Title string `json:"title"` // 通知标题
Content string `json:"content"` // 通知内容
NotificationPage string `json:"notification_page"` // 通知页面
StartDate string `json:"start_date"` // 生效开始日期
StartTime string `json:"start_time"` // 生效开始时间
EndDate string `json:"end_date"` // 生效结束日期
EndTime string `json:"end_time"` // 生效结束时间
Status int64 `json:"status"` // 状态
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
type AdminGetNotificationListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
Title *string `form:"title,optional"` // 通知标题(可选)
NotificationPage *string `form:"notification_page,optional"` // 通知页面(可选)
Status *int64 `form:"status,optional"` // 状态(可选)
StartDate *string `form:"start_date,optional"` // 开始日期范围(可选)
EndDate *string `form:"end_date,optional"` // 结束日期范围(可选)
}
type AdminGetNotificationListResp struct {
Total int64 `json:"total"` // 总数
Items []NotificationListItem `json:"items"` // 列表数据
}
type AdminUpdateNotificationReq struct {
Id string `path:"id"` // 通知ID
Title *string `json:"title,optional"` // 通知标题
Content *string `json:"content,optional"` // 通知内容
NotificationPage *string `json:"notification_page,optional"` // 通知页面
StartDate *string `json:"start_date,optional"` // 生效开始日期
StartTime *string `json:"start_time,optional"` // 生效开始时间
EndDate *string `json:"end_date,optional"` // 生效结束日期
EndTime *string `json:"end_time,optional"` // 生效结束时间
Status *int64 `json:"status,optional"` // 状态
}
type AdminUpdateNotificationResp struct {
Success bool `json:"success"` // 是否成功
}

View File

@@ -1,111 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AdminCreateOrderReq struct {
OrderNo string `json:"order_no"` // 商户订单号
PlatformOrderId string `json:"platform_order_id"` // 支付订单号
ProductName string `json:"product_name"` // 产品名称
PaymentPlatform string `json:"payment_platform"` // 支付方式
PaymentScene string `json:"payment_scene"` // 支付平台
Amount float64 `json:"amount"` // 金额
Status string `json:"status,default=pending"` // 支付状态pending-待支付paid-已支付refunded-已退款closed-已关闭failed-支付失败
}
type AdminCreateOrderResp struct {
Id string `json:"id"` // 订单ID
}
type AdminDeleteOrderReq struct {
Id string `path:"id"` // 订单ID
}
type AdminDeleteOrderResp struct {
Success bool `json:"success"` // 是否成功
}
type AdminGetOrderDetailReq struct {
Id string `path:"id"` // 订单ID
}
type AdminGetOrderDetailResp struct {
Id string `json:"id"` // 订单ID
OrderNo string `json:"order_no"` // 商户订单号
PlatformOrderId string `json:"platform_order_id"` // 支付订单号
ProductName string `json:"product_name"` // 产品名称
PaymentPlatform string `json:"payment_platform"` // 支付方式
PaymentScene string `json:"payment_scene"` // 支付平台
Amount float64 `json:"amount"` // 金额
Status string `json:"status"` // 支付状态pending-待支付paid-已支付refunded-已退款closed-已关闭failed-支付失败
QueryState string `json:"query_state"` // 查询状态pending-待查询success-查询成功failed-查询失败 processing-查询中
CreateTime string `json:"create_time"` // 创建时间
PayTime string `json:"pay_time"` // 支付时间
RefundTime string `json:"refund_time"` // 退款时间
UpdateTime string `json:"update_time"` // 更新时间
IsAgentOrder bool `json:"is_agent_order"` // 是否是代理订单
AgentProcessStatus string `json:"agent_process_status"` // 代理事务处理状态not_agent-非代理订单success-处理成功failed-处理失败pending-待处理
}
type AdminGetOrderListReq struct {
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"pageSize,default=20"` // 每页数量
OrderNo string `form:"order_no,optional"` // 商户订单号
PlatformOrderId string `form:"platform_order_id,optional"` // 支付订单号
ProductName string `form:"product_name,optional"` // 产品名称
PaymentPlatform string `form:"payment_platform,optional"` // 支付方式
PaymentScene string `form:"payment_scene,optional"` // 支付平台
Amount float64 `form:"amount,optional"` // 金额
Status string `form:"status,optional"` // 支付状态pending-待支付paid-已支付refunded-已退款closed-已关闭failed-支付失败
CreateTimeStart string `form:"create_time_start,optional"` // 创建时间开始
CreateTimeEnd string `form:"create_time_end,optional"` // 创建时间结束
PayTimeStart string `form:"pay_time_start,optional"` // 支付时间开始
PayTimeEnd string `form:"pay_time_end,optional"` // 支付时间结束
RefundTimeStart string `form:"refund_time_start,optional"` // 退款时间开始
RefundTimeEnd string `form:"refund_time_end,optional"` // 退款时间结束
QueryUserName string `form:"query_user_name,optional"` // 被查询人姓名
QueryUserIdCard string `form:"query_user_id_card,optional"` // 被查询人身份证号
QueryUserMobile string `form:"query_user_mobile,optional"` // 被查询人手机号
}
type AdminGetOrderListResp struct {
Total int64 `json:"total"` // 总数
Items []OrderListItem `json:"items"` // 列表
}
type AdminRefundOrderReq struct {
Id string `path:"id"` // 订单ID
RefundAmount float64 `json:"refund_amount"` // 退款金额
RefundReason string `json:"refund_reason"` // 退款原因
}
type AdminRefundOrderResp struct {
Status string `json:"status"` // 退款状态
RefundNo string `json:"refund_no"` // 退款单号
Amount float64 `json:"amount"` // 退款金额
}
type AdminRetryAgentProcessReq struct {
Id string `path:"id"` // 订单ID
}
type AdminRetryAgentProcessResp struct {
Status string `json:"status"` // 执行状态success-成功already_processed-已处理failed-失败
Message string `json:"message"` // 执行结果消息
ProcessedAt string `json:"processed_at"` // 处理时间
}
type AdminUpdateOrderReq struct {
Id string `path:"id"` // 订单ID
OrderNo *string `json:"order_no,optional"` // 商户订单号
PlatformOrderId *string `json:"platform_order_id,optional"` // 支付订单号
ProductName *string `json:"product_name,optional"` // 产品名称
PaymentPlatform *string `json:"payment_platform,optional"` // 支付方式
PaymentScene *string `json:"payment_scene,optional"` // 支付平台
Amount *float64 `json:"amount,optional"` // 金额
Status *string `json:"status,optional"` // 支付状态pending-待支付paid-已支付refunded-已退款closed-已关闭failed-支付失败
PayTime *string `json:"pay_time,optional"` // 支付时间
RefundTime *string `json:"refund_time,optional"` // 退款时间
}
type AdminUpdateOrderResp struct {
Success bool `json:"success"` // 是否成功
}

View File

@@ -1,66 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AdminCreatePlatformUserReq struct {
Mobile string `json:"mobile"` // 手机号
Password string `json:"password"` // 密码
Nickname string `json:"nickname"` // 昵称
Info string `json:"info"` // 备注信息
Inside int64 `json:"inside"` // 是否内部用户 1-是 0-否
}
type AdminCreatePlatformUserResp struct {
Id string `json:"id"` // 用户ID
}
type AdminDeletePlatformUserReq struct {
Id string `path:"id"` // 用户ID
}
type AdminDeletePlatformUserResp struct {
Success bool `json:"success"` // 是否成功
}
type AdminGetPlatformUserDetailReq struct {
Id string `path:"id"` // 用户ID
}
type AdminGetPlatformUserDetailResp struct {
Id string `json:"id"` // 用户ID
Mobile string `json:"mobile"` // 手机号
Nickname string `json:"nickname"` // 昵称
Info string `json:"info"` // 备注信息
Inside int64 `json:"inside"` // 是否内部用户 1-是 0-否
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
type AdminGetPlatformUserListReq struct {
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"pageSize,default=20"` // 每页数量
Mobile string `form:"mobile,optional"` // 手机号
Nickname string `form:"nickname,optional"` // 昵称
Inside int64 `form:"inside,optional"` // 是否内部用户 1-是 0-否
CreateTimeStart string `form:"create_time_start,optional"` // 创建时间开始
CreateTimeEnd string `form:"create_time_end,optional"` // 创建时间结束
OrderBy string `form:"order_by,optional"` // 排序字段
OrderType string `form:"order_type,optional"` // 排序类型
}
type AdminGetPlatformUserListResp struct {
Total int64 `json:"total"` // 总数
Items []PlatformUserListItem `json:"items"` // 列表
}
type AdminUpdatePlatformUserReq struct {
Id string `path:"id"` // 用户ID
Mobile *string `json:"mobile,optional"` // 手机号
Password *string `json:"password,optional"` // 密码
Nickname *string `json:"nickname,optional"` // 昵称
Info *string `json:"info,optional"` // 备注信息
Inside *int64 `json:"inside,optional"` // 是否内部用户 1-是 0-否
}
type AdminUpdatePlatformUserResp struct {
Success bool `json:"success"` // 是否成功
}

View File

@@ -1,91 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AdminCreateProductReq struct {
ProductName string `json:"product_name"` // 服务名
ProductEn string `json:"product_en"` // 英文名
Description string `json:"description"` // 描述
Notes string `json:"notes,optional"` // 备注
CostPrice float64 `json:"cost_price"` // 成本
SellPrice float64 `json:"sell_price"` // 售价
}
type AdminCreateProductResp struct {
Id string `json:"id"` // 产品ID
}
type AdminDeleteProductReq struct {
Id string `path:"id"` // 产品ID
}
type AdminDeleteProductResp struct {
Success bool `json:"success"` // 是否成功
}
type AdminGetProductDetailReq struct {
Id string `path:"id"` // 产品ID
}
type AdminGetProductDetailResp struct {
Id string `json:"id"` // 产品ID
ProductName string `json:"product_name"` // 服务名
ProductEn string `json:"product_en"` // 英文名
Description string `json:"description"` // 描述
Notes string `json:"notes"` // 备注
CostPrice float64 `json:"cost_price"` // 成本
SellPrice float64 `json:"sell_price"` // 售价
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
type AdminGetProductFeatureListReq struct {
ProductId string `path:"product_id"` // 产品ID
}
type AdminGetProductFeatureListResp struct {
Id string `json:"id"` // 关联ID
ProductId string `json:"product_id"` // 产品ID
FeatureId string `json:"feature_id"` // 功能ID
ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 功能描述
Sort int64 `json:"sort"` // 排序
Enable int64 `json:"enable"` // 是否启用
IsImportant int64 `json:"is_important"` // 是否重要
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
type AdminGetProductListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
ProductName *string `form:"product_name,optional"` // 服务名
ProductEn *string `form:"product_en,optional"` // 英文名
}
type AdminGetProductListResp struct {
Total int64 `json:"total"` // 总数
Items []ProductListItem `json:"items"` // 列表数据
}
type AdminUpdateProductFeaturesReq struct {
ProductId string `path:"product_id"` // 产品ID
Features []ProductFeatureItem `json:"features"` // 功能列表
}
type AdminUpdateProductFeaturesResp struct {
Success bool `json:"success"` // 是否成功
}
type AdminUpdateProductReq struct {
Id string `path:"id"` // 产品ID
ProductName *string `json:"product_name,optional"` // 服务名
ProductEn *string `json:"product_en,optional"` // 英文名
Description *string `json:"description,optional"` // 描述
Notes *string `json:"notes,optional"` // 备注
CostPrice *float64 `json:"cost_price,optional"` // 成本
SellPrice *float64 `json:"sell_price,optional"` // 售价
}
type AdminUpdateProductResp struct {
Success bool `json:"success"` // 是否成功
}

View File

@@ -1,60 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AdminGetQueryCleanupConfigListReq struct {
Status int64 `form:"status,optional"` // 状态1-启用0-禁用
}
type AdminGetQueryCleanupConfigListResp struct {
Items []QueryCleanupConfigItem `json:"items"` // 配置列表
}
type AdminGetQueryCleanupDetailListReq struct {
LogId string `path:"log_id"` // 清理日志ID
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"page_size,default=20"` // 每页数量
}
type AdminGetQueryCleanupDetailListResp struct {
Total int64 `json:"total"` // 总数
Items []QueryCleanupDetailItem `json:"items"` // 列表
}
type AdminGetQueryCleanupLogListReq struct {
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"page_size,default=20"` // 每页数量
Status int64 `form:"status,optional"` // 状态1-成功2-失败
StartTime string `form:"start_time,optional"` // 开始时间
EndTime string `form:"end_time,optional"` // 结束时间
}
type AdminGetQueryCleanupLogListResp struct {
Total int64 `json:"total"` // 总数
Items []QueryCleanupLogItem `json:"items"` // 列表
}
type AdminGetQueryDetailByOrderIdReq struct {
OrderId string `path:"order_id"`
}
type AdminGetQueryDetailByOrderIdResp struct {
Id string `json:"id"` // 主键ID
OrderId string `json:"order_id"` // 订单ID
UserId string `json:"user_id"` // 用户ID
ProductName string `json:"product_name"` // 产品ID
QueryParams map[string]interface{} `json:"query_params"`
QueryData []AdminQueryItem `json:"query_data"`
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
QueryState string `json:"query_state"` // 查询状态
}
type AdminUpdateQueryCleanupConfigReq struct {
Id string `json:"id"` // 主键ID
ConfigValue string `json:"config_value"` // 配置值
Status int64 `json:"status"` // 状态1-启用0-禁用
}
type AdminUpdateQueryCleanupConfigResp struct {
Success bool `json:"success"` // 是否成功
}

View File

@@ -1,66 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type CreateRoleReq struct {
RoleName string `json:"role_name"` // 角色名称
RoleCode string `json:"role_code"` // 角色编码
Description string `json:"description"` // 角色描述
Status int64 `json:"status,default=1"` // 状态0-禁用1-启用
Sort int64 `json:"sort,default=0"` // 排序
MenuIds []string `json:"menu_ids"` // 关联的菜单ID列表
}
type CreateRoleResp struct {
Id string `json:"id"` // 角色ID
}
type DeleteRoleReq struct {
Id string `path:"id"` // 角色ID
}
type DeleteRoleResp struct {
Success bool `json:"success"` // 是否成功
}
type GetRoleDetailReq struct {
Id string `path:"id"` // 角色ID
}
type GetRoleDetailResp struct {
Id string `json:"id"` // 角色ID
RoleName string `json:"role_name"` // 角色名称
RoleCode string `json:"role_code"` // 角色编码
Description string `json:"description"` // 角色描述
Status int64 `json:"status"` // 状态0-禁用1-启用
Sort int64 `json:"sort"` // 排序
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
MenuIds []string `json:"menu_ids"` // 关联的菜单ID列表
}
type GetRoleListReq struct {
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"pageSize,default=20"` // 每页数量
Name string `form:"name,optional"` // 角色名称
Code string `form:"code,optional"` // 角色编码
Status int64 `form:"status,optional,default=-1"` // 状态0-禁用1-启用
}
type GetRoleListResp struct {
Total int64 `json:"total"` // 总数
Items []RoleListItem `json:"items"` // 列表
}
type UpdateRoleReq struct {
Id string `path:"id"` // 角色ID
RoleName *string `json:"role_name,optional"` // 角色名称
RoleCode *string `json:"role_code,optional"` // 角色编码
Description *string `json:"description,optional"` // 角色描述
Status *int64 `json:"status,optional"` // 状态0-禁用1-启用
Sort *int64 `json:"sort,optional"` // 排序
MenuIds []string `json:"menu_ids,optional"` // 关联的菜单ID列表
}
type UpdateRoleResp struct {
Success bool `json:"success"` // 是否成功
}

View File

@@ -1,45 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AdminAssignRoleApiReq struct {
RoleId string `json:"role_id"`
ApiIds []string `json:"api_ids"`
}
type AdminAssignRoleApiResp struct {
Success bool `json:"success"`
}
type AdminGetAllApiListReq struct {
Status int64 `form:"status,optional,default=1"`
}
type AdminGetAllApiListResp struct {
Items []AdminRoleApiInfo `json:"items"`
}
type AdminGetRoleApiListReq struct {
RoleId string `path:"role_id"`
}
type AdminGetRoleApiListResp struct {
Items []AdminRoleApiInfo `json:"items"`
}
type AdminRemoveRoleApiReq struct {
RoleId string `json:"role_id"`
ApiIds []string `json:"api_ids"`
}
type AdminRemoveRoleApiResp struct {
Success bool `json:"success"`
}
type AdminUpdateRoleApiReq struct {
RoleId string `json:"role_id"`
ApiIds []string `json:"api_ids"`
}
type AdminUpdateRoleApiResp struct {
Success bool `json:"success"`
}

View File

@@ -1,78 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AdminCreateUserReq struct {
Username string `json:"username"` // 用户名
RealName string `json:"real_name"` // 真实姓名
Status int64 `json:"status,default=1"` // 状态0-禁用1-启用
RoleIds []string `json:"role_ids"` // 关联的角色ID列表
}
type AdminCreateUserResp struct {
Id string `json:"id"` // 用户ID
}
type AdminDeleteUserReq struct {
Id string `path:"id"` // 用户ID
}
type AdminDeleteUserResp struct {
Success bool `json:"success"` // 是否成功
}
type AdminGetUserDetailReq struct {
Id string `path:"id"` // 用户ID
}
type AdminGetUserDetailResp struct {
Id string `json:"id"` // 用户ID
Username string `json:"username"` // 用户名
RealName string `json:"real_name"` // 真实姓名
Status int64 `json:"status"` // 状态0-禁用1-启用
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
RoleIds []string `json:"role_ids"` // 关联的角色ID列表
}
type AdminGetUserListReq struct {
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"pageSize,default=20"` // 每页数量
Username string `form:"username,optional"` // 用户名
RealName string `form:"real_name,optional"` // 真实姓名
Status int64 `form:"status,optional,default=-1"` // 状态0-禁用1-启用
}
type AdminGetUserListResp struct {
Total int64 `json:"total"` // 总数
Items []AdminUserListItem `json:"items"` // 列表
}
type AdminResetPasswordReq struct {
Id string `path:"id"` // 用户ID
Password string `json:"password"` // 新密码
}
type AdminResetPasswordResp struct {
Success bool `json:"success"` // 是否成功
}
type AdminUpdateUserReq struct {
Id string `path:"id"` // 用户ID
Username *string `json:"username,optional"` // 用户名
RealName *string `json:"real_name,optional"` // 真实姓名
Status *int64 `json:"status,optional"` // 状态0-禁用1-启用
RoleIds []string `json:"role_ids,optional"` // 关联的角色ID列表
}
type AdminUpdateUserResp struct {
Success bool `json:"success"` // 是否成功
}
type AdminUserInfoReq struct {
}
type AdminUserInfoResp struct {
Username string `json:"username"` // 用户名
RealName string `json:"real_name"` // 真实姓名
Roles []string `json:"roles"` // 角色编码列表
}

View File

@@ -1,300 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AgentApplyReq struct {
Region string `json:"region,optional"`
Mobile string `json:"mobile"`
Code string `json:"code"`
Referrer string `json:"referrer"`
InviteCode string `json:"invite_code,optional"`
AgentCode int64 `json:"agent_code,optional"`
}
type AgentApplyResp struct {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
AgentCode int64 `json:"agent_code"`
}
type AgentGeneratingLinkReq struct {
ProductId string `json:"product_id"` // 产品ID
SetPrice float64 `json:"set_price"` // 设定价格
TargetPath string `json:"target_path,optional"` // 目标地址(可选,默认为推广报告页面)
}
type AgentGeneratingLinkResp struct {
LinkIdentifier string `json:"link_identifier"` // 推广链接标识
FullLink string `json:"full_link"` // 完整短链URL
}
type AgentInfoResp struct {
AgentId string `json:"agent_id"`
Level int64 `json:"level"`
LevelName string `json:"level_name"`
Region string `json:"region"`
Mobile string `json:"mobile"`
WechatId string `json:"wechat_id"`
TeamLeaderId string `json:"team_leader_id"`
IsRealName bool `json:"is_real_name"`
AgentCode int64 `json:"agent_code"`
}
type AgentProductConfigResp struct {
List []ProductConfigItem `json:"list"`
}
type ApplyUpgradeReq struct {
ToLevel int64 `json:"to_level"` // 目标等级2=黄金3=钻石
}
type ApplyUpgradeResp struct {
UpgradeId string `json:"upgrade_id"` // 升级记录ID
OrderNo string `json:"order_no"` // 支付订单号
}
type ApplyWithdrawalReq struct {
Amount float64 `json:"amount"` // 提现金额
PayeeAccount string `json:"payee_account"` // 收款账户
PayeeName string `json:"payee_name"` // 收款人姓名
}
type ApplyWithdrawalResp struct {
WithdrawalId string `json:"withdrawal_id"` // 提现记录ID
WithdrawalNo string `json:"withdrawal_no"` // 提现单号
}
type ConversionRateResp struct {
MyConversionRate ConversionRateData `json:"my_conversion_rate"` // 我的转化率
SubordinateConversionRate ConversionRateData `json:"subordinate_conversion_rate"` // 我的下级转化率
}
type DeleteInviteCodeReq struct {
Id string `json:"id"` // 邀请码ID
}
type DeleteInviteCodeResp struct {
}
type GenerateInviteCodeReq struct {
Count int64 `json:"count"` // 生成数量
ExpireDays int64 `json:"expire_days,optional"` // 过期天数可选0表示不过期
Remark string `json:"remark,optional"` // 备注(可选)
}
type GenerateInviteCodeResp struct {
Codes []string `json:"codes"` // 生成的邀请码列表
}
type GetCommissionListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"page_size"` // 每页数量
}
type GetCommissionListResp struct {
Total int64 `json:"total"` // 总数
List []CommissionItem `json:"list"` // 列表
}
type GetInviteCodeListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"page_size"` // 每页数量
Status int64 `form:"status,optional"` // 状态(可选)
}
type GetInviteCodeListResp struct {
Total int64 `json:"total"` // 总数
List []InviteCodeItem `json:"list"` // 列表
}
type GetInviteLinkReq struct {
InviteCode string `form:"invite_code"` // 邀请码
TargetPath string `form:"target_path,optional"` // 目标地址(可选,默认为注册页面)
}
type GetInviteLinkResp struct {
InviteLink string `json:"invite_link"` // 邀请链接
}
type GetLevelPrivilegeResp struct {
Levels []LevelPrivilegeItem `json:"levels"`
UpgradeToGoldFee float64 `json:"upgrade_to_gold_fee"`
UpgradeToDiamondFee float64 `json:"upgrade_to_diamond_fee"`
UpgradeToGoldRebate float64 `json:"upgrade_to_gold_rebate"`
UpgradeToDiamondRebate float64 `json:"upgrade_to_diamond_rebate"`
}
type GetLinkDataReq struct {
LinkIdentifier string `form:"link_identifier"` // 推广链接标识
}
type GetLinkDataResp struct {
AgentId string `json:"agent_id"` // 代理ID
ProductId string `json:"product_id"` // 产品ID
SetPrice float64 `json:"set_price"` // 代理设定价格
ActualBasePrice float64 `json:"actual_base_price"` // 实际底价
ProductName string `json:"product_name"` // 产品名称
ProductEn string `json:"product_en"` // 产品英文标识
SellPrice float64 `json:"sell_price"` // 销售价格(使用代理设定价格)
Description string `json:"description"` // 产品描述
Features []Feature `json:"features"` // 产品功能列表
}
type GetPromotionQueryListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"page_size"` // 每页数量
}
type GetPromotionQueryListResp struct {
Total int64 `json:"total"` // 总数
List []PromotionQueryItem `json:"list"` // 列表
}
type GetRebateListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"page_size"` // 每页数量
RebateType *int64 `form:"rebate_type,optional"` // 返佣类型可选1=直接上级返佣2=钻石上级返佣3=黄金上级返佣
}
type GetRebateListResp struct {
Total int64 `json:"total"` // 总数
List []RebateItem `json:"list"` // 列表
}
type GetRevenueInfoResp struct {
Balance float64 `json:"balance"` // 可用余额
FrozenBalance float64 `json:"frozen_balance"` // 冻结余额
TotalEarnings float64 `json:"total_earnings"` // 累计收益(钱包总收益)
WithdrawnAmount float64 `json:"withdrawn_amount"` // 累计提现
CommissionTotal float64 `json:"commission_total"` // 佣金累计总收益(推广订单获得的佣金)
CommissionToday float64 `json:"commission_today"` // 佣金今日收益
CommissionMonth float64 `json:"commission_month"` // 佣金本月收益
RebateTotal float64 `json:"rebate_total"` // 返佣累计总收益(包括推广返佣和升级返佣)
RebateToday float64 `json:"rebate_today"` // 返佣今日收益
RebateMonth float64 `json:"rebate_month"` // 返佣本月收益
}
type GetSubordinateContributionDetailReq struct {
SubordinateId string `form:"subordinate_id"` // 下级代理ID
Page int64 `form:"page"` // 页码
PageSize int64 `form:"page_size"` // 每页数量
TabType string `form:"tab_type,optional"` // 标签页类型order=订单列表invite=邀请列表
}
type GetSubordinateContributionDetailResp struct {
Mobile string `json:"mobile"` // 手机号
LevelName string `json:"level_name"` // 等级名称
CreateTime string `json:"create_time"` // 创建时间
OrderStats OrderStatistics `json:"order_stats"` // 订单统计(仅统计有返佣的订单)
RebateStats RebateStatistics `json:"rebate_stats"` // 返佣统计
InviteStats InviteStatistics `json:"invite_stats"` // 邀请统计
OrderList []OrderItem `json:"order_list"` // 订单列表(仅有贡献的订单)
InviteList []InviteItem `json:"invite_list"` // 邀请列表
OrderListTotal int64 `json:"order_list_total"` // 订单列表总数
InviteListTotal int64 `json:"invite_list_total"` // 邀请列表总数
}
type GetSubordinateListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"page_size"` // 每页数量
}
type GetSubordinateListResp struct {
Total int64 `json:"total"` // 总数
List []SubordinateItem `json:"list"` // 列表
}
type GetTeamListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"page_size"` // 每页数量
Mobile string `form:"mobile,optional"` // 手机号(可选,用于搜索)
}
type GetTeamListResp struct {
Statistics TeamStatistics `json:"statistics"` // 统计数据
Total int64 `json:"total"` // 总数
List []TeamMemberItem `json:"list"` // 列表
}
type GetUpgradeListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"page_size"` // 每页数量
}
type GetUpgradeListResp struct {
Total int64 `json:"total"` // 总数
List []UpgradeItem `json:"list"` // 列表
}
type GetUpgradeRebateListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"page_size"` // 每页数量
}
type GetUpgradeRebateListResp struct {
Total int64 `json:"total"` // 总数
List []UpgradeRebateItem `json:"list"` // 列表
}
type GetWithdrawalListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"page_size"` // 每页数量
}
type GetWithdrawalListResp struct {
Total int64 `json:"total"` // 总数
List []WithdrawalItem `json:"list"` // 列表
}
type RealNameAuthReq struct {
Name string `json:"name"` // 姓名
IdCard string `json:"id_card"` // 身份证号
Mobile string `json:"mobile"` // 手机号
Code string `json:"code"` // 验证码
}
type RealNameAuthResp struct {
Status string `json:"status"` // 状态pending=待审核approved=已通过rejected=已拒绝
}
type RegisterByInviteCodeReq struct {
Referrer string `json:"referrer"`
InviteCode string `json:"invite_code,optional"`
AgentCode int64 `json:"agent_code,optional"`
Mobile string `json:"mobile"`
Code string `json:"code"`
Region string `json:"region,optional"`
WechatId string `json:"wechat_id,optional"`
}
type RegisterByInviteCodeResp struct {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
AgentId string `json:"agent_id"` // 代理ID
Level int64 `json:"level"` // 代理等级
LevelName string `json:"level_name"` // 等级名称
AgentCode int64 `json:"agent_code"`
}
type ShortLinkRedirectResp struct {
}
type TeamStatisticsResp struct {
TotalCount int64 `json:"total_count"` // 团队总人数(不包括自己)
DirectCount int64 `json:"direct_count"` // 直接下级数量
IndirectCount int64 `json:"indirect_count"` // 间接下级数量
GoldCount int64 `json:"gold_count"` // 黄金代理数量
NormalCount int64 `json:"normal_count"` // 普通代理数量
TodayNewMembers int64 `json:"today_new_members"` // 今日新增成员
MonthNewMembers int64 `json:"month_new_members"` // 本月新增成员
}
type UpgradeSubordinateReq struct {
SubordinateId string `json:"subordinate_id"` // 下级代理ID
ToLevel int64 `json:"to_level"` // 目标等级只能是2=黄金)
}
type UpgradeSubordinateResp struct {
Success bool `json:"success"`
}

View File

@@ -1,16 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type HealthCheckResp struct {
Status string `json:"status"` // 服务状态
Message string `json:"message"` // 状态信息
}
type GetAppConfigResp struct {
QueryRetentionDays int64 `json:"query_retention_days"`
}
type GetAppVersionResp struct {
Version string `json:"version"`
WgtUrl string `json:"wgtUrl"`
}

View File

@@ -1,7 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type SendSmsReq struct {
Mobile string `json:"mobile" validate:"required,mobile"`
ActionType string `json:"actionType" validate:"required,oneof=login register query agentApply realName bindMobile"`
}

View File

@@ -1,36 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type DownloadAuthorizationDocumentReq struct {
DocumentId string `json:"documentId" validate:"required"` // 授权书ID
}
type DownloadAuthorizationDocumentResp struct {
FileName string `json:"fileName"` // 文件名
FileUrl string `json:"fileUrl"` // 文件访问URL
}
type GetAuthorizationDocumentByOrderReq struct {
OrderId string `json:"orderId" validate:"required"` // 订单ID
}
type GetAuthorizationDocumentByOrderResp struct {
Documents []AuthorizationDocumentInfo `json:"documents"` // 授权书列表
}
type GetAuthorizationDocumentReq struct {
DocumentId string `json:"documentId" validate:"required"` // 授权书ID
}
type GetAuthorizationDocumentResp struct {
DocumentId string `json:"documentId"` // 授权书ID
UserId string `json:"userId"` // 用户ID
OrderId string `json:"orderId"` // 订单ID
QueryId string `json:"queryId"` // 查询ID
FileName string `json:"fileName"` // 文件名
FileUrl string `json:"fileUrl"` // 文件访问URL
FileSize int64 `json:"fileSize"` // 文件大小
FileType string `json:"fileType"` // 文件类型
Status string `json:"status"` // 状态
CreateTime string `json:"createTime"` // 创建时间
}

View File

@@ -1,7 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type GetNotificationsResp struct {
Notifications []Notification `json:"notifications"` // 通知列表
Total int64 `json:"total"` // 总记录数
}

View File

@@ -1,28 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type IapCallbackReq struct {
OrderID string `json:"order_id" validate:"required"`
TransactionReceipt string `json:"transaction_receipt" validate:"required"`
}
type PaymentCheckReq struct {
OrderNo string `json:"order_no" validate:"required"`
}
type PaymentCheckResp struct {
Type string `json:"type"`
Status string `json:"status"`
}
type PaymentReq struct {
Id string `json:"id"`
PayMethod string `json:"pay_method"` // 支付方式: wechat, alipay, appleiap, test(仅开发环境), test_empty(仅开发环境-空报告模式)
PayType string `json:"pay_type" validate:"required,oneof=query agent_vip agent_upgrade"`
}
type PaymentResp struct {
PrepayData interface{} `json:"prepay_data"`
PrepayId string `json:"prepay_id"`
OrderNo string `json:"order_no"`
}

View File

@@ -1,14 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type GetProductByEnRequest struct {
ProductEn string `path:"product_en"`
}
type GetProductByIDRequest struct {
Id string `path:"id"`
}
type ProductResponse struct {
Product
}

View File

@@ -1,90 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type QueryDetailByOrderIdReq struct {
OrderId string `path:"order_id"`
}
type QueryDetailByOrderNoReq struct {
OrderNo string `path:"order_no"`
}
type QueryExampleReq struct {
Feature string `form:"feature"`
}
type QueryGenerateShareLinkReq struct {
OrderId *string `json:"order_id,optional"`
OrderNo *string `json:"order_no,optional"`
}
type QueryGenerateShareLinkResp struct {
ShareLink string `json:"share_link"`
}
type QueryListReq struct {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"page_size"` // 每页数据量
}
type QueryListResp struct {
Total int64 `json:"total"` // 总记录数
List []Query `json:"list"` // 查询列表
}
type QueryProvisionalOrderReq struct {
Id string `path:"id"`
}
type QueryProvisionalOrderResp struct {
Name string `json:"name"`
IdCard string `json:"id_card"`
Mobile string `json:"mobile"`
Product Product `json:"product"`
}
type QueryRetryReq struct {
Id string `path:"id"`
}
type QueryRetryResp struct {
Query
}
type QueryServiceReq struct {
Product string `path:"product"`
Data string `json:"data" validate:"required"`
AgentIdentifier string `json:"agent_identifier,optional"`
App bool `json:"app,optional"`
}
type QueryServiceResp struct {
Id string `json:"id"`
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
}
type QueryShareDetailReq struct {
Id string `path:"id"`
}
type QuerySingleTestReq struct {
Params map[string]interface{} `json:"params"`
Api string `json:"api"`
}
type QuerySingleTestResp struct {
Data interface{} `json:"data"`
Api string `json:"api"`
}
type UpdateQueryDataReq struct {
Id string `json:"id"` // 查询ID
QueryData string `json:"query_data"` // 查询数据(未加密的JSON)
}
type UpdateQueryDataResp struct {
Id string `json:"id"`
UpdatedAt string `json:"updated_at"` // 更新时间
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,73 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package types
type AuthReq struct {
Platform string `json:"platform"` // browser|wxh5|wxmini
Code string `json:"code,optional"`
}
type AuthResp struct {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
UserType int64 `json:"userType"`
HasMobile bool `json:"hasMobile"`
IsAgent bool `json:"isAgent"`
}
type BindMobileReq struct {
Mobile string `json:"mobile" validate:"required,mobile"`
Code string `json:"code" validate:"required"`
}
type BindMobileResp struct {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
}
type GetSignatureReq struct {
Url string `json:"url"`
}
type GetSignatureResp struct {
AppId string `json:"appId"`
Timestamp int64 `json:"timestamp"`
NonceStr string `json:"nonceStr"`
Signature string `json:"signature"`
}
type MobileCodeLoginReq struct {
Mobile string `json:"mobile"`
Code string `json:"code" validate:"required"`
}
type MobileCodeLoginResp struct {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
}
type UserInfoResp struct {
UserInfo User `json:"userInfo"`
}
type WXH5AuthReq struct {
Code string `json:"code"`
}
type WXH5AuthResp struct {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
}
type WXMiniAuthReq struct {
Code string `json:"code"`
}
type WXMiniAuthResp struct {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
}

View File

@@ -58,6 +58,7 @@ func main() {
server := rest.MustNewServer(c.RestConf)
server.Use(middleware.GlobalSourceInterceptor)
server.Use(middleware.UserDisableInterceptor(svcContext.UserModel, svcContext.Config.JwtAuth.AccessSecret))
defer server.Stop()
handler.RegisterHandlers(server, svcContext)

View File

@@ -11,8 +11,6 @@ import (
"reflect"
"time"
"qnc-server/common/globalkey"
"github.com/Masterminds/squirrel"
"github.com/google/uuid"
"github.com/pkg/errors"
@@ -21,6 +19,7 @@ import (
"github.com/zeromicro/go-zero/core/stores/sqlc"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/core/stringx"
"qnc-server/common/globalkey"
)
var (
@@ -29,8 +28,8 @@ var (
userRowsExpectAutoSet = strings.Join(stringx.Remove(userFieldNames, "`create_time`", "`update_time`"), ",")
userRowsWithPlaceHolder = strings.Join(stringx.Remove(userFieldNames, "`id`", "`create_time`", "`update_time`"), "=?,") + "=?"
cacheQncUserIdPrefix = "cache:qnc:user:id:"
cacheQncUserMobilePrefix = "cache:qnc:user:mobile:"
cacheZacUserIdPrefix = "cache:zac:user:id:"
cacheZacUserMobilePrefix = "cache:zac:user:mobile:"
)
type (
@@ -70,6 +69,7 @@ type (
Nickname sql.NullString `db:"nickname"`
Info string `db:"info"`
Inside int64 `db:"inside"`
Disable int64 `db:"disable"` // 0可用 1禁用
}
)
@@ -83,15 +83,15 @@ func newUserModel(conn sqlx.SqlConn, c cache.CacheConf) *defaultUserModel {
func (m *defaultUserModel) Insert(ctx context.Context, session sqlx.Session, data *User) (sql.Result, error) {
data.DelState = globalkey.DelStateNo
m.insertUUID(data)
qncUserIdKey := fmt.Sprintf("%s%v", cacheQncUserIdPrefix, data.Id)
qncUserMobileKey := fmt.Sprintf("%s%v", cacheQncUserMobilePrefix, data.Mobile)
zacUserIdKey := fmt.Sprintf("%s%v", cacheZacUserIdPrefix, data.Id)
zacUserMobileKey := fmt.Sprintf("%s%v", cacheZacUserMobilePrefix, data.Mobile)
return m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, userRowsExpectAutoSet)
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, userRowsExpectAutoSet)
if session != nil {
return session.ExecCtx(ctx, query, data.Id, data.DeleteTime, data.DelState, data.Version, data.Mobile, data.Password, data.Nickname, data.Info, data.Inside)
return session.ExecCtx(ctx, query, data.Id, data.DeleteTime, data.DelState, data.Version, data.Mobile, data.Password, data.Nickname, data.Info, data.Inside, data.Disable)
}
return conn.ExecCtx(ctx, query, data.Id, data.DeleteTime, data.DelState, data.Version, data.Mobile, data.Password, data.Nickname, data.Info, data.Inside)
}, qncUserIdKey, qncUserMobileKey)
return conn.ExecCtx(ctx, query, data.Id, data.DeleteTime, data.DelState, data.Version, data.Mobile, data.Password, data.Nickname, data.Info, data.Inside, data.Disable)
}, zacUserIdKey, zacUserMobileKey)
}
func (m *defaultUserModel) insertUUID(data *User) {
t := reflect.TypeOf(data).Elem()
@@ -111,9 +111,9 @@ func (m *defaultUserModel) insertUUID(data *User) {
}
func (m *defaultUserModel) FindOne(ctx context.Context, id string) (*User, error) {
qncUserIdKey := fmt.Sprintf("%s%v", cacheQncUserIdPrefix, id)
zacUserIdKey := fmt.Sprintf("%s%v", cacheZacUserIdPrefix, id)
var resp User
err := m.QueryRowCtx(ctx, &resp, qncUserIdKey, func(ctx context.Context, conn sqlx.SqlConn, v interface{}) error {
err := m.QueryRowCtx(ctx, &resp, zacUserIdKey, func(ctx context.Context, conn sqlx.SqlConn, v interface{}) error {
query := fmt.Sprintf("select %s from %s where `id` = ? and del_state = ? limit 1", userRows, m.table)
return conn.QueryRowCtx(ctx, v, query, id, globalkey.DelStateNo)
})
@@ -128,9 +128,9 @@ func (m *defaultUserModel) FindOne(ctx context.Context, id string) (*User, error
}
func (m *defaultUserModel) FindOneByMobile(ctx context.Context, mobile sql.NullString) (*User, error) {
qncUserMobileKey := fmt.Sprintf("%s%v", cacheQncUserMobilePrefix, mobile)
zacUserMobileKey := fmt.Sprintf("%s%v", cacheZacUserMobilePrefix, mobile)
var resp User
err := m.QueryRowIndexCtx(ctx, &resp, qncUserMobileKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v interface{}) (i interface{}, e error) {
err := m.QueryRowIndexCtx(ctx, &resp, zacUserMobileKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v interface{}) (i interface{}, e error) {
query := fmt.Sprintf("select %s from %s where `mobile` = ? and del_state = ? limit 1", userRows, m.table)
if err := conn.QueryRowCtx(ctx, &resp, query, mobile, globalkey.DelStateNo); err != nil {
return nil, err
@@ -152,15 +152,15 @@ func (m *defaultUserModel) Update(ctx context.Context, session sqlx.Session, new
if err != nil {
return nil, err
}
qncUserIdKey := fmt.Sprintf("%s%v", cacheQncUserIdPrefix, data.Id)
qncUserMobileKey := fmt.Sprintf("%s%v", cacheQncUserMobilePrefix, data.Mobile)
zacUserIdKey := fmt.Sprintf("%s%v", cacheZacUserIdPrefix, data.Id)
zacUserMobileKey := fmt.Sprintf("%s%v", cacheZacUserMobilePrefix, data.Mobile)
return m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, userRowsWithPlaceHolder)
if session != nil {
return session.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.Mobile, newData.Password, newData.Nickname, newData.Info, newData.Inside, newData.Id)
return session.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.Mobile, newData.Password, newData.Nickname, newData.Info, newData.Inside, newData.Disable, newData.Id)
}
return conn.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.Mobile, newData.Password, newData.Nickname, newData.Info, newData.Inside, newData.Id)
}, qncUserIdKey, qncUserMobileKey)
return conn.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.Mobile, newData.Password, newData.Nickname, newData.Info, newData.Inside, newData.Disable, newData.Id)
}, zacUserIdKey, zacUserMobileKey)
}
func (m *defaultUserModel) UpdateWithVersion(ctx context.Context, session sqlx.Session, newData *User) error {
@@ -175,15 +175,15 @@ func (m *defaultUserModel) UpdateWithVersion(ctx context.Context, session sqlx.S
if err != nil {
return err
}
qncUserIdKey := fmt.Sprintf("%s%v", cacheQncUserIdPrefix, data.Id)
qncUserMobileKey := fmt.Sprintf("%s%v", cacheQncUserMobilePrefix, data.Mobile)
zacUserIdKey := fmt.Sprintf("%s%v", cacheZacUserIdPrefix, data.Id)
zacUserMobileKey := fmt.Sprintf("%s%v", cacheZacUserMobilePrefix, data.Mobile)
sqlResult, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("update %s set %s where `id` = ? and version = ? ", m.table, userRowsWithPlaceHolder)
if session != nil {
return session.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.Mobile, newData.Password, newData.Nickname, newData.Info, newData.Inside, newData.Id, oldVersion)
return session.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.Mobile, newData.Password, newData.Nickname, newData.Info, newData.Inside, newData.Disable, newData.Id, oldVersion)
}
return conn.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.Mobile, newData.Password, newData.Nickname, newData.Info, newData.Inside, newData.Id, oldVersion)
}, qncUserIdKey, qncUserMobileKey)
return conn.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.Mobile, newData.Password, newData.Nickname, newData.Info, newData.Inside, newData.Disable, newData.Id, oldVersion)
}, zacUserIdKey, zacUserMobileKey)
if err != nil {
return err
}
@@ -406,19 +406,19 @@ func (m *defaultUserModel) Delete(ctx context.Context, session sqlx.Session, id
return err
}
qncUserIdKey := fmt.Sprintf("%s%v", cacheQncUserIdPrefix, id)
qncUserMobileKey := fmt.Sprintf("%s%v", cacheQncUserMobilePrefix, data.Mobile)
zacUserIdKey := fmt.Sprintf("%s%v", cacheZacUserIdPrefix, id)
zacUserMobileKey := fmt.Sprintf("%s%v", cacheZacUserMobilePrefix, data.Mobile)
_, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
if session != nil {
return session.ExecCtx(ctx, query, id)
}
return conn.ExecCtx(ctx, query, id)
}, qncUserIdKey, qncUserMobileKey)
}, zacUserIdKey, zacUserMobileKey)
return err
}
func (m *defaultUserModel) formatPrimary(primary interface{}) string {
return fmt.Sprintf("%s%v", cacheQncUserIdPrefix, primary)
return fmt.Sprintf("%s%v", cacheZacUserIdPrefix, primary)
}
func (m *defaultUserModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary interface{}) error {
query := fmt.Sprintf("select %s from %s where `id` = ? and del_state = ? limit 1", userRows, m.table)

View File

@@ -16,6 +16,7 @@ const PARAM_VERIFICATION_ERROR uint32 = 100007
const CUSTOM_ERROR uint32 = 100008
const USER_NOT_FOUND uint32 = 100009
const USER_NEED_BIND_MOBILE uint32 = 100010
const USER_DISABLED uint32 = 100011 // 用户已被封禁
const LOGIN_FAILED uint32 = 200001
const LOGIC_QUERY_WAIT uint32 = 200002

View File

@@ -11,6 +11,7 @@ func init() {
message[TOKEN_GENERATE_ERROR] = "生成token失败"
message[DB_ERROR] = "系统维护升级中,请稍后再试"
message[DB_UPDATE_AFFECTED_ZERO_ERROR] = "更新数据影响行数为0"
message[USER_DISABLED] = "用户已被封禁"
}
func MapErrMsg(errcode uint32) string {

View File

@@ -29,7 +29,7 @@ $tables = @(
# "agent",
# "agent_commission",
# "agent_config"
"query_user_record"
# "query_user_record"
# "agent_freeze_task",
# "agent_invite_code",
# "agent_invite_code_usage",
@@ -56,14 +56,14 @@ $tables = @(
# "query_cleanup_config",
# "query_cleanup_detail",
# "query_cleanup_log",
# "user",
"user"
# "user_auth"
)
# 为每个表生成模型
foreach ($table in $tables) {
Write-Host "正在生成表: $table" -ForegroundColor Green
goctl model mysql datasource -url="zac:5vg67b3UNHu8@tcp(127.0.0.1:21201)/zac" -table="$table" -dir="./model" --home="$HOME_DIR" -cache=true --style=goZero
goctl model mysql datasource -url="zac:5vg67b3UNHu8@tcp(127.0.0.1:23221)/zac" -table="$table" -dir="./model" --home="$HOME_DIR" -cache=true --style=goZero
# 移动生成的文件到目标目录
if (Test-Path $OUTPUT_DIR) {

View File

@@ -1,66 +0,0 @@
-- ============================================================
-- 查询用户记录表 - 添加索引脚本
-- 用途:为已存在的 query_user_record 表添加索引,优化按姓名、身份证、手机号筛选订单的查询性能
-- 执行说明:在目标数据库执行此脚本添加索引
-- 注意:如果索引已存在,执行会报错,可以忽略或先检查索引是否存在
-- ============================================================
-- 检查并添加 idx_name 索引(用于按姓名筛选订单)
-- 如果索引已存在,此语句会报错,可以忽略
ALTER TABLE `query_user_record`
ADD INDEX `idx_name` (`name`) COMMENT '用于按姓名筛选订单';
-- 检查并添加 idx_del_state_order_id 复合索引用于筛选未删除记录并按订单ID查询
-- 如果索引已存在,此语句会报错,可以忽略
ALTER TABLE `query_user_record`
ADD INDEX `idx_del_state_order_id` (`del_state`, `order_id`) COMMENT '用于筛选未删除记录并按订单ID查询';
-- 检查并添加 idx_name_id_card_mobile 复合索引(用于多条件组合筛选)
-- 如果索引已存在,此语句会报错,可以忽略
ALTER TABLE `query_user_record`
ADD INDEX `idx_name_id_card_mobile` (`name`, `id_card`, `mobile`) COMMENT '复合索引:用于多条件组合筛选(姓名+身份证+手机号)';
-- ============================================================
-- 可选:如果希望先检查索引是否存在再添加,可以使用以下存储过程方式
-- ============================================================
--
-- DELIMITER $$
--
-- DROP PROCEDURE IF EXISTS `add_index_if_not_exists`$$
--
-- CREATE PROCEDURE `add_index_if_not_exists`(
-- IN p_table_name VARCHAR(128),
-- IN p_index_name VARCHAR(128),
-- IN p_index_definition TEXT
-- )
-- BEGIN
-- DECLARE v_index_exists INT DEFAULT 0;
--
-- SELECT COUNT(*) INTO v_index_exists
-- FROM information_schema.statistics
-- WHERE table_schema = DATABASE()
-- AND table_name = p_table_name
-- AND index_name = p_index_name;
--
-- IF v_index_exists = 0 THEN
-- SET @sql = CONCAT('ALTER TABLE `', p_table_name, '` ADD INDEX `', p_index_name, '` ', p_index_definition);
-- PREPARE stmt FROM @sql;
-- EXECUTE stmt;
-- DEALLOCATE PREPARE stmt;
-- SELECT CONCAT('索引 ', p_index_name, ' 已成功添加') AS result;
-- ELSE
-- SELECT CONCAT('索引 ', p_index_name, ' 已存在,跳过') AS result;
-- END IF;
-- END$$
--
-- DELIMITER ;
--
-- -- 使用存储过程添加索引
-- CALL `add_index_if_not_exists`('query_user_record', 'idx_name', '(`name`) COMMENT ''用于按姓名筛选订单''');
-- CALL `add_index_if_not_exists`('query_user_record', 'idx_del_state_order_id', '(`del_state`, `order_id`) COMMENT ''用于筛选未删除记录并按订单ID查询''');
-- CALL `add_index_if_not_exists`('query_user_record', 'idx_name_id_card_mobile', '(`name`, `id_card`, `mobile`) COMMENT ''复合索引:用于多条件组合筛选(姓名+身份证+手机号)''');
--
-- -- 清理存储过程
-- DROP PROCEDURE IF EXISTS `add_index_if_not_exists`;
--
-- ============================================================

View File

@@ -0,0 +1,5 @@
-- 为用户表添加 disable 字段0 可用1 禁用,默认 0
ALTER TABLE `user` ADD COLUMN `disable` tinyint NOT NULL DEFAULT 0 COMMENT '0可用 1禁用' AFTER `inside`;
-- 解除封禁示例UPDATE `user` SET `disable` = 0 WHERE `id` = ?;
-- 封禁用户示例UPDATE `user` SET `disable` = 1 WHERE `id` = ?;

View File

@@ -12,7 +12,7 @@ services:
MYSQL_USER: zac
MYSQL_PASSWORD: 5vg67b3UNHu8
ports:
- "21201:3306"
- "23221:3306"
volumes:
# 数据挂载 - Data mounting
- ./data/mysql/data:/var/lib/mysql
@@ -33,7 +33,7 @@ services:
image: redis:7.4.0
container_name: zac_redis
ports:
- "21202:6379"
- "23222:6379"
environment:
# 时区上海 - Time zone Shanghai (Change if needed)
TZ: Asia/Shanghai
@@ -50,7 +50,7 @@ services:
image: hibiken/asynqmon:latest
container_name: zac_asynqmon
ports:
- "21203:8080"
- "23223:8080"
environment:
- TZ=Asia/Shanghai
command:
@@ -72,7 +72,7 @@ services:
PMA_USER: zac
PMA_PASSWORD: 5vg67b3UNHu8
ports:
- "21204:80"
- "23224:80"
depends_on:
- mysql
networks: