Compare commits
65 Commits
4d5013486c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9906e97328 | |||
| 6c540c4216 | |||
| fc9d7983b7 | |||
| 93886e2e90 | |||
| 7aa4fb60f6 | |||
| 81cd477c62 | |||
| 323f14e1f5 | |||
| cff19bb80d | |||
| 347306426f | |||
| f5f0e0d8b2 | |||
| 4908048b5b | |||
| 0b87a39c41 | |||
| d209270630 | |||
| 96a02f73d4 | |||
| 021349c60e | |||
| a63e4a9dbb | |||
| f6d3b80659 | |||
| d630d84718 | |||
| b3429bad76 | |||
| 60a0770917 | |||
| ed5ebc5648 | |||
| d63338aea4 | |||
| 578911c6ae | |||
| 5b5a708c84 | |||
| c4c3423de0 | |||
| 250dd83506 | |||
| fdc6c24c79 | |||
| b3105417ec | |||
| 54e3edfea7 | |||
| ef6ca3b9da | |||
| 07ad436fd5 | |||
| ad28fc2301 | |||
| ad809f6f8b | |||
| e96adc9f98 | |||
| a14f1dcf2a | |||
| 5942de22ad | |||
| e30e69f8b8 | |||
| c9b83926a5 | |||
| fbaab6a45c | |||
| 3a8f31a3c2 | |||
| 586330cfa6 | |||
| 04df8460a4 | |||
| 0206710e29 | |||
| d1c59b6803 | |||
| 668b3f65e3 | |||
| adb678435e | |||
| 3c6e2683f5 | |||
| dc747139c9 | |||
| 21194c60a8 | |||
| e6485c034f | |||
| 7b47f4512f | |||
| 21fc156af0 | |||
| 2f53165b64 | |||
| fd127bd285 | |||
| 13829de3e6 | |||
| 8b63a8fc41 | |||
| dd9f024ed9 | |||
| 5109b12d8e | |||
| a1859fdeb9 | |||
| cff3a32da4 | |||
| fda007011b | |||
| a87326a085 | |||
| 0f676d3c76 | |||
| c23ab8338b | |||
| 8d00d67540 |
11
.gitignore
vendored
11
.gitignore
vendored
@@ -6,7 +6,6 @@
|
||||
**/.DS_Store
|
||||
|
||||
#deploy data
|
||||
|
||||
data/*
|
||||
!data/.gitkeep
|
||||
|
||||
@@ -19,4 +18,14 @@ data/*
|
||||
|
||||
/tmp/
|
||||
|
||||
# 打包出来的可执行文件
|
||||
/app/api
|
||||
/app/main/api/main
|
||||
/app/main/api/_*
|
||||
|
||||
|
||||
# 文档目录
|
||||
documents/*
|
||||
!documents/.gitkeep
|
||||
|
||||
deploy/script/js
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
# API调用失败退款时的代理处理确认
|
||||
|
||||
## 执行流程分析
|
||||
|
||||
### 关键执行顺序
|
||||
|
||||
```
|
||||
1. 支付成功 → 创建代理订单(ProcessStatus = 0,未处理)
|
||||
↓
|
||||
2. 支付回调 → 发送查询任务
|
||||
↓
|
||||
3. 查询任务执行:
|
||||
├─ 创建查询记录(query表,状态为 "pending") ✅ 第77-87行
|
||||
├─ 生成授权书 ✅ 第108-142行
|
||||
├─ 调用API(第164行)⚠️ 可能失败
|
||||
│ ├─ 如果成功 → 继续执行
|
||||
│ └─ 如果失败 → return handleError(第166行)⚠️ 直接返回
|
||||
│
|
||||
├─ [API成功才会执行到这里]
|
||||
├─ 保存响应数据 ✅ 第177-182行
|
||||
├─ 更新查询状态为 "success" ✅ 第184-189行
|
||||
└─ 发送代理处理任务 ✅ 第192行(关键!只有到这里才会发送)
|
||||
```
|
||||
|
||||
### 关键代码位置
|
||||
|
||||
**第164-167行**:
|
||||
```go
|
||||
combinedResponse, err := l.svcCtx.ApiRequestService.ProcessRequests(decryptData, product.Id)
|
||||
if err != nil {
|
||||
return l.handleError(ctx, err, order, query) // ← 直接返回,不会继续执行
|
||||
}
|
||||
```
|
||||
|
||||
**第192行(发送代理处理任务)**:
|
||||
```go
|
||||
// 报告生成成功后,发送代理处理异步任务(不阻塞报告流程)
|
||||
if asyncErr := l.svcCtx.AsynqService.SendAgentProcessTask(order.Id); asyncErr != nil {
|
||||
logx.Errorf("发送代理处理任务失败,订单ID: %d, 错误: %v", order.Id, asyncErr)
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 确认结果
|
||||
|
||||
### ✅ API调用失败时的情况(第166-167行)
|
||||
|
||||
**执行流程**:
|
||||
1. 支付时创建代理订单(`ProcessStatus = 0`)
|
||||
2. API调用失败(第164行)
|
||||
3. **直接返回** `handleError`(第166行)
|
||||
4. 进入退款流程
|
||||
5. **第192行不会执行**(因为已经return了)
|
||||
|
||||
**代理状态**:
|
||||
- ✅ 代理订单 `ProcessStatus = 0`(未处理)
|
||||
- ✅ 代理**没有收到**佣金
|
||||
- ✅ 代理**没有收到**返佣
|
||||
- ✅ 代理处理任务**没有发送**
|
||||
|
||||
---
|
||||
|
||||
## 业务逻辑分析
|
||||
|
||||
### ✅ 符合业务逻辑
|
||||
|
||||
**理由**:
|
||||
1. **服务未完成交付**
|
||||
- API调用失败,意味着无法生成查询报告
|
||||
- 用户支付了订单,但服务没有成功交付
|
||||
|
||||
2. **用户权益保护**
|
||||
- 平台退款给用户是合理的
|
||||
- 用户没有获得服务,不应该承担费用
|
||||
|
||||
3. **代理收益逻辑**
|
||||
- 代理的收益应该基于**服务成功交付**
|
||||
- 而不是仅仅因为用户支付了订单
|
||||
- 如果服务未成功交付,代理不应该获得收益
|
||||
|
||||
4. **当前实现正确**
|
||||
- 只有在查询成功后(第184行更新状态为 "success")
|
||||
- 才会发送代理处理任务(第192行)
|
||||
- API调用失败时,查询未成功,代理任务不会发送
|
||||
|
||||
---
|
||||
|
||||
## 结论
|
||||
|
||||
### ✅ 当前处理完全正确
|
||||
|
||||
**对于 API 调用失败退款的情况**:
|
||||
- ✅ 代理订单未处理(`ProcessStatus = 0`)
|
||||
- ✅ 代理没有收到佣金和返佣
|
||||
- ✅ 代理处理任务没有发送
|
||||
- ✅ **完全符合业务逻辑**
|
||||
|
||||
**业务逻辑合理性**:
|
||||
- ✅ 代理收益应该在服务成功交付后才发放
|
||||
- ✅ API调用失败意味着服务未交付,不应发放收益
|
||||
- ✅ 退款给用户是合理的,保护用户权益
|
||||
|
||||
---
|
||||
|
||||
## 不需要修改
|
||||
|
||||
当前逻辑已经正确处理了这种情况,**无需修改**。
|
||||
|
||||
**关键保护点**:
|
||||
1. 代理处理任务只在查询成功后发送(第192行)
|
||||
2. API调用失败会直接返回,不会执行到第192行
|
||||
3. 代理订单状态保持为0,代理没有收益
|
||||
|
||||
---
|
||||
|
||||
## 需要注意的其他场景
|
||||
|
||||
虽然当前场景处理正确,但需要注意以下场景:
|
||||
|
||||
### ⚠️ 场景:代理已处理但订单被退款
|
||||
|
||||
如果:
|
||||
1. API调用成功
|
||||
2. 查询状态更新为 "success"
|
||||
3. 发送代理处理任务
|
||||
4. 代理处理任务执行,发放佣金和返佣(`ProcessStatus = 1`)
|
||||
5. **之后**订单被退款(比如管理员手动退款)
|
||||
|
||||
这种情况下需要撤销代理收益(需要另外处理,不是当前场景)。
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -59,7 +59,6 @@ service main {
|
||||
// 代理实名认证审核(已废弃:实名认证改为三要素核验,无需审核)
|
||||
// @handler AdminAuditRealName
|
||||
// post /real_name/audit (AdminAuditRealNameReq) returns (AdminAuditRealNameResp)
|
||||
|
||||
// 系统配置查询
|
||||
@handler AdminGetAgentConfig
|
||||
get /config returns (AdminGetAgentConfigResp)
|
||||
@@ -83,6 +82,14 @@ service main {
|
||||
// 邀请码列表查询
|
||||
@handler AdminGetInviteCodeList
|
||||
get /invite_code/list (AdminGetInviteCodeListReq) returns (AdminGetInviteCodeListResp)
|
||||
|
||||
// 代理手机号修改
|
||||
@handler AdminUpdateAgentMobile
|
||||
post /mobile/update (AdminUpdateAgentMobileReq) returns (AdminUpdateAgentMobileResp)
|
||||
|
||||
// 代理等级降级(管理端)
|
||||
@handler AdminDowngradeAgent
|
||||
post /level/downgrade (AdminDowngradeAgentReq) returns (AdminDowngradeAgentResp)
|
||||
}
|
||||
|
||||
type (
|
||||
@@ -93,22 +100,25 @@ type (
|
||||
Mobile *string `form:"mobile,optional"` // 手机号(可选)
|
||||
Region *string `form:"region,optional"` // 区域(可选)
|
||||
Level *int64 `form:"level,optional"` // 等级(可选)
|
||||
TeamLeaderId *int64 `form:"team_leader_id,optional"` // 团队首领ID(可选)
|
||||
TeamLeaderId *string `form:"team_leader_id,optional"` // 团队首领ID(可选)
|
||||
}
|
||||
AgentListItem {
|
||||
Id int64 `json:"id"` // 主键
|
||||
UserId int64 `json:"user_id"` // 用户ID
|
||||
Id string `json:"id"` // 主键
|
||||
UserId string `json:"user_id"` // 用户ID
|
||||
Level int64 `json:"level"` // 等级:1=普通,2=黄金,3=钻石
|
||||
LevelName string `json:"level_name"` // 等级名称
|
||||
Region string `json:"region"` // 区域
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
WechatId string `json:"wechat_id"` // 微信号
|
||||
TeamLeaderId int64 `json:"team_leader_id"` // 团队首领ID
|
||||
TeamLeaderId string `json:"team_leader_id"` // 团队首领ID
|
||||
AgentCode int64 `json:"agent_code"`
|
||||
Balance float64 `json:"balance"` // 钱包余额
|
||||
TotalEarnings float64 `json:"total_earnings"` // 累计收益
|
||||
FrozenBalance float64 `json:"frozen_balance"` // 冻结余额
|
||||
WithdrawnAmount float64 `json:"withdrawn_amount"` // 提现总额
|
||||
IsRealName bool `json:"is_real_name"` // 是否已实名
|
||||
RealName string `json:"real_name"` // 姓名(实名认证的姓名)
|
||||
IdCardPlain string `json:"id_card_plain"` // 身份证号(解密后的明文)
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
}
|
||||
AdminGetAgentListResp {
|
||||
@@ -128,14 +138,14 @@ type (
|
||||
AdminGetAgentLinkListReq {
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"pageSize"` // 每页数量
|
||||
AgentId *int64 `form:"agent_id,optional"` // 代理ID(可选)
|
||||
ProductId *int64 `form:"product_id,optional"` // 产品ID(可选)
|
||||
AgentId *string `form:"agent_id,optional"` // 代理ID(可选)
|
||||
ProductId *string `form:"product_id,optional"` // 产品ID(可选)
|
||||
LinkIdentifier *string `form:"link_identifier,optional"` // 推广码(可选)
|
||||
}
|
||||
AgentLinkListItem {
|
||||
Id int64 `json:"id"` // 主键
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
ProductId int64 `json:"product_id"` // 产品ID
|
||||
Id string `json:"id"` // 主键
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
ProductId string `json:"product_id"` // 产品ID
|
||||
ProductName string `json:"product_name"` // 产品名称
|
||||
SetPrice float64 `json:"set_price"` // 设定价格
|
||||
ActualBasePrice float64 `json:"actual_base_price"` // 实际底价
|
||||
@@ -148,24 +158,26 @@ type (
|
||||
}
|
||||
// 代理订单分页查询
|
||||
AdminGetAgentOrderListReq {
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"pageSize"` // 每页数量
|
||||
AgentId *int64 `form:"agent_id,optional"` // 代理ID(可选)
|
||||
OrderId *int64 `form:"order_id,optional"` // 订单ID(可选)
|
||||
ProcessStatus *int64 `form:"process_status,optional"` // 处理状态(可选)
|
||||
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"` // 处理状态(可选)
|
||||
OrderStatus *string `form:"order_status,optional"` // 订单状态(可选):pending-待支付,paid-已支付,refunded-已退款,closed-已关闭,failed-支付失败
|
||||
}
|
||||
AgentOrderListItem {
|
||||
Id int64 `json:"id"` // 主键
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
OrderId int64 `json:"order_id"` // 订单ID
|
||||
ProductId int64 `json:"product_id"` // 产品ID
|
||||
Id string `json:"id"` // 主键
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
OrderId string `json:"order_id"` // 订单ID
|
||||
ProductId string `json:"product_id"` // 产品ID
|
||||
ProductName string `json:"product_name"` // 产品名称
|
||||
OrderAmount float64 `json:"order_amount"` // 订单金额
|
||||
SetPrice float64 `json:"set_price"` // 设定价格
|
||||
ActualBasePrice float64 `json:"actual_base_price"` // 实际底价
|
||||
PriceCost float64 `json:"price_cost"` // 提价成本
|
||||
AgentProfit float64 `json:"agent_profit"` // 代理收益
|
||||
ProcessStatus int64 `json:"process_status"` // 处理状态
|
||||
ProcessStatus int64 `json:"process_status"` // 处理状态(保留用于筛选,前端不显示)
|
||||
OrderStatus string `json:"order_status"` // 订单状态:pending-待支付,paid-已支付,refunded-已退款,closed-已关闭,failed-支付失败
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
}
|
||||
AdminGetAgentOrderListResp {
|
||||
@@ -174,16 +186,16 @@ type (
|
||||
}
|
||||
// 代理佣金分页查询
|
||||
AdminGetAgentCommissionListReq {
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"pageSize"` // 每页数量
|
||||
AgentId *int64 `form:"agent_id,optional"` // 代理ID(可选)
|
||||
OrderId *int64 `form:"order_id,optional"` // 订单ID(可选)
|
||||
Status *int64 `form:"status,optional"` // 状态(可选)
|
||||
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"` // 状态(可选)
|
||||
}
|
||||
AgentCommissionListItem {
|
||||
Id int64 `json:"id"` // 主键
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
OrderId int64 `json:"order_id"` // 订单ID
|
||||
Id string `json:"id"` // 主键
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
OrderId string `json:"order_id"` // 订单ID
|
||||
ProductName string `json:"product_name"` // 产品名称
|
||||
Amount float64 `json:"amount"` // 金额
|
||||
Status int64 `json:"status"` // 状态
|
||||
@@ -195,19 +207,21 @@ type (
|
||||
}
|
||||
// 代理返佣分页查询
|
||||
AdminGetAgentRebateListReq {
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"pageSize"` // 每页数量
|
||||
AgentId *int64 `form:"agent_id,optional"` // 代理ID(可选)
|
||||
SourceAgentId *int64 `form:"source_agent_id,optional"` // 来源代理ID(可选)
|
||||
RebateType *int64 `form:"rebate_type,optional"` // 返佣类型(可选)
|
||||
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"` // 返佣类型(可选)
|
||||
Status *int64 `form:"status,optional"` // 状态(可选):1=已发放,2=已冻结,3=已取消(已退款)
|
||||
}
|
||||
AgentRebateListItem {
|
||||
Id int64 `json:"id"` // 主键
|
||||
AgentId int64 `json:"agent_id"` // 获得返佣的代理ID
|
||||
SourceAgentId int64 `json:"source_agent_id"` // 来源代理ID
|
||||
OrderId int64 `json:"order_id"` // 订单ID
|
||||
Id string `json:"id"` // 主键
|
||||
AgentId string `json:"agent_id"` // 获得返佣的代理ID
|
||||
SourceAgentId string `json:"source_agent_id"` // 来源代理ID
|
||||
OrderId string `json:"order_id"` // 订单ID
|
||||
RebateType int64 `json:"rebate_type"` // 返佣类型
|
||||
Amount float64 `json:"amount"` // 金额
|
||||
Status int64 `json:"status"` // 状态:1=已发放,2=已冻结,3=已取消(已退款)
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
}
|
||||
AdminGetAgentRebateListResp {
|
||||
@@ -216,15 +230,15 @@ type (
|
||||
}
|
||||
// 代理升级记录分页查询
|
||||
AdminGetAgentUpgradeListReq {
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"pageSize"` // 每页数量
|
||||
AgentId *int64 `form:"agent_id,optional"` // 代理ID(可选)
|
||||
UpgradeType *int64 `form:"upgrade_type,optional"` // 升级类型(可选)
|
||||
Status *int64 `form:"status,optional"` // 状态(可选)
|
||||
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"` // 状态(可选)
|
||||
}
|
||||
AgentUpgradeListItem {
|
||||
Id int64 `json:"id"` // 主键
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
Id string `json:"id"` // 主键
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
FromLevel int64 `json:"from_level"` // 原等级
|
||||
ToLevel int64 `json:"to_level"` // 目标等级
|
||||
UpgradeType int64 `json:"upgrade_type"` // 升级类型
|
||||
@@ -241,22 +255,25 @@ type (
|
||||
AdminGetAgentWithdrawalListReq {
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"pageSize"` // 每页数量
|
||||
AgentId *int64 `form:"agent_id,optional"` // 代理ID(可选)
|
||||
AgentId *string `form:"agent_id,optional"` // 代理ID(可选)
|
||||
Status *int64 `form:"status,optional"` // 状态(可选)
|
||||
WithdrawNo *string `form:"withdraw_no,optional"` // 提现单号(可选)
|
||||
}
|
||||
AgentWithdrawalListItem {
|
||||
Id int64 `json:"id"` // 主键
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
WithdrawNo string `json:"withdraw_no"` // 提现单号
|
||||
Amount float64 `json:"amount"` // 金额
|
||||
TaxAmount float64 `json:"tax_amount"` // 税费金额
|
||||
ActualAmount float64 `json:"actual_amount"` // 实际到账金额
|
||||
Status int64 `json:"status"` // 状态
|
||||
PayeeAccount string `json:"payee_account"` // 收款账户
|
||||
PayeeName string `json:"payee_name"` // 收款人姓名
|
||||
Remark string `json:"remark"` // 备注
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
Id string `json:"id"` // 主键
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
WithdrawNo string `json:"withdraw_no"` // 提现单号
|
||||
Amount float64 `json:"amount"` // 金额
|
||||
TaxAmount float64 `json:"tax_amount"` // 税费金额
|
||||
ActualAmount float64 `json:"actual_amount"` // 实际到账金额
|
||||
Status int64 `json:"status"` // 状态
|
||||
WithdrawalType int64 `json:"withdrawal_type"` // 提现方式:1=支付宝,2=银行卡
|
||||
PayeeAccount string `json:"payee_account"` // 收款账户(支付宝账号或银行卡号)
|
||||
PayeeName string `json:"payee_name"` // 收款人姓名
|
||||
BankCardNo string `json:"bank_card_no"` // 银行卡号(银行卡提现时使用)
|
||||
BankName string `json:"bank_name"` // 开户行名称(银行卡提现时使用)
|
||||
Remark string `json:"remark"` // 备注
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
}
|
||||
AdminGetAgentWithdrawalListResp {
|
||||
Total int64 `json:"total"` // 总数
|
||||
@@ -264,7 +281,7 @@ type (
|
||||
}
|
||||
// 代理提现审核
|
||||
AdminAuditWithdrawalReq {
|
||||
WithdrawalId int64 `json:"withdrawal_id"` // 提现记录ID
|
||||
WithdrawalId string `json:"withdrawal_id"` // 提现记录ID
|
||||
Status int64 `json:"status"` // 审核状态:2=通过,3=拒绝
|
||||
Remark string `json:"remark"` // 备注
|
||||
}
|
||||
@@ -273,20 +290,20 @@ type (
|
||||
}
|
||||
// 代理实名认证分页查询
|
||||
AdminGetAgentRealNameListReq {
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"pageSize"` // 每页数量
|
||||
AgentId *int64 `form:"agent_id,optional"` // 代理ID(可选)
|
||||
Status *int64 `form:"status,optional"` // 状态(可选):1=未验证,2=已通过
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"pageSize"` // 每页数量
|
||||
AgentId *string `form:"agent_id,optional"` // 代理ID(可选)
|
||||
Status *int64 `form:"status,optional"` // 状态(可选):1=未验证,2=已通过
|
||||
}
|
||||
AgentRealNameListItem {
|
||||
Id int64 `json:"id"` // 主键
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
Name string `json:"name"` // 姓名
|
||||
IdCard string `json:"id_card"` // 身份证号
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
Status int64 `json:"status"` // 状态:1=未验证,2=已通过(verify_time不为空表示已通过)
|
||||
VerifyTime string `json:"verify_time"` // 验证时间(三要素核验通过时间)
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
Id string `json:"id"` // 主键
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
Name string `json:"name"` // 姓名
|
||||
IdCard string `json:"id_card"` // 身份证号
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
Status int64 `json:"status"` // 状态:1=未验证,2=已通过(verify_time不为空表示已通过)
|
||||
VerifyTime string `json:"verify_time"` // 验证时间(三要素核验通过时间)
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
}
|
||||
AdminGetAgentRealNameListResp {
|
||||
Total int64 `json:"total"` // 总数
|
||||
@@ -303,14 +320,16 @@ type (
|
||||
}
|
||||
// 系统配置查询(价格配置已移除,改为产品配置表管理)
|
||||
AdminGetAgentConfigResp {
|
||||
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"` // 免税额度
|
||||
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"`
|
||||
}
|
||||
LevelBonusConfig {
|
||||
Diamond int64 `json:"diamond"` // 钻石加成:0
|
||||
@@ -320,7 +339,6 @@ type (
|
||||
UpgradeFeeConfig {
|
||||
NormalToGold float64 `json:"normal_to_gold"` // 普通→黄金:199
|
||||
NormalToDiamond float64 `json:"normal_to_diamond"` // 普通→钻石:980
|
||||
GoldToDiamond float64 `json:"gold_to_diamond"` // 黄金→钻石:980
|
||||
}
|
||||
UpgradeRebateConfig {
|
||||
NormalToGoldRebate float64 `json:"normal_to_gold_rebate"` // 普通→黄金返佣:139
|
||||
@@ -332,34 +350,36 @@ type (
|
||||
Normal float64 `json:"normal"` // 直接上级是普通的返佣金额(2元)
|
||||
}
|
||||
CommissionFreezeConfig {
|
||||
Ratio float64 `json:"ratio"` // 佣金冻结比例(例如:0.1表示10%)
|
||||
Threshold float64 `json:"threshold"` // 佣金冻结阈值(订单单价达到此金额才触发冻结,单位:元)
|
||||
Days int64 `json:"days"` // 佣金冻结解冻天数(单位:天,例如:30表示30天后解冻)
|
||||
Ratio float64 `json:"ratio"` // 佣金冻结比例(例如:0.1表示10%)
|
||||
Threshold float64 `json:"threshold"` // 佣金冻结阈值(订单单价达到此金额才触发冻结,单位:元)
|
||||
Days int64 `json:"days"` // 佣金冻结解冻天数(单位:天,例如:30表示30天后解冻)
|
||||
}
|
||||
// 系统配置更新(价格配置已移除,改为产品配置表管理)
|
||||
AdminUpdateAgentConfigReq {
|
||||
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"` // 免税额度
|
||||
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"`
|
||||
}
|
||||
AdminUpdateAgentConfigResp {
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
// 产品配置分页查询
|
||||
AdminGetAgentProductConfigListReq {
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"pageSize"` // 每页数量
|
||||
ProductId *int64 `form:"product_id,optional"` // 产品ID(可选)
|
||||
ProductName *string `form:"product_name,optional"` // 产品名称(可选,用于搜索)
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"pageSize"` // 每页数量
|
||||
ProductId *string `form:"product_id,optional"` // 产品ID(可选)
|
||||
ProductName *string `form:"product_name,optional"` // 产品名称(可选,用于搜索)
|
||||
}
|
||||
AgentProductConfigItem {
|
||||
Id int64 `json:"id"` // 主键
|
||||
ProductId int64 `json:"product_id"` // 产品ID
|
||||
Id string `json:"id"` // 主键
|
||||
ProductId string `json:"product_id"` // 产品ID
|
||||
ProductName string `json:"product_name"` // 产品名称
|
||||
BasePrice float64 `json:"base_price"` // 基础底价
|
||||
PriceRangeMin float64 `json:"price_range_min"` // 最低定价
|
||||
@@ -374,11 +394,11 @@ type (
|
||||
}
|
||||
// 产品配置更新
|
||||
AdminUpdateAgentProductConfigReq {
|
||||
Id int64 `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"` // 提价手续费比例(可选)
|
||||
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"` // 提价手续费比例(可选)
|
||||
}
|
||||
AdminUpdateAgentProductConfigResp {
|
||||
Success bool `json:"success"`
|
||||
@@ -397,19 +417,19 @@ type (
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"pageSize"` // 每页数量
|
||||
Code *string `form:"code,optional"` // 邀请码(可选)
|
||||
AgentId *int64 `form:"agent_id,optional"` // 发放代理ID(可选,NULL表示平台发放)
|
||||
AgentId *string `form:"agent_id,optional"` // 发放代理ID(可选,NULL表示平台发放)
|
||||
TargetLevel *int64 `form:"target_level,optional"` // 目标等级(可选)
|
||||
Status *int64 `form:"status,optional"` // 状态(可选)
|
||||
}
|
||||
InviteCodeListItem {
|
||||
Id int64 `json:"id"` // 主键
|
||||
Id string `json:"id"` // 主键
|
||||
Code string `json:"code"` // 邀请码
|
||||
AgentId int64 `json:"agent_id"` // 发放代理ID(0表示平台发放)
|
||||
AgentId string `json:"agent_id"` // 发放代理ID(0表示平台发放)
|
||||
AgentMobile string `json:"agent_mobile"` // 发放代理手机号
|
||||
TargetLevel int64 `json:"target_level"` // 目标等级
|
||||
Status int64 `json:"status"` // 状态:0=未使用,1=已使用,2=已失效
|
||||
UsedUserId int64 `json:"used_user_id"` // 使用用户ID
|
||||
UsedAgentId int64 `json:"used_agent_id"` // 使用代理ID
|
||||
UsedUserId string `json:"used_user_id"` // 使用用户ID
|
||||
UsedAgentId string `json:"used_agent_id"` // 使用代理ID
|
||||
UsedTime string `json:"used_time"` // 使用时间
|
||||
ExpireTime string `json:"expire_time"` // 过期时间
|
||||
Remark string `json:"remark"` // 备注
|
||||
@@ -419,5 +439,22 @@ type (
|
||||
Total int64 `json:"total"` // 总数
|
||||
Items []InviteCodeListItem `json:"items"` // 列表数据
|
||||
}
|
||||
// 代理手机号修改
|
||||
AdminUpdateAgentMobileReq {
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
Mobile string `json:"mobile"` // 新手机号
|
||||
}
|
||||
AdminUpdateAgentMobileResp {
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
// 代理等级降级
|
||||
AdminDowngradeAgentReq {
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
ToLevel int64 `json:"to_level"` // 目标等级:1=普通,2=黄金,3=钻石(须低于当前等级)
|
||||
Remark string `json:"remark,optional"` // 备注(可选)
|
||||
}
|
||||
AdminDowngradeAgentResp {
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ type (
|
||||
|
||||
// API信息
|
||||
AdminApiInfo {
|
||||
Id int64 `json:"id"`
|
||||
Id string `json:"id"`
|
||||
ApiName string `json:"api_name"`
|
||||
ApiCode string `json:"api_code"`
|
||||
Method string `json:"method"`
|
||||
@@ -38,7 +38,7 @@ type (
|
||||
|
||||
// API详情请求
|
||||
AdminGetApiDetailReq {
|
||||
Id int64 `path:"id"`
|
||||
Id string `path:"id"`
|
||||
}
|
||||
|
||||
// API详情响应
|
||||
@@ -58,12 +58,12 @@ type (
|
||||
|
||||
// 创建API响应
|
||||
AdminCreateApiResp {
|
||||
Id int64 `json:"id"`
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
// 更新API请求
|
||||
AdminUpdateApiReq {
|
||||
Id int64 `path:"id"`
|
||||
Id string `path:"id"`
|
||||
ApiName string `json:"api_name"`
|
||||
ApiCode string `json:"api_code"`
|
||||
Method string `json:"method"`
|
||||
@@ -79,7 +79,7 @@ type (
|
||||
|
||||
// 删除API请求
|
||||
AdminDeleteApiReq {
|
||||
Id int64 `path:"id"`
|
||||
Id string `path:"id"`
|
||||
}
|
||||
|
||||
// 删除API响应
|
||||
@@ -89,7 +89,7 @@ type (
|
||||
|
||||
// 批量更新API状态请求
|
||||
AdminBatchUpdateApiStatusReq {
|
||||
Ids []int64 `json:"ids"`
|
||||
Ids []string `json:"ids"`
|
||||
Status int64 `json:"status"`
|
||||
}
|
||||
|
||||
|
||||
178
app/main/api/desc/admin/admin_complaint.api
Normal file
178
app/main/api/desc/admin/admin_complaint.api
Normal file
@@ -0,0 +1,178 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "投诉管理服务"
|
||||
desc: "投诉管理相关接口"
|
||||
version: "v1"
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: api/v1/admin/complaint
|
||||
group: admin_complaint
|
||||
middleware: AdminAuthInterceptor
|
||||
)
|
||||
service main {
|
||||
@doc "获取投诉列表"
|
||||
@handler AdminGetComplaintList
|
||||
get /list (AdminGetComplaintListReq) returns (AdminGetComplaintListResp)
|
||||
|
||||
@doc "获取投诉详情"
|
||||
@handler AdminGetComplaintDetail
|
||||
get /detail/:id (AdminGetComplaintDetailReq) returns (AdminGetComplaintDetailResp)
|
||||
|
||||
@doc "更新投诉状态"
|
||||
@handler AdminUpdateComplaintStatus
|
||||
put /update-status/:id (AdminUpdateComplaintStatusReq) returns (AdminUpdateComplaintStatusResp)
|
||||
|
||||
@doc "更新投诉备注"
|
||||
@handler AdminUpdateComplaintRemark
|
||||
put /update-remark/:id (AdminUpdateComplaintRemarkReq) returns (AdminUpdateComplaintRemarkResp)
|
||||
}
|
||||
|
||||
type (
|
||||
// 列表请求
|
||||
AdminGetComplaintListReq {
|
||||
Page int64 `form:"page,default=1"` // 页码
|
||||
PageSize int64 `form:"pageSize,default=20"` // 每页数量
|
||||
Type string `form:"type,optional"` // 投诉类型:alipay-支付宝投诉,manual-主动投诉
|
||||
Status string `form:"status,optional"` // 投诉状态:pending-待处理,processing-处理中,resolved-已解决,closed-已关闭
|
||||
Name string `form:"name,optional"` // 投诉人姓名
|
||||
Contact string `form:"contact,optional"` // 联系方式
|
||||
OrderId string `form:"order_id,optional"` // 关联订单ID
|
||||
CreateTimeStart string `form:"create_time_start,optional"` // 创建时间开始
|
||||
CreateTimeEnd string `form:"create_time_end,optional"` // 创建时间结束
|
||||
HandleTimeStart string `form:"handle_time_start,optional"` // 处理时间开始
|
||||
HandleTimeEnd string `form:"handle_time_end,optional"` // 处理时间结束
|
||||
}
|
||||
|
||||
// 列表响应
|
||||
AdminGetComplaintListResp {
|
||||
Total int64 `json:"total"` // 总数
|
||||
Items []ComplaintListItem `json:"items"` // 列表
|
||||
}
|
||||
|
||||
// 列表项
|
||||
ComplaintListItem {
|
||||
Id string `json:"id"` // 投诉ID
|
||||
Type string `json:"type"` // 投诉类型:alipay-支付宝投诉,manual-主动投诉
|
||||
OrderId string `json:"order_id"` // 关联订单ID
|
||||
Name string `json:"name"` // 投诉人姓名
|
||||
Contact string `json:"contact"` // 联系方式
|
||||
Content string `json:"content"` // 投诉内容
|
||||
Status string `json:"status"` // 投诉状态
|
||||
StatusDescription string `json:"status_description"` // 状态描述
|
||||
Remark string `json:"remark"` // 处理备注
|
||||
HandlerId string `json:"handler_id"` // 处理人ID
|
||||
HandleTime string `json:"handle_time"` // 处理时间
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
UpdateTime string `json:"update_time"` // 更新时间
|
||||
// 支付宝投诉特有字段
|
||||
TaskId string `json:"task_id"` // 支付宝投诉单号
|
||||
TradeNo string `json:"trade_no"` // 支付宝交易单号
|
||||
ComplainAmount string `json:"complain_amount"` // 投诉金额
|
||||
GmtComplain string `json:"gmt_complain"` // 投诉时间
|
||||
// 主动投诉特有字段
|
||||
Subject string `json:"subject"` // 投诉主题
|
||||
Priority string `json:"priority"` // 优先级
|
||||
Source string `json:"source"` // 投诉来源
|
||||
}
|
||||
|
||||
// 详情请求
|
||||
AdminGetComplaintDetailReq {
|
||||
Id string `path:"id"` // 投诉ID
|
||||
}
|
||||
|
||||
// 详情响应
|
||||
AdminGetComplaintDetailResp {
|
||||
Id string `json:"id"` // 投诉ID
|
||||
Type string `json:"type"` // 投诉类型:alipay-支付宝投诉,manual-主动投诉
|
||||
OrderId string `json:"order_id"` // 关联订单ID
|
||||
Name string `json:"name"` // 投诉人姓名
|
||||
Contact string `json:"contact"` // 联系方式
|
||||
Content string `json:"content"` // 投诉内容
|
||||
Status string `json:"status"` // 投诉状态
|
||||
StatusDescription string `json:"status_description"` // 状态描述
|
||||
Remark string `json:"remark"` // 处理备注
|
||||
HandlerId string `json:"handler_id"` // 处理人ID
|
||||
HandleTime string `json:"handle_time"` // 处理时间
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
UpdateTime string `json:"update_time"` // 更新时间
|
||||
// 支付宝投诉详情
|
||||
AlipayComplaint *AlipayComplaintDetail `json:"alipay_complaint,optional"` // 支付宝投诉详情
|
||||
// 主动投诉详情
|
||||
ManualComplaint *ManualComplaintDetail `json:"manual_complaint,optional"` // 主动投诉详情
|
||||
}
|
||||
|
||||
// 支付宝投诉详情
|
||||
AlipayComplaintDetail {
|
||||
Id string `json:"id"` // 支付宝投诉表ID
|
||||
AlipayId int64 `json:"alipay_id"` // 支付宝投诉主表的主键id
|
||||
TaskId string `json:"task_id"` // 投诉单号id
|
||||
OppositePid string `json:"opposite_pid"` // 被投诉人pid
|
||||
OppositeName string `json:"opposite_name"` // 被投诉方名称
|
||||
ComplainAmount string `json:"complain_amount"` // 投诉单涉及交易总金额
|
||||
GmtComplain string `json:"gmt_complain"` // 投诉时间
|
||||
GmtProcess string `json:"gmt_process"` // 处理时间
|
||||
ComplainContent string `json:"complain_content"` // 用户投诉内容
|
||||
TradeNo string `json:"trade_no"` // 投诉交易单号
|
||||
Status string `json:"status"` // 投诉状态
|
||||
StatusDescription string `json:"status_description"` // 投诉单状态枚举值描述
|
||||
ProcessCode string `json:"process_code"` // 商家处理结果码
|
||||
ProcessMessage string `json:"process_message"` // 商家处理结果码对应描述
|
||||
ProcessRemark string `json:"process_remark"` // 商家处理备注
|
||||
ProcessImgUrlList []string `json:"process_img_url_list"` // 商家处理备注图片url列表
|
||||
GmtRiskFinishTime string `json:"gmt_risk_finish_time"` // 推送时间
|
||||
ComplainUrl string `json:"complain_url"` // 投诉网址
|
||||
CertifyInfo []string `json:"certify_info"` // 投诉凭证图片信息
|
||||
TradeInfoList []AlipayComplaintTradeInfo `json:"trade_info_list"` // 交易信息列表
|
||||
}
|
||||
|
||||
// 支付宝投诉交易信息
|
||||
AlipayComplaintTradeInfo {
|
||||
Id string `json:"id"` // 交易信息表ID
|
||||
AlipayTradeId string `json:"alipay_trade_id"` // 交易信息表主键id
|
||||
AlipayComplaintRecordId string `json:"alipay_complaint_record_id"` // 投诉主表id
|
||||
TradeNo string `json:"trade_no"` // 支付宝交易单号
|
||||
OutNo string `json:"out_no"` // 商家订单号
|
||||
GmtTrade string `json:"gmt_trade"` // 交易时间
|
||||
GmtRefund string `json:"gmt_refund"` // 退款时间
|
||||
Status string `json:"status"` // 交易投诉状态
|
||||
StatusDescription string `json:"status_description"` // 交易投诉状态描述
|
||||
Amount string `json:"amount"` // 交易单金额
|
||||
}
|
||||
|
||||
// 主动投诉详情
|
||||
ManualComplaintDetail {
|
||||
Id string `json:"id"` // 主动投诉表ID
|
||||
UserId string `json:"user_id"` // 关联用户ID
|
||||
Subject string `json:"subject"` // 投诉主题
|
||||
Priority string `json:"priority"` // 优先级:low-低,medium-中,high-高,urgent-紧急
|
||||
Source string `json:"source"` // 投诉来源:web-网站,phone-电话,email-邮件,other-其他
|
||||
AttachmentUrls []string `json:"attachment_urls"` // 附件URL列表
|
||||
}
|
||||
|
||||
// 更新投诉状态请求
|
||||
AdminUpdateComplaintStatusReq {
|
||||
Id string `path:"id"` // 投诉ID
|
||||
Status string `json:"status"` // 投诉状态:pending-待处理,processing-处理中,resolved-已解决,closed-已关闭
|
||||
StatusDescription string `json:"status_description,optional"` // 状态描述
|
||||
HandlerId string `json:"handler_id,optional"` // 处理人ID
|
||||
}
|
||||
|
||||
// 更新投诉状态响应
|
||||
AdminUpdateComplaintStatusResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
|
||||
// 更新投诉备注请求
|
||||
AdminUpdateComplaintRemarkReq {
|
||||
Id string `path:"id"` // 投诉ID
|
||||
Remark string `json:"remark"` // 处理备注
|
||||
}
|
||||
|
||||
// 更新投诉备注响应
|
||||
AdminUpdateComplaintRemarkResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
)
|
||||
|
||||
@@ -45,27 +45,31 @@ service main {
|
||||
type (
|
||||
// 创建功能请求
|
||||
AdminCreateFeatureReq {
|
||||
ApiId string `json:"api_id"` // API标识
|
||||
Name string `json:"name"` // 描述
|
||||
ApiId string `json:"api_id"` // API标识
|
||||
Name string `json:"name"` // 描述
|
||||
WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元)
|
||||
CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价(单位:元)
|
||||
}
|
||||
// 创建功能响应
|
||||
AdminCreateFeatureResp {
|
||||
Id int64 `json:"id"` // 功能ID
|
||||
}
|
||||
AdminCreateFeatureResp {
|
||||
Id string `json:"id"` // 功能ID
|
||||
}
|
||||
// 更新功能请求
|
||||
AdminUpdateFeatureReq {
|
||||
Id int64 `path:"id"` // 功能ID
|
||||
ApiId *string `json:"api_id,optional"` // API标识
|
||||
Name *string `json:"name,optional"` // 描述
|
||||
}
|
||||
AdminUpdateFeatureReq {
|
||||
Id string `path:"id"` // 功能ID
|
||||
ApiId *string `json:"api_id,optional"` // API标识
|
||||
Name *string `json:"name,optional"` // 描述
|
||||
WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元)
|
||||
CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价(单位:元)
|
||||
}
|
||||
// 更新功能响应
|
||||
AdminUpdateFeatureResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
// 删除功能请求
|
||||
AdminDeleteFeatureReq {
|
||||
Id int64 `path:"id"` // 功能ID
|
||||
}
|
||||
AdminDeleteFeatureReq {
|
||||
Id string `path:"id"` // 功能ID
|
||||
}
|
||||
// 删除功能响应
|
||||
AdminDeleteFeatureResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
@@ -78,12 +82,14 @@ type (
|
||||
Name *string `form:"name,optional"` // 描述
|
||||
}
|
||||
// 功能列表项
|
||||
FeatureListItem {
|
||||
Id int64 `json:"id"` // 功能ID
|
||||
ApiId string `json:"api_id"` // API标识
|
||||
Name string `json:"name"` // 描述
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
UpdateTime string `json:"update_time"` // 更新时间
|
||||
FeatureListItem {
|
||||
Id string `json:"id"` // 功能ID
|
||||
ApiId string `json:"api_id"` // API标识
|
||||
Name string `json:"name"` // 描述
|
||||
WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元)
|
||||
CostPrice float64 `json:"cost_price"` // 天远API调用成本价(单位:元)
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
UpdateTime string `json:"update_time"` // 更新时间
|
||||
}
|
||||
// 获取功能列表响应
|
||||
AdminGetFeatureListResp {
|
||||
@@ -91,38 +97,40 @@ type (
|
||||
Items []FeatureListItem `json:"items"` // 列表数据
|
||||
}
|
||||
// 获取功能详情请求
|
||||
AdminGetFeatureDetailReq {
|
||||
Id int64 `path:"id"` // 功能ID
|
||||
}
|
||||
AdminGetFeatureDetailReq {
|
||||
Id string `path:"id"` // 功能ID
|
||||
}
|
||||
// 获取功能详情响应
|
||||
AdminGetFeatureDetailResp {
|
||||
Id int64 `json:"id"` // 功能ID
|
||||
ApiId string `json:"api_id"` // API标识
|
||||
Name string `json:"name"` // 描述
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
UpdateTime string `json:"update_time"` // 更新时间
|
||||
AdminGetFeatureDetailResp {
|
||||
Id string `json:"id"` // 功能ID
|
||||
ApiId string `json:"api_id"` // API标识
|
||||
Name string `json:"name"` // 描述
|
||||
WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元)
|
||||
CostPrice float64 `json:"cost_price"` // 天远API调用成本价(单位:元)
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
UpdateTime string `json:"update_time"` // 更新时间
|
||||
}
|
||||
// 配置功能示例数据请求
|
||||
AdminConfigFeatureExampleReq {
|
||||
FeatureId int64 `json:"feature_id"` // 功能ID
|
||||
Data string `json:"data"` // 示例数据JSON
|
||||
}
|
||||
AdminConfigFeatureExampleReq {
|
||||
FeatureId string `json:"feature_id"` // 功能ID
|
||||
Data string `json:"data"` // 示例数据JSON
|
||||
}
|
||||
// 配置功能示例数据响应
|
||||
AdminConfigFeatureExampleResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
// 查看功能示例数据请求
|
||||
AdminGetFeatureExampleReq {
|
||||
FeatureId int64 `path:"feature_id"` // 功能ID
|
||||
}
|
||||
AdminGetFeatureExampleReq {
|
||||
FeatureId string `path:"feature_id"` // 功能ID
|
||||
}
|
||||
// 查看功能示例数据响应
|
||||
AdminGetFeatureExampleResp {
|
||||
Id int64 `json:"id"` // 示例数据ID
|
||||
FeatureId int64 `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"` // 更新时间
|
||||
}
|
||||
AdminGetFeatureExampleResp {
|
||||
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"` // 更新时间
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -49,23 +49,21 @@ type (
|
||||
ProductEn string `json:"product_en"` // 英文名
|
||||
Description string `json:"description"` // 描述
|
||||
Notes string `json:"notes,optional"` // 备注
|
||||
CostPrice float64 `json:"cost_price"` // 成本
|
||||
SellPrice float64 `json:"sell_price"` // 售价
|
||||
}
|
||||
|
||||
// 创建产品响应
|
||||
AdminCreateProductResp {
|
||||
Id int64 `json:"id"` // 产品ID
|
||||
}
|
||||
AdminCreateProductResp {
|
||||
Id string `json:"id"` // 产品ID
|
||||
}
|
||||
|
||||
// 更新产品请求
|
||||
AdminUpdateProductReq {
|
||||
Id int64 `path:"id"` // 产品ID
|
||||
ProductName *string `json:"product_name,optional"` // 服务名
|
||||
AdminUpdateProductReq {
|
||||
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"` // 售价
|
||||
}
|
||||
|
||||
@@ -75,9 +73,9 @@ type (
|
||||
}
|
||||
|
||||
// 删除产品请求
|
||||
AdminDeleteProductReq {
|
||||
Id int64 `path:"id"` // 产品ID
|
||||
}
|
||||
AdminDeleteProductReq {
|
||||
Id string `path:"id"` // 产品ID
|
||||
}
|
||||
|
||||
// 删除产品响应
|
||||
AdminDeleteProductResp {
|
||||
@@ -93,14 +91,14 @@ type (
|
||||
}
|
||||
|
||||
// 产品列表项
|
||||
ProductListItem {
|
||||
Id int64 `json:"id"` // 产品ID
|
||||
ProductName string `json:"product_name"` // 服务名
|
||||
ProductListItem {
|
||||
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"` // 售价
|
||||
CostPrice float64 `json:"cost_price"` // 成本价(由功能成本累加得出)
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
UpdateTime string `json:"update_time"` // 更新时间
|
||||
}
|
||||
@@ -112,41 +110,40 @@ type (
|
||||
}
|
||||
|
||||
// 获取产品详情请求
|
||||
AdminGetProductDetailReq {
|
||||
Id int64 `path:"id"` // 产品ID
|
||||
}
|
||||
AdminGetProductDetailReq {
|
||||
Id string `path:"id"` // 产品ID
|
||||
}
|
||||
|
||||
// 获取产品详情响应
|
||||
AdminGetProductDetailResp {
|
||||
Id int64 `json:"id"` // 产品ID
|
||||
ProductName string `json:"product_name"` // 服务名
|
||||
AdminGetProductDetailResp {
|
||||
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"` // 更新时间
|
||||
}
|
||||
|
||||
// 获取产品功能列表请求
|
||||
AdminGetProductFeatureListReq {
|
||||
ProductId int64 `path:"product_id"` // 产品ID
|
||||
}
|
||||
AdminGetProductFeatureListReq {
|
||||
ProductId string `path:"product_id"` // 产品ID
|
||||
}
|
||||
|
||||
// 获取产品功能列表响应Item
|
||||
AdminGetProductFeatureListResp {
|
||||
Id int64 `json:"id"` // 关联ID
|
||||
ProductId int64 `json:"product_id"` // 产品ID
|
||||
FeatureId int64 `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"` // 更新时间
|
||||
}
|
||||
AdminGetProductFeatureListResp {
|
||||
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"` // 更新时间
|
||||
}
|
||||
|
||||
// // 获取产品功能列表响应
|
||||
// AdminGetProductFeatureListResp {
|
||||
@@ -154,21 +151,21 @@ type (
|
||||
// }
|
||||
|
||||
// 产品功能关联项
|
||||
ProductFeatureItem {
|
||||
FeatureId int64 `json:"feature_id"` // 功能ID
|
||||
Sort int64 `json:"sort"` // 排序
|
||||
Enable int64 `json:"enable"` // 是否启用
|
||||
IsImportant int64 `json:"is_important"` // 是否重要
|
||||
}
|
||||
ProductFeatureItem {
|
||||
FeatureId string `json:"feature_id"` // 功能ID
|
||||
Sort int64 `json:"sort"` // 排序
|
||||
Enable int64 `json:"enable"` // 是否启用
|
||||
IsImportant int64 `json:"is_important"` // 是否重要
|
||||
}
|
||||
|
||||
// 更新产品功能关联请求(批量)
|
||||
AdminUpdateProductFeaturesReq {
|
||||
ProductId int64 `path:"product_id"` // 产品ID
|
||||
Features []ProductFeatureItem `json:"features"` // 功能列表
|
||||
}
|
||||
AdminUpdateProductFeaturesReq {
|
||||
ProductId string `path:"product_id"` // 产品ID
|
||||
Features []ProductFeatureItem `json:"features"` // 功能列表
|
||||
}
|
||||
|
||||
// 更新产品功能关联响应
|
||||
AdminUpdateProductFeaturesResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -28,25 +28,31 @@ service main {
|
||||
@handler AdminGetQueryCleanupConfigList
|
||||
get /cleanup/configs (AdminGetQueryCleanupConfigListReq) returns (AdminGetQueryCleanupConfigListResp)
|
||||
|
||||
@doc "按 QueryId+FeatureApiId 补删单条查询的某个模块数据(仅内部运维使用)"
|
||||
@handler AdminDeleteQueryFeatureData
|
||||
post /cleanup/delete/feature (AdminDeleteQueryFeatureDataReq) returns (AdminDeleteQueryFeatureDataResp)
|
||||
|
||||
@doc "更新清理配置"
|
||||
@handler AdminUpdateQueryCleanupConfig
|
||||
put /cleanup/config (AdminUpdateQueryCleanupConfigReq) returns (AdminUpdateQueryCleanupConfigResp)
|
||||
}
|
||||
|
||||
type AdminGetQueryDetailByOrderIdReq {
|
||||
OrderId int64 `path:"order_id"`
|
||||
type AdminGetQueryDetailByOrderIdReq {
|
||||
OrderId string `path:"order_id"`
|
||||
}
|
||||
|
||||
type AdminGetQueryDetailByOrderIdResp {
|
||||
Id int64 `json:"id"` // 主键ID
|
||||
OrderId int64 `json:"order_id"` // 订单ID
|
||||
UserId int64 `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 AdminGetQueryDetailByOrderIdResp {
|
||||
Id string `json:"id"` // 主键ID
|
||||
OrderId string `json:"order_id"` // 订单ID
|
||||
UserId string `json:"user_id"` // 用户ID
|
||||
ProductName string `json:"product_name"` // 产品名称
|
||||
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"` // 查询状态
|
||||
AgentUserName string `json:"agent_user_name"` // 代理用户姓名(非代理单时为空)
|
||||
AgentUserMobile string `json:"agent_user_mobile"` // 代理用户手机号(非代理单时为空)
|
||||
}
|
||||
|
||||
type AdminQueryItem {
|
||||
@@ -68,8 +74,8 @@ type AdminGetQueryCleanupLogListResp {
|
||||
Items []QueryCleanupLogItem `json:"items"` // 列表
|
||||
}
|
||||
|
||||
type QueryCleanupLogItem {
|
||||
Id int64 `json:"id"` // 主键ID
|
||||
type QueryCleanupLogItem {
|
||||
Id string `json:"id"` // 主键ID
|
||||
CleanupTime string `json:"cleanup_time"` // 清理时间
|
||||
CleanupBefore string `json:"cleanup_before"` // 清理截止时间
|
||||
Status int64 `json:"status"` // 状态:1-成功,2-失败
|
||||
@@ -80,8 +86,8 @@ type QueryCleanupLogItem {
|
||||
}
|
||||
|
||||
// 清理详情相关请求响应定义
|
||||
type AdminGetQueryCleanupDetailListReq {
|
||||
LogId int64 `path:"log_id"` // 清理日志ID
|
||||
type AdminGetQueryCleanupDetailListReq {
|
||||
LogId string `path:"log_id"` // 清理日志ID
|
||||
Page int64 `form:"page,default=1"` // 页码
|
||||
PageSize int64 `form:"page_size,default=20"` // 每页数量
|
||||
}
|
||||
@@ -91,12 +97,12 @@ type AdminGetQueryCleanupDetailListResp {
|
||||
Items []QueryCleanupDetailItem `json:"items"` // 列表
|
||||
}
|
||||
|
||||
type QueryCleanupDetailItem {
|
||||
Id int64 `json:"id"` // 主键ID
|
||||
CleanupLogId int64 `json:"cleanup_log_id"` // 清理日志ID
|
||||
QueryId int64 `json:"query_id"` // 查询ID
|
||||
OrderId int64 `json:"order_id"` // 订单ID
|
||||
UserId int64 `json:"user_id"` // 用户ID
|
||||
type QueryCleanupDetailItem {
|
||||
Id string `json:"id"` // 主键ID
|
||||
CleanupLogId string `json:"cleanup_log_id"` // 清理日志ID
|
||||
QueryId string `json:"query_id"` // 查询ID
|
||||
OrderId string `json:"order_id"` // 订单ID
|
||||
UserId string `json:"user_id"` // 用户ID
|
||||
ProductName string `json:"product_name"` // 产品名称
|
||||
QueryState string `json:"query_state"` // 查询状态
|
||||
CreateTimeOld string `json:"create_time_old"` // 原创建时间
|
||||
@@ -112,8 +118,8 @@ type AdminGetQueryCleanupConfigListResp {
|
||||
Items []QueryCleanupConfigItem `json:"items"` // 配置列表
|
||||
}
|
||||
|
||||
type QueryCleanupConfigItem {
|
||||
Id int64 `json:"id"` // 主键ID
|
||||
type QueryCleanupConfigItem {
|
||||
Id string `json:"id"` // 主键ID
|
||||
ConfigKey string `json:"config_key"` // 配置键
|
||||
ConfigValue string `json:"config_value"` // 配置值
|
||||
ConfigDesc string `json:"config_desc"` // 配置描述
|
||||
@@ -122,12 +128,23 @@ type QueryCleanupConfigItem {
|
||||
UpdateTime string `json:"update_time"` // 更新时间
|
||||
}
|
||||
|
||||
type AdminUpdateQueryCleanupConfigReq {
|
||||
Id int64 `json:"id"` // 主键ID
|
||||
type AdminUpdateQueryCleanupConfigReq {
|
||||
Id string `json:"id"` // 主键ID
|
||||
ConfigValue string `json:"config_value"` // 配置值
|
||||
Status int64 `json:"status"` // 状态:1-启用,0-禁用
|
||||
}
|
||||
|
||||
type AdminUpdateQueryCleanupConfigResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
}
|
||||
|
||||
// 运维补删接口:按 QueryId+FeatureApiId 删除单条查询中的指定模块数据
|
||||
type AdminDeleteQueryFeatureDataReq {
|
||||
QueryId string `json:"query_id"` // 查询ID(Query表ID)
|
||||
FeatureApiId string `json:"feature_api_id"` // 模块API标识(与前台 OfflineFeature 一致)
|
||||
}
|
||||
|
||||
type AdminDeleteQueryFeatureDataResp {
|
||||
Success bool `json:"success"` // 是否删除成功(或数据本就不存在)
|
||||
Message string `json:"message"` // 结果说明
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ info(
|
||||
type (
|
||||
// 获取角色API权限列表请求
|
||||
AdminGetRoleApiListReq {
|
||||
RoleId int64 `path:"role_id"`
|
||||
RoleId string `path:"role_id"`
|
||||
}
|
||||
|
||||
// 获取角色API权限列表响应
|
||||
@@ -20,9 +20,9 @@ type (
|
||||
|
||||
// 角色API权限信息
|
||||
AdminRoleApiInfo {
|
||||
Id int64 `json:"id"`
|
||||
RoleId int64 `json:"role_id"`
|
||||
ApiId int64 `json:"api_id"`
|
||||
Id string `json:"id"`
|
||||
RoleId string `json:"role_id"`
|
||||
ApiId string `json:"api_id"`
|
||||
ApiName string `json:"api_name"`
|
||||
ApiCode string `json:"api_code"`
|
||||
Method string `json:"method"`
|
||||
@@ -33,8 +33,8 @@ type (
|
||||
|
||||
// 分配角色API权限请求
|
||||
AdminAssignRoleApiReq {
|
||||
RoleId int64 `json:"role_id"`
|
||||
ApiIds []int64 `json:"api_ids"`
|
||||
RoleId string `json:"role_id"`
|
||||
ApiIds []string `json:"api_ids"`
|
||||
}
|
||||
|
||||
// 分配角色API权限响应
|
||||
@@ -44,8 +44,8 @@ type (
|
||||
|
||||
// 移除角色API权限请求
|
||||
AdminRemoveRoleApiReq {
|
||||
RoleId int64 `json:"role_id"`
|
||||
ApiIds []int64 `json:"api_ids"`
|
||||
RoleId string `json:"role_id"`
|
||||
ApiIds []string `json:"api_ids"`
|
||||
}
|
||||
|
||||
// 移除角色API权限响应
|
||||
@@ -55,8 +55,8 @@ type (
|
||||
|
||||
// 更新角色API权限请求
|
||||
AdminUpdateRoleApiReq {
|
||||
RoleId int64 `json:"role_id"`
|
||||
ApiIds []int64 `json:"api_ids"`
|
||||
RoleId string `json:"role_id"`
|
||||
ApiIds []string `json:"api_ids"`
|
||||
}
|
||||
|
||||
// 更新角色API权限响应
|
||||
|
||||
@@ -58,52 +58,52 @@ type (
|
||||
}
|
||||
|
||||
// 列表项
|
||||
AdminUserListItem {
|
||||
Id int64 `json:"id"` // 用户ID
|
||||
Username string `json:"username"` // 用户名
|
||||
RealName string `json:"real_name"` // 真实姓名
|
||||
Status int64 `json:"status"` // 状态:0-禁用,1-启用
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
RoleIds []int64 `json:"role_ids"` // 关联的角色ID列表
|
||||
}
|
||||
AdminUserListItem {
|
||||
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"` // 创建时间
|
||||
RoleIds []string `json:"role_ids"` // 关联的角色ID列表
|
||||
}
|
||||
|
||||
// 详情请求
|
||||
AdminGetUserDetailReq {
|
||||
Id int64 `path:"id"` // 用户ID
|
||||
}
|
||||
AdminGetUserDetailReq {
|
||||
Id string `path:"id"` // 用户ID
|
||||
}
|
||||
|
||||
// 详情响应
|
||||
AdminGetUserDetailResp {
|
||||
Id int64 `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 []int64 `json:"role_ids"` // 关联的角色ID列表
|
||||
}
|
||||
AdminGetUserDetailResp {
|
||||
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列表
|
||||
}
|
||||
|
||||
// 创建请求
|
||||
AdminCreateUserReq {
|
||||
Username string `json:"username"` // 用户名
|
||||
RealName string `json:"real_name"` // 真实姓名
|
||||
Status int64 `json:"status,default=1"` // 状态:0-禁用,1-启用
|
||||
RoleIds []int64 `json:"role_ids"` // 关联的角色ID列表
|
||||
}
|
||||
AdminCreateUserReq {
|
||||
Username string `json:"username"` // 用户名
|
||||
RealName string `json:"real_name"` // 真实姓名
|
||||
Status int64 `json:"status,default=1"` // 状态:0-禁用,1-启用
|
||||
RoleIds []string `json:"role_ids"` // 关联的角色ID列表
|
||||
}
|
||||
|
||||
// 创建响应
|
||||
AdminCreateUserResp {
|
||||
Id int64 `json:"id"` // 用户ID
|
||||
}
|
||||
AdminCreateUserResp {
|
||||
Id string `json:"id"` // 用户ID
|
||||
}
|
||||
|
||||
// 更新请求
|
||||
AdminUpdateUserReq {
|
||||
Id int64 `path:"id"` // 用户ID
|
||||
Username *string `json:"username,optional"` // 用户名
|
||||
RealName *string `json:"real_name,optional"` // 真实姓名
|
||||
Status *int64 `json:"status,optional"` // 状态:0-禁用,1-启用
|
||||
RoleIds []int64 `json:"role_ids,optional"` // 关联的角色ID列表
|
||||
}
|
||||
AdminUpdateUserReq {
|
||||
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列表
|
||||
}
|
||||
|
||||
// 更新响应
|
||||
AdminUpdateUserResp {
|
||||
@@ -111,9 +111,9 @@ type (
|
||||
}
|
||||
|
||||
// 删除请求
|
||||
AdminDeleteUserReq {
|
||||
Id int64 `path:"id"` // 用户ID
|
||||
}
|
||||
AdminDeleteUserReq {
|
||||
Id string `path:"id"` // 用户ID
|
||||
}
|
||||
|
||||
// 删除响应
|
||||
AdminDeleteUserResp {
|
||||
@@ -132,13 +132,13 @@ type (
|
||||
}
|
||||
|
||||
// 重置密码请求
|
||||
AdminResetPasswordReq {
|
||||
Id int64 `path:"id"` // 用户ID
|
||||
Password string `json:"password"` // 新密码
|
||||
}
|
||||
AdminResetPasswordReq {
|
||||
Id string `path:"id"` // 用户ID
|
||||
Password string `json:"password"` // 新密码
|
||||
}
|
||||
|
||||
// 重置密码响应
|
||||
AdminResetPasswordResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
94
app/main/api/desc/admin/dashboard.api
Normal file
94
app/main/api/desc/admin/dashboard.api
Normal file
@@ -0,0 +1,94 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "后台统计面板服务"
|
||||
desc: "后台统计面板相关接口"
|
||||
author: "team"
|
||||
version: "v1"
|
||||
)
|
||||
|
||||
// ============================================
|
||||
// 统计面板接口
|
||||
// ============================================
|
||||
@server (
|
||||
prefix: /api/v1/admin/dashboard
|
||||
group: admin_dashboard
|
||||
middleware: AdminAuthInterceptor
|
||||
)
|
||||
service main {
|
||||
// 获取统计面板数据
|
||||
@handler AdminGetDashboardStatistics
|
||||
get /statistics returns (AdminGetDashboardStatisticsResp)
|
||||
}
|
||||
|
||||
type (
|
||||
// 统计面板响应
|
||||
AdminGetDashboardStatisticsResp {
|
||||
// 订单统计
|
||||
OrderStats AdminOrderStatistics `json:"order_stats"`
|
||||
// 营收统计
|
||||
RevenueStats AdminRevenueStatistics `json:"revenue_stats"`
|
||||
// 代理统计
|
||||
AgentStats AdminAgentStatistics `json:"agent_stats"`
|
||||
// 利润统计
|
||||
ProfitStats AdminProfitStatistics `json:"profit_stats"`
|
||||
// 订单趋势(最近7天)
|
||||
OrderTrend []AdminTrendData `json:"order_trend"`
|
||||
// 营收趋势(最近7天)
|
||||
RevenueTrend []AdminTrendData `json:"revenue_trend"`
|
||||
}
|
||||
// 订单统计
|
||||
AdminOrderStatistics {
|
||||
TodayCount int64 `json:"today_count"` // 今日订单数
|
||||
MonthCount int64 `json:"month_count"` // 当月订单数
|
||||
TotalCount int64 `json:"total_count"` // 总订单数
|
||||
YesterdayCount int64 `json:"yesterday_count"` // 昨日订单数
|
||||
ChangeRate float64 `json:"change_rate"` // 变化率(百分比)
|
||||
}
|
||||
// 营收统计
|
||||
AdminRevenueStatistics {
|
||||
TodayAmount float64 `json:"today_amount"` // 今日营收
|
||||
MonthAmount float64 `json:"month_amount"` // 当月营收
|
||||
TotalAmount float64 `json:"total_amount"` // 总营收
|
||||
YesterdayAmount float64 `json:"yesterday_amount"` // 昨日营收
|
||||
ChangeRate float64 `json:"change_rate"` // 变化率(百分比)
|
||||
}
|
||||
// 代理统计
|
||||
AdminAgentStatistics {
|
||||
TotalCount int64 `json:"total_count"` // 代理总数
|
||||
TodayNew int64 `json:"today_new"` // 今日新增
|
||||
MonthNew int64 `json:"month_new"` // 当月新增
|
||||
}
|
||||
// 利润统计
|
||||
AdminProfitStatistics {
|
||||
TodayProfit float64 `json:"today_profit"` // 今日利润
|
||||
MonthProfit float64 `json:"month_profit"` // 当月利润
|
||||
TotalProfit float64 `json:"total_profit"` // 总利润
|
||||
TodayProfitRate float64 `json:"today_profit_rate"` // 今日利润率
|
||||
MonthProfitRate float64 `json:"month_profit_rate"` // 当月利润率
|
||||
TotalProfitRate float64 `json:"total_profit_rate"` // 总利润率
|
||||
// 今日明细
|
||||
TodayDetail AdminProfitDetail `json:"today_detail"`
|
||||
// 当月明细
|
||||
MonthDetail AdminProfitDetail `json:"month_detail"`
|
||||
// 总计明细
|
||||
TotalDetail AdminProfitDetail `json:"total_detail"`
|
||||
}
|
||||
// 利润明细
|
||||
AdminProfitDetail {
|
||||
Revenue float64 `json:"revenue"` // 营收
|
||||
Commission float64 `json:"commission"` // 佣金
|
||||
Rebate float64 `json:"rebate"` // 返利
|
||||
CompanyTax float64 `json:"company_tax"` // 税务成本
|
||||
ApiCost float64 `json:"api_cost"` // API调用成本
|
||||
TaxIncome float64 `json:"tax_income"` // 提现收税
|
||||
Profit float64 `json:"profit"` // 利润
|
||||
ProfitRate float64 `json:"profit_rate"` // 利润率
|
||||
}
|
||||
// 趋势数据
|
||||
AdminTrendData {
|
||||
Date string `json:"date"` // 日期(格式:MM-DD)
|
||||
Value float64 `json:"value"` // 数值
|
||||
}
|
||||
)
|
||||
|
||||
@@ -7,8 +7,8 @@ info (
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: api/v1/admin/menu
|
||||
group: admin_menu
|
||||
prefix: api/v1/admin/menu
|
||||
group: admin_menu
|
||||
middleware: AdminAuthInterceptor
|
||||
)
|
||||
service main {
|
||||
@@ -40,100 +40,88 @@ service main {
|
||||
type (
|
||||
// 列表请求
|
||||
GetMenuListReq {
|
||||
Name string `form:"name,optional"` // 菜单名称
|
||||
Path string `form:"path,optional"` // 路由路径
|
||||
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 string `form:"type,optional"` // 类型
|
||||
}
|
||||
|
||||
// 列表项
|
||||
MenuListItem {
|
||||
Id int64 `json:"id"` // 菜单ID
|
||||
Pid int64 `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"` // 排序
|
||||
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"` // 子菜单
|
||||
Children []MenuListItem `json:"children"` // 子菜单
|
||||
}
|
||||
|
||||
// 详情请求
|
||||
GetMenuDetailReq {
|
||||
Id int64 `path:"id"` // 菜单ID
|
||||
Id string `path:"id"` // 菜单ID
|
||||
}
|
||||
|
||||
// 详情响应
|
||||
GetMenuDetailResp {
|
||||
Id int64 `json:"id"` // 菜单ID
|
||||
Pid int64 `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"` // 排序
|
||||
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"` // 更新时间
|
||||
}
|
||||
|
||||
// 创建请求
|
||||
CreateMenuReq {
|
||||
Pid int64 `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"` // 路由元数据
|
||||
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 string `json:"type"` // 类型
|
||||
Sort int64 `json:"sort,optional"` // 排序
|
||||
}
|
||||
|
||||
// 创建响应
|
||||
CreateMenuResp {
|
||||
Id int64 `json:"id"` // 菜单ID
|
||||
Id string `json:"id"` // 菜单ID
|
||||
}
|
||||
|
||||
// 更新请求
|
||||
UpdateMenuReq {
|
||||
Id int64 `path:"id"` // 菜单ID
|
||||
Pid int64 `json:"pid,optional"` // 父菜单ID
|
||||
Name string `json:"name"` // 路由名称
|
||||
Path string `json:"path,optional"` // 路由路径
|
||||
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"` // 排序
|
||||
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"` // 排序
|
||||
}
|
||||
|
||||
// 更新响应
|
||||
UpdateMenuResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
|
||||
// 删除请求
|
||||
DeleteMenuReq {
|
||||
Id int64 `path:"id"` // 菜单ID
|
||||
Id string `path:"id"` // 菜单ID
|
||||
}
|
||||
|
||||
// 删除响应
|
||||
DeleteMenuResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
|
||||
// 获取所有菜单请求
|
||||
GetMenuAllReq {
|
||||
}
|
||||
|
||||
GetMenuAllReq {}
|
||||
// 获取所有菜单响应
|
||||
GetMenuAllResp {
|
||||
Name string `json:"name"`
|
||||
@@ -144,4 +132,5 @@ type (
|
||||
Meta map[string]interface{} `json:"meta"`
|
||||
Children []GetMenuAllResp `json:"children"`
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@ type (
|
||||
}
|
||||
|
||||
// 创建通知响应
|
||||
AdminCreateNotificationResp {
|
||||
Id int64 `json:"id"` // 通知ID
|
||||
}
|
||||
AdminCreateNotificationResp {
|
||||
Id string `json:"id"` // 通知ID
|
||||
}
|
||||
|
||||
// 更新通知请求
|
||||
AdminUpdateNotificationReq {
|
||||
Id int64 `path:"id"` // 通知ID
|
||||
Title *string `json:"title,optional"` // 通知标题
|
||||
AdminUpdateNotificationReq {
|
||||
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"` // 生效开始日期
|
||||
@@ -37,9 +37,9 @@ type (
|
||||
}
|
||||
|
||||
// 删除通知请求
|
||||
AdminDeleteNotificationReq {
|
||||
Id int64 `path:"id"` // 通知ID
|
||||
}
|
||||
AdminDeleteNotificationReq {
|
||||
Id string `path:"id"` // 通知ID
|
||||
}
|
||||
|
||||
// 删除通知响应
|
||||
AdminDeleteNotificationResp {
|
||||
@@ -47,14 +47,14 @@ type (
|
||||
}
|
||||
|
||||
// 获取通知详情请求
|
||||
AdminGetNotificationDetailReq {
|
||||
Id int64 `path:"id"` // 通知ID
|
||||
}
|
||||
AdminGetNotificationDetailReq {
|
||||
Id string `path:"id"` // 通知ID
|
||||
}
|
||||
|
||||
// 获取通知详情响应
|
||||
AdminGetNotificationDetailResp {
|
||||
Id int64 `json:"id"` // 通知ID
|
||||
Title string `json:"title"` // 通知标题
|
||||
AdminGetNotificationDetailResp {
|
||||
Id string `json:"id"` // 通知ID
|
||||
Title string `json:"title"` // 通知标题
|
||||
Content string `json:"content"` // 通知内容
|
||||
NotificationPage string `json:"notification_page"` // 通知页面
|
||||
StartDate string `json:"start_date"` // 生效开始日期
|
||||
@@ -78,9 +78,9 @@ type (
|
||||
}
|
||||
|
||||
// 通知列表项
|
||||
NotificationListItem {
|
||||
Id int64 `json:"id"` // 通知ID
|
||||
Title string `json:"title"` // 通知标题
|
||||
NotificationListItem {
|
||||
Id string `json:"id"` // 通知ID
|
||||
Title string `json:"title"` // 通知标题
|
||||
NotificationPage string `json:"notification_page"` // 通知页面
|
||||
Content string `json:"content"` // 通知内容
|
||||
StartDate string `json:"start_date"` // 生效开始日期
|
||||
@@ -125,4 +125,4 @@ service main {
|
||||
// 获取通知列表
|
||||
@handler AdminGetNotificationList
|
||||
get /list (AdminGetNotificationListReq) returns (AdminGetNotificationListResp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,10 @@ type (
|
||||
PayTimeEnd string `form:"pay_time_end,optional"` // 支付时间结束
|
||||
RefundTimeStart string `form:"refund_time_start,optional"` // 退款时间开始
|
||||
RefundTimeEnd string `form:"refund_time_end,optional"` // 退款时间结束
|
||||
// 被查询人(与 query_subject_index 密文一致,多条件为 AND)
|
||||
QuerySubjectName string `form:"query_subject_name,optional"` // 姓名(明文,服务端转密文查询)
|
||||
QuerySubjectMobile string `form:"query_subject_mobile,optional"` // 手机号
|
||||
QuerySubjectIdCard string `form:"query_subject_id_card,optional"` // 身份证
|
||||
}
|
||||
// 列表响应
|
||||
AdminGetOrderListResp {
|
||||
@@ -66,8 +70,8 @@ type (
|
||||
Items []OrderListItem `json:"items"` // 列表
|
||||
}
|
||||
// 列表项
|
||||
OrderListItem {
|
||||
Id int64 `json:"id"` // 订单ID
|
||||
OrderListItem {
|
||||
Id string `json:"id"` // 订单ID
|
||||
OrderNo string `json:"order_no"` // 商户订单号
|
||||
PlatformOrderId string `json:"platform_order_id"` // 支付订单号
|
||||
ProductName string `json:"product_name"` // 产品名称
|
||||
@@ -83,12 +87,12 @@ type (
|
||||
AgentProcessStatus string `json:"agent_process_status"` // 代理事务处理状态:not_agent-非代理订单,success-处理成功,failed-处理失败,pending-待处理
|
||||
}
|
||||
// 详情请求
|
||||
AdminGetOrderDetailReq {
|
||||
Id int64 `path:"id"` // 订单ID
|
||||
AdminGetOrderDetailReq {
|
||||
Id string `path:"id"` // 订单ID
|
||||
}
|
||||
// 详情响应
|
||||
AdminGetOrderDetailResp {
|
||||
Id int64 `json:"id"` // 订单ID
|
||||
AdminGetOrderDetailResp {
|
||||
Id string `json:"id"` // 订单ID
|
||||
OrderNo string `json:"order_no"` // 商户订单号
|
||||
PlatformOrderId string `json:"platform_order_id"` // 支付订单号
|
||||
ProductName string `json:"product_name"` // 产品名称
|
||||
@@ -115,12 +119,12 @@ type (
|
||||
Status string `json:"status,default=pending"` // 支付状态:pending-待支付,paid-已支付,refunded-已退款,closed-已关闭,failed-支付失败
|
||||
}
|
||||
// 创建响应
|
||||
AdminCreateOrderResp {
|
||||
Id int64 `json:"id"` // 订单ID
|
||||
AdminCreateOrderResp {
|
||||
Id string `json:"id"` // 订单ID
|
||||
}
|
||||
// 更新请求
|
||||
AdminUpdateOrderReq {
|
||||
Id int64 `path:"id"` // 订单ID
|
||||
AdminUpdateOrderReq {
|
||||
Id string `path:"id"` // 订单ID
|
||||
OrderNo *string `json:"order_no,optional"` // 商户订单号
|
||||
PlatformOrderId *string `json:"platform_order_id,optional"` // 支付订单号
|
||||
ProductName *string `json:"product_name,optional"` // 产品名称
|
||||
@@ -136,16 +140,16 @@ type (
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
// 删除请求
|
||||
AdminDeleteOrderReq {
|
||||
Id int64 `path:"id"` // 订单ID
|
||||
AdminDeleteOrderReq {
|
||||
Id string `path:"id"` // 订单ID
|
||||
}
|
||||
// 删除响应
|
||||
AdminDeleteOrderResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
// 退款请求
|
||||
AdminRefundOrderReq {
|
||||
Id int64 `path:"id"` // 订单ID
|
||||
AdminRefundOrderReq {
|
||||
Id string `path:"id"` // 订单ID
|
||||
RefundAmount float64 `json:"refund_amount"` // 退款金额
|
||||
RefundReason string `json:"refund_reason"` // 退款原因
|
||||
}
|
||||
@@ -156,8 +160,8 @@ type (
|
||||
Amount float64 `json:"amount"` // 退款金额
|
||||
}
|
||||
// 重新执行代理处理请求
|
||||
AdminRetryAgentProcessReq {
|
||||
Id int64 `path:"id"` // 订单ID
|
||||
AdminRetryAgentProcessReq {
|
||||
Id string `path:"id"` // 订单ID
|
||||
}
|
||||
// 重新执行代理处理响应
|
||||
AdminRetryAgentProcessResp {
|
||||
@@ -165,4 +169,4 @@ type (
|
||||
Message string `json:"message"` // 执行结果消息
|
||||
ProcessedAt string `json:"processed_at"` // 处理时间
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -7,9 +7,9 @@ info (
|
||||
)
|
||||
|
||||
// 平台用户管理接口
|
||||
@server(
|
||||
prefix: /api/v1/admin/platform_user
|
||||
group: admin_platform_user
|
||||
@server (
|
||||
prefix: /api/v1/admin/platform_user
|
||||
group: admin_platform_user
|
||||
middleware: AdminAuthInterceptor
|
||||
)
|
||||
service main {
|
||||
@@ -37,86 +37,77 @@ service main {
|
||||
type (
|
||||
// 分页列表请求
|
||||
AdminGetPlatformUserListReq {
|
||||
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-否
|
||||
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"` // 排序类型
|
||||
CreateTimeEnd string `form:"create_time_end,optional"` // 创建时间结束
|
||||
OrderBy string `form:"order_by,optional"` // 排序字段
|
||||
OrderType string `form:"order_type,optional"` // 排序类型
|
||||
}
|
||||
|
||||
// 分页列表响应
|
||||
AdminGetPlatformUserListResp {
|
||||
Total int64 `json:"total"` // 总数
|
||||
Items []PlatformUserListItem `json:"items"` // 列表
|
||||
}
|
||||
|
||||
// 列表项
|
||||
PlatformUserListItem {
|
||||
Id int64 `json:"id"` // 用户ID
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
Nickname string `json:"nickname"` // 昵称
|
||||
Info string `json:"info"` // 备注信息
|
||||
Inside int64 `json:"inside"` // 是否内部用户 1-是 0-否
|
||||
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"` // 更新时间
|
||||
}
|
||||
|
||||
// 详情请求
|
||||
AdminGetPlatformUserDetailReq {
|
||||
Id int64 `path:"id"` // 用户ID
|
||||
Id string `path:"id"` // 用户ID
|
||||
}
|
||||
|
||||
// 详情响应
|
||||
AdminGetPlatformUserDetailResp {
|
||||
Id int64 `json:"id"` // 用户ID
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
Nickname string `json:"nickname"` // 昵称
|
||||
Info string `json:"info"` // 备注信息
|
||||
Inside int64 `json:"inside"` // 是否内部用户 1-是 0-否
|
||||
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"` // 更新时间
|
||||
}
|
||||
|
||||
// 创建请求
|
||||
AdminCreatePlatformUserReq {
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
Password string `json:"password"` // 密码
|
||||
Nickname string `json:"nickname"` // 昵称
|
||||
Info string `json:"info"` // 备注信息
|
||||
Inside int64 `json:"inside"` // 是否内部用户 1-是 0-否
|
||||
Info string `json:"info"` // 备注信息
|
||||
Inside int64 `json:"inside"` // 是否内部用户 1-是 0-否
|
||||
}
|
||||
|
||||
// 创建响应
|
||||
AdminCreatePlatformUserResp {
|
||||
Id int64 `json:"id"` // 用户ID
|
||||
Id string `json:"id"` // 用户ID
|
||||
}
|
||||
|
||||
// 更新请求
|
||||
AdminUpdatePlatformUserReq {
|
||||
Id int64 `path:"id"` // 用户ID
|
||||
Mobile *string `json:"mobile,optional"` // 手机号
|
||||
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-否
|
||||
Info *string `json:"info,optional"` // 备注信息
|
||||
Inside *int64 `json:"inside,optional"` // 是否内部用户 1-是 0-否
|
||||
}
|
||||
|
||||
// 更新响应
|
||||
AdminUpdatePlatformUserResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
|
||||
// 删除请求
|
||||
AdminDeletePlatformUserReq {
|
||||
Id int64 `path:"id"` // 用户ID
|
||||
Id string `path:"id"` // 用户ID
|
||||
}
|
||||
|
||||
// 删除响应
|
||||
AdminDeletePlatformUserResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -50,25 +50,25 @@ type (
|
||||
}
|
||||
|
||||
// 列表项
|
||||
RoleListItem {
|
||||
Id int64 `json:"id"` // 角色ID
|
||||
RoleName string `json:"role_name"` // 角色名称
|
||||
RoleListItem {
|
||||
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"` // 创建时间
|
||||
MenuIds []int64 `json:"menu_ids"` // 关联的菜单ID列表
|
||||
}
|
||||
MenuIds []string `json:"menu_ids"` // 关联的菜单ID列表
|
||||
}
|
||||
|
||||
// 详情请求
|
||||
GetRoleDetailReq {
|
||||
Id int64 `path:"id"` // 角色ID
|
||||
}
|
||||
GetRoleDetailReq {
|
||||
Id string `path:"id"` // 角色ID
|
||||
}
|
||||
|
||||
// 详情响应
|
||||
GetRoleDetailResp {
|
||||
Id int64 `json:"id"` // 角色ID
|
||||
GetRoleDetailResp {
|
||||
Id string `json:"id"` // 角色ID
|
||||
RoleName string `json:"role_name"` // 角色名称
|
||||
RoleCode string `json:"role_code"` // 角色编码
|
||||
Description string `json:"description"` // 角色描述
|
||||
@@ -76,34 +76,34 @@ type (
|
||||
Sort int64 `json:"sort"` // 排序
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
UpdateTime string `json:"update_time"` // 更新时间
|
||||
MenuIds []int64 `json:"menu_ids"` // 关联的菜单ID列表
|
||||
}
|
||||
MenuIds []string `json:"menu_ids"` // 关联的菜单ID列表
|
||||
}
|
||||
|
||||
// 创建请求
|
||||
CreateRoleReq {
|
||||
CreateRoleReq {
|
||||
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 []int64 `json:"menu_ids"` // 关联的菜单ID列表
|
||||
}
|
||||
MenuIds []string `json:"menu_ids"` // 关联的菜单ID列表
|
||||
}
|
||||
|
||||
// 创建响应
|
||||
CreateRoleResp {
|
||||
Id int64 `json:"id"` // 角色ID
|
||||
}
|
||||
CreateRoleResp {
|
||||
Id string `json:"id"` // 角色ID
|
||||
}
|
||||
|
||||
// 更新请求
|
||||
UpdateRoleReq {
|
||||
Id int64 `path:"id"` // 角色ID
|
||||
UpdateRoleReq {
|
||||
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 []int64 `json:"menu_ids,optional"` // 关联的菜单ID列表
|
||||
}
|
||||
MenuIds []string `json:"menu_ids,optional"` // 关联的菜单ID列表
|
||||
}
|
||||
|
||||
// 更新响应
|
||||
UpdateRoleResp {
|
||||
@@ -111,12 +111,12 @@ type (
|
||||
}
|
||||
|
||||
// 删除请求
|
||||
DeleteRoleReq {
|
||||
Id int64 `path:"id"` // 角色ID
|
||||
}
|
||||
DeleteRoleReq {
|
||||
Id string `path:"id"` // 角色ID
|
||||
}
|
||||
|
||||
// 删除响应
|
||||
DeleteRoleResp {
|
||||
Success bool `json:"success"` // 是否成功
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
syntax = "v1"
|
||||
|
||||
import "product.api"
|
||||
|
||||
info (
|
||||
title: "代理服务"
|
||||
desc: "新代理系统接口"
|
||||
version: "v1"
|
||||
)
|
||||
|
||||
// ============================================
|
||||
// 公开接口(无需登录)
|
||||
// ============================================
|
||||
@server (
|
||||
prefix: api/v1/agent
|
||||
group: agent
|
||||
@@ -17,7 +16,14 @@ service main {
|
||||
// 获取推广链接数据
|
||||
@handler GetLinkData
|
||||
get /link (GetLinkDataReq) returns (GetLinkDataResp)
|
||||
}
|
||||
|
||||
@server (
|
||||
prefix: api/v1/agent
|
||||
group: agent
|
||||
middleware: AuthInterceptor
|
||||
)
|
||||
service main {
|
||||
// 通过邀请码申请成为代理(必须提供邀请码)
|
||||
@handler ApplyForAgent
|
||||
post /apply (AgentApplyReq) returns (AgentApplyResp)
|
||||
@@ -32,8 +38,8 @@ type (
|
||||
LinkIdentifier string `form:"link_identifier"` // 推广链接标识
|
||||
}
|
||||
GetLinkDataResp {
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
ProductId int64 `json:"product_id"` // 产品ID
|
||||
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"` // 产品名称
|
||||
@@ -43,31 +49,37 @@ type (
|
||||
Features []Feature `json:"features"` // 产品功能列表
|
||||
}
|
||||
AgentApplyReq {
|
||||
Region string `json:"region,optional"` // 区域(可选)
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
Code string `json:"code"` // 验证码
|
||||
InviteCode string `json:"invite_code"` // 邀请码(必填,只能通过邀请码成为代理)
|
||||
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"`
|
||||
}
|
||||
AgentApplyResp {
|
||||
AccessToken string `json:"accessToken"`
|
||||
AccessExpire int64 `json:"accessExpire"`
|
||||
RefreshAfter int64 `json:"refreshAfter"`
|
||||
AgentCode int64 `json:"agent_code"`
|
||||
}
|
||||
// 通过邀请码注册
|
||||
RegisterByInviteCodeReq {
|
||||
InviteCode string `json:"invite_code"` // 邀请码
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
Code string `json:"code"` // 验证码
|
||||
Region string `json:"region,optional"` // 区域(可选)
|
||||
WechatId string `json:"wechat_id,optional"` // 微信号(可选)
|
||||
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"`
|
||||
}
|
||||
RegisterByInviteCodeResp {
|
||||
AccessToken string `json:"accessToken"`
|
||||
AccessExpire int64 `json:"accessExpire"`
|
||||
RefreshAfter int64 `json:"refreshAfter"`
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
Level int64 `json:"level"` // 代理等级
|
||||
LevelName string `json:"level_name"` // 等级名称
|
||||
AgentCode int64 `json:"agent_code"`
|
||||
}
|
||||
// 生成邀请码
|
||||
GenerateInviteCodeReq {
|
||||
@@ -89,7 +101,7 @@ type (
|
||||
List []InviteCodeItem `json:"list"` // 列表
|
||||
}
|
||||
InviteCodeItem {
|
||||
Id int64 `json:"id"` // 记录ID
|
||||
Id string `json:"id"` // 记录ID
|
||||
Code string `json:"code"` // 邀请码
|
||||
TargetLevel int64 `json:"target_level"` // 目标等级
|
||||
Status int64 `json:"status"` // 状态:0=未使用,1=已使用,2=已失效
|
||||
@@ -100,7 +112,7 @@ type (
|
||||
}
|
||||
// 删除邀请码
|
||||
DeleteInviteCodeReq {
|
||||
Id int64 `json:"id"` // 邀请码ID
|
||||
Id string `json:"id"` // 邀请码ID
|
||||
}
|
||||
DeleteInviteCodeResp {}
|
||||
// 获取邀请链接
|
||||
@@ -111,20 +123,36 @@ type (
|
||||
GetInviteLinkResp {
|
||||
InviteLink string `json:"invite_link"` // 邀请链接
|
||||
}
|
||||
// 生成邀请海报(后端 imageService 合成背景+二维码)
|
||||
GetInvitePosterReq {
|
||||
InviteLink string `form:"invite_link"` // 邀请链接
|
||||
Format string `form:"format,optional"` // base64 时返回 JSON,否则返回 image/png
|
||||
}
|
||||
GetInvitePosterResp {
|
||||
PosterBase64 string `json:"poster_base64"` // PNG base64,前端用 data:image/png;base64,{poster_base64}
|
||||
}
|
||||
// 获取代理等级特权信息
|
||||
GetLevelPrivilegeResp {
|
||||
Levels []LevelPrivilegeItem `json:"levels"` // 各等级特权信息列表
|
||||
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"`
|
||||
}
|
||||
LevelPrivilegeItem {
|
||||
Level int64 `json:"level"` // 等级:1=普通,2=黄金,3=钻石
|
||||
LevelName string `json:"level_name"` // 等级名称
|
||||
LevelBonus float64 `json:"level_bonus"` // 等级加成(元)
|
||||
PriceReduction float64 `json:"price_reduction"` // 底价降低(元,相对于当前等级)
|
||||
PromoteRebate string `json:"promote_rebate"` // 推广返佣说明
|
||||
MaxPromoteRebate float64 `json:"max_promote_rebate"` // 最高推广返佣金额(元)
|
||||
UpgradeRebate string `json:"upgrade_rebate"` // 下级升级返佣说明
|
||||
Privileges []string `json:"privileges"` // 特权列表
|
||||
CanUpgradeSubordinate bool `json:"can_upgrade_subordinate"` // 是否可以升级下级
|
||||
Level int64 `json:"level"` // 等级:1=普通,2=黄金,3=钻石
|
||||
LevelName string `json:"level_name"` // 等级名称
|
||||
LevelBonus float64 `json:"level_bonus"` // 等级加成(元)
|
||||
PriceReduction float64 `json:"price_reduction"` // 底价降低(元,相对于当前等级)
|
||||
PromoteRebate string `json:"promote_rebate"` // 推广返佣说明(旧字段,兼容保留)
|
||||
MaxPromoteRebate float64 `json:"max_promote_rebate"` // 最高推广返佣金额(元,旧字段,兼容保留)
|
||||
UpgradeRebate string `json:"upgrade_rebate"` // 下级升级返佣说明(旧字段,兼容保留)
|
||||
Privileges []string `json:"privileges"` // 特权列表(旧字段,兼容保留)
|
||||
CanUpgradeSubordinate bool `json:"can_upgrade_subordinate"` // 是否可以升级下级(旧字段,兼容保留)
|
||||
MaxSetPrice float64 `json:"max_set_price"` // 该等级可设置查询价最高金额(按所有产品最高价格取上限)
|
||||
SubordinateRewardMax float64 `json:"subordinate_reward_max"` // 下级代理查询奖励最高金额(元/单)
|
||||
InviteGoldReward float64 `json:"invite_gold_reward"` // 邀请黄金代理奖励金额(元)
|
||||
InviteDiamondReward float64 `json:"invite_diamond_reward"` // 邀请钻石代理奖励金额(元)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -206,6 +234,10 @@ service main {
|
||||
@handler ApplyWithdrawal
|
||||
post /withdrawal/apply (ApplyWithdrawalReq) returns (ApplyWithdrawalResp)
|
||||
|
||||
// 获取上次提现信息(用于前端预填)
|
||||
@handler GetLastWithdrawalInfo
|
||||
get /withdrawal/last_info (GetLastWithdrawalInfoReq) returns (GetLastWithdrawalInfoResp)
|
||||
|
||||
// 实名认证
|
||||
@handler RealNameAuth
|
||||
post /real_name (RealNameAuthReq) returns (RealNameAuthResp)
|
||||
@@ -226,26 +258,61 @@ service main {
|
||||
@handler GetInviteLink
|
||||
get /invite_link (GetInviteLinkReq) returns (GetInviteLinkResp)
|
||||
|
||||
// 生成邀请海报(后端 imageService 合成背景+二维码,format=base64 返回 JSON)
|
||||
@handler GetInvitePoster
|
||||
get /invite/poster (GetInvitePosterReq) returns (GetInvitePosterResp)
|
||||
|
||||
// 获取代理等级特权信息
|
||||
@handler GetLevelPrivilege
|
||||
get /level/privilege returns (GetLevelPrivilegeResp)
|
||||
|
||||
// 获取推广查询报告列表
|
||||
@handler GetPromotionQueryList
|
||||
get /promotion/query/list (GetPromotionQueryListReq) returns (GetPromotionQueryListResp)
|
||||
|
||||
// ============================================
|
||||
// 用户模块白名单相关接口
|
||||
// ============================================
|
||||
@handler GetWhitelistFeatures
|
||||
get /whitelist/features (GetWhitelistFeaturesReq) returns (GetWhitelistFeaturesResp)
|
||||
|
||||
// 创建白名单订单
|
||||
@handler CreateWhitelistOrder
|
||||
post /whitelist/order/create (CreateWhitelistOrderReq) returns (CreateWhitelistOrderResp)
|
||||
|
||||
// 获取用户白名单列表
|
||||
@handler GetWhitelistList
|
||||
get /whitelist/list (GetWhitelistListReq) returns (GetWhitelistListResp)
|
||||
|
||||
// 检查模块是否已下架(用于显示下架按钮状态)
|
||||
@handler CheckFeatureWhitelistStatus
|
||||
get /whitelist/check (CheckFeatureWhitelistStatusReq) returns (CheckFeatureWhitelistStatusResp)
|
||||
|
||||
// 下架单个模块(统一入口:创建/补充白名单并根据 QueryId 删除本次报告中的模块数据)
|
||||
@handler OfflineFeature
|
||||
post /whitelist/offline (OfflineFeatureReq) returns (OfflineFeatureResp)
|
||||
|
||||
// 检查订单是否属于当前代理推广
|
||||
@handler CheckOrderAgent
|
||||
get /order/agent (CheckOrderAgentReq) returns (CheckOrderAgentResp)
|
||||
}
|
||||
|
||||
type (
|
||||
// 代理信息
|
||||
AgentInfoResp {
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
Level int64 `json:"level"` // 代理等级:1=普通,2=黄金,3=钻石
|
||||
LevelName string `json:"level_name"` // 等级名称
|
||||
Region string `json:"region"` // 区域(可选)
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
WechatId string `json:"wechat_id"` // 微信号(可选)
|
||||
TeamLeaderId int64 `json:"team_leader_id"` // 团队首领ID
|
||||
IsRealName bool `json:"is_real_name"` // 是否已实名
|
||||
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"`
|
||||
}
|
||||
// 生成推广链接
|
||||
AgentGeneratingLinkReq {
|
||||
ProductId int64 `json:"product_id"` // 产品ID
|
||||
ProductId string `json:"product_id"` // 产品ID
|
||||
SetPrice float64 `json:"set_price"` // 设定价格
|
||||
TargetPath string `json:"target_path,optional"` // 目标地址(可选,默认为推广报告页面)
|
||||
}
|
||||
@@ -258,7 +325,7 @@ type (
|
||||
List []ProductConfigItem `json:"list"`
|
||||
}
|
||||
ProductConfigItem {
|
||||
ProductId int64 `json:"product_id"` // 产品ID
|
||||
ProductId string `json:"product_id"` // 产品ID
|
||||
ProductName string `json:"product_name"` // 产品名称
|
||||
ProductEn string `json:"product_en"` // 产品英文标识
|
||||
ActualBasePrice float64 `json:"actual_base_price"` // 实际底价
|
||||
@@ -305,7 +372,7 @@ type (
|
||||
List []SubordinateItem `json:"list"` // 列表
|
||||
}
|
||||
SubordinateItem {
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
Level int64 `json:"level"` // 等级
|
||||
LevelName string `json:"level_name"` // 等级名称
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
@@ -315,7 +382,7 @@ type (
|
||||
}
|
||||
// 下级贡献详情
|
||||
GetSubordinateContributionDetailReq {
|
||||
SubordinateId int64 `form:"subordinate_id"` // 下级代理ID
|
||||
SubordinateId string `form:"subordinate_id"` // 下级代理ID
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"page_size"` // 每页数量
|
||||
TabType string `form:"tab_type,optional"` // 标签页类型:order=订单列表,invite=邀请列表
|
||||
@@ -349,14 +416,14 @@ type (
|
||||
}
|
||||
OrderItem {
|
||||
OrderNo string `json:"order_no"` // 订单号
|
||||
ProductId int64 `json:"product_id"` // 产品ID
|
||||
ProductId string `json:"product_id"` // 产品ID
|
||||
ProductName string `json:"product_name"` // 产品名称
|
||||
OrderAmount float64 `json:"order_amount"` // 订单金额
|
||||
RebateAmount float64 `json:"rebate_amount"` // 返佣金额
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
}
|
||||
InviteItem {
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
Level int64 `json:"level"` // 等级
|
||||
LevelName string `json:"level_name"` // 等级名称
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
@@ -385,31 +452,35 @@ type (
|
||||
MonthEarnings float64 `json:"month_earnings"` // 月收益
|
||||
}
|
||||
TeamMemberItem {
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
Level int64 `json:"level"` // 等级
|
||||
LevelName string `json:"level_name"` // 等级名称
|
||||
Mobile string `json:"mobile"` // 手机号
|
||||
CreateTime string `json:"create_time"` // 加入团队时间
|
||||
TodayQueries int64 `json:"today_queries"` // 当日查询量
|
||||
MonthQueries int64 `json:"month_queries"` // 本月查询量
|
||||
TotalQueries int64 `json:"total_queries"` // 总查询量
|
||||
TotalRebateAmount float64 `json:"total_rebate_amount"` // 返佣给我的总金额
|
||||
TodayRebateAmount float64 `json:"today_rebate_amount"` // 返佣给我的今日金额
|
||||
TotalInvites int64 `json:"total_invites"` // 邀请加入团队的总人数
|
||||
TodayInvites int64 `json:"today_invites"` // 邀请加入团队的今日人数
|
||||
MonthInvites int64 `json:"month_invites"` // 邀请加入团队的本月人数
|
||||
IsDirect bool `json:"is_direct"` // 是否直接下级
|
||||
}
|
||||
// 收益信息
|
||||
GetRevenueInfoResp {
|
||||
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"` // 返佣本月收益
|
||||
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"` // 返佣本月收益
|
||||
AlipayMonthQuota float64 `json:"alipay_month_quota"` // 支付宝每月提现总额度
|
||||
AlipayMonthUsed float64 `json:"alipay_month_used"` // 本月已使用的支付宝提现额度
|
||||
}
|
||||
// 佣金记录
|
||||
GetCommissionListReq {
|
||||
@@ -421,8 +492,8 @@ type (
|
||||
List []CommissionItem `json:"list"` // 列表
|
||||
}
|
||||
CommissionItem {
|
||||
Id int64 `json:"id"` // 记录ID
|
||||
OrderId int64 `json:"order_id"` // 订单ID
|
||||
Id string `json:"id"` // 记录ID
|
||||
OrderId string `json:"order_id"` // 订单ID
|
||||
OrderNo string `json:"order_no"` // 订单号
|
||||
ProductName string `json:"product_name"` // 产品名称
|
||||
Amount float64 `json:"amount"` // 佣金金额
|
||||
@@ -440,14 +511,15 @@ type (
|
||||
List []RebateItem `json:"list"` // 列表
|
||||
}
|
||||
RebateItem {
|
||||
Id int64 `json:"id"` // 记录ID
|
||||
SourceAgentId int64 `json:"source_agent_id"` // 来源代理ID
|
||||
Id string `json:"id"` // 记录ID
|
||||
SourceAgentId string `json:"source_agent_id"` // 来源代理ID
|
||||
SourceAgentMobile string `json:"source_agent_mobile"` // 来源代理手机号
|
||||
SourceAgentLevel int64 `json:"source_agent_level"` // 来源代理等级:1=普通,2=黄金,3=钻石
|
||||
OrderId int64 `json:"order_id"` // 订单ID
|
||||
OrderId string `json:"order_id"` // 订单ID
|
||||
OrderNo string `json:"order_no"` // 订单号
|
||||
RebateType int64 `json:"rebate_type"` // 返佣类型:1=直接上级,2=钻石上级,3=黄金上级
|
||||
Amount float64 `json:"amount"` // 返佣金额
|
||||
Status int64 `json:"status"` // 状态:1=已发放,2=已冻结,3=已取消(已退款)
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
}
|
||||
// 升级返佣记录
|
||||
@@ -460,8 +532,8 @@ type (
|
||||
List []UpgradeRebateItem `json:"list"` // 列表
|
||||
}
|
||||
UpgradeRebateItem {
|
||||
Id int64 `json:"id"` // 记录ID
|
||||
SourceAgentId int64 `json:"source_agent_id"` // 来源代理ID(升级的代理)
|
||||
Id string `json:"id"` // 记录ID
|
||||
SourceAgentId string `json:"source_agent_id"` // 来源代理ID(升级的代理)
|
||||
SourceAgentMobile string `json:"source_agent_mobile"` // 来源代理手机号
|
||||
OrderNo string `json:"order_no"` // 订单号
|
||||
FromLevel int64 `json:"from_level"` // 原等级
|
||||
@@ -479,8 +551,8 @@ type (
|
||||
List []UpgradeItem `json:"list"` // 列表
|
||||
}
|
||||
UpgradeItem {
|
||||
Id int64 `json:"id"` // 记录ID
|
||||
AgentId int64 `json:"agent_id"` // 代理ID
|
||||
Id string `json:"id"` // 记录ID
|
||||
AgentId string `json:"agent_id"` // 代理ID
|
||||
FromLevel int64 `json:"from_level"` // 原等级
|
||||
ToLevel int64 `json:"to_level"` // 目标等级
|
||||
UpgradeType int64 `json:"upgrade_type"` // 升级类型:1=自主付费,2=钻石升级
|
||||
@@ -494,13 +566,13 @@ type (
|
||||
ToLevel int64 `json:"to_level"` // 目标等级:2=黄金,3=钻石
|
||||
}
|
||||
ApplyUpgradeResp {
|
||||
UpgradeId int64 `json:"upgrade_id"` // 升级记录ID
|
||||
UpgradeId string `json:"upgrade_id"` // 升级记录ID
|
||||
OrderNo string `json:"order_no"` // 支付订单号
|
||||
}
|
||||
// 钻石升级下级
|
||||
UpgradeSubordinateReq {
|
||||
SubordinateId int64 `json:"subordinate_id"` // 下级代理ID
|
||||
ToLevel int64 `json:"to_level"` // 目标等级(只能是2=黄金)
|
||||
SubordinateId string `json:"subordinate_id"` // 下级代理ID
|
||||
ToLevel int64 `json:"to_level"` // 目标等级(只能是2=黄金)
|
||||
}
|
||||
UpgradeSubordinateResp {
|
||||
Success bool `json:"success"`
|
||||
@@ -514,28 +586,46 @@ type (
|
||||
Total int64 `json:"total"` // 总数
|
||||
List []WithdrawalItem `json:"list"` // 列表
|
||||
}
|
||||
// 提现记录
|
||||
WithdrawalItem {
|
||||
Id int64 `json:"id"` // 记录ID
|
||||
WithdrawalNo string `json:"withdrawal_no"` // 提现单号
|
||||
Amount float64 `json:"amount"` // 提现金额
|
||||
TaxAmount float64 `json:"tax_amount"` // 税费金额
|
||||
ActualAmount float64 `json:"actual_amount"` // 实际到账金额
|
||||
Status int64 `json:"status"` // 状态:1=待审核,2=审核通过,3=审核拒绝,4=提现中,5=提现成功,6=提现失败
|
||||
PayeeAccount string `json:"payee_account"` // 收款账户
|
||||
PayeeName string `json:"payee_name"` // 收款人姓名
|
||||
Remark string `json:"remark"` // 备注
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
Id string `json:"id"` // 记录ID
|
||||
WithdrawalNo string `json:"withdrawal_no"` // 提现单号
|
||||
Amount float64 `json:"amount"` // 提现金额
|
||||
TaxAmount float64 `json:"tax_amount"` // 税费金额
|
||||
ActualAmount float64 `json:"actual_amount"` // 实际到账金额
|
||||
Status int64 `json:"status"` // 状态:1=待审核,2=审核通过,3=审核拒绝,4=提现中,5=提现成功,6=提现失败
|
||||
WithdrawalType int64 `json:"withdrawal_type"` // 提现方式:1=支付宝,2=银行卡
|
||||
PayeeAccount string `json:"payee_account"` // 收款账户(支付宝账号或银行卡号)
|
||||
PayeeName string `json:"payee_name"` // 收款人姓名
|
||||
BankCardNo string `json:"bank_card_no"` // 银行卡号(银行卡提现时填写)
|
||||
BankName string `json:"bank_name"` // 开户行名称(银行卡提现时填写)
|
||||
Remark string `json:"remark"` // 备注
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
}
|
||||
// 申请提现
|
||||
ApplyWithdrawalReq {
|
||||
Amount float64 `json:"amount"` // 提现金额
|
||||
PayeeAccount string `json:"payee_account"` // 收款账户
|
||||
PayeeName string `json:"payee_name"` // 收款人姓名
|
||||
Amount float64 `json:"amount"` // 提现金额
|
||||
WithdrawalType int64 `json:"withdrawal_type"` // 提现方式:1=支付宝,2=银行卡
|
||||
PayeeAccount string `json:"payee_account"` // 收款账户(支付宝账号或银行卡号)
|
||||
PayeeName string `json:"payee_name"` // 收款人姓名
|
||||
BankCardNo string `json:"bank_card_no,optional"` // 银行卡号(银行卡提现必填)
|
||||
BankName string `json:"bank_name,optional"` // 开户行名称(银行卡提现必填)
|
||||
}
|
||||
ApplyWithdrawalResp {
|
||||
WithdrawalId int64 `json:"withdrawal_id"` // 提现记录ID
|
||||
WithdrawalId string `json:"withdrawal_id"` // 提现记录ID
|
||||
WithdrawalNo string `json:"withdrawal_no"` // 提现单号
|
||||
}
|
||||
// 获取上次提现信息(用于前端预填)
|
||||
GetLastWithdrawalInfoReq {
|
||||
WithdrawalType int64 `form:"withdrawal_type"` // 提现方式:1=支付宝,2=银行卡
|
||||
}
|
||||
GetLastWithdrawalInfoResp {
|
||||
WithdrawalType int64 `json:"withdrawal_type"` // 提现方式
|
||||
PayeeAccount string `json:"payee_account"` // 收款账户(支付宝账号或银行卡号)
|
||||
PayeeName string `json:"payee_name"` // 收款人姓名
|
||||
BankCardNo string `json:"bank_card_no"` // 银行卡号
|
||||
BankName string `json:"bank_name"` // 开户行名称
|
||||
}
|
||||
// 实名认证
|
||||
RealNameAuthReq {
|
||||
Name string `json:"name"` // 姓名
|
||||
@@ -546,6 +636,99 @@ type (
|
||||
RealNameAuthResp {
|
||||
Status string `json:"status"` // 状态:pending=待审核,approved=已通过,rejected=已拒绝
|
||||
}
|
||||
// 推广查询列表
|
||||
GetPromotionQueryListReq {
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"page_size"` // 每页数量
|
||||
}
|
||||
GetPromotionQueryListResp {
|
||||
Total int64 `json:"total"` // 总数
|
||||
List []PromotionQueryItem `json:"list"` // 列表
|
||||
}
|
||||
PromotionQueryItem {
|
||||
Id string `json:"id"` // 查询ID
|
||||
OrderId string `json:"order_id"` // 订单ID
|
||||
ProductName string `json:"product_name"` // 产品名称
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
QueryState string `json:"query_state"` // 查询状态
|
||||
Params map[string]interface{} `json:"params"` // 查询参数(已脱敏)
|
||||
Price float64 `json:"price"` // 查询价格
|
||||
}
|
||||
// ============================================
|
||||
// 用户模块白名单相关类型
|
||||
// ============================================
|
||||
GetWhitelistFeaturesReq {}
|
||||
GetWhitelistFeaturesResp {
|
||||
List []WhitelistFeatureItem `json:"list"` // 可屏蔽的feature列表
|
||||
}
|
||||
WhitelistFeatureItem {
|
||||
FeatureId string `json:"feature_id"` // Feature的UUID
|
||||
FeatureApiId string `json:"feature_api_id"` // Feature的API标识
|
||||
FeatureName string `json:"feature_name"` // Feature的名称
|
||||
WhitelistPrice float64 `json:"whitelist_price"` // 屏蔽价格(单位:元)
|
||||
}
|
||||
CreateWhitelistOrderReq {
|
||||
IdCard string `json:"id_card"` // 身份证号(查询对象标识)
|
||||
FeatureIds []string `json:"feature_ids"` // 要屏蔽的feature ID列表
|
||||
OrderId string `json:"order_id,optional"` // 关联的查询订单ID(可选)
|
||||
}
|
||||
CreateWhitelistOrderResp {
|
||||
OrderId string `json:"order_id"` // 订单ID
|
||||
OrderNo string `json:"order_no"` // 订单号
|
||||
TotalAmount float64 `json:"total_amount"` // 总金额
|
||||
}
|
||||
GetWhitelistListReq {
|
||||
Page int64 `form:"page"` // 页码
|
||||
PageSize int64 `form:"page_size"` // 每页数量
|
||||
IdCard string `form:"id_card,optional"` // 身份证号(可选,用于筛选)
|
||||
}
|
||||
GetWhitelistListResp {
|
||||
Total int64 `json:"total"` // 总数
|
||||
List []WhitelistItem `json:"list"` // 列表
|
||||
}
|
||||
WhitelistItem {
|
||||
Id string `json:"id"` // 白名单记录ID
|
||||
IdCard string `json:"id_card"` // 身份证号
|
||||
FeatureId string `json:"feature_id"` // Feature的UUID
|
||||
FeatureApiId string `json:"feature_api_id"` // Feature的API标识
|
||||
FeatureName string `json:"feature_name"` // Feature的名称
|
||||
Amount float64 `json:"amount"` // 费用
|
||||
Status int64 `json:"status"` // 状态:1=生效,2=已失效
|
||||
StatusText string `json:"status_text"` // 状态文本
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
}
|
||||
// 检查模块白名单状态请求
|
||||
CheckFeatureWhitelistStatusReq {
|
||||
IdCard string `form:"id_card"` // 身份证号
|
||||
FeatureApiId string `form:"feature_api_id"` // Feature的API标识
|
||||
QueryId string `form:"query_id,optional"` // 查询记录ID(可选,用于检查报告数据是否已删除)
|
||||
}
|
||||
// 检查模块白名单状态响应
|
||||
CheckFeatureWhitelistStatusResp {
|
||||
IsWhitelisted bool `json:"is_whitelisted"` // 是否在白名单中
|
||||
WhitelistPrice float64 `json:"whitelist_price"` // 屏蔽价格(单位:元),如果为0表示不支持下架
|
||||
FeatureId string `json:"feature_id"` // Feature的UUID
|
||||
DataDeleted bool `json:"data_deleted"` // 报告数据是否已删除(仅当提供了query_id时有效)
|
||||
}
|
||||
// 下架单个模块请求
|
||||
OfflineFeatureReq {
|
||||
FeatureApiId string `json:"feature_api_id"` // Feature的API标识
|
||||
QueryId string `json:"query_id"` // 查询记录ID(Query表的ID,必选)
|
||||
}
|
||||
// 下架单个模块响应
|
||||
OfflineFeatureResp {
|
||||
Success bool `json:"success"` // 是否已完成下架
|
||||
NeedPay bool `json:"need_pay"` // 是否需要发起支付
|
||||
Amount float64 `json:"amount"` // 需要支付的金额(单位:元),0表示无需支付
|
||||
}
|
||||
// 检查订单是否属于当前代理请求
|
||||
CheckOrderAgentReq {
|
||||
OrderId string `form:"order_id"` // 订单ID
|
||||
}
|
||||
// 检查订单是否属于当前代理响应
|
||||
CheckOrderAgentResp {
|
||||
IsAgentOrder bool `json:"is_agent_order"` // 是否是当前代理推广的订单
|
||||
}
|
||||
)
|
||||
|
||||
// ============================================
|
||||
|
||||
@@ -11,7 +11,7 @@ info (
|
||||
group: app
|
||||
)
|
||||
service main {
|
||||
@doc(
|
||||
@doc (
|
||||
summary: "心跳检测接口"
|
||||
)
|
||||
@handler healthCheck
|
||||
@@ -19,12 +19,15 @@ service main {
|
||||
|
||||
@handler getAppVersion
|
||||
get /app/version returns (getAppVersionResp)
|
||||
|
||||
@handler getAppConfig
|
||||
get /app/config returns (getAppConfigResp)
|
||||
}
|
||||
|
||||
type (
|
||||
// 心跳检测响应
|
||||
HealthCheckResp {
|
||||
Status string `json:"status"` // 服务状态
|
||||
Status string `json:"status"` // 服务状态
|
||||
Message string `json:"message"` // 状态信息
|
||||
}
|
||||
)
|
||||
@@ -34,4 +37,11 @@ type (
|
||||
Version string `json:"version"`
|
||||
WgtUrl string `json:"wgtUrl"`
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
type (
|
||||
getAppConfigResp {
|
||||
QueryRetentionDays int64 `json:"query_retention_days"`
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -1,56 +1,50 @@
|
||||
type (
|
||||
// GetAuthorizationDocumentReq 获取授权书请求
|
||||
GetAuthorizationDocumentReq {
|
||||
DocumentId int64 `json:"documentId" validate:"required"` // 授权书ID
|
||||
DocumentId string `json:"documentId" validate:"required"` // 授权书ID
|
||||
}
|
||||
|
||||
// GetAuthorizationDocumentResp 获取授权书响应
|
||||
GetAuthorizationDocumentResp {
|
||||
DocumentId int64 `json:"documentId"` // 授权书ID
|
||||
UserId int64 `json:"userId"` // 用户ID
|
||||
OrderId int64 `json:"orderId"` // 订单ID
|
||||
QueryId int64 `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"` // 创建时间
|
||||
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"` // 创建时间
|
||||
}
|
||||
|
||||
// GetAuthorizationDocumentByOrderReq 根据订单ID获取授权书请求
|
||||
GetAuthorizationDocumentByOrderReq {
|
||||
OrderId int64 `json:"orderId" validate:"required"` // 订单ID
|
||||
OrderId string `json:"orderId" validate:"required"` // 订单ID
|
||||
}
|
||||
|
||||
// GetAuthorizationDocumentByOrderResp 根据订单ID获取授权书响应
|
||||
GetAuthorizationDocumentByOrderResp {
|
||||
Documents []AuthorizationDocumentInfo `json:"documents"` // 授权书列表
|
||||
}
|
||||
|
||||
// AuthorizationDocumentInfo 授权书信息
|
||||
AuthorizationDocumentInfo {
|
||||
DocumentId int64 `json:"documentId"` // 授权书ID
|
||||
UserId int64 `json:"userId"` // 用户ID
|
||||
OrderId int64 `json:"orderId"` // 订单ID
|
||||
QueryId int64 `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"` // 创建时间
|
||||
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"` // 创建时间
|
||||
}
|
||||
|
||||
// DownloadAuthorizationDocumentReq 下载授权书请求
|
||||
DownloadAuthorizationDocumentReq {
|
||||
DocumentId int64 `json:"documentId" validate:"required"` // 授权书ID
|
||||
DocumentId string `json:"documentId" validate:"required"` // 授权书ID
|
||||
}
|
||||
|
||||
// DownloadAuthorizationDocumentResp 下载授权书响应
|
||||
DownloadAuthorizationDocumentResp {
|
||||
FileName string `json:"fileName"` // 文件名
|
||||
FileUrl string `json:"fileUrl"` // 文件访问URL
|
||||
FileUrl string `json:"fileUrl"` // 文件访问URL
|
||||
}
|
||||
)
|
||||
|
||||
@@ -63,12 +57,13 @@ service main {
|
||||
// 获取授权书信息
|
||||
@handler GetAuthorizationDocument
|
||||
get /authorization/document/:documentId (GetAuthorizationDocumentReq) returns (GetAuthorizationDocumentResp)
|
||||
|
||||
|
||||
// 根据订单ID获取授权书列表
|
||||
@handler GetAuthorizationDocumentByOrder
|
||||
get /authorization/document/order/:orderId (GetAuthorizationDocumentByOrderReq) returns (GetAuthorizationDocumentByOrderResp)
|
||||
|
||||
|
||||
// 下载授权书文件
|
||||
@handler DownloadAuthorizationDocument
|
||||
get /authorization/download/:documentId (DownloadAuthorizationDocumentReq) returns (DownloadAuthorizationDocumentResp)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,17 +19,20 @@ service main {
|
||||
@handler AlipayCallback
|
||||
post /pay/alipay/callback
|
||||
|
||||
// 支付宝from消息回调
|
||||
@handler AlipayFrom
|
||||
post /pay/alipay/from
|
||||
|
||||
// 微信退款回调
|
||||
@handler WechatPayRefundCallback
|
||||
post /pay/wechat/refund_callback
|
||||
}
|
||||
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: pay
|
||||
jwt: JwtAuth
|
||||
middleware: UserAuthInterceptor
|
||||
|
||||
prefix: api/v1
|
||||
group: pay
|
||||
jwt: JwtAuth
|
||||
middleware: AuthInterceptor
|
||||
)
|
||||
service main {
|
||||
// 支付
|
||||
@@ -47,7 +50,8 @@ type (
|
||||
PaymentReq {
|
||||
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"`
|
||||
PayType string `json:"pay_type" validate:"required,oneof=query agent_vip agent_upgrade whitelist"`
|
||||
Code string `json:"code,optional"` // 微信小程序登录 code,未绑定 openid 时传此参数以换取 openid 并调起支付
|
||||
}
|
||||
PaymentResp {
|
||||
PrepayData interface{} `json:"prepay_data"`
|
||||
@@ -65,7 +69,8 @@ type (
|
||||
|
||||
type (
|
||||
IapCallbackReq {
|
||||
OrderID int64 `json:"order_id" validate:"required"`
|
||||
OrderID string `json:"order_id" validate:"required"`
|
||||
TransactionReceipt string `json:"transaction_receipt" validate:"required"`
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ info (
|
||||
version: "v1"
|
||||
)
|
||||
type Feature {
|
||||
ID int64 `json:"id"` // 功能ID
|
||||
ApiID string `json:"api_id"` // API标识
|
||||
Name string `json:"name"` // 功能描述
|
||||
ID string `json:"id"` // 功能ID
|
||||
ApiID string `json:"api_id"` // API标识
|
||||
Name string `json:"name"` // 功能描述
|
||||
}
|
||||
// 产品基本类型定义
|
||||
type Product {
|
||||
@@ -34,7 +34,7 @@ service main {
|
||||
}
|
||||
|
||||
type GetProductByIDRequest {
|
||||
Id int64 `path:"id"`
|
||||
Id string `path:"id"`
|
||||
}
|
||||
|
||||
type GetProductByEnRequest {
|
||||
@@ -52,4 +52,4 @@ type ProductResponse {
|
||||
service main {
|
||||
@handler GetProductAppByEn
|
||||
get /app_en/:product_en (GetProductByEnRequest) returns (ProductResponse)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ info (
|
||||
//============================> query v1 <============================
|
||||
// 查询基本类型定义
|
||||
type Query {
|
||||
Id int64 `json:"id"` // 主键ID
|
||||
OrderId int64 `json:"order_id"` // 订单ID
|
||||
UserId int64 `json:"user_id"` // 用户ID
|
||||
Id string `json:"id"` // 主键ID
|
||||
OrderId string `json:"order_id"` // 订单ID
|
||||
UserId string `json:"user_id"` // 用户ID
|
||||
Product string `json:"product"` // 产品ID
|
||||
ProductName string `json:"product_name"` // 产品ID
|
||||
QueryParams map[string]interface{} `json:"query_params"`
|
||||
@@ -19,6 +19,8 @@ type Query {
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
UpdateTime string `json:"update_time"` // 更新时间
|
||||
QueryState string `json:"query_state"` // 查询状态
|
||||
Params map[string]interface{} `json:"params"` // 查询参数(已脱敏)
|
||||
Price float64 `json:"price"` // 查询价格
|
||||
}
|
||||
|
||||
type QueryItem {
|
||||
@@ -68,7 +70,7 @@ type (
|
||||
prefix: api/v1
|
||||
group: query
|
||||
jwt: JwtAuth
|
||||
middleware: UserAuthInterceptor
|
||||
middleware: AuthInterceptor
|
||||
)
|
||||
service main {
|
||||
@doc "query service"
|
||||
@@ -80,7 +82,7 @@ service main {
|
||||
prefix: api/v1
|
||||
group: query
|
||||
jwt: JwtAuth
|
||||
middleware: UserAuthInterceptor
|
||||
middleware: AuthInterceptor
|
||||
)
|
||||
service main {
|
||||
@doc "获取查询临时订单"
|
||||
@@ -114,7 +116,7 @@ service main {
|
||||
|
||||
type (
|
||||
QueryGenerateShareLinkReq {
|
||||
OrderId *int64 `json:"order_id,optional"`
|
||||
OrderId *string `json:"order_id,optional"`
|
||||
OrderNo *string `json:"order_no,optional"`
|
||||
}
|
||||
QueryGenerateShareLinkResp {
|
||||
@@ -154,7 +156,7 @@ type (
|
||||
|
||||
type (
|
||||
QueryDetailByOrderIdReq {
|
||||
OrderId int64 `path:"order_id"`
|
||||
OrderId string `path:"order_id"`
|
||||
}
|
||||
)
|
||||
|
||||
@@ -166,7 +168,7 @@ type (
|
||||
|
||||
type (
|
||||
QueryRetryReq {
|
||||
Id int64 `path:"id"`
|
||||
Id string `path:"id"`
|
||||
}
|
||||
QueryRetryResp {
|
||||
Query
|
||||
@@ -175,11 +177,11 @@ type (
|
||||
|
||||
type (
|
||||
UpdateQueryDataReq {
|
||||
Id int64 `json:"id"` // 查询ID
|
||||
Id string `json:"id"` // 查询ID
|
||||
QueryData string `json:"query_data"` // 查询数据(未加密的JSON)
|
||||
}
|
||||
UpdateQueryDataResp {
|
||||
Id int64 `json:"id"`
|
||||
Id string `json:"id"`
|
||||
UpdatedAt string `json:"updated_at"` // 更新时间
|
||||
}
|
||||
)
|
||||
|
||||
@@ -9,10 +9,10 @@ info (
|
||||
//============================> user v1 <============================
|
||||
// 用户基本类型定义
|
||||
type User {
|
||||
Id int64 `json:"id"`
|
||||
Mobile string `json:"mobile"`
|
||||
NickName string `json:"nickName"`
|
||||
UserType int64 `json:"userType"`
|
||||
Id string `json:"id"`
|
||||
Mobile string `json:"mobile"`
|
||||
NickName string `json:"nickName"`
|
||||
UserType int64 `json:"userType"`
|
||||
}
|
||||
|
||||
//no need login
|
||||
@@ -21,6 +21,9 @@ type User {
|
||||
group: user
|
||||
)
|
||||
service main {
|
||||
@doc "unified auth"
|
||||
@handler auth
|
||||
post /user/auth (AuthReq) returns (AuthResp)
|
||||
@doc "mobile code login"
|
||||
@handler mobileCodeLogin
|
||||
post /user/mobileCodeLogin (MobileCodeLoginReq) returns (MobileCodeLoginResp)
|
||||
@@ -38,6 +41,18 @@ service main {
|
||||
}
|
||||
|
||||
type (
|
||||
AuthReq {
|
||||
Platform string `json:"platform"` // browser|wxh5|wxmini
|
||||
Code string `json:"code,optional"`
|
||||
}
|
||||
AuthResp {
|
||||
AccessToken string `json:"accessToken"`
|
||||
AccessExpire int64 `json:"accessExpire"`
|
||||
RefreshAfter int64 `json:"refreshAfter"`
|
||||
UserType int64 `json:"userType"`
|
||||
HasMobile bool `json:"hasMobile"`
|
||||
IsAgent bool `json:"isAgent"`
|
||||
}
|
||||
MobileCodeLoginReq {
|
||||
Mobile string `json:"mobile"`
|
||||
Code string `json:"code" validate:"required"`
|
||||
@@ -125,6 +140,7 @@ type (
|
||||
AccessToken string `json:"accessToken"`
|
||||
AccessExpire int64 `json:"accessExpire"`
|
||||
RefreshAfter int64 `json:"refreshAfter"`
|
||||
IsAgent bool `json:"is_agent,optional"` // 该手机号已是代理时为 true,前端可据此自动进入代理中心
|
||||
}
|
||||
)
|
||||
|
||||
@@ -141,8 +157,26 @@ service main {
|
||||
|
||||
type (
|
||||
sendSmsReq {
|
||||
Mobile string `json:"mobile" validate:"required,mobile"`
|
||||
ActionType string `json:"actionType" validate:"required,oneof=login register query agentApply realName bindMobile"`
|
||||
Mobile string `json:"mobile" validate:"required,mobile"`
|
||||
ActionType string `json:"actionType" validate:"required,oneof=login register query agentApply realName bindMobile"`
|
||||
CaptchaVerifyParam string `json:"captchaVerifyParam,optional"` // 阿里云滑块验证码参数
|
||||
}
|
||||
)
|
||||
|
||||
//============================> captcha v1 <============================
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: captcha
|
||||
)
|
||||
service main {
|
||||
@doc "get encrypted scene id for aliyun captcha"
|
||||
@handler getEncryptedSceneId
|
||||
post /captcha/encryptedSceneId returns (GetEncryptedSceneIdResp)
|
||||
}
|
||||
|
||||
type (
|
||||
GetEncryptedSceneIdResp {
|
||||
EncryptedSceneId string `json:"encryptedSceneId"`
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -28,3 +28,5 @@ import "./admin/admin_query.api"
|
||||
import "./admin/admin_agent.api"
|
||||
import "./admin/admin_api.api"
|
||||
import "./admin/admin_role_api.api"
|
||||
import "./admin/admin_complaint.api"
|
||||
import "./admin/dashboard.api"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
Name: main
|
||||
Host: 0.0.0.0
|
||||
Port: 8888
|
||||
Timeout: 0
|
||||
DataSource: "ycc:5vg67b3UNHu8@tcp(127.0.0.1:21001)/ycc?charset=utf8mb4&parseTime=True&loc=Local"
|
||||
CacheRedis:
|
||||
- Host: "127.0.0.1:21002"
|
||||
@@ -17,6 +18,18 @@ VerifyCode:
|
||||
SignName: "天远查"
|
||||
TemplateCode: "SMS_302641455"
|
||||
ValidTime: 300
|
||||
|
||||
Captcha:
|
||||
# 建议与短信相同的 AccessKey,或单独为验证码创建子账号
|
||||
AccessKeyID: "LTAI5tKGB3TVJbMHSoZN3yr9"
|
||||
AccessKeySecret: "OCQ30GWp4yENMjmfOAaagksE18bp65"
|
||||
# 验证码服务 Endpoint,国内一般为 captcha.cn-shanghai.aliyuncs.com
|
||||
EndpointURL: "captcha.cn-shanghai.aliyuncs.com"
|
||||
# 阿里云控制台中该场景的 SceneId,请替换为真实值
|
||||
SceneID: "wynt39to"
|
||||
# 验证码控制台中的 ekey(通常为 Base64 字符串),用于生成 EncryptedSceneId
|
||||
EKey: ""
|
||||
|
||||
Encrypt:
|
||||
SecretKey: "ff83609b2b24fc73196aac3d3dfb874f"
|
||||
WestConfig:
|
||||
@@ -29,16 +42,15 @@ YushanConfig:
|
||||
AcctID: "YSSJ843926726"
|
||||
Url: "https://api.yushanshuju.com/credit-gw/service"
|
||||
Alipay:
|
||||
AppID: "2021004165608254"
|
||||
PrivateKey: "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCPsXuwFJeHAL8CwI0QdD9GP7xQ8eejIoQKg6J3/peu26su68JCtGSRhlDm/7vbLHJcFR6h7at+INoz2juc7SqlmNO7i9wKc3+Ua0487y1G2fCsneRNxTTqbceBZwqjj9/AAN0u5/4nSl0bcqTeMddofdpTGOvwGvIJh6CZgCglnhMZnH4D6H6yiIyZf7Q6k2d/qBpVGK8kluYEtSnf/vEQCHhxRx+/DgTL7V1LjbA3BYoPTELZ15JAj0uIzuxextAtxOm4+Huli0RJFAN3q/to2L1Zs8yYY1gKJyTaPWKsJWBx8zI+gZcC/e45k6CZnGgh1Fn3+Xqkf7eGxJGGHs1fAgMBAAECggEAM2rkApbrvdBDiV2TXK7sMVv/K8vUAmkIbKa7zUpZxqUuNSUBp1LbpcM1UeNyujPGXDLmejUMp55j1igiKr4nA4iTQ0oBm+/GWDqpjV5cijzURUBegIGvtK9Bs4lGok6KVy839l/nbvHKLVcxrZySIv7dz9xcGNfbghN5IVRdiU/kOokNbtwQNC837piG5q4PHL6bzwIUGbrLED/RDmw/IwVMMmZovcQQ2JAuWJBo9CS9LB0Nc3I4MOPNx/0Rl+5URSSfmJAriL5ihlWckocQCUHwhRpSGQ6Q4xAXFYvb8OsApAQG3WU9SciBfs2wg/QfGNFzwQgGFofPcTQg3DTeuQKBgQDUHBTsgoe3WXnGo6qZKw1zA4OtF67IJJoltHo5JtkBRKCNVU3BJ+q+6i/fn0MBwScKQ1mhPjWe3h+qTRT207RRxGaxb6ljATOiU+BxmpHvu6jP+DVYtP5F3M7MCAGqpDAEoXgoAWttxmijqk+5YuLOLe0j/btCmpzuH7zwxSnqlQKBgQCtbTvaS/g+Jeu4Ml6iv7xi5//JCjeTn2wUJpXnNmN0jn+riRwEO81z4GWuOI8WukZHHAnufI6qWk2sLH0gcdLQ/STsMnl2L3NbeUyO8o5w2JSAlnZDYfaFfasGqFkGJrBLqG6bh/Bk1DP3/Bl6iMEwDbmu7Ptoy8ihokng9dEPIwKBgBHdi6WgGO5IiwlAH85m4eseEKkzpXUWICWs3d6SdxS0QxGkbbgnNI6ACyg6sdoj+rXSlmoOY1XOP7yIYYuoqTd542xui0XbhA3YIr9u1XvrwnxB27xtAj3AK2rkAb/ttF2ve/9inznPzGB8p9plidTz6VVuuacSfsVPxwpAkRdBAoGAR7c9Ifd6b1DFGkWSBuEc6RWhG6Si+OPbELYoFRXTqNZoiynGsSV9v2ZTBemTmkVrXGqG3N0bLezr47/9+lW3ZP7ZrubsfWf/3xrZAt/g8V9OgaI2w4SWKfuepsElFzsWeiLroltjmH58Axd3/cjhgpqaZ3DOQjbK/7QZsvJUAlsCgYEAqTQVhKLizM7BvXu1N6Z2K8trfJbiN+f90XhZIRPkIIcom0PnOfXhRtT76MCxz9n+lwf+alOKOfbQFy0pZtWG/eaFSYroQlXL+EfmqlFPXZR6D0NQLeygWAKH8161IQUh2VF3Qkhle6g6ZkyJA3Ev4RmqH2BYGv8hcZTTHsZ3Ic4="
|
||||
AlipayPublicKey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2CqoCp95w/JV3RT/gzF4/8QmVT1HQNaeW7yUp+mA7x9AbjvlTW/+eRn6oGAL/XhZLjvHD0XjKLVKX0MJVS1aUQHEHEbOJN4Eu8II45OavD4iZISa7Kp9V6AM+i4qTyaeV2wNDnGxHQBaLVUGCfMR+56EK2YpORdE1H9uy72SSQseVb3bmpsV9EW/IJNmcVL/ut3uA1JWAoRmzlQ7ekxg7p8AYXzYPEHQr1tl7W+M4zv9wO9GKZCxIqMA8U3RP5npPfRaCfIRGzXzCqFEEUvWuidOB7frsvN4jiPD07qpL2Bi9LM1X/ee2kC/oM8Uhd7ERZhG8MbZfijZKxgrsDKBcwIDAQAB"
|
||||
AppCertPath: "etc/merchant/appCertPublicKey_2021004165608254.crt"
|
||||
AppID: "2021006129617228"
|
||||
PrivateKey: "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQChnB4yOExQu8YF1cIdzIKMVE+sSwH7QFq73H1Tam0W6dvO4g3sXsOP/ddQHoIYz8rbwcgtGYZtIl0huJ2/jCRl60ZY6mv2B3NHl9C9HYqzx9xXxOhUwlaIQEV5ZregQ4KfCGHgpUA7SG/kXj9oUkSOD7AWwbJi2AVmN4YlD2TILzN8MwaYhNvpdfJvno7Z+HXMAO23SkHifjLZFLSxQQLXXOsK5DKsmQUrd24aNKyuyT4oH9eB+/MIbpLZrPPcdNmL/Wefs8Mb9/DXgZ3jd7GGVIubxSU5O4KLbJ/thFukfQGgbv8LML6ksKmLunXk5qPv3LA2rCedFF8fn4BkT63lAgMBAAECggEANBXe3Yyre/Go1sSX9YauJJAfxYW/M70AAUAE3FeWpSXmA/1zQ1Ufbk7/kADlKR3/YWhJHc/2NUI4BeA8ZznBmV+Eoq+a8AZirxZM3kahJ2Qordj2kCq6PNuKCKCEWhCoDp1i/kYEN5cXCOEfSn4JPkfsFsmCtryssM8AWv1lG+cnNWo8bwoE8WBYUG2MjqemVyn9IKTPmlGORMALHddOoFupwotEVsoFQRt/NMEN2rzJT9BuBl7RedKjP921bIB8OprD9Vz4Htp3C6lz/MNsE69IajjWaTiIkDrvsqSPMMn9r8u/Ooi9V7NE7EGdS/jLwCCM5p8ycL63mF9wNX8eAQKBgQDYCOLfL7775uSSj6En1hhr8DBkbDtBJvPVNeJ404za3936gL+ntuqzAvLmE03HLlks0rgScJveAtV/GtWt/4dGbq5T0Nso0gSDk1g3oMEW3bZsS2hSa5CuwRVtJ7/tYrYchp0S31c6JXhoRpqtfbmGoEQbDuif0m9IACIzzG2pJQKBgQC/gb4iHAXxIYHEgrcqtAaReOkvWsqLtjfFxPV9XUAKTQknx8Xf2RK/TENF68xe03oHoVpRh5vDX5Nwv6191LYzi/P55MviBH7uE6azcESFGISSb7CdKMZFDiV1XYHkwCaQoGh3L11o252en99oDbRtH1rCAnUA9/vwRvCaORy1wQKBgQCxFNeiyqhqI6FI4aLf3Ia4M3H3XyBTD3LfWgQBtqbG4qo6JD71YuKPSeOA5GHk2wEN1Mw9kUCygvAt9/kfX02rVh5fZdu/YieBEs5FCug7rhFSQ52HsdQu6uZ9Sw/vrfJI/67RQXFmoEBKeVVg0KW6zLQG2fmkyAGfqzxd6TwaYQKBgBFYfxA32ZHtpwNVk6GajL3AZd6UKqRc7NBM9q9UMui78YhY3+NWlgwdrDo5EVnFbdgjFTstPT6E+aXMtroe+iHRG1gXESB3p8eIoCDAmnQztE5PL4AMoWi/z0TCI3HEtbmDzfJ9p8hHnA8yC9ow45a+sEnCTza3P2qUAlb1tVQBAoGATNlojr8dMziX7N2K792IgcMA8bu46plFX6PKsT3tq5jVcGlewU+9tqJk5yoPB5cJwyUm6rq6EividXx6vbfxR3VTU3wTtkLxwHqg8x2qFncHm9ElFzpYLOzI2Hbp0nBaSUdRK9FQxn+hqXz9M9pBDPIAu/W97Pz6vyFdqRxUIl4="
|
||||
AlipayPublicKey: ""
|
||||
AppCertPath: "etc/merchant/appCertPublicKey_2021006129617228.crt"
|
||||
AlipayCertPath: "etc/merchant/alipayCertPublicKey_RSA2.crt"
|
||||
AlipayRootCertPath: "etc/merchant/alipayRootCert.crt"
|
||||
IsProduction: true
|
||||
NotifyUrl: "https://6m4685017o.goho.co/api/v1/pay/alipay/callback"
|
||||
ReturnURL: "http://localhost:5678/inquire"
|
||||
|
||||
Wxpay:
|
||||
AppID: "wx442ee1ac1ee75917"
|
||||
MchID: "1687993434"
|
||||
@@ -57,7 +69,7 @@ Applepay:
|
||||
BundleID: "com.allinone.check"
|
||||
IssuerID: "bf828d85-5269-4914-9660-c066e09cd6ef"
|
||||
KeyID: "LAY65829DQ"
|
||||
LoadPrivateKeyPath: "etc/merchant/AuthKey_LAY65829DQ.p8"
|
||||
LoadPrivateKeyPath: "app/main/api/etc/merchant/AuthKey_LAY65829DQ.p8"
|
||||
Ali:
|
||||
Code: "d55b58829efb41c8aa8e86769cba4844"
|
||||
SystemConfig:
|
||||
@@ -66,10 +78,8 @@ WechatH5:
|
||||
AppID: "wx442ee1ac1ee75917"
|
||||
AppSecret: "c80474909db42f63913b7a307b3bee17"
|
||||
WechatMini:
|
||||
AppID: "wx781abb66b3368963" # 小程序的AppID
|
||||
AppSecret: "c7d02cdb0fc23c35c93187af9243b00d" # 小程序的AppSecret
|
||||
TycAppID: "wxe74617f3dd56c196"
|
||||
TycAppSecret: "c8207e54aef5689b2a7c1f91ed7ae8a0"
|
||||
AppID: "wxc12fd469eb3730fd" # 小程序的AppID
|
||||
AppSecret: "1dbb76843f1e12bef33ba3de61e2d6dd" # 小程序的AppSecret
|
||||
Query:
|
||||
ShareLinkExpire: 604800 # 7天 = 7 * 24 * 60 * 60 = 604800秒
|
||||
AdminConfig:
|
||||
@@ -80,8 +90,8 @@ TaxConfig:
|
||||
TaxRate: 0.06
|
||||
TaxExemptionAmount: 0.00
|
||||
Tianyuanapi:
|
||||
AccessID: "7f8a9b2c4d5e6f1a"
|
||||
Key: "9e4f8a1b3c6d7e2f5a8b9c0d1e4f7a2b"
|
||||
AccessID: "9e60b34eb51f3827"
|
||||
Key: "04c6b4c559be6d5ba5351c04c8713a64"
|
||||
BaseURL: "https://api.tianyuanapi.com"
|
||||
Timeout: 60
|
||||
Authorization:
|
||||
|
||||
@@ -16,16 +16,28 @@ VerifyCode:
|
||||
AccessKeyID: "LTAI5tKGB3TVJbMHSoZN3yr9"
|
||||
AccessKeySecret: "OCQ30GWp4yENMjmfOAaagksE18bp65"
|
||||
EndpointURL: "dysmsapi.aliyuncs.com"
|
||||
SignName: "天远查"
|
||||
SignName: "海南海宇大数据"
|
||||
TemplateCode: "SMS_302641455"
|
||||
ValidTime: 300
|
||||
|
||||
Captcha:
|
||||
# 建议与短信相同的 AccessKey,或单独为验证码创建子账号
|
||||
AccessKeyID: "LTAI5tKGB3TVJbMHSoZN3yr9"
|
||||
AccessKeySecret: "OCQ30GWp4yENMjmfOAaagksE18bp65"
|
||||
# 验证码服务 Endpoint,国内一般为 captcha.cn-shanghai.aliyuncs.com
|
||||
EndpointURL: "captcha.cn-shanghai.aliyuncs.com"
|
||||
# 阿里云控制台中该场景的 SceneId,请替换为真实值
|
||||
SceneID: "wynt39to"
|
||||
# 验证码控制台中的 ekey(通常为 Base64 字符串),用于生成 EncryptedSceneId
|
||||
EKey: ""
|
||||
|
||||
Encrypt:
|
||||
SecretKey: "ff83609b2b24fc73196aac3d3dfb874f"
|
||||
Alipay:
|
||||
AppID: "2021004165608254"
|
||||
PrivateKey: "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCPsXuwFJeHAL8CwI0QdD9GP7xQ8eejIoQKg6J3/peu26su68JCtGSRhlDm/7vbLHJcFR6h7at+INoz2juc7SqlmNO7i9wKc3+Ua0487y1G2fCsneRNxTTqbceBZwqjj9/AAN0u5/4nSl0bcqTeMddofdpTGOvwGvIJh6CZgCglnhMZnH4D6H6yiIyZf7Q6k2d/qBpVGK8kluYEtSnf/vEQCHhxRx+/DgTL7V1LjbA3BYoPTELZ15JAj0uIzuxextAtxOm4+Huli0RJFAN3q/to2L1Zs8yYY1gKJyTaPWKsJWBx8zI+gZcC/e45k6CZnGgh1Fn3+Xqkf7eGxJGGHs1fAgMBAAECggEAM2rkApbrvdBDiV2TXK7sMVv/K8vUAmkIbKa7zUpZxqUuNSUBp1LbpcM1UeNyujPGXDLmejUMp55j1igiKr4nA4iTQ0oBm+/GWDqpjV5cijzURUBegIGvtK9Bs4lGok6KVy839l/nbvHKLVcxrZySIv7dz9xcGNfbghN5IVRdiU/kOokNbtwQNC837piG5q4PHL6bzwIUGbrLED/RDmw/IwVMMmZovcQQ2JAuWJBo9CS9LB0Nc3I4MOPNx/0Rl+5URSSfmJAriL5ihlWckocQCUHwhRpSGQ6Q4xAXFYvb8OsApAQG3WU9SciBfs2wg/QfGNFzwQgGFofPcTQg3DTeuQKBgQDUHBTsgoe3WXnGo6qZKw1zA4OtF67IJJoltHo5JtkBRKCNVU3BJ+q+6i/fn0MBwScKQ1mhPjWe3h+qTRT207RRxGaxb6ljATOiU+BxmpHvu6jP+DVYtP5F3M7MCAGqpDAEoXgoAWttxmijqk+5YuLOLe0j/btCmpzuH7zwxSnqlQKBgQCtbTvaS/g+Jeu4Ml6iv7xi5//JCjeTn2wUJpXnNmN0jn+riRwEO81z4GWuOI8WukZHHAnufI6qWk2sLH0gcdLQ/STsMnl2L3NbeUyO8o5w2JSAlnZDYfaFfasGqFkGJrBLqG6bh/Bk1DP3/Bl6iMEwDbmu7Ptoy8ihokng9dEPIwKBgBHdi6WgGO5IiwlAH85m4eseEKkzpXUWICWs3d6SdxS0QxGkbbgnNI6ACyg6sdoj+rXSlmoOY1XOP7yIYYuoqTd542xui0XbhA3YIr9u1XvrwnxB27xtAj3AK2rkAb/ttF2ve/9inznPzGB8p9plidTz6VVuuacSfsVPxwpAkRdBAoGAR7c9Ifd6b1DFGkWSBuEc6RWhG6Si+OPbELYoFRXTqNZoiynGsSV9v2ZTBemTmkVrXGqG3N0bLezr47/9+lW3ZP7ZrubsfWf/3xrZAt/g8V9OgaI2w4SWKfuepsElFzsWeiLroltjmH58Axd3/cjhgpqaZ3DOQjbK/7QZsvJUAlsCgYEAqTQVhKLizM7BvXu1N6Z2K8trfJbiN+f90XhZIRPkIIcom0PnOfXhRtT76MCxz9n+lwf+alOKOfbQFy0pZtWG/eaFSYroQlXL+EfmqlFPXZR6D0NQLeygWAKH8161IQUh2VF3Qkhle6g6ZkyJA3Ev4RmqH2BYGv8hcZTTHsZ3Ic4="
|
||||
AlipayPublicKey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2CqoCp95w/JV3RT/gzF4/8QmVT1HQNaeW7yUp+mA7x9AbjvlTW/+eRn6oGAL/XhZLjvHD0XjKLVKX0MJVS1aUQHEHEbOJN4Eu8II45OavD4iZISa7Kp9V6AM+i4qTyaeV2wNDnGxHQBaLVUGCfMR+56EK2YpORdE1H9uy72SSQseVb3bmpsV9EW/IJNmcVL/ut3uA1JWAoRmzlQ7ekxg7p8AYXzYPEHQr1tl7W+M4zv9wO9GKZCxIqMA8U3RP5npPfRaCfIRGzXzCqFEEUvWuidOB7frsvN4jiPD07qpL2Bi9LM1X/ee2kC/oM8Uhd7ERZhG8MbZfijZKxgrsDKBcwIDAQAB"
|
||||
AppCertPath: "etc/merchant/appCertPublicKey_2021004165608254.crt"
|
||||
AppID: "2021006129617228"
|
||||
PrivateKey: "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQChnB4yOExQu8YF1cIdzIKMVE+sSwH7QFq73H1Tam0W6dvO4g3sXsOP/ddQHoIYz8rbwcgtGYZtIl0huJ2/jCRl60ZY6mv2B3NHl9C9HYqzx9xXxOhUwlaIQEV5ZregQ4KfCGHgpUA7SG/kXj9oUkSOD7AWwbJi2AVmN4YlD2TILzN8MwaYhNvpdfJvno7Z+HXMAO23SkHifjLZFLSxQQLXXOsK5DKsmQUrd24aNKyuyT4oH9eB+/MIbpLZrPPcdNmL/Wefs8Mb9/DXgZ3jd7GGVIubxSU5O4KLbJ/thFukfQGgbv8LML6ksKmLunXk5qPv3LA2rCedFF8fn4BkT63lAgMBAAECggEANBXe3Yyre/Go1sSX9YauJJAfxYW/M70AAUAE3FeWpSXmA/1zQ1Ufbk7/kADlKR3/YWhJHc/2NUI4BeA8ZznBmV+Eoq+a8AZirxZM3kahJ2Qordj2kCq6PNuKCKCEWhCoDp1i/kYEN5cXCOEfSn4JPkfsFsmCtryssM8AWv1lG+cnNWo8bwoE8WBYUG2MjqemVyn9IKTPmlGORMALHddOoFupwotEVsoFQRt/NMEN2rzJT9BuBl7RedKjP921bIB8OprD9Vz4Htp3C6lz/MNsE69IajjWaTiIkDrvsqSPMMn9r8u/Ooi9V7NE7EGdS/jLwCCM5p8ycL63mF9wNX8eAQKBgQDYCOLfL7775uSSj6En1hhr8DBkbDtBJvPVNeJ404za3936gL+ntuqzAvLmE03HLlks0rgScJveAtV/GtWt/4dGbq5T0Nso0gSDk1g3oMEW3bZsS2hSa5CuwRVtJ7/tYrYchp0S31c6JXhoRpqtfbmGoEQbDuif0m9IACIzzG2pJQKBgQC/gb4iHAXxIYHEgrcqtAaReOkvWsqLtjfFxPV9XUAKTQknx8Xf2RK/TENF68xe03oHoVpRh5vDX5Nwv6191LYzi/P55MviBH7uE6azcESFGISSb7CdKMZFDiV1XYHkwCaQoGh3L11o252en99oDbRtH1rCAnUA9/vwRvCaORy1wQKBgQCxFNeiyqhqI6FI4aLf3Ia4M3H3XyBTD3LfWgQBtqbG4qo6JD71YuKPSeOA5GHk2wEN1Mw9kUCygvAt9/kfX02rVh5fZdu/YieBEs5FCug7rhFSQ52HsdQu6uZ9Sw/vrfJI/67RQXFmoEBKeVVg0KW6zLQG2fmkyAGfqzxd6TwaYQKBgBFYfxA32ZHtpwNVk6GajL3AZd6UKqRc7NBM9q9UMui78YhY3+NWlgwdrDo5EVnFbdgjFTstPT6E+aXMtroe+iHRG1gXESB3p8eIoCDAmnQztE5PL4AMoWi/z0TCI3HEtbmDzfJ9p8hHnA8yC9ow45a+sEnCTza3P2qUAlb1tVQBAoGATNlojr8dMziX7N2K792IgcMA8bu46plFX6PKsT3tq5jVcGlewU+9tqJk5yoPB5cJwyUm6rq6EividXx6vbfxR3VTU3wTtkLxwHqg8x2qFncHm9ElFzpYLOzI2Hbp0nBaSUdRK9FQxn+hqXz9M9pBDPIAu/W97Pz6vyFdqRxUIl4="
|
||||
AlipayPublicKey: ""
|
||||
AppCertPath: "etc/merchant/appCertPublicKey_2021006129617228.crt"
|
||||
AlipayCertPath: "etc/merchant/alipayCertPublicKey_RSA2.crt"
|
||||
AlipayRootCertPath: "etc/merchant/alipayRootCert.crt"
|
||||
IsProduction: true
|
||||
@@ -41,7 +53,7 @@ Wxpay:
|
||||
MchPublicKeyPath: "etc/merchant/pub_key.pem"
|
||||
MchPlatformRAS: "5630D013C88EA348BF66E642B6C39AA0180D4B15"
|
||||
NotifyUrl: "https://www.onecha.cn/api/v1/pay/wechat/callback"
|
||||
RefundNotifyUrl: "https://www.onecha.cn/api/v1/wechat/refund_callback"
|
||||
RefundNotifyUrl: "https://www.onecha.cn/api/v1/pay/wechat/refund_callback"
|
||||
Applepay:
|
||||
ProductionVerifyURL: "https://api.storekit.itunes.apple.com/inApps/v1/transactions/receipt"
|
||||
SandboxVerifyURL: "https://api.storekit-sandbox.itunes.apple.com/inApps/v1/transactions/receipt"
|
||||
@@ -56,8 +68,8 @@ WechatH5:
|
||||
AppID: "wx442ee1ac1ee75917"
|
||||
AppSecret: "c80474909db42f63913b7a307b3bee17"
|
||||
WechatMini:
|
||||
AppID: "wx5bacc94add2da981" # 小程序的AppID
|
||||
AppSecret: "48a2c1e8ff1b7d4c0ff82fbefa64d2d0" # 小程序的AppSecret
|
||||
AppID: "wxc12fd469eb3730fd" # 小程序的AppID
|
||||
AppSecret: "1dbb76843f1e12bef33ba3de61e2d6dd" # 小程序的AppSecret
|
||||
Query:
|
||||
ShareLinkExpire: 604800 # 7天 = 7 * 24 * 60 * 60 = 604800秒
|
||||
AdminConfig:
|
||||
@@ -68,8 +80,8 @@ TaxConfig:
|
||||
TaxRate: 0.06
|
||||
TaxExemptionAmount: 0.00
|
||||
Tianyuanapi:
|
||||
AccessID: "7f8a9b2c4d5e6f1a"
|
||||
Key: "9e4f8a1b3c6d7e2f5a8b9c0d1e4f7a2b"
|
||||
AccessID: "9e60b34eb51f3827"
|
||||
Key: "04c6b4c559be6d5ba5351c04c8713a64"
|
||||
BaseURL: "https://api.tianyuanapi.com"
|
||||
Timeout: 60
|
||||
Authorization:
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDuDCCAqCgAwIBAgIQICQIJEqhy5G63s3j7VrljTANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE
|
||||
MIIDrzCCApegAwIBAgIQICYBJSGBNP/dFk3HtTIEnjANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE
|
||||
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0
|
||||
aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IENs
|
||||
YXNzIDIgUjEwHhcNMjQwODI0MTMzMDA3WhcNMjkwODIzMTMzMDA3WjCBmDELMAkGA1UEBhMCQ04x
|
||||
MzAxBgNVBAoMKua1t+WNl+ecgeWtpuWuh+aAnee9kee7nOenkeaKgOaciemZkOWFrOWPuDEPMA0G
|
||||
A1UECwwGQWxpcGF5MUMwQQYDVQQDDDrmlK/ku5jlrp0o5Lit5Zu9Kee9kee7nOaKgOacr+aciemZ
|
||||
kOWFrOWPuC0yMDg4ODQxODczNDU0MDUzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
|
||||
2CqoCp95w/JV3RT/gzF4/8QmVT1HQNaeW7yUp+mA7x9AbjvlTW/+eRn6oGAL/XhZLjvHD0XjKLVK
|
||||
X0MJVS1aUQHEHEbOJN4Eu8II45OavD4iZISa7Kp9V6AM+i4qTyaeV2wNDnGxHQBaLVUGCfMR+56E
|
||||
K2YpORdE1H9uy72SSQseVb3bmpsV9EW/IJNmcVL/ut3uA1JWAoRmzlQ7ekxg7p8AYXzYPEHQr1tl
|
||||
7W+M4zv9wO9GKZCxIqMA8U3RP5npPfRaCfIRGzXzCqFEEUvWuidOB7frsvN4jiPD07qpL2Bi9LM1
|
||||
X/ee2kC/oM8Uhd7ERZhG8MbZfijZKxgrsDKBcwIDAQABoxIwEDAOBgNVHQ8BAf8EBAMCA/gwDQYJ
|
||||
KoZIhvcNAQELBQADggEBADsqTEJB7QQc+zFteTgZ608BnTvVlZlPHK+5pLFSG9N1XK3LCv2wj1Tc
|
||||
FfDo6VXq5YhLmIIp8LlyUWTn5Gwd+/3Rbv50p52CvzsdeqZ9kSJAqFyO4iWmAPUB4f63yLH81q+1
|
||||
eyUjc4GkUmZ3EZmB2+vyG2iRHvyG27TYbWrGPWz4AaPECU5jn3rIPDVvR6C9JXjODiiuU5PCVJ9j
|
||||
pCmGgmllTYAHSvhkOF8zM+qt1Fz0iEtB2ZPMzKexBD4uz8ULkwp+x3QvuLD/ebBbMr2R3BJMCD+3
|
||||
2dx0wQJ0OhXuXGOXbuwyAo17LmRKheucoadlT+7Ilr+i5JrAwApBLQSQI6w=
|
||||
YXNzIDIgUjEwHhcNMjYwMTI1MTA1NzMxWhcNMzEwMTI0MTA1NzMxWjCBjzELMAkGA1UEBhMCQ04x
|
||||
KjAoBgNVBAoMIea1t+WNl+a1t+Wuh+Wkp+aVsOaNruaciemZkOWFrOWPuDEPMA0GA1UECwwGQWxp
|
||||
cGF5MUMwQQYDVQQDDDrmlK/ku5jlrp0o5Lit5Zu9Kee9kee7nOaKgOacr+aciemZkOWFrOWPuC0y
|
||||
MDg4MjUxOTEzNDA0MjU4MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkQ51RD+Z+6lX
|
||||
RQtx1vrEoxX8fMZKQMhUcvQhPwn9edXP3Dcwa9osIl/ncXQBFd1KiE0IUP8unfgyPgVsWxL5npfd
|
||||
ReqA35hsjuN2jB1d/SASwMTio2Zdqjbh3tK7MsnRdgpj/u2RpOK1gSp6yScZM67h1t4ScXdsrpd4
|
||||
VBXuvffloL/anZkrAoVtCjlmreXI/cnKMOqO19YckPGax7kFD5vTOknydIASqMJTTDThfbUzbkHH
|
||||
GK16s18PYvDivhz/LSgvjAGd2e0G9PXLUJAMsedg+cnBLNba0NqLxHhX4//SfnmataK4MB0s4eEs
|
||||
sNCkYuXVF+odEp8wxNhaPhMj8QIDAQABoxIwEDAOBgNVHQ8BAf8EBAMCA/gwDQYJKoZIhvcNAQEL
|
||||
BQADggEBAJjgYw0gjfY82GH+MDlb3ThlDBpAckI/PskaO80ZlkMJ3i2QIXkqXJgNmoL/WyG3kLWC
|
||||
ek2REzbhZvNk/Pm8hulNTpTM/0HFffDgVDIvVgXNjY6JdCnRiCimrAQ87P+ZP9Og7pD+m+cWl92k
|
||||
rYZNx1qtbltF0lGAoV9KwgSg9EFPTLst+RCQmbHsRpsDWdK+3mIPd4YeegIL/3QDf7j94aJ9FWGj
|
||||
HHzQrXsLw/brfm8QMSwuByh8mynHWxFK4l3Ndo3HPKSZOHs7VfNPcSyD15q/RF2tzt8DFvbXnfwI
|
||||
GrOKL72CBwmxfMUYvTYqcKzLsgxuPbC6r4csMYhMFdhHGKg=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIE4jCCAsqgAwIBAgIIYsSr5bKAMl8wDQYJKoZIhvcNAQELBQAwejELMAkGA1UEBhMCQ04xFjAU
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEpzCCA4+gAwIBAgIQICUEEJni7ld+YaII5tXCjTANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE
|
||||
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0
|
||||
aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IENs
|
||||
YXNzIDEgUjEwHhcNMjUwNDEwMDQwNTQyWhcNMzAwNDA5MDQwNTQyWjBuMQswCQYDVQQGEwJDTjEz
|
||||
MDEGA1UECgwq5rW35Y2X55yB5a2m5a6H5oCd572R57uc56eR5oqA5pyJ6ZmQ5YWs5Y+4MQ8wDQYD
|
||||
VQQLDAZBbGlwYXkxGTAXBgNVBAMMEDIwODg4NDE4NzM0NTQwNTMwggEiMA0GCSqGSIb3DQEBAQUA
|
||||
A4IBDwAwggEKAoIBAQCPsXuwFJeHAL8CwI0QdD9GP7xQ8eejIoQKg6J3/peu26su68JCtGSRhlDm
|
||||
/7vbLHJcFR6h7at+INoz2juc7SqlmNO7i9wKc3+Ua0487y1G2fCsneRNxTTqbceBZwqjj9/AAN0u
|
||||
5/4nSl0bcqTeMddofdpTGOvwGvIJh6CZgCglnhMZnH4D6H6yiIyZf7Q6k2d/qBpVGK8kluYEtSnf
|
||||
/vEQCHhxRx+/DgTL7V1LjbA3BYoPTELZ15JAj0uIzuxextAtxOm4+Huli0RJFAN3q/to2L1Zs8yY
|
||||
Y1gKJyTaPWKsJWBx8zI+gZcC/e45k6CZnGgh1Fn3+Xqkf7eGxJGGHs1fAgMBAAGjggEqMIIBJjAf
|
||||
BgNVHSMEGDAWgBRxB+IEYRbk5fJl6zEPyeD0PJrVkTAdBgNVHQ4EFgQUb4Kgf8qXsgDnWyG5deLm
|
||||
Rw1DhPowQAYDVR0gBDkwNzA1BgdggRwBbgEBMCowKAYIKwYBBQUHAgEWHGh0dHA6Ly9jYS5hbGlw
|
||||
YXkuY29tL2Nwcy5wZGYwDgYDVR0PAQH/BAQDAgbAMDAGA1UdHwQpMCcwJaAjoCGGH2h0dHA6Ly9j
|
||||
YS5hbGlwYXkuY29tL2NybDEwMC5jcmwwYAYIKwYBBQUHAQEEVDBSMCgGCCsGAQUFBzAChhxodHRw
|
||||
Oi8vY2EuYWxpcGF5LmNvbS9jYTYuY2VyMCYGCCsGAQUFBzABhhpodHRwOi8vY2EuYWxpcGF5LmNv
|
||||
bTo4MzQwLzANBgkqhkiG9w0BAQsFAAOCAQEAYFgnBMeYL/+DjWpimqTtlGnlDsjPUDOjpZopzSa+
|
||||
HdL4nxWZBW48K+EzN8x45Ua7b1VKNmHWXe1O3X6W2Cz2H53NslVglzipPnxg9REx3Acr+8spkxWe
|
||||
oxX9+1xwbSzBnpwG4UayambP0I6L2V9YQxSiLlLr6t2VuDxwCHVLu83rvnrOdlKjyjZop6oufhC9
|
||||
29BqfVmR6xuZv/VsCRx+BuRqNtHDoOZuP26kRVaHdnZMPPyTVw++cBt5Xh0Pq6vrYr1Nr9Kkp7wy
|
||||
8RW951YTarYY5rDQ8RdaEFxPc+QWKQujVFQCvvt3ktTzrVa1mCgW/vX5qI0hXdPGGbq0DH3dxg==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,23 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEnjCCA4agAwIBAgIQICYBJUC8w9JR1ono3J6eXTANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE
|
||||
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0
|
||||
aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IENs
|
||||
YXNzIDEgUjEwHhcNMjYwMTI1MTA1NzMwWhcNMzEwMTI0MTA1NzMwWjBlMQswCQYDVQQGEwJDTjEq
|
||||
MCgGA1UECgwh5rW35Y2X5rW35a6H5aSn5pWw5o2u5pyJ6ZmQ5YWs5Y+4MQ8wDQYDVQQLDAZBbGlw
|
||||
YXkxGTAXBgNVBAMMEDIwODgyNTE5MTM0MDQyNTgwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
|
||||
AoIBAQChnB4yOExQu8YF1cIdzIKMVE+sSwH7QFq73H1Tam0W6dvO4g3sXsOP/ddQHoIYz8rbwcgt
|
||||
GYZtIl0huJ2/jCRl60ZY6mv2B3NHl9C9HYqzx9xXxOhUwlaIQEV5ZregQ4KfCGHgpUA7SG/kXj9o
|
||||
UkSOD7AWwbJi2AVmN4YlD2TILzN8MwaYhNvpdfJvno7Z+HXMAO23SkHifjLZFLSxQQLXXOsK5DKs
|
||||
mQUrd24aNKyuyT4oH9eB+/MIbpLZrPPcdNmL/Wefs8Mb9/DXgZ3jd7GGVIubxSU5O4KLbJ/thFuk
|
||||
fQGgbv8LML6ksKmLunXk5qPv3LA2rCedFF8fn4BkT63lAgMBAAGjggEqMIIBJjAfBgNVHSMEGDAW
|
||||
gBRxB+IEYRbk5fJl6zEPyeD0PJrVkTAdBgNVHQ4EFgQU3DI06nLE+mBhs3ZvNofQ86FekdwwQAYD
|
||||
VR0gBDkwNzA1BgdggRwBbgEBMCowKAYIKwYBBQUHAgEWHGh0dHA6Ly9jYS5hbGlwYXkuY29tL2Nw
|
||||
cy5wZGYwDgYDVR0PAQH/BAQDAgbAMDAGA1UdHwQpMCcwJaAjoCGGH2h0dHA6Ly9jYS5hbGlwYXku
|
||||
Y29tL2NybDEwOS5jcmwwYAYIKwYBBQUHAQEEVDBSMCgGCCsGAQUFBzAChhxodHRwOi8vY2EuYWxp
|
||||
cGF5LmNvbS9jYTYuY2VyMCYGCCsGAQUFBzABhhpodHRwOi8vY2EuYWxpcGF5LmNvbTo4MzQwLzAN
|
||||
BgkqhkiG9w0BAQsFAAOCAQEAJGeEwijmgFt3Nk9WFljjpQ9pUwGYrvaIam9eiBLVe7LbAMLXIeai
|
||||
9ej7lBp3WJ4CkWqvnJKEFWN3u+jiyA3iIg208Wsj+DZCqnuqo5Yg+OzAPj9J8YPNptN76VQ2ZOsH
|
||||
MaZAp/HH0hmAznJ5VBGHeqf8E7du/kS8pe0MNg2HgAPyXbrFoNWl40KPNNRm+dO2yPn9kMxhE4BE
|
||||
Qos7E2WhZ/UwX1zv8jJLOuXJtwCbhbBZ9cDg60Rj5VxEnDoAE23d6l9e13jizDol+hsQIFYQHLng
|
||||
xiARUyLcb9G3wfmAl6prXCK61LxZWzP07s54kykLgF5lQeM7yaCgo93fZ/fztg==
|
||||
-----END CERTIFICATE-----
|
||||
43
app/main/api/etc/merchant/bak/alipayCertPublicKey_RSA2.crt
Normal file
43
app/main/api/etc/merchant/bak/alipayCertPublicKey_RSA2.crt
Normal file
@@ -0,0 +1,43 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDrzCCApegAwIBAgIQICUSBOVPmqSb4NzESDUfmDANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE
|
||||
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0
|
||||
aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IENs
|
||||
YXNzIDIgUjEwHhcNMjUxMjA0MDg0MzU1WhcNMzAxMjAzMDg0MzU1WjCBjzELMAkGA1UEBhMCQ04x
|
||||
KjAoBgNVBAoMIea1t+WNl+a1t+Wuh+Wkp+aVsOaNruaciemZkOWFrOWPuDEPMA0GA1UECwwGQWxp
|
||||
cGF5MUMwQQYDVQQDDDrmlK/ku5jlrp0o5Lit5Zu9Kee9kee7nOaKgOacr+aciemZkOWFrOWPuC0y
|
||||
MDg4OTQxNTA3NzkwNjA0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiuKilHTo/kPL
|
||||
cD8ez6HtudB5BrrHz2H+hxbb+5kwPjaE14HCws9fbgtIxxaDWyKKOpUGqo5RGmMFpPaQfci0meBD
|
||||
G0XyBafGyzDvivrkBCa2gQSzKzuxoFyNkBAubih91gYz6ZyfMDLmfeCR7ItapUtCRtt+xg1O64s+
|
||||
cZOSL94o8UnrUBJRW6auhhE8kDibxPpekSOqaWmlt6G8R1xMmf4CxdrErxLajCC3wmSEOyA5yu1M
|
||||
yU/8Ve8g70zXgGAgQHXxgMblp9BE+dL11VIeyB0HEa68YVwtlUzbhtk+NPy+TI8wNMASjlr9oeoo
|
||||
X0nm+oqXOBUwPW+txB1yeQ8tKQIDAQABoxIwEDAOBgNVHQ8BAf8EBAMCA/gwDQYJKoZIhvcNAQEL
|
||||
BQADggEBAHIbaJsjcPXKgpWxSFkr+ScYwQiqry+hh5kqgQLAhGYlcHQurbCP0kvlUWMZhGJR2no/
|
||||
b70xe+HZbxf5c4iVv6vss7o3nBGghMFYhpGfOCYDYeGkANEkczpDL5oBpgSbp/nN5zI9RQsYomD6
|
||||
Vp5QWvXZEM1/nz0o5nM3MfcF3/xC9/rO0ZqnE0TLJ2khmJmz5OIeqF0WdMXx5Q4/T70fFzpA+q/l
|
||||
BfiGYtcNNu1N7Db2y495C9nmax+AHoaHQpWXtgwOaq5TlAs6FDl/Nj7o0uTK0NsVgIEKzF4xszrn
|
||||
tOeb3KiVXE+wwaD5DXhsqO7uYTrVDsOy6HfKZST/LNS/E+M=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIE4jCCAsqgAwIBAgIIYsSr5bKAMl8wDQYJKoZIhvcNAQELBQAwejELMAkGA1UEBhMCQ04xFjAU
|
||||
BgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0aG9yaXR5MTEw
|
||||
LwYDVQQDDChBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFIxMB4XDTE4MDMy
|
||||
MjE0MzQxNVoXDTM3MTEyNjE0MzQxNVowgYIxCzAJBgNVBAYTAkNOMRYwFAYDVQQKDA1BbnQgRmlu
|
||||
YW5jaWFsMSAwHgYDVQQLDBdDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTE5MDcGA1UEAwwwQW50IEZp
|
||||
bmFuY2lhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBDbGFzcyAyIFIxMIIBIjANBgkqhkiG9w0B
|
||||
AQEFAAOCAQ8AMIIBCgKCAQEAsLMfYaoRoPRbmDcAfXPCmKf43pWRN5yTXa/KJWO0l+mrgQvs89bA
|
||||
NEvbDUxlkGwycwtwi5DgBuBgVhLliXu+R9CYgr2dXs8D8Hx/gsggDcyGPLmVrDOnL+dyeauheARZ
|
||||
fA3du60fwEwwbGcVIpIxPa/4n3IS/ElxQa6DNgqxh8J9Xwh7qMGl0JK9+bALuxf7B541Gr4p0WEN
|
||||
G8fhgjBV4w4ut9eQLOoa1eddOUSZcy46Z7allwowwgt7b5VFfx/P1iKJ3LzBMgkCK7GZ2kiLrL7R
|
||||
iqV+h482J7hkJD+ardoc6LnrHO/hIZymDxok+VH9fVeUdQa29IZKrIDVj65THQIDAQABo2MwYTAf
|
||||
BgNVHSMEGDAWgBRfdLQEwE8HWurlsdsio4dBspzhATAdBgNVHQ4EFgQUSqHkYINtUSAtDPnS8Xoy
|
||||
oP9p7qEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggIB
|
||||
AIQ8TzFy4bVIVb8+WhHKCkKNPcJe2EZuIcqvRoi727lZTJOfYy/JzLtckyZYfEI8J0lasZ29wkTt
|
||||
a1IjSo+a6XdhudU4ONVBrL70U8Kzntplw/6TBNbLFpp7taRALjUgbCOk4EoBMbeCL0GiYYsTS0mw
|
||||
7xdySzmGQku4GTyqutIGPQwKxSj9iSFw1FCZqr4VP4tyXzMUgc52SzagA6i7AyLedd3tbS6lnR5B
|
||||
L+W9Kx9hwT8L7WANAxQzv/jGldeuSLN8bsTxlOYlsdjmIGu/C9OWblPYGpjQQIRyvs4Cc/mNhrh+
|
||||
14EQgwuemIIFDLOgcD+iISoN8CqegelNcJndFw1PDN6LkVoiHz9p7jzsge8RKay/QW6C03KNDpWZ
|
||||
EUCgCUdfHfo8xKeR+LL1cfn24HKJmZt8L/aeRZwZ1jwePXFRVtiXELvgJuM/tJDIFj2KD337iV64
|
||||
fWcKQ/ydDVGqfDZAdcU4hQdsrPWENwPTQPfVPq2NNLMyIH9+WKx9Ed6/WzeZmIy5ZWpX1TtTolo6
|
||||
OJXQFeItMAjHxW/ZSZTok5IS3FuRhExturaInnzjYpx50a6kS34c5+c8hYq7sAtZ/CNLZmBnBCFD
|
||||
aMQqT8xFZJ5uolUaSeXxg7JFY1QsYp5RKvj4SjFwCGKJ2+hPPe9UyyltxOidNtxjaknOCeBHytOr
|
||||
-----END CERTIFICATE-----
|
||||
88
app/main/api/etc/merchant/bak/alipayRootCert.crt
Normal file
88
app/main/api/etc/merchant/bak/alipayRootCert.crt
Normal file
@@ -0,0 +1,88 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIBszCCAVegAwIBAgIIaeL+wBcKxnswDAYIKoEcz1UBg3UFADAuMQswCQYDVQQG
|
||||
EwJDTjEOMAwGA1UECgwFTlJDQUMxDzANBgNVBAMMBlJPT1RDQTAeFw0xMjA3MTQw
|
||||
MzExNTlaFw00MjA3MDcwMzExNTlaMC4xCzAJBgNVBAYTAkNOMQ4wDAYDVQQKDAVO
|
||||
UkNBQzEPMA0GA1UEAwwGUk9PVENBMFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAE
|
||||
MPCca6pmgcchsTf2UnBeL9rtp4nw+itk1Kzrmbnqo05lUwkwlWK+4OIrtFdAqnRT
|
||||
V7Q9v1htkv42TsIutzd126NdMFswHwYDVR0jBBgwFoAUTDKxl9kzG8SmBcHG5Yti
|
||||
W/CXdlgwDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAQYwHQYDVR0OBBYEFEwysZfZ
|
||||
MxvEpgXBxuWLYlvwl3ZYMAwGCCqBHM9VAYN1BQADSAAwRQIgG1bSLeOXp3oB8H7b
|
||||
53W+CKOPl2PknmWEq/lMhtn25HkCIQDaHDgWxWFtnCrBjH16/W3Ezn7/U/Vjo5xI
|
||||
pDoiVhsLwg==
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIF0zCCA7ugAwIBAgIIH8+hjWpIDREwDQYJKoZIhvcNAQELBQAwejELMAkGA1UE
|
||||
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmlj
|
||||
YXRpb24gQXV0aG9yaXR5MTEwLwYDVQQDDChBbnQgRmluYW5jaWFsIENlcnRpZmlj
|
||||
YXRpb24gQXV0aG9yaXR5IFIxMB4XDTE4MDMyMTEzNDg0MFoXDTM4MDIyODEzNDg0
|
||||
MFowejELMAkGA1UEBhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNV
|
||||
BAsMF0NlcnRpZmljYXRpb24gQXV0aG9yaXR5MTEwLwYDVQQDDChBbnQgRmluYW5j
|
||||
aWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFIxMIICIjANBgkqhkiG9w0BAQEF
|
||||
AAOCAg8AMIICCgKCAgEAtytTRcBNuur5h8xuxnlKJetT65cHGemGi8oD+beHFPTk
|
||||
rUTlFt9Xn7fAVGo6QSsPb9uGLpUFGEdGmbsQ2q9cV4P89qkH04VzIPwT7AywJdt2
|
||||
xAvMs+MgHFJzOYfL1QkdOOVO7NwKxH8IvlQgFabWomWk2Ei9WfUyxFjVO1LVh0Bp
|
||||
dRBeWLMkdudx0tl3+21t1apnReFNQ5nfX29xeSxIhesaMHDZFViO/DXDNW2BcTs6
|
||||
vSWKyJ4YIIIzStumD8K1xMsoaZBMDxg4itjWFaKRgNuPiIn4kjDY3kC66Sl/6yTl
|
||||
YUz8AybbEsICZzssdZh7jcNb1VRfk79lgAprm/Ktl+mgrU1gaMGP1OE25JCbqli1
|
||||
Pbw/BpPynyP9+XulE+2mxFwTYhKAwpDIDKuYsFUXuo8t261pCovI1CXFzAQM2w7H
|
||||
DtA2nOXSW6q0jGDJ5+WauH+K8ZSvA6x4sFo4u0KNCx0ROTBpLif6GTngqo3sj+98
|
||||
SZiMNLFMQoQkjkdN5Q5g9N6CFZPVZ6QpO0JcIc7S1le/g9z5iBKnifrKxy0TQjtG
|
||||
PsDwc8ubPnRm/F82RReCoyNyx63indpgFfhN7+KxUIQ9cOwwTvemmor0A+ZQamRe
|
||||
9LMuiEfEaWUDK+6O0Gl8lO571uI5onYdN1VIgOmwFbe+D8TcuzVjIZ/zvHrAGUcC
|
||||
AwEAAaNdMFswCwYDVR0PBAQDAgEGMAwGA1UdEwQFMAMBAf8wHQYDVR0OBBYEFF90
|
||||
tATATwda6uWx2yKjh0GynOEBMB8GA1UdIwQYMBaAFF90tATATwda6uWx2yKjh0Gy
|
||||
nOEBMA0GCSqGSIb3DQEBCwUAA4ICAQCVYaOtqOLIpsrEikE5lb+UARNSFJg6tpkf
|
||||
tJ2U8QF/DejemEHx5IClQu6ajxjtu0Aie4/3UnIXop8nH/Q57l+Wyt9T7N2WPiNq
|
||||
JSlYKYbJpPF8LXbuKYG3BTFTdOVFIeRe2NUyYh/xs6bXGr4WKTXb3qBmzR02FSy3
|
||||
IODQw5Q6zpXj8prYqFHYsOvGCEc1CwJaSaYwRhTkFedJUxiyhyB5GQwoFfExCVHW
|
||||
05ZFCAVYFldCJvUzfzrWubN6wX0DD2dwultgmldOn/W/n8at52mpPNvIdbZb2F41
|
||||
T0YZeoWnCJrYXjq/32oc1cmifIHqySnyMnavi75DxPCdZsCOpSAT4j4lAQRGsfgI
|
||||
kkLPGQieMfNNkMCKh7qjwdXAVtdqhf0RVtFILH3OyEodlk1HYXqX5iE5wlaKzDop
|
||||
PKwf2Q3BErq1xChYGGVS+dEvyXc/2nIBlt7uLWKp4XFjqekKbaGaLJdjYP5b2s7N
|
||||
1dM0MXQ/f8XoXKBkJNzEiM3hfsU6DOREgMc1DIsFKxfuMwX3EkVQM1If8ghb6x5Y
|
||||
jXayv+NLbidOSzk4vl5QwngO/JYFMkoc6i9LNwEaEtR9PhnrdubxmrtM+RjfBm02
|
||||
77q3dSWFESFQ4QxYWew4pHE0DpWbWy/iMIKQ6UZ5RLvB8GEcgt8ON7BBJeMc+Dyi
|
||||
kT9qhqn+lw==
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICiDCCAgygAwIBAgIIQX76UsB/30owDAYIKoZIzj0EAwMFADB6MQswCQYDVQQG
|
||||
EwJDTjEWMBQGA1UECgwNQW50IEZpbmFuY2lhbDEgMB4GA1UECwwXQ2VydGlmaWNh
|
||||
dGlvbiBBdXRob3JpdHkxMTAvBgNVBAMMKEFudCBGaW5hbmNpYWwgQ2VydGlmaWNh
|
||||
dGlvbiBBdXRob3JpdHkgRTEwHhcNMTkwNDI4MTYyMDQ0WhcNNDkwNDIwMTYyMDQ0
|
||||
WjB6MQswCQYDVQQGEwJDTjEWMBQGA1UECgwNQW50IEZpbmFuY2lhbDEgMB4GA1UE
|
||||
CwwXQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxMTAvBgNVBAMMKEFudCBGaW5hbmNp
|
||||
YWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgRTEwdjAQBgcqhkjOPQIBBgUrgQQA
|
||||
IgNiAASCCRa94QI0vR5Up9Yr9HEupz6hSoyjySYqo7v837KnmjveUIUNiuC9pWAU
|
||||
WP3jwLX3HkzeiNdeg22a0IZPoSUCpasufiLAnfXh6NInLiWBrjLJXDSGaY7vaokt
|
||||
rpZvAdmjXTBbMAsGA1UdDwQEAwIBBjAMBgNVHRMEBTADAQH/MB0GA1UdDgQWBBRZ
|
||||
4ZTgDpksHL2qcpkFkxD2zVd16TAfBgNVHSMEGDAWgBRZ4ZTgDpksHL2qcpkFkxD2
|
||||
zVd16TAMBggqhkjOPQQDAwUAA2gAMGUCMQD4IoqT2hTUn0jt7oXLdMJ8q4vLp6sg
|
||||
wHfPiOr9gxreb+e6Oidwd2LDnC4OUqCWiF8CMAzwKs4SnDJYcMLf2vpkbuVE4dTH
|
||||
Rglz+HGcTLWsFs4KxLsq7MuU+vJTBUeDJeDjdA==
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDxTCCAq2gAwIBAgIUEMdk6dVgOEIS2cCP0Q43P90Ps5YwDQYJKoZIhvcNAQEF
|
||||
BQAwajELMAkGA1UEBhMCQ04xEzARBgNVBAoMCmlUcnVzQ2hpbmExHDAaBgNVBAsM
|
||||
E0NoaW5hIFRydXN0IE5ldHdvcmsxKDAmBgNVBAMMH2lUcnVzQ2hpbmEgQ2xhc3Mg
|
||||
MiBSb290IENBIC0gRzMwHhcNMTMwNDE4MDkzNjU2WhcNMzMwNDE4MDkzNjU2WjBq
|
||||
MQswCQYDVQQGEwJDTjETMBEGA1UECgwKaVRydXNDaGluYTEcMBoGA1UECwwTQ2hp
|
||||
bmEgVHJ1c3QgTmV0d29yazEoMCYGA1UEAwwfaVRydXNDaGluYSBDbGFzcyAyIFJv
|
||||
b3QgQ0EgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOPPShpV
|
||||
nJbMqqCw6Bz1kehnoPst9pkr0V9idOwU2oyS47/HjJXk9Rd5a9xfwkPO88trUpz5
|
||||
4GmmwspDXjVFu9L0eFaRuH3KMha1Ak01citbF7cQLJlS7XI+tpkTGHEY5pt3EsQg
|
||||
wykfZl/A1jrnSkspMS997r2Gim54cwz+mTMgDRhZsKK/lbOeBPpWtcFizjXYCqhw
|
||||
WktvQfZBYi6o4sHCshnOswi4yV1p+LuFcQ2ciYdWvULh1eZhLxHbGXyznYHi0dGN
|
||||
z+I9H8aXxqAQfHVhbdHNzi77hCxFjOy+hHrGsyzjrd2swVQ2iUWP8BfEQqGLqM1g
|
||||
KgWKYfcTGdbPB1MCAwEAAaNjMGEwHQYDVR0OBBYEFG/oAMxTVe7y0+408CTAK8hA
|
||||
uTyRMB8GA1UdIwQYMBaAFG/oAMxTVe7y0+408CTAK8hAuTyRMA8GA1UdEwEB/wQF
|
||||
MAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBLnUTfW7hp
|
||||
emMbuUGCk7RBswzOT83bDM6824EkUnf+X0iKS95SUNGeeSWK2o/3ALJo5hi7GZr3
|
||||
U8eLaWAcYizfO99UXMRBPw5PRR+gXGEronGUugLpxsjuynoLQu8GQAeysSXKbN1I
|
||||
UugDo9u8igJORYA+5ms0s5sCUySqbQ2R5z/GoceyI9LdxIVa1RjVX8pYOj8JFwtn
|
||||
DJN3ftSFvNMYwRuILKuqUYSHc2GPYiHVflDh5nDymCMOQFcFG3WsEuB+EYQPFgIU
|
||||
1DHmdZcz7Llx8UOZXX2JupWCYzK1XhJb+r4hK5ncf/w8qGtYlmyJpxk3hr1TfUJX
|
||||
Yf4Zr0fJsGuv
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,23 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEnjCCA4agAwIBAgIQICUSBMps1Bik3MiRXKyhFTANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE
|
||||
BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0
|
||||
aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IENs
|
||||
YXNzIDEgUjEwHhcNMjUxMjA0MDg0MzU0WhcNMzAxMjAzMDg0MzU0WjBlMQswCQYDVQQGEwJDTjEq
|
||||
MCgGA1UECgwh5rW35Y2X5rW35a6H5aSn5pWw5o2u5pyJ6ZmQ5YWs5Y+4MQ8wDQYDVQQLDAZBbGlw
|
||||
YXkxGTAXBgNVBAMMEDIwODg5NDE1MDc3OTA2MDQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
|
||||
AoIBAQDJzOKCuHfM2/VYSroIm2TcO/Eoych6wF1FUtPeAoTva+YgHMrEDXt/OvqfNMylvtZYZya4
|
||||
hocZ9KTDA0FwHmFT9RP0tu0hXzNcKLx2U31iwi6Y29f0EwSYHvLIDjLw0XbxownR7iHvoCaXLtHz
|
||||
2S4tcJNB5sew3asOEAMTAKq1z679R/3WETVRPsNl211vhkxUpcL4Ct97s/lVL/cwRFFEi2LajfCV
|
||||
ZLqzrlkaQJucGcFQBdbzDd3gDrGtpmQvtmDWoAasg0/Kt7UJ6FPZKbbb9fc0yZAMSkD00jyVfYwq
|
||||
56TGXAP4P+NGhGGd0gbTGHPPA4Dr9zxSuQNAqiYn/mEPAgMBAAGjggEqMIIBJjAfBgNVHSMEGDAW
|
||||
gBRxB+IEYRbk5fJl6zEPyeD0PJrVkTAdBgNVHQ4EFgQUF9wZ+c5xzGlKYGD+ZCJl/JcPwrcwQAYD
|
||||
VR0gBDkwNzA1BgdggRwBbgEBMCowKAYIKwYBBQUHAgEWHGh0dHA6Ly9jYS5hbGlwYXkuY29tL2Nw
|
||||
cy5wZGYwDgYDVR0PAQH/BAQDAgbAMDAGA1UdHwQpMCcwJaAjoCGGH2h0dHA6Ly9jYS5hbGlwYXku
|
||||
Y29tL2NybDEwOC5jcmwwYAYIKwYBBQUHAQEEVDBSMCgGCCsGAQUFBzAChhxodHRwOi8vY2EuYWxp
|
||||
cGF5LmNvbS9jYTYuY2VyMCYGCCsGAQUFBzABhhpodHRwOi8vY2EuYWxpcGF5LmNvbTo4MzQwLzAN
|
||||
BgkqhkiG9w0BAQsFAAOCAQEAqCJLeBQU8g/L0aI+iqFecr8cB+loPhbwDdVyg+ajmm1+5K3mq8+p
|
||||
8Vt1GpdgsIobu06F7hzkDnPy72vabPWl7KTetdNHTzHcdy3zXB5U58xObZD1GJaOU/brhY9cvMnz
|
||||
CEEshx0sH4ay8A15go3cdZy+XheZVJ94Da+eAww1hskJ/A8svV6jHBtx3ZH78AGvpgo9J1QA+7iI
|
||||
22NT13UDymWgF7AdFkEyi6JNfZC3j/BSSYV/HDWg/W4mE3z8H5iTRSassH6EDNLVkPqFARgUKnzb
|
||||
2xUubWevKL3VfiVSY1NoRn3b+mSzlRjzXO57GK6BR6MY51gt85sZEdci5+j6PA==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -24,6 +24,7 @@ type Config struct {
|
||||
AdminConfig AdminConfig
|
||||
TaxConfig TaxConfig
|
||||
Promotion PromotionConfig // 推广链接配置
|
||||
Captcha CaptchaConfig // 阿里云滑块验证码配置
|
||||
}
|
||||
|
||||
// JwtAuth 用于 JWT 鉴权配置
|
||||
@@ -116,3 +117,12 @@ type PromotionConfig struct {
|
||||
PromotionDomain string // 推广域名(用于生成短链)
|
||||
OfficialDomain string // 正式站点域名(短链重定向的目标域名)
|
||||
}
|
||||
|
||||
// CaptchaConfig 阿里云滑块验证码配置
|
||||
type CaptchaConfig struct {
|
||||
AccessKeyID string
|
||||
AccessKeySecret string
|
||||
EndpointURL string
|
||||
SceneID string
|
||||
EKey string // 加密模式用的 ekey(Base64)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package admin_agent
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"ycc-server/app/main/api/internal/logic/admin_agent"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
)
|
||||
|
||||
func AdminDowngradeAgentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AdminDowngradeAgentReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := admin_agent.NewAdminDowngradeAgentLogic(r.Context(), svcCtx)
|
||||
resp, err := l.AdminDowngradeAgent(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package admin_agent
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"ycc-server/app/main/api/internal/logic/admin_agent"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func AdminUpdateAgentMobileHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AdminUpdateAgentMobileReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := admin_agent.NewAdminUpdateAgentMobileLogic(r.Context(), svcCtx)
|
||||
resp, err := l.AdminUpdateAgentMobile(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package admin_complaint
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"ycc-server/app/main/api/internal/logic/admin_complaint"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
)
|
||||
|
||||
func AdminGetComplaintDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AdminGetComplaintDetailReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := admin_complaint.NewAdminGetComplaintDetailLogic(r.Context(), svcCtx)
|
||||
resp, err := l.AdminGetComplaintDetail(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package admin_complaint
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"ycc-server/app/main/api/internal/logic/admin_complaint"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
)
|
||||
|
||||
func AdminGetComplaintListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AdminGetComplaintListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := admin_complaint.NewAdminGetComplaintListLogic(r.Context(), svcCtx)
|
||||
resp, err := l.AdminGetComplaintList(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package admin_complaint
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"ycc-server/app/main/api/internal/logic/admin_complaint"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
)
|
||||
|
||||
func AdminUpdateComplaintRemarkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AdminUpdateComplaintRemarkReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := admin_complaint.NewAdminUpdateComplaintRemarkLogic(r.Context(), svcCtx)
|
||||
resp, err := l.AdminUpdateComplaintRemark(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package admin_complaint
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"ycc-server/app/main/api/internal/logic/admin_complaint"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
)
|
||||
|
||||
func AdminUpdateComplaintStatusHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AdminUpdateComplaintStatusReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := admin_complaint.NewAdminUpdateComplaintStatusLogic(r.Context(), svcCtx)
|
||||
resp, err := l.AdminUpdateComplaintStatus(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package admin_dashboard
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"ycc-server/app/main/api/internal/logic/admin_dashboard"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/common/result"
|
||||
)
|
||||
|
||||
func AdminGetDashboardStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := admin_dashboard.NewAdminGetDashboardStatisticsLogic(r.Context(), svcCtx)
|
||||
resp, err := l.AdminGetDashboardStatistics()
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package admin_query
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"ycc-server/app/main/api/internal/logic/admin_query"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
)
|
||||
|
||||
func AdminDeleteQueryFeatureDataHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AdminDeleteQueryFeatureDataReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := admin_query.NewAdminDeleteQueryFeatureDataLogic(r.Context(), svcCtx)
|
||||
resp, err := l.AdminDeleteQueryFeatureData(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"ycc-server/app/main/api/internal/logic/agent"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func CheckFeatureWhitelistStatusHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CheckFeatureWhitelistStatusReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := agent.NewCheckFeatureWhitelistStatusLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CheckFeatureWhitelistStatus(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"ycc-server/app/main/api/internal/logic/agent"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
)
|
||||
|
||||
func CheckOrderAgentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CheckOrderAgentReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := agent.NewCheckOrderAgentLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CheckOrderAgent(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"ycc-server/app/main/api/internal/logic/agent"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func CreateWhitelistOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateWhitelistOrderReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := agent.NewCreateWhitelistOrderLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateWhitelistOrder(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"ycc-server/app/main/api/internal/logic/agent"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func GetInvitePosterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.GetInvitePosterReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
req.Format = strings.TrimSpace(strings.ToLower(req.Format))
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := agent.NewGetInvitePosterLogic(r.Context(), svcCtx)
|
||||
|
||||
if req.Format == "base64" {
|
||||
base64Str, err := l.GetInvitePosterBase64(&req)
|
||||
if err != nil {
|
||||
result.HttpResult(r, w, nil, err)
|
||||
return
|
||||
}
|
||||
result.HttpResult(r, w, &types.GetInvitePosterResp{PosterBase64: base64Str}, nil)
|
||||
return
|
||||
}
|
||||
|
||||
pngBytes, err := l.GetInvitePoster(&req)
|
||||
if err != nil {
|
||||
result.HttpResult(r, w, nil, err)
|
||||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "image/png")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, _ = w.Write(pngBytes)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"ycc-server/app/main/api/internal/logic/agent"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
)
|
||||
|
||||
func GetLastWithdrawalInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.GetLastWithdrawalInfoReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := agent.NewGetLastWithdrawalInfoLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetLastWithdrawalInfo(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"ycc-server/app/main/api/internal/logic/agent"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func GetPromotionQueryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.GetPromotionQueryListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := agent.NewGetPromotionQueryListLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetPromotionQueryList(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"ycc-server/app/main/api/internal/logic/agent"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func GetWhitelistFeaturesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.GetWhitelistFeaturesReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := agent.NewGetWhitelistFeaturesLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetWhitelistFeatures(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"ycc-server/app/main/api/internal/logic/agent"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func GetWhitelistListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.GetWhitelistListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := agent.NewGetWhitelistListLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetWhitelistList(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
|
||||
31
app/main/api/internal/handler/agent/offlinefeaturehandler.go
Normal file
31
app/main/api/internal/handler/agent/offlinefeaturehandler.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"ycc-server/app/main/api/internal/logic/agent"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func OfflineFeatureHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.OfflineFeatureReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
if err := validator.Validate(req); err != nil {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := agent.NewOfflineFeatureLogic(r.Context(), svcCtx)
|
||||
resp, err := l.OfflineFeature(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
|
||||
17
app/main/api/internal/handler/app/getappconfighandler.go
Normal file
17
app/main/api/internal/handler/app/getappconfighandler.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"ycc-server/app/main/api/internal/logic/app"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/common/result"
|
||||
)
|
||||
|
||||
func GetAppConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := app.NewGetAppConfigLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetAppConfig()
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
"ycc-server/pkg/captcha"
|
||||
"ycc-server/pkg/lzkit/validator"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
@@ -23,7 +24,8 @@ func SendSmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
result.ParamValidateErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := auth.NewSendSmsLogic(r.Context(), svcCtx)
|
||||
ctx := captcha.WithUserAgent(r.Context(), r.Header.Get("User-Agent"))
|
||||
l := auth.NewSendSmsLogic(ctx, svcCtx)
|
||||
err := l.SendSms(&req)
|
||||
result.HttpResult(r, w, nil, err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package captcha
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"ycc-server/app/main/api/internal/logic/captcha"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func GetEncryptedSceneIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.GetEncryptedSceneIdResp
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := captcha.NewGetEncryptedSceneIdLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetEncryptedSceneId()
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
18
app/main/api/internal/handler/pay/alipayfromhandler.go
Normal file
18
app/main/api/internal/handler/pay/alipayfromhandler.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package pay
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"ycc-server/app/main/api/internal/logic/pay"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/common/result"
|
||||
)
|
||||
|
||||
func AlipayFromHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := pay.NewAlipayFromLogic(r.Context(), svcCtx)
|
||||
err := l.AlipayFrom(w, r)
|
||||
result.HttpResult(r, w, nil, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import (
|
||||
admin_agent "ycc-server/app/main/api/internal/handler/admin_agent"
|
||||
admin_api "ycc-server/app/main/api/internal/handler/admin_api"
|
||||
admin_auth "ycc-server/app/main/api/internal/handler/admin_auth"
|
||||
admin_complaint "ycc-server/app/main/api/internal/handler/admin_complaint"
|
||||
admin_dashboard "ycc-server/app/main/api/internal/handler/admin_dashboard"
|
||||
admin_feature "ycc-server/app/main/api/internal/handler/admin_feature"
|
||||
admin_menu "ycc-server/app/main/api/internal/handler/admin_menu"
|
||||
admin_notification "ycc-server/app/main/api/internal/handler/admin_notification"
|
||||
@@ -21,6 +23,7 @@ import (
|
||||
app "ycc-server/app/main/api/internal/handler/app"
|
||||
auth "ycc-server/app/main/api/internal/handler/auth"
|
||||
authorization "ycc-server/app/main/api/internal/handler/authorization"
|
||||
captcha "ycc-server/app/main/api/internal/handler/captcha"
|
||||
notification "ycc-server/app/main/api/internal/handler/notification"
|
||||
pay "ycc-server/app/main/api/internal/handler/pay"
|
||||
product "ycc-server/app/main/api/internal/handler/product"
|
||||
@@ -66,6 +69,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Path: "/invite_code/list",
|
||||
Handler: admin_agent.AdminGetInviteCodeListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/level/downgrade",
|
||||
Handler: admin_agent.AdminDowngradeAgentHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/link/list",
|
||||
@@ -76,6 +84,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Path: "/list",
|
||||
Handler: admin_agent.AdminGetAgentListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/mobile/update",
|
||||
Handler: admin_agent.AdminUpdateAgentMobileHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/order/list",
|
||||
@@ -172,6 +185,53 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
rest.WithPrefix("/api/v1/admin/auth"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
// 获取投诉详情
|
||||
Method: http.MethodGet,
|
||||
Path: "/detail/:id",
|
||||
Handler: admin_complaint.AdminGetComplaintDetailHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 获取投诉列表
|
||||
Method: http.MethodGet,
|
||||
Path: "/list",
|
||||
Handler: admin_complaint.AdminGetComplaintListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 更新投诉备注
|
||||
Method: http.MethodPut,
|
||||
Path: "/update-remark/:id",
|
||||
Handler: admin_complaint.AdminUpdateComplaintRemarkHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 更新投诉状态
|
||||
Method: http.MethodPut,
|
||||
Path: "/update-status/:id",
|
||||
Handler: admin_complaint.AdminUpdateComplaintStatusHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/api/v1/admin/complaint"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/statistics",
|
||||
Handler: admin_dashboard.AdminGetDashboardStatisticsHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/api/v1/admin/dashboard"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
|
||||
@@ -440,6 +500,12 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Path: "/cleanup/configs",
|
||||
Handler: admin_query.AdminGetQueryCleanupConfigListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 按 QueryId+FeatureApiId 补删单条查询的某个模块数据(仅内部运维使用)
|
||||
Method: http.MethodPost,
|
||||
Path: "/cleanup/delete/feature",
|
||||
Handler: admin_query.AdminDeleteQueryFeatureDataHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 获取清理详情列表
|
||||
Method: http.MethodGet,
|
||||
@@ -589,25 +655,34 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/apply",
|
||||
Handler: agent.ApplyForAgentHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/link",
|
||||
Handler: agent.GetLinkDataHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/register/invite",
|
||||
Handler: agent.RegisterByInviteCodeHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/v1/agent"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/apply",
|
||||
Handler: agent.ApplyForAgentHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/register/invite",
|
||||
Handler: agent.RegisterByInviteCodeHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/api/v1/agent"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.UserAuthInterceptor},
|
||||
@@ -632,6 +707,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Path: "/info",
|
||||
Handler: agent.GetAgentInfoHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/invite/poster",
|
||||
Handler: agent.GetInvitePosterHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/invite_code/delete",
|
||||
@@ -657,11 +737,21 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Path: "/level/privilege",
|
||||
Handler: agent.GetLevelPrivilegeHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/order/agent",
|
||||
Handler: agent.CheckOrderAgentHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/product_config",
|
||||
Handler: agent.GetAgentProductConfigHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/promotion/query/list",
|
||||
Handler: agent.GetPromotionQueryListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/real_name",
|
||||
@@ -717,11 +807,41 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Path: "/upgrade/subordinate",
|
||||
Handler: agent.UpgradeSubordinateHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/whitelist/check",
|
||||
Handler: agent.CheckFeatureWhitelistStatusHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/whitelist/features",
|
||||
Handler: agent.GetWhitelistFeaturesHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/whitelist/list",
|
||||
Handler: agent.GetWhitelistListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/whitelist/offline",
|
||||
Handler: agent.OfflineFeatureHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/whitelist/order/create",
|
||||
Handler: agent.CreateWhitelistOrderHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/withdrawal/apply",
|
||||
Handler: agent.ApplyWithdrawalHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/withdrawal/last_info",
|
||||
Handler: agent.GetLastWithdrawalInfoHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/withdrawal/list",
|
||||
@@ -745,6 +865,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/app/config",
|
||||
Handler: app.GetAppConfigHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/app/version",
|
||||
@@ -793,6 +918,18 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
rest.WithPrefix("/api/v1"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// get encrypted scene id for aliyun captcha
|
||||
Method: http.MethodPost,
|
||||
Path: "/captcha/encryptedSceneId",
|
||||
Handler: captcha.GetEncryptedSceneIdHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/v1"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
@@ -812,6 +949,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Path: "/pay/alipay/callback",
|
||||
Handler: pay.AlipayCallbackHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/pay/alipay/from",
|
||||
Handler: pay.AlipayFromHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/pay/wechat/callback",
|
||||
@@ -828,7 +970,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.UserAuthInterceptor},
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
@@ -900,7 +1042,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.UserAuthInterceptor},
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
// query service
|
||||
@@ -916,7 +1058,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.UserAuthInterceptor},
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
// 生成分享链接
|
||||
@@ -991,6 +1133,12 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// unified auth
|
||||
Method: http.MethodPost,
|
||||
Path: "/user/auth",
|
||||
Handler: user.AuthHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// mobile code login
|
||||
Method: http.MethodPost,
|
||||
|
||||
25
app/main/api/internal/handler/user/authhandler.go
Normal file
25
app/main/api/internal/handler/user/authhandler.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
logic "ycc-server/app/main/api/internal/logic/user"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/result"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func AuthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.AuthReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
result.ParamErrorResult(r, w, err)
|
||||
return
|
||||
}
|
||||
l := logic.NewAuthLogic(r.Context(), svcCtx)
|
||||
resp, err := l.Auth(&req)
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
"ycc-server/common/globalkey"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/pkg/lzkit/lzUtils"
|
||||
|
||||
@@ -32,6 +32,13 @@ func NewAdminAuditWithdrawalLogic(ctx context.Context, svcCtx *svc.ServiceContex
|
||||
}
|
||||
}
|
||||
|
||||
// parseFloat 解析配置中的浮点数
|
||||
func (l *AdminAuditWithdrawalLogic) parseFloat(s string) (float64, error) {
|
||||
var result float64
|
||||
_, err := fmt.Sscanf(s, "%f", &result)
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (l *AdminAuditWithdrawalLogic) AdminAuditWithdrawal(req *types.AdminAuditWithdrawalReq) (resp *types.AdminAuditWithdrawalResp, err error) {
|
||||
// 1. 查询提现记录
|
||||
withdrawal, err := l.svcCtx.AgentWithdrawalModel.FindOne(l.ctx, req.WithdrawalId)
|
||||
@@ -46,39 +53,126 @@ func (l *AdminAuditWithdrawalLogic) AdminAuditWithdrawal(req *types.AdminAuditWi
|
||||
|
||||
// 4. 使用事务处理审核
|
||||
err = l.svcCtx.AgentWithdrawalModel.Trans(l.ctx, func(transCtx context.Context, session sqlx.Session) error {
|
||||
if req.Status == 2 { // 审核通过
|
||||
// 4.1 更新提现记录状态为提现中
|
||||
withdrawal.Status = 4 // 提现中
|
||||
withdrawal.Remark = sql.NullString{String: req.Remark, Valid: true}
|
||||
if err := l.svcCtx.AgentWithdrawalModel.UpdateWithVersion(transCtx, session, withdrawal); err != nil {
|
||||
return errors.Wrapf(err, "更新提现记录失败")
|
||||
}
|
||||
switch req.Status {
|
||||
case 2: // 审核通过
|
||||
// 4.1 根据提现方式处理
|
||||
switch withdrawal.WithdrawalType {
|
||||
case 1:
|
||||
// 支付宝提现:审核通过前再次校验月度额度,避免一次性通过多笔超限
|
||||
now := time.Now()
|
||||
monthStart := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location())
|
||||
nextMonthStart := monthStart.AddDate(0, 1, 0)
|
||||
|
||||
// 4.2 调用支付宝转账接口
|
||||
outBizNo := withdrawal.WithdrawNo
|
||||
transferResp, err := l.svcCtx.AlipayService.AliTransfer(transCtx, withdrawal.PayeeAccount, withdrawal.PayeeName, withdrawal.ActualAmount, "代理提现", outBizNo)
|
||||
if err != nil {
|
||||
// 转账失败,更新状态为失败
|
||||
withdrawal.Status = 6 // 提现失败
|
||||
withdrawal.Remark = sql.NullString{String: fmt.Sprintf("转账失败: %v", err), Valid: true}
|
||||
l.svcCtx.AgentWithdrawalModel.UpdateWithVersion(transCtx, session, withdrawal)
|
||||
|
||||
// 解冻余额
|
||||
wallet, err := l.svcCtx.AgentWalletModel.FindOneByAgentId(transCtx, withdrawal.AgentId)
|
||||
if err == nil {
|
||||
wallet.FrozenBalance -= withdrawal.Amount
|
||||
wallet.Balance += withdrawal.Amount
|
||||
l.svcCtx.AgentWalletModel.UpdateWithVersion(transCtx, session, wallet)
|
||||
// 获取支付宝月度额度配置(默认 800 元)
|
||||
alipayQuota := 800.0
|
||||
if cfg, cfgErr := l.svcCtx.AgentConfigModel.FindOneByConfigKey(transCtx, "alipay_month_quota"); cfgErr == nil {
|
||||
if parsed, parseErr := l.parseFloat(cfg.ConfigValue); parseErr == nil && parsed > 0 {
|
||||
alipayQuota = parsed
|
||||
}
|
||||
}
|
||||
|
||||
return errors.Wrapf(err, "支付宝转账失败")
|
||||
}
|
||||
// 统计本月已成功的支付宝提现金额(status=5)
|
||||
withdrawBuilder := l.svcCtx.AgentWithdrawalModel.SelectBuilder().
|
||||
Where("agent_id = ? AND withdrawal_type = ? AND status = ? AND create_time >= ? AND create_time < ?",
|
||||
withdrawal.AgentId, 1, 5, monthStart, nextMonthStart)
|
||||
usedAmount, sumErr := l.svcCtx.AgentWithdrawalModel.FindSum(transCtx, withdrawBuilder, "amount")
|
||||
if sumErr != nil {
|
||||
return errors.Wrapf(sumErr, "查询本月支付宝提现额度使用情况失败")
|
||||
}
|
||||
|
||||
// 4.3 根据转账结果更新状态
|
||||
switch transferResp.Status {
|
||||
case "SUCCESS":
|
||||
// 转账成功
|
||||
if usedAmount+withdrawal.Amount > alipayQuota {
|
||||
// 超出额度,不允许通过,保持待审核状态并提示原因
|
||||
withdrawal.Status = 1
|
||||
withdrawal.Remark = sql.NullString{
|
||||
String: fmt.Sprintf("超过本月支付宝提现额度(限额:%.2f 元,已用:%.2f 元),请使用银行卡提现或调整金额", alipayQuota, usedAmount),
|
||||
Valid: true,
|
||||
}
|
||||
if err := l.svcCtx.AgentWithdrawalModel.UpdateWithVersion(transCtx, session, withdrawal); err != nil {
|
||||
return errors.Wrapf(err, "更新提现记录失败")
|
||||
}
|
||||
return errors.Wrapf(xerr.NewErrMsg("超过本月支付宝提现额度,无法通过该笔提现"), "")
|
||||
}
|
||||
|
||||
// 支付宝提现:开发环境下做模拟,不调用真实支付宝转账
|
||||
mockTransferStatus := "SUCCESS"
|
||||
var transferResp struct {
|
||||
Status string
|
||||
SubCode string
|
||||
}
|
||||
|
||||
if os.Getenv("ENV") == "development" {
|
||||
transferResp.Status = mockTransferStatus
|
||||
logx.Infof("【DEV】模拟支付宝转账成功,withdrawNo=%s, amount=%.2f, payee=%s",
|
||||
withdrawal.WithdrawNo, withdrawal.ActualAmount, withdrawal.PayeeAccount)
|
||||
} else {
|
||||
// 生产环境:同步调用支付宝转账接口
|
||||
outBizNo := withdrawal.WithdrawNo
|
||||
resp, err := l.svcCtx.AlipayService.AliTransfer(transCtx, withdrawal.PayeeAccount, withdrawal.PayeeName, withdrawal.ActualAmount, "代理提现", outBizNo)
|
||||
if err != nil {
|
||||
// 调用失败:保持状态为待审核(1),只记录备注,方便管理员重试
|
||||
withdrawal.Status = 1 // 待审核
|
||||
withdrawal.Remark = sql.NullString{String: fmt.Sprintf("支付宝转账调用失败: %v", err), Valid: true}
|
||||
_ = l.svcCtx.AgentWithdrawalModel.UpdateWithVersion(transCtx, session, withdrawal)
|
||||
|
||||
return errors.Wrapf(err, "支付宝转账失败")
|
||||
}
|
||||
transferResp.Status = resp.Status
|
||||
transferResp.SubCode = resp.SubCode
|
||||
}
|
||||
|
||||
// 4.2 根据转账结果更新状态
|
||||
switch transferResp.Status {
|
||||
case "SUCCESS":
|
||||
// 转账成功
|
||||
withdrawal.Status = 5 // 提现成功
|
||||
if err := l.svcCtx.AgentWithdrawalModel.UpdateWithVersion(transCtx, session, withdrawal); err != nil {
|
||||
return errors.Wrapf(err, "更新提现记录失败")
|
||||
}
|
||||
|
||||
// 更新钱包(解冻并扣除)
|
||||
wallet, err := l.svcCtx.AgentWalletModel.FindOneByAgentId(transCtx, withdrawal.AgentId)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "查询钱包失败")
|
||||
}
|
||||
wallet.FrozenBalance -= withdrawal.Amount
|
||||
wallet.WithdrawnAmount += withdrawal.Amount
|
||||
if err := l.svcCtx.AgentWalletModel.UpdateWithVersion(transCtx, session, wallet); err != nil {
|
||||
return errors.Wrapf(err, "更新钱包失败")
|
||||
}
|
||||
|
||||
// 更新扣税记录状态
|
||||
taxBuilder := l.svcCtx.AgentWithdrawalTaxModel.SelectBuilder().
|
||||
Where("withdrawal_id = ?", withdrawal.Id)
|
||||
taxRecords, err := l.svcCtx.AgentWithdrawalTaxModel.FindAll(transCtx, taxBuilder, "")
|
||||
if err == nil && len(taxRecords) > 0 {
|
||||
taxRecord := taxRecords[0]
|
||||
taxRecord.TaxStatus = 2 // 已扣税
|
||||
taxRecord.TaxTime = lzUtils.TimeToNullTime(time.Now())
|
||||
l.svcCtx.AgentWithdrawalTaxModel.UpdateWithVersion(transCtx, session, taxRecord)
|
||||
}
|
||||
|
||||
case "FAIL":
|
||||
// 转账失败:保持待审核状态,方便人工处理或重试
|
||||
withdrawal.Status = 1 // 待审核
|
||||
errorMsg := l.mapAlipayError(transferResp.SubCode)
|
||||
withdrawal.Remark = sql.NullString{String: errorMsg, Valid: true}
|
||||
if err := l.svcCtx.AgentWithdrawalModel.UpdateWithVersion(transCtx, session, withdrawal); err != nil {
|
||||
return errors.Wrapf(err, "更新提现记录失败")
|
||||
}
|
||||
|
||||
case "DEALING":
|
||||
// 处理中:同样保持待审核状态(1),由管理员后续确认
|
||||
withdrawal.Status = 1
|
||||
withdrawal.Remark = sql.NullString{String: "支付宝处理中,请稍后重试或联系平台", Valid: true}
|
||||
if err := l.svcCtx.AgentWithdrawalModel.UpdateWithVersion(transCtx, session, withdrawal); err != nil {
|
||||
return errors.Wrapf(err, "更新提现记录失败")
|
||||
}
|
||||
}
|
||||
|
||||
case 2:
|
||||
// 银行卡提现:审核通过即视为提现成功(线下已/将立即打款)
|
||||
withdrawal.Status = 5 // 提现成功
|
||||
withdrawal.Remark = sql.NullString{String: req.Remark, Valid: true}
|
||||
if err := l.svcCtx.AgentWithdrawalModel.UpdateWithVersion(transCtx, session, withdrawal); err != nil {
|
||||
return errors.Wrapf(err, "更新提现记录失败")
|
||||
}
|
||||
@@ -96,7 +190,7 @@ func (l *AdminAuditWithdrawalLogic) AdminAuditWithdrawal(req *types.AdminAuditWi
|
||||
|
||||
// 更新扣税记录状态
|
||||
taxBuilder := l.svcCtx.AgentWithdrawalTaxModel.SelectBuilder().
|
||||
Where("withdrawal_id = ? AND del_state = ?", withdrawal.Id, globalkey.DelStateNo)
|
||||
Where("withdrawal_id = ?", withdrawal.Id)
|
||||
taxRecords, err := l.svcCtx.AgentWithdrawalTaxModel.FindAll(transCtx, taxBuilder, "")
|
||||
if err == nil && len(taxRecords) > 0 {
|
||||
taxRecord := taxRecords[0]
|
||||
@@ -104,30 +198,9 @@ func (l *AdminAuditWithdrawalLogic) AdminAuditWithdrawal(req *types.AdminAuditWi
|
||||
taxRecord.TaxTime = lzUtils.TimeToNullTime(time.Now())
|
||||
l.svcCtx.AgentWithdrawalTaxModel.UpdateWithVersion(transCtx, session, taxRecord)
|
||||
}
|
||||
|
||||
case "FAIL":
|
||||
// 转账失败
|
||||
withdrawal.Status = 6 // 提现失败
|
||||
errorMsg := l.mapAlipayError(transferResp.SubCode)
|
||||
withdrawal.Remark = sql.NullString{String: errorMsg, Valid: true}
|
||||
if err := l.svcCtx.AgentWithdrawalModel.UpdateWithVersion(transCtx, session, withdrawal); err != nil {
|
||||
return errors.Wrapf(err, "更新提现记录失败")
|
||||
}
|
||||
|
||||
// 解冻余额
|
||||
wallet, err := l.svcCtx.AgentWalletModel.FindOneByAgentId(transCtx, withdrawal.AgentId)
|
||||
if err == nil {
|
||||
wallet.FrozenBalance -= withdrawal.Amount
|
||||
wallet.Balance += withdrawal.Amount
|
||||
l.svcCtx.AgentWalletModel.UpdateWithVersion(transCtx, session, wallet)
|
||||
}
|
||||
|
||||
case "DEALING":
|
||||
// 处理中,保持提现中状态,后续通过轮询更新
|
||||
// 状态已经是4(提现中),无需更新
|
||||
}
|
||||
|
||||
} else if req.Status == 3 { // 审核拒绝
|
||||
case 3: // 审核拒绝
|
||||
// 4.1 更新提现记录状态为拒绝
|
||||
withdrawal.Status = 3 // 审核拒绝
|
||||
withdrawal.Remark = sql.NullString{String: req.Remark, Valid: true}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package admin_agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type AdminDowngradeAgentLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewAdminDowngradeAgentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminDowngradeAgentLogic {
|
||||
return &AdminDowngradeAgentLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AdminDowngradeAgentLogic) AdminDowngradeAgent(req *types.AdminDowngradeAgentReq) (resp *types.AdminDowngradeAgentResp, err error) {
|
||||
if req.AgentId == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("代理ID不能为空"), "")
|
||||
}
|
||||
|
||||
_, err = l.svcCtx.AgentModel.FindOne(l.ctx, req.AgentId)
|
||||
if err != nil {
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("代理不存在"), "")
|
||||
}
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查询代理失败, %v", err)
|
||||
}
|
||||
|
||||
if err := l.svcCtx.AgentService.ProcessDowngrade(l.ctx, req.AgentId, req.ToLevel, req.Remark); err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg(err.Error()), "")
|
||||
}
|
||||
|
||||
return &types.AdminDowngradeAgentResp{
|
||||
Success: true,
|
||||
}, nil
|
||||
}
|
||||
@@ -1,20 +1,21 @@
|
||||
package admin_agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"time"
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/tool"
|
||||
"ycc-server/common/xerr"
|
||||
"context"
|
||||
"database/sql"
|
||||
"time"
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/tool"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type AdminGenerateDiamondInviteCodeLogic struct {
|
||||
@@ -70,14 +71,15 @@ func (l *AdminGenerateDiamondInviteCodeLogic) AdminGenerateDiamondInviteCode(req
|
||||
}
|
||||
|
||||
// 创建邀请码记录(平台发放的钻石邀请码)
|
||||
inviteCode := &model.AgentInviteCode{
|
||||
Code: code,
|
||||
AgentId: sql.NullInt64{Valid: false}, // NULL表示平台发放
|
||||
TargetLevel: 3, // 钻石代理
|
||||
Status: 0, // 未使用
|
||||
ExpireTime: expireTime,
|
||||
Remark: sql.NullString{String: req.Remark, Valid: req.Remark != ""},
|
||||
}
|
||||
inviteCode := &model.AgentInviteCode{
|
||||
Id: uuid.NewString(),
|
||||
Code: code,
|
||||
AgentId: sql.NullString{Valid: false}, // NULL表示平台发放
|
||||
TargetLevel: 3, // 钻石代理
|
||||
Status: 0, // 未使用
|
||||
ExpireTime: expireTime,
|
||||
Remark: sql.NullString{String: req.Remark, Valid: req.Remark != ""},
|
||||
}
|
||||
|
||||
_, err := l.svcCtx.AgentInviteCodeModel.Insert(transCtx, session, inviteCode)
|
||||
if err != nil {
|
||||
|
||||
@@ -41,13 +41,13 @@ func (l *AdminGetAgentCommissionListLogic) AdminGetAgentCommissionList(req *type
|
||||
}
|
||||
|
||||
// 批量查product_name
|
||||
productIds := make(map[int64]struct{})
|
||||
productIds := make(map[string]struct{})
|
||||
for _, v := range list {
|
||||
productIds[v.ProductId] = struct{}{}
|
||||
}
|
||||
productNameMap := make(map[int64]string)
|
||||
productNameMap := make(map[string]string)
|
||||
if len(productIds) > 0 {
|
||||
ids := make([]int64, 0, len(productIds))
|
||||
ids := make([]string, 0, len(productIds))
|
||||
for id := range productIds {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@ func (l *AdminGetAgentConfigLogic) AdminGetAgentConfig() (resp *types.AdminGetAg
|
||||
commissionFreezeThreshold := getConfigFloat("commission_freeze_threshold")
|
||||
commissionFreezeDays := getConfigInt("commission_freeze_days")
|
||||
|
||||
goldUplift := getConfigFloat("gold_max_uplift_amount")
|
||||
diamondUplift := getConfigFloat("diamond_max_uplift_amount")
|
||||
return &types.AdminGetAgentConfigResp{
|
||||
LevelBonus: types.LevelBonusConfig{
|
||||
Normal: int64(level1Bonus),
|
||||
@@ -78,7 +80,6 @@ func (l *AdminGetAgentConfigLogic) AdminGetAgentConfig() (resp *types.AdminGetAg
|
||||
UpgradeFee: types.UpgradeFeeConfig{
|
||||
NormalToGold: upgradeToGoldFee,
|
||||
NormalToDiamond: upgradeToDiamondFee,
|
||||
GoldToDiamond: upgradeToDiamondFee - upgradeToGoldFee,
|
||||
},
|
||||
UpgradeRebate: types.UpgradeRebateConfig{
|
||||
NormalToGoldRebate: upgradeToGoldRebate,
|
||||
@@ -95,7 +96,9 @@ func (l *AdminGetAgentConfigLogic) AdminGetAgentConfig() (resp *types.AdminGetAg
|
||||
Threshold: commissionFreezeThreshold,
|
||||
Days: commissionFreezeDays,
|
||||
},
|
||||
TaxRate: getConfigFloat("tax_rate"),
|
||||
TaxExemptionAmount: getConfigFloat("tax_exemption_amount"),
|
||||
TaxRate: getConfigFloat("tax_rate"),
|
||||
TaxExemptionAmount: getConfigFloat("tax_exemption_amount"),
|
||||
GoldMaxUpliftAmount: goldUplift,
|
||||
DiamondMaxUpliftAmount: diamondUplift,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -44,15 +44,15 @@ func (l *AdminGetAgentLinkListLogic) AdminGetAgentLinkList(req *types.AdminGetAg
|
||||
}
|
||||
|
||||
// 批量查product_id->name,避免N+1
|
||||
productIdSet := make(map[int64]struct{})
|
||||
productIdSet := make(map[string]struct{})
|
||||
for _, link := range links {
|
||||
productIdSet[link.ProductId] = struct{}{}
|
||||
}
|
||||
productIdList := make([]int64, 0, len(productIdSet))
|
||||
productIdList := make([]string, 0, len(productIdSet))
|
||||
for id := range productIdSet {
|
||||
productIdList = append(productIdList, id)
|
||||
}
|
||||
productNameMap := make(map[int64]string)
|
||||
productNameMap := make(map[string]string)
|
||||
if len(productIdList) > 0 {
|
||||
products, _ := l.svcCtx.ProductModel.FindAll(l.ctx, l.svcCtx.ProductModel.SelectBuilder().Where(squirrel.Eq{"id": productIdList}), "")
|
||||
for _, p := range products {
|
||||
@@ -63,14 +63,14 @@ func (l *AdminGetAgentLinkListLogic) AdminGetAgentLinkList(req *types.AdminGetAg
|
||||
items := make([]types.AgentLinkListItem, 0, len(links))
|
||||
for _, link := range links {
|
||||
items = append(items, types.AgentLinkListItem{
|
||||
Id: link.Id,
|
||||
AgentId: link.AgentId,
|
||||
ProductId: link.ProductId,
|
||||
ProductName: productNameMap[link.ProductId],
|
||||
SetPrice: link.SetPrice,
|
||||
Id: link.Id,
|
||||
AgentId: link.AgentId,
|
||||
ProductId: link.ProductId,
|
||||
ProductName: productNameMap[link.ProductId],
|
||||
SetPrice: link.SetPrice,
|
||||
ActualBasePrice: link.ActualBasePrice,
|
||||
LinkIdentifier: link.LinkIdentifier,
|
||||
CreateTime: link.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
LinkIdentifier: link.LinkIdentifier,
|
||||
CreateTime: link.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package admin_agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
@@ -29,7 +30,7 @@ func NewAdminGetAgentListLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
|
||||
func (l *AdminGetAgentListLogic) AdminGetAgentList(req *types.AdminGetAgentListReq) (resp *types.AdminGetAgentListResp, err error) {
|
||||
builder := l.svcCtx.AgentModel.SelectBuilder()
|
||||
|
||||
|
||||
// 如果传入TeamLeaderId,则查找该团队首领下的所有代理
|
||||
if req.TeamLeaderId != nil {
|
||||
builder = builder.Where(squirrel.Eq{"team_leader_id": *req.TeamLeaderId})
|
||||
@@ -78,21 +79,35 @@ func (l *AdminGetAgentListLogic) AdminGetAgentList(req *types.AdminGetAgentListR
|
||||
|
||||
// 查询钱包信息
|
||||
wallet, _ := l.svcCtx.AgentWalletModel.FindOneByAgentId(l.ctx, agent.Id)
|
||||
|
||||
// 查询实名认证信息
|
||||
|
||||
// 查询实名认证信息(数据库姓名明文、身份证密文,解密后明文返回不脱敏)
|
||||
realNameInfo, _ := l.svcCtx.AgentRealNameModel.FindOneByAgentId(l.ctx, agent.Id)
|
||||
isRealName := false
|
||||
if realNameInfo != nil && realNameInfo.VerifyTime.Valid {
|
||||
isRealName = true // verify_time不为空表示已通过三要素核验
|
||||
realName := ""
|
||||
idCardPlain := "" // 解密后明文返回
|
||||
if realNameInfo != nil {
|
||||
if realNameInfo.VerifyTime.Valid {
|
||||
isRealName = true // verify_time不为空表示已通过三要素核验
|
||||
}
|
||||
realName = realNameInfo.Name
|
||||
if realNameInfo.IdCard != "" {
|
||||
key, keyErr := hex.DecodeString(l.svcCtx.Config.Encrypt.SecretKey)
|
||||
if keyErr == nil {
|
||||
decrypted, err := crypto.DecryptIDCard(realNameInfo.IdCard, key)
|
||||
if err == nil {
|
||||
idCardPlain = decrypted
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wechatId := ""
|
||||
if agent.WechatId.Valid {
|
||||
wechatId = agent.WechatId.String
|
||||
}
|
||||
teamLeaderId := int64(0)
|
||||
teamLeaderId := ""
|
||||
if agent.TeamLeaderId.Valid {
|
||||
teamLeaderId = agent.TeamLeaderId.Int64
|
||||
teamLeaderId = agent.TeamLeaderId.String
|
||||
}
|
||||
|
||||
// 获取区域
|
||||
@@ -102,22 +117,25 @@ func (l *AdminGetAgentListLogic) AdminGetAgentList(req *types.AdminGetAgentListR
|
||||
}
|
||||
|
||||
item := types.AgentListItem{
|
||||
Id: agent.Id,
|
||||
UserId: agent.UserId,
|
||||
Level: agent.Level,
|
||||
LevelName: levelName,
|
||||
Region: region,
|
||||
Mobile: agent.Mobile,
|
||||
WechatId: wechatId,
|
||||
TeamLeaderId: teamLeaderId,
|
||||
Balance: 0,
|
||||
TotalEarnings: 0,
|
||||
FrozenBalance: 0,
|
||||
Id: agent.Id,
|
||||
UserId: agent.UserId,
|
||||
Level: agent.Level,
|
||||
LevelName: levelName,
|
||||
Region: region,
|
||||
Mobile: agent.Mobile,
|
||||
WechatId: wechatId,
|
||||
TeamLeaderId: teamLeaderId,
|
||||
AgentCode: agent.AgentCode,
|
||||
Balance: 0,
|
||||
TotalEarnings: 0,
|
||||
FrozenBalance: 0,
|
||||
WithdrawnAmount: 0,
|
||||
IsRealName: isRealName,
|
||||
CreateTime: agent.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
IsRealName: isRealName,
|
||||
RealName: realName,
|
||||
IdCardPlain: idCardPlain,
|
||||
CreateTime: agent.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
|
||||
|
||||
if wallet != nil {
|
||||
item.Balance = wallet.Balance
|
||||
item.TotalEarnings = wallet.TotalEarnings
|
||||
|
||||
@@ -2,7 +2,6 @@ package admin_agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"ycc-server/common/globalkey"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
"github.com/Masterminds/squirrel"
|
||||
@@ -29,8 +28,7 @@ func NewAdminGetAgentOrderListLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
||||
}
|
||||
|
||||
func (l *AdminGetAgentOrderListLogic) AdminGetAgentOrderList(req *types.AdminGetAgentOrderListReq) (resp *types.AdminGetAgentOrderListResp, err error) {
|
||||
builder := l.svcCtx.AgentOrderModel.SelectBuilder().
|
||||
Where("del_state = ?", globalkey.DelStateNo)
|
||||
builder := l.svcCtx.AgentOrderModel.SelectBuilder()
|
||||
|
||||
if req.AgentId != nil {
|
||||
builder = builder.Where("agent_id = ?", *req.AgentId)
|
||||
@@ -42,6 +40,27 @@ func (l *AdminGetAgentOrderListLogic) AdminGetAgentOrderList(req *types.AdminGet
|
||||
builder = builder.Where("process_status = ?", *req.ProcessStatus)
|
||||
}
|
||||
|
||||
// 如果提供了订单状态筛选,先查询符合条件的订单ID列表
|
||||
var filteredOrderIds []string
|
||||
if req.OrderStatus != nil && *req.OrderStatus != "" {
|
||||
orderBuilder := l.svcCtx.OrderModel.SelectBuilder().
|
||||
Where("status = ?", *req.OrderStatus).
|
||||
Columns("id")
|
||||
orders, _ := l.svcCtx.OrderModel.FindAll(l.ctx, orderBuilder, "")
|
||||
filteredOrderIds = make([]string, 0, len(orders))
|
||||
for _, o := range orders {
|
||||
filteredOrderIds = append(filteredOrderIds, o.Id)
|
||||
}
|
||||
// 如果没有符合条件的订单,直接返回空结果
|
||||
if len(filteredOrderIds) == 0 {
|
||||
return &types.AdminGetAgentOrderListResp{
|
||||
Total: 0,
|
||||
Items: []types.AgentOrderListItem{},
|
||||
}, nil
|
||||
}
|
||||
builder = builder.Where(squirrel.Eq{"order_id": filteredOrderIds})
|
||||
}
|
||||
|
||||
// 分页查询
|
||||
page := req.Page
|
||||
if page <= 0 {
|
||||
@@ -58,15 +77,15 @@ func (l *AdminGetAgentOrderListLogic) AdminGetAgentOrderList(req *types.AdminGet
|
||||
}
|
||||
|
||||
// 批量查询产品名称
|
||||
productIdSet := make(map[int64]struct{})
|
||||
productIdSet := make(map[string]struct{})
|
||||
for _, order := range orders {
|
||||
productIdSet[order.ProductId] = struct{}{}
|
||||
}
|
||||
productIdList := make([]int64, 0, len(productIdSet))
|
||||
productIdList := make([]string, 0, len(productIdSet))
|
||||
for id := range productIdSet {
|
||||
productIdList = append(productIdList, id)
|
||||
}
|
||||
productNameMap := make(map[int64]string)
|
||||
productNameMap := make(map[string]string)
|
||||
if len(productIdList) > 0 {
|
||||
products, _ := l.svcCtx.ProductModel.FindAll(l.ctx, l.svcCtx.ProductModel.SelectBuilder().Where(squirrel.Eq{"id": productIdList}), "")
|
||||
for _, p := range products {
|
||||
@@ -74,9 +93,30 @@ func (l *AdminGetAgentOrderListLogic) AdminGetAgentOrderList(req *types.AdminGet
|
||||
}
|
||||
}
|
||||
|
||||
// 批量查询订单状态
|
||||
orderIdSet := make(map[string]struct{})
|
||||
for _, order := range orders {
|
||||
orderIdSet[order.OrderId] = struct{}{}
|
||||
}
|
||||
orderIdList := make([]string, 0, len(orderIdSet))
|
||||
for id := range orderIdSet {
|
||||
orderIdList = append(orderIdList, id)
|
||||
}
|
||||
orderStatusMap := make(map[string]string)
|
||||
if len(orderIdList) > 0 {
|
||||
orderList, _ := l.svcCtx.OrderModel.FindAll(l.ctx, l.svcCtx.OrderModel.SelectBuilder().Where(squirrel.Eq{"id": orderIdList}), "")
|
||||
for _, o := range orderList {
|
||||
orderStatusMap[o.Id] = o.Status
|
||||
}
|
||||
}
|
||||
|
||||
// 组装响应
|
||||
items := make([]types.AgentOrderListItem, 0, len(orders))
|
||||
for _, order := range orders {
|
||||
orderStatus := orderStatusMap[order.OrderId]
|
||||
if orderStatus == "" {
|
||||
orderStatus = "unknown" // 如果查询不到订单,默认为 unknown
|
||||
}
|
||||
items = append(items, types.AgentOrderListItem{
|
||||
Id: order.Id,
|
||||
AgentId: order.AgentId,
|
||||
@@ -89,6 +129,7 @@ func (l *AdminGetAgentOrderListLogic) AdminGetAgentOrderList(req *types.AdminGet
|
||||
PriceCost: order.PriceCost,
|
||||
AgentProfit: order.AgentProfit,
|
||||
ProcessStatus: order.ProcessStatus,
|
||||
OrderStatus: orderStatus,
|
||||
CreateTime: order.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -28,8 +28,7 @@ func NewAdminGetAgentProductConfigListLogic(ctx context.Context, svcCtx *svc.Ser
|
||||
}
|
||||
|
||||
func (l *AdminGetAgentProductConfigListLogic) AdminGetAgentProductConfigList(req *types.AdminGetAgentProductConfigListReq) (resp *types.AdminGetAgentProductConfigListResp, err error) {
|
||||
builder := l.svcCtx.AgentProductConfigModel.SelectBuilder().
|
||||
Where("del_state = ?", globalkey.DelStateNo)
|
||||
builder := l.svcCtx.AgentProductConfigModel.SelectBuilder()
|
||||
|
||||
// 如果提供了产品ID,直接过滤
|
||||
if req.ProductId != nil {
|
||||
|
||||
@@ -2,7 +2,6 @@ package admin_agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"ycc-server/common/globalkey"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/pkg/lzkit/crypto"
|
||||
|
||||
@@ -29,8 +28,7 @@ func NewAdminGetAgentRealNameListLogic(ctx context.Context, svcCtx *svc.ServiceC
|
||||
}
|
||||
|
||||
func (l *AdminGetAgentRealNameListLogic) AdminGetAgentRealNameList(req *types.AdminGetAgentRealNameListReq) (resp *types.AdminGetAgentRealNameListResp, err error) {
|
||||
builder := l.svcCtx.AgentRealNameModel.SelectBuilder().
|
||||
Where("del_state = ?", globalkey.DelStateNo)
|
||||
builder := l.svcCtx.AgentRealNameModel.SelectBuilder()
|
||||
|
||||
if req.AgentId != nil {
|
||||
builder = builder.Where("agent_id = ?", *req.AgentId)
|
||||
|
||||
@@ -2,7 +2,6 @@ package admin_agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"ycc-server/common/globalkey"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
"github.com/Masterminds/squirrel"
|
||||
@@ -29,8 +28,7 @@ func NewAdminGetAgentRebateListLogic(ctx context.Context, svcCtx *svc.ServiceCon
|
||||
}
|
||||
|
||||
func (l *AdminGetAgentRebateListLogic) AdminGetAgentRebateList(req *types.AdminGetAgentRebateListReq) (resp *types.AdminGetAgentRebateListResp, err error) {
|
||||
builder := l.svcCtx.AgentRebateModel.SelectBuilder().
|
||||
Where("del_state = ?", globalkey.DelStateNo)
|
||||
builder := l.svcCtx.AgentRebateModel.SelectBuilder()
|
||||
|
||||
if req.AgentId != nil {
|
||||
builder = builder.Where("agent_id = ?", *req.AgentId)
|
||||
@@ -41,6 +39,9 @@ func (l *AdminGetAgentRebateListLogic) AdminGetAgentRebateList(req *types.AdminG
|
||||
if req.RebateType != nil {
|
||||
builder = builder.Where("rebate_type = ?", *req.RebateType)
|
||||
}
|
||||
if req.Status != nil {
|
||||
builder = builder.Where("status = ?", *req.Status)
|
||||
}
|
||||
|
||||
// 分页查询
|
||||
page := req.Page
|
||||
@@ -58,15 +59,15 @@ func (l *AdminGetAgentRebateListLogic) AdminGetAgentRebateList(req *types.AdminG
|
||||
}
|
||||
|
||||
// 批量查询产品名称
|
||||
productIdSet := make(map[int64]struct{})
|
||||
productIdSet := make(map[string]struct{})
|
||||
for _, rebate := range rebates {
|
||||
productIdSet[rebate.ProductId] = struct{}{}
|
||||
}
|
||||
productIdList := make([]int64, 0, len(productIdSet))
|
||||
productIdList := make([]string, 0, len(productIdSet))
|
||||
for id := range productIdSet {
|
||||
productIdList = append(productIdList, id)
|
||||
}
|
||||
productNameMap := make(map[int64]string)
|
||||
productNameMap := make(map[string]string)
|
||||
if len(productIdList) > 0 {
|
||||
products, _ := l.svcCtx.ProductModel.FindAll(l.ctx, l.svcCtx.ProductModel.SelectBuilder().Where(squirrel.Eq{"id": productIdList}), "")
|
||||
for _, p := range products {
|
||||
@@ -79,12 +80,13 @@ func (l *AdminGetAgentRebateListLogic) AdminGetAgentRebateList(req *types.AdminG
|
||||
for _, rebate := range rebates {
|
||||
items = append(items, types.AgentRebateListItem{
|
||||
Id: rebate.Id,
|
||||
AgentId: rebate.AgentId,
|
||||
AgentId: rebate.AgentId,
|
||||
SourceAgentId: rebate.SourceAgentId,
|
||||
OrderId: rebate.OrderId,
|
||||
RebateType: rebate.RebateType,
|
||||
Amount: rebate.RebateAmount,
|
||||
CreateTime: rebate.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
OrderId: rebate.OrderId,
|
||||
RebateType: rebate.RebateType,
|
||||
Amount: rebate.RebateAmount,
|
||||
Status: rebate.Status,
|
||||
CreateTime: rebate.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package admin_agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"ycc-server/common/globalkey"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -28,8 +27,7 @@ func NewAdminGetAgentUpgradeListLogic(ctx context.Context, svcCtx *svc.ServiceCo
|
||||
}
|
||||
|
||||
func (l *AdminGetAgentUpgradeListLogic) AdminGetAgentUpgradeList(req *types.AdminGetAgentUpgradeListReq) (resp *types.AdminGetAgentUpgradeListResp, err error) {
|
||||
builder := l.svcCtx.AgentUpgradeModel.SelectBuilder().
|
||||
Where("del_state = ?", globalkey.DelStateNo)
|
||||
builder := l.svcCtx.AgentUpgradeModel.SelectBuilder()
|
||||
|
||||
if req.AgentId != nil {
|
||||
builder = builder.Where("agent_id = ?", *req.AgentId)
|
||||
|
||||
@@ -49,6 +49,17 @@ func (l *AdminGetAgentWithdrawalListLogic) AdminGetAgentWithdrawalList(req *type
|
||||
item.Remark = v.Remark.String
|
||||
}
|
||||
item.CreateTime = v.CreateTime.Format("2006-01-02 15:04:05")
|
||||
|
||||
// 如果是银行卡提现,填充银行卡信息
|
||||
if v.WithdrawalType == 2 {
|
||||
if v.BankCardNo.Valid {
|
||||
item.BankCardNo = v.BankCardNo.String
|
||||
}
|
||||
if v.BankName.Valid {
|
||||
item.BankName = v.BankName.String
|
||||
}
|
||||
}
|
||||
|
||||
items = append(items, item)
|
||||
}
|
||||
resp = &types.AdminGetAgentWithdrawalListResp{
|
||||
|
||||
@@ -2,7 +2,6 @@ package admin_agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"ycc-server/common/globalkey"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/pkg/lzkit/crypto"
|
||||
|
||||
@@ -31,14 +30,13 @@ func NewAdminGetInviteCodeListLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
||||
|
||||
func (l *AdminGetInviteCodeListLogic) AdminGetInviteCodeList(req *types.AdminGetInviteCodeListReq) (resp *types.AdminGetInviteCodeListResp, err error) {
|
||||
// 1. 构建查询条件
|
||||
builder := l.svcCtx.AgentInviteCodeModel.SelectBuilder().
|
||||
Where("del_state = ?", globalkey.DelStateNo)
|
||||
builder := l.svcCtx.AgentInviteCodeModel.SelectBuilder()
|
||||
|
||||
if req.Code != nil && *req.Code != "" {
|
||||
builder = builder.Where("code = ?", *req.Code)
|
||||
}
|
||||
if req.AgentId != nil {
|
||||
if *req.AgentId == 0 {
|
||||
if req.AgentId != nil && *req.AgentId != "" {
|
||||
if *req.AgentId == "0" {
|
||||
// agent_id = 0 表示查询平台发放的邀请码(agent_id为NULL)
|
||||
builder = builder.Where("agent_id IS NULL")
|
||||
} else {
|
||||
@@ -59,16 +57,16 @@ func (l *AdminGetInviteCodeListLogic) AdminGetInviteCodeList(req *types.AdminGet
|
||||
}
|
||||
|
||||
// 3. 批量查询代理信息(用于显示代理手机号)
|
||||
agentIds := make(map[int64]struct{})
|
||||
agentIds := make(map[string]struct{})
|
||||
for _, v := range list {
|
||||
if v.AgentId.Valid && v.AgentId.Int64 > 0 {
|
||||
agentIds[v.AgentId.Int64] = struct{}{}
|
||||
if v.AgentId.Valid && v.AgentId.String != "" {
|
||||
agentIds[v.AgentId.String] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
agentMobileMap := make(map[int64]string)
|
||||
agentMobileMap := make(map[string]string)
|
||||
if len(agentIds) > 0 {
|
||||
agentIdList := make([]int64, 0, len(agentIds))
|
||||
agentIdList := make([]string, 0, len(agentIds))
|
||||
for id := range agentIds {
|
||||
agentIdList = append(agentIdList, id)
|
||||
}
|
||||
@@ -90,7 +88,7 @@ func (l *AdminGetInviteCodeListLogic) AdminGetInviteCodeList(req *types.AdminGet
|
||||
item := types.InviteCodeListItem{
|
||||
Id: v.Id,
|
||||
Code: v.Code,
|
||||
AgentId: 0,
|
||||
AgentId: "",
|
||||
AgentMobile: "",
|
||||
TargetLevel: v.TargetLevel,
|
||||
Status: v.Status,
|
||||
@@ -98,15 +96,15 @@ func (l *AdminGetInviteCodeListLogic) AdminGetInviteCodeList(req *types.AdminGet
|
||||
}
|
||||
|
||||
if v.AgentId.Valid {
|
||||
item.AgentId = v.AgentId.Int64
|
||||
item.AgentMobile = agentMobileMap[v.AgentId.Int64]
|
||||
item.AgentId = v.AgentId.String
|
||||
item.AgentMobile = agentMobileMap[v.AgentId.String]
|
||||
}
|
||||
|
||||
if v.UsedUserId.Valid {
|
||||
item.UsedUserId = v.UsedUserId.Int64
|
||||
item.UsedUserId = v.UsedUserId.String
|
||||
}
|
||||
if v.UsedAgentId.Valid {
|
||||
item.UsedAgentId = v.UsedAgentId.Int64
|
||||
item.UsedAgentId = v.UsedAgentId.String
|
||||
}
|
||||
if v.UsedTime.Valid {
|
||||
item.UsedTime = v.UsedTime.Time.Format("2006-01-02 15:04:05")
|
||||
|
||||
@@ -2,6 +2,7 @@ package admin_agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"strconv"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
@@ -9,6 +10,7 @@ import (
|
||||
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/app/main/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
@@ -28,17 +30,77 @@ func NewAdminUpdateAgentConfigLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
||||
}
|
||||
|
||||
func (l *AdminUpdateAgentConfigLogic) AdminUpdateAgentConfig(req *types.AdminUpdateAgentConfigReq) (resp *types.AdminUpdateAgentConfigResp, err error) {
|
||||
// 更新配置的辅助函数
|
||||
configTypeForKey := func(key string) string {
|
||||
switch key {
|
||||
case "level_1_bonus", "level_2_bonus", "level_3_bonus":
|
||||
return "bonus"
|
||||
case "upgrade_to_gold_fee", "upgrade_to_diamond_fee", "upgrade_to_gold_rebate", "upgrade_to_diamond_rebate":
|
||||
return "upgrade"
|
||||
case "direct_parent_amount_diamond", "direct_parent_amount_gold", "direct_parent_amount_normal", "max_gold_rebate_amount":
|
||||
return "rebate"
|
||||
case "commission_freeze_ratio", "commission_freeze_threshold", "commission_freeze_days":
|
||||
return "rebate"
|
||||
case "tax_rate", "tax_exemption_amount":
|
||||
return "tax"
|
||||
case "gold_max_uplift_amount", "diamond_max_uplift_amount":
|
||||
return "price"
|
||||
default:
|
||||
return "rebate"
|
||||
}
|
||||
}
|
||||
|
||||
updateConfig := func(key string, value *float64) error {
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
valStr := strconv.FormatFloat(*value, 'f', -1, 64)
|
||||
config, err := l.svcCtx.AgentConfigModel.FindOneByConfigKey(l.ctx, key)
|
||||
if err != nil {
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
cfg := &model.AgentConfig{
|
||||
ConfigKey: key,
|
||||
ConfigValue: valStr,
|
||||
ConfigType: configTypeForKey(key),
|
||||
Description: sql.NullString{},
|
||||
DeleteTime: sql.NullTime{},
|
||||
Version: 0,
|
||||
}
|
||||
_, insErr := l.svcCtx.AgentConfigModel.Insert(l.ctx, nil, cfg)
|
||||
if insErr != nil {
|
||||
return errors.Wrapf(insErr, "创建配置失败, key: %s", key)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return errors.Wrapf(err, "查询配置失败, key: %s", key)
|
||||
}
|
||||
config.ConfigValue = strconv.FormatFloat(*value, 'f', -1, 64)
|
||||
return l.svcCtx.AgentConfigModel.UpdateWithVersion(l.ctx, nil, config)
|
||||
config.ConfigValue = valStr
|
||||
if uErr := l.svcCtx.AgentConfigModel.UpdateWithVersion(l.ctx, nil, config); uErr != nil {
|
||||
if errors.Is(uErr, model.ErrNoRowsUpdate) {
|
||||
latestByKey, reErr := l.svcCtx.AgentConfigModel.FindOneByConfigKey(l.ctx, key)
|
||||
if reErr != nil {
|
||||
if errors.Is(reErr, model.ErrNotFound) {
|
||||
cfg := &model.AgentConfig{
|
||||
ConfigKey: key,
|
||||
ConfigValue: valStr,
|
||||
ConfigType: configTypeForKey(key),
|
||||
Description: sql.NullString{},
|
||||
DeleteTime: sql.NullTime{},
|
||||
Version: 0,
|
||||
}
|
||||
_, insErr := l.svcCtx.AgentConfigModel.Insert(l.ctx, nil, cfg)
|
||||
if insErr != nil {
|
||||
return errors.Wrapf(insErr, "创建配置失败, key: %s", key)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return errors.Wrapf(reErr, "查询最新配置失败, key: %s", key)
|
||||
}
|
||||
latestByKey.ConfigValue = valStr
|
||||
return l.svcCtx.AgentConfigModel.UpdateWithVersion(l.ctx, nil, latestByKey)
|
||||
}
|
||||
return uErr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 更新等级加成配置
|
||||
@@ -118,6 +180,13 @@ func (l *AdminUpdateAgentConfigLogic) AdminUpdateAgentConfig(req *types.AdminUpd
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "更新免税额度失败, %v", err)
|
||||
}
|
||||
|
||||
if err := updateConfig("gold_max_uplift_amount", req.GoldMaxUpliftAmount); err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "更新黄金代理最高价上调金额失败, %v", err)
|
||||
}
|
||||
if err := updateConfig("diamond_max_uplift_amount", req.DiamondMaxUpliftAmount); err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "更新钻石代理最高价上调金额失败, %v", err)
|
||||
}
|
||||
|
||||
return &types.AdminUpdateAgentConfigResp{
|
||||
Success: true,
|
||||
}, nil
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package admin_agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"regexp"
|
||||
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/pkg/lzkit/crypto"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
// 手机号正则:11 位大陆手机号
|
||||
var mobileRegexp = regexp.MustCompile(`^1[3-9]\d{9}$`)
|
||||
|
||||
type AdminUpdateAgentMobileLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewAdminUpdateAgentMobileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminUpdateAgentMobileLogic {
|
||||
return &AdminUpdateAgentMobileLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AdminUpdateAgentMobileLogic) AdminUpdateAgentMobile(req *types.AdminUpdateAgentMobileReq) (resp *types.AdminUpdateAgentMobileResp, err error) {
|
||||
// 1. 校验手机号格式
|
||||
if req.Mobile == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("手机号不能为空"), "")
|
||||
}
|
||||
if !mobileRegexp.MatchString(req.Mobile) {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("手机号格式不正确"), "")
|
||||
}
|
||||
|
||||
// 2. 查询代理
|
||||
agent, err := l.svcCtx.AgentModel.FindOne(l.ctx, req.AgentId)
|
||||
if err != nil {
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("代理不存在"), "")
|
||||
}
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查询代理失败, %v", err)
|
||||
}
|
||||
|
||||
// 3. 加密新手机号
|
||||
encryptedMobile, err := crypto.EncryptMobile(req.Mobile, l.svcCtx.Config.Encrypt.SecretKey)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "加密手机号失败, %v", err)
|
||||
}
|
||||
|
||||
// 4. 更新代理手机号
|
||||
agent.Mobile = encryptedMobile
|
||||
if err := l.svcCtx.AgentModel.UpdateWithVersion(l.ctx, nil, agent); err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "更新手机号失败, %v", err)
|
||||
}
|
||||
|
||||
return &types.AdminUpdateAgentMobileResp{
|
||||
Success: true,
|
||||
}, nil
|
||||
}
|
||||
@@ -40,7 +40,7 @@ func (l *AdminBatchUpdateApiStatusLogic) AdminBatchUpdateApiStatus(req *types.Ad
|
||||
// 2. 批量更新API状态
|
||||
successCount := 0
|
||||
for _, id := range req.Ids {
|
||||
if id <= 0 {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func (l *AdminBatchUpdateApiStatusLogic) AdminBatchUpdateApiStatus(req *types.Ad
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
continue // 跳过不存在的API
|
||||
}
|
||||
logx.Errorf("查询API失败, err: %v, id: %d", err, id)
|
||||
logx.Errorf("查询API失败, err: %v, id: %s", err, id)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
@@ -58,6 +59,7 @@ func (l *AdminCreateApiLogic) AdminCreateApi(req *types.AdminCreateApiReq) (resp
|
||||
|
||||
// 3. 创建API记录
|
||||
apiData := &model.AdminApi{
|
||||
Id: uuid.NewString(),
|
||||
ApiName: req.ApiName,
|
||||
ApiCode: req.ApiCode,
|
||||
Method: req.Method,
|
||||
@@ -71,8 +73,7 @@ func (l *AdminCreateApiLogic) AdminCreateApi(req *types.AdminCreateApiReq) (resp
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR),
|
||||
"创建API失败, err: %v", err)
|
||||
}
|
||||
|
||||
// 4. 返回结果
|
||||
apiId, _ := result.LastInsertId()
|
||||
return &types.AdminCreateApiResp{Id: apiId}, nil
|
||||
_ = result
|
||||
return &types.AdminCreateApiResp{Id: apiData.Id}, nil
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ func NewAdminDeleteApiLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ad
|
||||
|
||||
func (l *AdminDeleteApiLogic) AdminDeleteApi(req *types.AdminDeleteApiReq) (resp *types.AdminDeleteApiResp, err error) {
|
||||
// 1. 参数验证
|
||||
if req.Id <= 0 {
|
||||
if req.Id == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.PARAM_VERIFICATION_ERROR),
|
||||
"API ID必须大于0, id: %d", req.Id)
|
||||
"API ID不能为空, id: %s", req.Id)
|
||||
}
|
||||
|
||||
// 2. 查询API是否存在
|
||||
|
||||
@@ -28,9 +28,9 @@ func NewAdminGetApiDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
|
||||
func (l *AdminGetApiDetailLogic) AdminGetApiDetail(req *types.AdminGetApiDetailReq) (resp *types.AdminGetApiDetailResp, err error) {
|
||||
// 1. 参数验证
|
||||
if req.Id <= 0 {
|
||||
if req.Id == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.PARAM_VERIFICATION_ERROR),
|
||||
"API ID必须大于0, id: %d", req.Id)
|
||||
"API ID不能为空, id: %s", req.Id)
|
||||
}
|
||||
|
||||
// 2. 查询API详情
|
||||
|
||||
@@ -28,9 +28,9 @@ func NewAdminUpdateApiLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ad
|
||||
|
||||
func (l *AdminUpdateApiLogic) AdminUpdateApi(req *types.AdminUpdateApiReq) (resp *types.AdminUpdateApiResp, err error) {
|
||||
// 1. 参数验证
|
||||
if req.Id <= 0 {
|
||||
if req.Id == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.PARAM_VERIFICATION_ERROR),
|
||||
"API ID必须大于0, id: %d", req.Id)
|
||||
"API ID不能为空, id: %s", req.Id)
|
||||
}
|
||||
if req.ApiName == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.PARAM_VERIFICATION_ERROR),
|
||||
|
||||
@@ -57,7 +57,7 @@ func (l *AdminLoginLogic) AdminLogin(req *types.AdminLoginReq) (resp *types.Admi
|
||||
}
|
||||
|
||||
// 获取角色ID数组
|
||||
roleIds := make([]int64, 0)
|
||||
roleIds := make([]string, 0)
|
||||
for _, permission := range permissions {
|
||||
roleIds = append(roleIds, permission.RoleId)
|
||||
}
|
||||
@@ -77,7 +77,7 @@ func (l *AdminLoginLogic) AdminLogin(req *types.AdminLoginReq) (resp *types.Admi
|
||||
expiresAt := l.svcCtx.Config.AdminConfig.AccessExpire
|
||||
claims := jwtx.JwtClaims{
|
||||
UserId: user.Id,
|
||||
AgentId: 0,
|
||||
AgentId: "",
|
||||
Platform: model.PlatformAdmin,
|
||||
UserType: model.UserTypeAdmin,
|
||||
IsAgent: model.AgentStatusNo,
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
package admin_complaint
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/pkg/lzkit/lzUtils"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type AdminGetComplaintDetailLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewAdminGetComplaintDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetComplaintDetailLogic {
|
||||
return &AdminGetComplaintDetailLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AdminGetComplaintDetailLogic) AdminGetComplaintDetail(req *types.AdminGetComplaintDetailReq) (resp *types.AdminGetComplaintDetailResp, err error) {
|
||||
// 获取投诉主表信息
|
||||
complaint, err := l.svcCtx.ComplaintMainModel.FindOne(l.ctx, req.Id)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminGetComplaintDetail, 查询投诉失败 err: %v", err)
|
||||
}
|
||||
|
||||
// 构建响应
|
||||
resp = &types.AdminGetComplaintDetailResp{
|
||||
Id: complaint.Id,
|
||||
Type: complaint.Type,
|
||||
OrderId: lzUtils.NullStringToString(complaint.OrderId),
|
||||
Name: lzUtils.NullStringToString(complaint.Name),
|
||||
Contact: lzUtils.NullStringToString(complaint.Contact),
|
||||
Content: lzUtils.NullStringToString(complaint.Content),
|
||||
Status: lzUtils.NullStringToString(complaint.Status),
|
||||
StatusDescription: lzUtils.NullStringToString(complaint.StatusDescription),
|
||||
Remark: lzUtils.NullStringToString(complaint.Remark),
|
||||
HandlerId: lzUtils.NullStringToString(complaint.HandlerId),
|
||||
CreateTime: complaint.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
UpdateTime: complaint.UpdateTime.Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
|
||||
if complaint.HandleTime.Valid {
|
||||
resp.HandleTime = complaint.HandleTime.Time.Format("2006-01-02 15:04:05")
|
||||
}
|
||||
|
||||
// 获取支付宝投诉详情
|
||||
if complaint.Type == "alipay" {
|
||||
alipayBuilder := l.svcCtx.ComplaintAlipayModel.SelectBuilder().
|
||||
Where("complaint_id = ?", complaint.Id)
|
||||
alipayComplaints, err := l.svcCtx.ComplaintAlipayModel.FindAll(l.ctx, alipayBuilder, "")
|
||||
if err != nil && !errors.Is(err, model.ErrNotFound) {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminGetComplaintDetail, 查询支付宝投诉失败 err: %v", err)
|
||||
}
|
||||
|
||||
if len(alipayComplaints) > 0 {
|
||||
alipayComplaint := alipayComplaints[0]
|
||||
alipayDetail := &types.AlipayComplaintDetail{
|
||||
Id: alipayComplaint.Id,
|
||||
AlipayId: alipayComplaint.AlipayId,
|
||||
TaskId: alipayComplaint.TaskId,
|
||||
OppositePid: lzUtils.NullStringToString(alipayComplaint.OppositePid),
|
||||
OppositeName: lzUtils.NullStringToString(alipayComplaint.OppositeName),
|
||||
ComplainContent: lzUtils.NullStringToString(alipayComplaint.ComplainContent),
|
||||
TradeNo: lzUtils.NullStringToString(alipayComplaint.TradeNo),
|
||||
Status: lzUtils.NullStringToString(alipayComplaint.Status),
|
||||
StatusDescription: lzUtils.NullStringToString(alipayComplaint.StatusDescription),
|
||||
ProcessCode: lzUtils.NullStringToString(alipayComplaint.ProcessCode),
|
||||
ProcessMessage: lzUtils.NullStringToString(alipayComplaint.ProcessMessage),
|
||||
ProcessRemark: lzUtils.NullStringToString(alipayComplaint.ProcessRemark),
|
||||
ComplainUrl: lzUtils.NullStringToString(alipayComplaint.ComplainUrl),
|
||||
}
|
||||
|
||||
if alipayComplaint.ComplainAmount.Valid {
|
||||
alipayDetail.ComplainAmount = strconv.FormatFloat(alipayComplaint.ComplainAmount.Float64, 'f', -1, 64)
|
||||
}
|
||||
if alipayComplaint.GmtComplain.Valid {
|
||||
alipayDetail.GmtComplain = alipayComplaint.GmtComplain.Time.Format("2006-01-02 15:04:05")
|
||||
}
|
||||
if alipayComplaint.GmtProcess.Valid {
|
||||
alipayDetail.GmtProcess = alipayComplaint.GmtProcess.Time.Format("2006-01-02 15:04:05")
|
||||
}
|
||||
if alipayComplaint.GmtRiskFinishTime.Valid {
|
||||
alipayDetail.GmtRiskFinishTime = alipayComplaint.GmtRiskFinishTime.Time.Format("2006-01-02 15:04:05")
|
||||
}
|
||||
|
||||
// 解析图片列表
|
||||
if alipayComplaint.ProcessImgUrlList.Valid {
|
||||
var imgList []string
|
||||
if err := json.Unmarshal([]byte(alipayComplaint.ProcessImgUrlList.String), &imgList); err == nil {
|
||||
alipayDetail.ProcessImgUrlList = imgList
|
||||
}
|
||||
}
|
||||
if alipayComplaint.CertifyInfo.Valid {
|
||||
var certifyList []string
|
||||
if err := json.Unmarshal([]byte(alipayComplaint.CertifyInfo.String), &certifyList); err == nil {
|
||||
alipayDetail.CertifyInfo = certifyList
|
||||
}
|
||||
}
|
||||
|
||||
// 获取交易信息列表
|
||||
tradeBuilder := l.svcCtx.ComplaintAlipayTradeModel.SelectBuilder().
|
||||
Where("complaint_id = ?", alipayComplaint.Id)
|
||||
trades, err := l.svcCtx.ComplaintAlipayTradeModel.FindAll(l.ctx, tradeBuilder, "")
|
||||
if err != nil && !errors.Is(err, model.ErrNotFound) {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminGetComplaintDetail, 查询交易信息失败 err: %v", err)
|
||||
}
|
||||
|
||||
alipayDetail.TradeInfoList = make([]types.AlipayComplaintTradeInfo, 0, len(trades))
|
||||
for _, trade := range trades {
|
||||
tradeInfo := types.AlipayComplaintTradeInfo{
|
||||
Id: trade.Id,
|
||||
TradeNo: lzUtils.NullStringToString(trade.TradeNo),
|
||||
OutNo: lzUtils.NullStringToString(trade.OutNo),
|
||||
Status: lzUtils.NullStringToString(trade.Status),
|
||||
StatusDescription: lzUtils.NullStringToString(trade.StatusDescription),
|
||||
}
|
||||
|
||||
if trade.AlipayTradeId.Valid {
|
||||
tradeInfo.AlipayTradeId = strconv.FormatInt(trade.AlipayTradeId.Int64, 10)
|
||||
}
|
||||
if trade.AlipayComplaintRecordId.Valid {
|
||||
tradeInfo.AlipayComplaintRecordId = strconv.FormatInt(trade.AlipayComplaintRecordId.Int64, 10)
|
||||
}
|
||||
if trade.GmtTrade.Valid {
|
||||
tradeInfo.GmtTrade = trade.GmtTrade.Time.Format("2006-01-02 15:04:05")
|
||||
}
|
||||
if trade.GmtRefund.Valid {
|
||||
tradeInfo.GmtRefund = trade.GmtRefund.Time.Format("2006-01-02 15:04:05")
|
||||
}
|
||||
if trade.Amount.Valid {
|
||||
tradeInfo.Amount = strconv.FormatFloat(trade.Amount.Float64, 'f', -1, 64)
|
||||
}
|
||||
|
||||
alipayDetail.TradeInfoList = append(alipayDetail.TradeInfoList, tradeInfo)
|
||||
}
|
||||
|
||||
resp.AlipayComplaint = alipayDetail
|
||||
}
|
||||
}
|
||||
|
||||
// 获取主动投诉详情
|
||||
if complaint.Type == "manual" {
|
||||
manualBuilder := l.svcCtx.ComplaintManualModel.SelectBuilder().
|
||||
Where("complaint_id = ?", complaint.Id)
|
||||
manualComplaints, err := l.svcCtx.ComplaintManualModel.FindAll(l.ctx, manualBuilder, "")
|
||||
if err != nil && !errors.Is(err, model.ErrNotFound) {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminGetComplaintDetail, 查询主动投诉失败 err: %v", err)
|
||||
}
|
||||
|
||||
if len(manualComplaints) > 0 {
|
||||
manualComplaint := manualComplaints[0]
|
||||
manualDetail := &types.ManualComplaintDetail{
|
||||
Id: manualComplaint.Id,
|
||||
UserId: lzUtils.NullStringToString(manualComplaint.UserId),
|
||||
Subject: lzUtils.NullStringToString(manualComplaint.Subject),
|
||||
Priority: lzUtils.NullStringToString(manualComplaint.Priority),
|
||||
Source: lzUtils.NullStringToString(manualComplaint.Source),
|
||||
}
|
||||
|
||||
// 解析附件URL列表
|
||||
if manualComplaint.AttachmentUrls.Valid {
|
||||
var urlList []string
|
||||
if err := json.Unmarshal([]byte(manualComplaint.AttachmentUrls.String), &urlList); err == nil {
|
||||
manualDetail.AttachmentUrls = urlList
|
||||
}
|
||||
}
|
||||
|
||||
resp.ManualComplaint = manualDetail
|
||||
}
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package admin_complaint
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/pkg/lzkit/lzUtils"
|
||||
|
||||
"github.com/Masterminds/squirrel"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/core/mr"
|
||||
)
|
||||
|
||||
type AdminGetComplaintListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewAdminGetComplaintListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetComplaintListLogic {
|
||||
return &AdminGetComplaintListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AdminGetComplaintListLogic) AdminGetComplaintList(req *types.AdminGetComplaintListReq) (resp *types.AdminGetComplaintListResp, err error) {
|
||||
// 构建查询条件
|
||||
builder := l.svcCtx.ComplaintMainModel.SelectBuilder()
|
||||
if req.Type != "" {
|
||||
builder = builder.Where("type = ?", req.Type)
|
||||
}
|
||||
if req.Status != "" {
|
||||
builder = builder.Where("status = ?", req.Status)
|
||||
}
|
||||
if req.Name != "" {
|
||||
builder = builder.Where("name LIKE ?", "%"+req.Name+"%")
|
||||
}
|
||||
if req.Contact != "" {
|
||||
builder = builder.Where("contact LIKE ?", "%"+req.Contact+"%")
|
||||
}
|
||||
if req.OrderId != "" {
|
||||
builder = builder.Where("order_id = ?", req.OrderId)
|
||||
}
|
||||
// 时间范围查询
|
||||
if req.CreateTimeStart != "" {
|
||||
builder = builder.Where("create_time >= ?", req.CreateTimeStart)
|
||||
}
|
||||
if req.CreateTimeEnd != "" {
|
||||
builder = builder.Where("create_time <= ?", req.CreateTimeEnd)
|
||||
}
|
||||
if req.HandleTimeStart != "" {
|
||||
builder = builder.Where("handle_time >= ?", req.HandleTimeStart)
|
||||
}
|
||||
if req.HandleTimeEnd != "" {
|
||||
builder = builder.Where("handle_time <= ?", req.HandleTimeEnd)
|
||||
}
|
||||
|
||||
// 并发获取总数和列表
|
||||
var total int64
|
||||
var complaints []*model.ComplaintMain
|
||||
err = mr.Finish(func() error {
|
||||
var err error
|
||||
total, err = l.svcCtx.ComplaintMainModel.FindCount(l.ctx, builder, "id")
|
||||
if err != nil {
|
||||
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminGetComplaintList, 查询投诉总数失败 err: %v", err)
|
||||
}
|
||||
return nil
|
||||
}, func() error {
|
||||
var err error
|
||||
complaints, err = l.svcCtx.ComplaintMainModel.FindPageListByPage(l.ctx, builder, req.Page, req.PageSize, "create_time DESC")
|
||||
if err != nil {
|
||||
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminGetComplaintList, 查询投诉列表失败 err: %v", err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 构建响应
|
||||
resp = &types.AdminGetComplaintListResp{
|
||||
Total: total,
|
||||
Items: make([]types.ComplaintListItem, 0, len(complaints)),
|
||||
}
|
||||
|
||||
// 批量获取支付宝投诉和主动投诉的详细信息
|
||||
complaintIds := make([]string, 0, len(complaints))
|
||||
for _, complaint := range complaints {
|
||||
complaintIds = append(complaintIds, complaint.Id)
|
||||
}
|
||||
|
||||
// 获取支付宝投诉信息
|
||||
alipayComplaintMap := make(map[string]*model.ComplaintAlipay)
|
||||
if len(complaintIds) > 0 {
|
||||
alipayBuilder := l.svcCtx.ComplaintAlipayModel.SelectBuilder().
|
||||
Where(squirrel.Eq{"complaint_id": complaintIds})
|
||||
alipayComplaints, err := l.svcCtx.ComplaintAlipayModel.FindAll(l.ctx, alipayBuilder, "")
|
||||
if err != nil && !errors.Is(err, model.ErrNotFound) {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminGetComplaintList, 批量查询支付宝投诉失败 err: %v", err)
|
||||
}
|
||||
for _, alipayComplaint := range alipayComplaints {
|
||||
alipayComplaintMap[alipayComplaint.ComplaintId] = alipayComplaint
|
||||
}
|
||||
}
|
||||
|
||||
// 获取主动投诉信息
|
||||
manualComplaintMap := make(map[string]*model.ComplaintManual)
|
||||
if len(complaintIds) > 0 {
|
||||
manualBuilder := l.svcCtx.ComplaintManualModel.SelectBuilder().
|
||||
Where(squirrel.Eq{"complaint_id": complaintIds})
|
||||
manualComplaints, err := l.svcCtx.ComplaintManualModel.FindAll(l.ctx, manualBuilder, "")
|
||||
if err != nil && !errors.Is(err, model.ErrNotFound) {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminGetComplaintList, 批量查询主动投诉失败 err: %v", err)
|
||||
}
|
||||
for _, manualComplaint := range manualComplaints {
|
||||
manualComplaintMap[manualComplaint.ComplaintId] = manualComplaint
|
||||
}
|
||||
}
|
||||
|
||||
// 构建列表项
|
||||
for _, complaint := range complaints {
|
||||
item := types.ComplaintListItem{
|
||||
Id: complaint.Id,
|
||||
Type: complaint.Type,
|
||||
OrderId: lzUtils.NullStringToString(complaint.OrderId),
|
||||
Name: lzUtils.NullStringToString(complaint.Name),
|
||||
Contact: lzUtils.NullStringToString(complaint.Contact),
|
||||
Content: lzUtils.NullStringToString(complaint.Content),
|
||||
Status: lzUtils.NullStringToString(complaint.Status),
|
||||
StatusDescription: lzUtils.NullStringToString(complaint.StatusDescription),
|
||||
Remark: lzUtils.NullStringToString(complaint.Remark),
|
||||
HandlerId: lzUtils.NullStringToString(complaint.HandlerId),
|
||||
CreateTime: complaint.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
UpdateTime: complaint.UpdateTime.Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
|
||||
if complaint.HandleTime.Valid {
|
||||
item.HandleTime = complaint.HandleTime.Time.Format("2006-01-02 15:04:05")
|
||||
}
|
||||
|
||||
// 填充支付宝投诉特有字段
|
||||
if complaint.Type == "alipay" {
|
||||
if alipayComplaint, ok := alipayComplaintMap[complaint.Id]; ok {
|
||||
item.TaskId = alipayComplaint.TaskId
|
||||
item.TradeNo = lzUtils.NullStringToString(alipayComplaint.TradeNo)
|
||||
if alipayComplaint.ComplainAmount.Valid {
|
||||
item.ComplainAmount = strconv.FormatFloat(alipayComplaint.ComplainAmount.Float64, 'f', -1, 64)
|
||||
}
|
||||
if alipayComplaint.GmtComplain.Valid {
|
||||
item.GmtComplain = alipayComplaint.GmtComplain.Time.Format("2006-01-02 15:04:05")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 填充主动投诉特有字段
|
||||
if complaint.Type == "manual" {
|
||||
if manualComplaint, ok := manualComplaintMap[complaint.Id]; ok {
|
||||
item.Subject = lzUtils.NullStringToString(manualComplaint.Subject)
|
||||
item.Priority = lzUtils.NullStringToString(manualComplaint.Priority)
|
||||
item.Source = lzUtils.NullStringToString(manualComplaint.Source)
|
||||
}
|
||||
}
|
||||
|
||||
resp.Items = append(resp.Items, item)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package admin_complaint
|
||||
|
||||
import (
|
||||
"context"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/pkg/lzkit/lzUtils"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type AdminUpdateComplaintRemarkLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewAdminUpdateComplaintRemarkLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminUpdateComplaintRemarkLogic {
|
||||
return &AdminUpdateComplaintRemarkLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AdminUpdateComplaintRemarkLogic) AdminUpdateComplaintRemark(req *types.AdminUpdateComplaintRemarkReq) (resp *types.AdminUpdateComplaintRemarkResp, err error) {
|
||||
// 获取投诉主表信息
|
||||
complaint, err := l.svcCtx.ComplaintMainModel.FindOne(l.ctx, req.Id)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminUpdateComplaintRemark, 查询投诉失败 err: %v", err)
|
||||
}
|
||||
|
||||
// 更新备注
|
||||
complaint.Remark = lzUtils.StringToNullString(req.Remark)
|
||||
|
||||
// 更新数据库
|
||||
err = l.svcCtx.ComplaintMainModel.UpdateWithVersion(l.ctx, nil, complaint)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminUpdateComplaintRemark, 更新投诉备注失败 err: %v", err)
|
||||
}
|
||||
|
||||
return &types.AdminUpdateComplaintRemarkResp{
|
||||
Success: true,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package admin_complaint
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/pkg/lzkit/lzUtils"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type AdminUpdateComplaintStatusLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewAdminUpdateComplaintStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminUpdateComplaintStatusLogic {
|
||||
return &AdminUpdateComplaintStatusLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AdminUpdateComplaintStatusLogic) AdminUpdateComplaintStatus(req *types.AdminUpdateComplaintStatusReq) (resp *types.AdminUpdateComplaintStatusResp, err error) {
|
||||
// 获取投诉主表信息
|
||||
complaint, err := l.svcCtx.ComplaintMainModel.FindOne(l.ctx, req.Id)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminUpdateComplaintStatus, 查询投诉失败 err: %v", err)
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
complaint.Status = lzUtils.StringToNullString(req.Status)
|
||||
if req.StatusDescription != "" {
|
||||
complaint.StatusDescription = lzUtils.StringToNullString(req.StatusDescription)
|
||||
}
|
||||
if req.HandlerId != "" {
|
||||
complaint.HandlerId = lzUtils.StringToNullString(req.HandlerId)
|
||||
complaint.HandleTime = lzUtils.TimeToNullTime(time.Now())
|
||||
}
|
||||
|
||||
// 更新数据库
|
||||
err = l.svcCtx.ComplaintMainModel.UpdateWithVersion(l.ctx, nil, complaint)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminUpdateComplaintStatus, 更新投诉状态失败 err: %v", err)
|
||||
}
|
||||
|
||||
return &types.AdminUpdateComplaintStatusResp{
|
||||
Success: true,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,463 @@
|
||||
package admin_dashboard
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
"ycc-server/common/globalkey"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"ycc-server/app/main/api/internal/service"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type AdminGetDashboardStatisticsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewAdminGetDashboardStatisticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetDashboardStatisticsLogic {
|
||||
return &AdminGetDashboardStatisticsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AdminGetDashboardStatisticsLogic) AdminGetDashboardStatistics() (resp *types.AdminGetDashboardStatisticsResp, err error) {
|
||||
// 使用Asia/Shanghai时区
|
||||
loc, _ := time.LoadLocation("Asia/Shanghai")
|
||||
now := time.Now().In(loc)
|
||||
|
||||
// 计算时间范围
|
||||
todayStart := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, loc)
|
||||
todayEnd := todayStart.AddDate(0, 0, 1)
|
||||
yesterdayStart := todayStart.AddDate(0, 0, -1)
|
||||
yesterdayEnd := todayStart
|
||||
monthStart := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, loc)
|
||||
monthEnd := monthStart.AddDate(0, 1, 0)
|
||||
|
||||
// 1. 订单统计
|
||||
orderStats, err := l.calculateOrderStatistics(todayStart, todayEnd, yesterdayStart, yesterdayEnd, monthStart, monthEnd)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "计算订单统计失败, %v", err)
|
||||
}
|
||||
|
||||
// 2. 营收统计
|
||||
revenueStats, err := l.calculateRevenueStatistics(todayStart, todayEnd, yesterdayStart, yesterdayEnd, monthStart, monthEnd)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "计算营收统计失败, %v", err)
|
||||
}
|
||||
|
||||
// 3. 代理统计
|
||||
agentStats, err := l.calculateAgentStatistics(todayStart, monthStart)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "计算代理统计失败, %v", err)
|
||||
}
|
||||
|
||||
// 4. 利润统计
|
||||
profitStats, err := l.calculateProfitStatistics(todayStart, todayEnd, monthStart, monthEnd, revenueStats)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "计算利润统计失败, %v", err)
|
||||
}
|
||||
|
||||
// 5. 订单趋势(最近7天)
|
||||
orderTrend, err := l.calculateOrderTrend(now, loc)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "计算订单趋势失败, %v", err)
|
||||
}
|
||||
|
||||
// 6. 营收趋势(最近7天)
|
||||
revenueTrend, err := l.calculateRevenueTrend(now, loc)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "计算营收趋势失败, %v", err)
|
||||
}
|
||||
|
||||
return &types.AdminGetDashboardStatisticsResp{
|
||||
OrderStats: orderStats,
|
||||
RevenueStats: revenueStats,
|
||||
AgentStats: agentStats,
|
||||
ProfitStats: profitStats,
|
||||
OrderTrend: orderTrend,
|
||||
RevenueTrend: revenueTrend,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// calculateOrderStatistics 计算订单统计
|
||||
func (l *AdminGetDashboardStatisticsLogic) calculateOrderStatistics(todayStart, todayEnd, yesterdayStart, yesterdayEnd, monthStart, monthEnd time.Time) (types.AdminOrderStatistics, error) {
|
||||
var stats types.AdminOrderStatistics
|
||||
|
||||
// 今日订单数
|
||||
todayBuilder := l.svcCtx.OrderModel.SelectBuilder().
|
||||
Where("status = ? AND create_time >= ? AND create_time < ?", "paid", todayStart, todayEnd)
|
||||
todayCount, err := l.svcCtx.OrderModel.FindCount(l.ctx, todayBuilder, "id")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
stats.TodayCount = todayCount
|
||||
|
||||
// 昨日订单数
|
||||
yesterdayBuilder := l.svcCtx.OrderModel.SelectBuilder().
|
||||
Where("status = ? AND create_time >= ? AND create_time < ?", "paid", yesterdayStart, yesterdayEnd)
|
||||
yesterdayCount, err := l.svcCtx.OrderModel.FindCount(l.ctx, yesterdayBuilder, "id")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
stats.YesterdayCount = yesterdayCount
|
||||
|
||||
// 当月订单数
|
||||
monthBuilder := l.svcCtx.OrderModel.SelectBuilder().
|
||||
Where("status = ? AND create_time >= ? AND create_time < ?", "paid", monthStart, monthEnd)
|
||||
monthCount, err := l.svcCtx.OrderModel.FindCount(l.ctx, monthBuilder, "id")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
stats.MonthCount = monthCount
|
||||
|
||||
// 总订单数
|
||||
totalBuilder := l.svcCtx.OrderModel.SelectBuilder().
|
||||
Where("status = ?", "paid")
|
||||
totalCount, err := l.svcCtx.OrderModel.FindCount(l.ctx, totalBuilder, "id")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
stats.TotalCount = totalCount
|
||||
|
||||
// 计算变化率
|
||||
if stats.YesterdayCount > 0 {
|
||||
stats.ChangeRate = float64(stats.TodayCount-stats.YesterdayCount) / float64(stats.YesterdayCount) * 100
|
||||
} else if stats.TodayCount > 0 {
|
||||
stats.ChangeRate = 100 // 从0增长到有值,算100%增长
|
||||
}
|
||||
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
// calculateRevenueStatistics 计算营收统计
|
||||
func (l *AdminGetDashboardStatisticsLogic) calculateRevenueStatistics(todayStart, todayEnd, yesterdayStart, yesterdayEnd, monthStart, monthEnd time.Time) (types.AdminRevenueStatistics, error) {
|
||||
var stats types.AdminRevenueStatistics
|
||||
|
||||
// 今日营收
|
||||
todayBuilder := l.svcCtx.OrderModel.SelectBuilder().
|
||||
Where("status = ? AND create_time >= ? AND create_time < ?", "paid", todayStart, todayEnd)
|
||||
todayAmount, err := l.svcCtx.OrderModel.FindSum(l.ctx, todayBuilder, "amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
stats.TodayAmount = todayAmount
|
||||
|
||||
// 昨日营收
|
||||
yesterdayBuilder := l.svcCtx.OrderModel.SelectBuilder().
|
||||
Where("status = ? AND create_time >= ? AND create_time < ?", "paid", yesterdayStart, yesterdayEnd)
|
||||
yesterdayAmount, err := l.svcCtx.OrderModel.FindSum(l.ctx, yesterdayBuilder, "amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
stats.YesterdayAmount = yesterdayAmount
|
||||
|
||||
// 当月营收
|
||||
monthBuilder := l.svcCtx.OrderModel.SelectBuilder().
|
||||
Where("status = ? AND create_time >= ? AND create_time < ?", "paid", monthStart, monthEnd)
|
||||
monthAmount, err := l.svcCtx.OrderModel.FindSum(l.ctx, monthBuilder, "amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
stats.MonthAmount = monthAmount
|
||||
|
||||
// 总营收
|
||||
totalBuilder := l.svcCtx.OrderModel.SelectBuilder().
|
||||
Where("status = ?", "paid")
|
||||
totalAmount, err := l.svcCtx.OrderModel.FindSum(l.ctx, totalBuilder, "amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
stats.TotalAmount = totalAmount
|
||||
|
||||
// 计算变化率
|
||||
if stats.YesterdayAmount > 0 {
|
||||
stats.ChangeRate = (stats.TodayAmount - stats.YesterdayAmount) / stats.YesterdayAmount * 100
|
||||
} else if stats.TodayAmount > 0 {
|
||||
stats.ChangeRate = 100 // 从0增长到有值,算100%增长
|
||||
}
|
||||
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
// calculateAgentStatistics 计算代理统计
|
||||
func (l *AdminGetDashboardStatisticsLogic) calculateAgentStatistics(todayStart, monthStart time.Time) (types.AdminAgentStatistics, error) {
|
||||
var stats types.AdminAgentStatistics
|
||||
|
||||
// 代理总数
|
||||
totalBuilder := l.svcCtx.AgentModel.SelectBuilder()
|
||||
totalCount, err := l.svcCtx.AgentModel.FindCount(l.ctx, totalBuilder, "id")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
stats.TotalCount = totalCount
|
||||
|
||||
// 今日新增
|
||||
todayBuilder := l.svcCtx.AgentModel.SelectBuilder().
|
||||
Where("create_time >= ?", todayStart)
|
||||
todayNew, err := l.svcCtx.AgentModel.FindCount(l.ctx, todayBuilder, "id")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
stats.TodayNew = todayNew
|
||||
|
||||
// 当月新增
|
||||
monthBuilder := l.svcCtx.AgentModel.SelectBuilder().
|
||||
Where("create_time >= ?", monthStart)
|
||||
monthNew, err := l.svcCtx.AgentModel.FindCount(l.ctx, monthBuilder, "id")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
stats.MonthNew = monthNew
|
||||
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
// calculateProfitStatistics 计算利润统计
|
||||
func (l *AdminGetDashboardStatisticsLogic) calculateProfitStatistics(todayStart, todayEnd, monthStart, monthEnd time.Time, revenueStats types.AdminRevenueStatistics) (types.AdminProfitStatistics, error) {
|
||||
var stats types.AdminProfitStatistics
|
||||
|
||||
// 税务成本比例(6%)
|
||||
const companyTaxRate = 0.06
|
||||
|
||||
// 今日利润计算
|
||||
// 今日营收
|
||||
todayRevenue := revenueStats.TodayAmount
|
||||
// 今日佣金
|
||||
todayCommissionBuilder := l.svcCtx.AgentCommissionModel.SelectBuilder().
|
||||
Where("del_state = ? AND status != ? AND create_time >= ? AND create_time < ?", globalkey.DelStateNo, 3, todayStart, todayEnd)
|
||||
todayCommission, err := l.svcCtx.AgentCommissionModel.FindSum(l.ctx, todayCommissionBuilder, "amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
// 今日返利
|
||||
todayRebateBuilder := l.svcCtx.AgentRebateModel.SelectBuilder().
|
||||
Where("del_state = ? AND status != ? AND create_time >= ? AND create_time < ?", globalkey.DelStateNo, 3, todayStart, todayEnd)
|
||||
todayRebate, err := l.svcCtx.AgentRebateModel.FindSum(l.ctx, todayRebateBuilder, "rebate_amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
// 今日税务成本(订单金额的6%)
|
||||
todayCompanyTax := todayRevenue * companyTaxRate
|
||||
// 今日提现收税(agent_withdrawal_tax表中tax_status=2的tax_amount总和)
|
||||
todayTaxIncomeBuilder := l.svcCtx.AgentWithdrawalTaxModel.SelectBuilder().
|
||||
Where("del_state = ? AND tax_status = ? AND create_time >= ? AND create_time < ?", globalkey.DelStateNo, 2, todayStart, todayEnd)
|
||||
todayTaxIncome, err := l.svcCtx.AgentWithdrawalTaxModel.FindSum(l.ctx, todayTaxIncomeBuilder, "tax_amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
// 今日API调用成本
|
||||
todayApiCost := 0.0
|
||||
if l.svcCtx.TianyuanapiCallLogService != nil {
|
||||
logx.Infof("开始获取今日API调用成本,时间范围: %v 到 %v", todayStart, todayEnd)
|
||||
todayApiStats, err := l.svcCtx.TianyuanapiCallLogService.GetStatistics(l.ctx, service.StatisticsFilter{
|
||||
StartDate: todayStart,
|
||||
EndDate: todayEnd,
|
||||
})
|
||||
if err != nil {
|
||||
logx.Errorf("获取今日API调用成本失败: %v", err)
|
||||
} else {
|
||||
todayApiCost = todayApiStats.TotalCost
|
||||
logx.Infof("今日API调用成本统计完成,总成本: %f", todayApiCost)
|
||||
}
|
||||
} else {
|
||||
logx.Errorf("TianyuanapiCallLogService 未初始化,无法获取API调用成本")
|
||||
}
|
||||
// 今日利润 = 营收 - 佣金 - 返利 - 税务成本 - API调用成本 + 提现收税
|
||||
stats.TodayProfit = todayRevenue - todayCommission - todayRebate - todayCompanyTax - todayApiCost + todayTaxIncome
|
||||
if todayRevenue > 0 {
|
||||
stats.TodayProfitRate = stats.TodayProfit / todayRevenue * 100
|
||||
}
|
||||
// 今日明细
|
||||
stats.TodayDetail = types.AdminProfitDetail{
|
||||
Revenue: todayRevenue,
|
||||
Commission: todayCommission,
|
||||
Rebate: todayRebate,
|
||||
CompanyTax: todayCompanyTax,
|
||||
ApiCost: todayApiCost,
|
||||
TaxIncome: todayTaxIncome,
|
||||
Profit: stats.TodayProfit,
|
||||
ProfitRate: stats.TodayProfitRate,
|
||||
}
|
||||
|
||||
// 当月利润计算
|
||||
// 当月营收
|
||||
monthRevenue := revenueStats.MonthAmount
|
||||
// 当月佣金
|
||||
monthCommissionBuilder := l.svcCtx.AgentCommissionModel.SelectBuilder().
|
||||
Where("del_state = ? AND status != ? AND create_time >= ? AND create_time < ?", globalkey.DelStateNo, 3, monthStart, monthEnd)
|
||||
monthCommission, err := l.svcCtx.AgentCommissionModel.FindSum(l.ctx, monthCommissionBuilder, "amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
// 当月返利
|
||||
monthRebateBuilder := l.svcCtx.AgentRebateModel.SelectBuilder().
|
||||
Where("del_state = ? AND status != ? AND create_time >= ? AND create_time < ?", globalkey.DelStateNo, 3, monthStart, monthEnd)
|
||||
monthRebate, err := l.svcCtx.AgentRebateModel.FindSum(l.ctx, monthRebateBuilder, "rebate_amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
// 当月税务成本
|
||||
monthCompanyTax := monthRevenue * companyTaxRate
|
||||
// 当月提现收税
|
||||
monthTaxIncomeBuilder := l.svcCtx.AgentWithdrawalTaxModel.SelectBuilder().
|
||||
Where("del_state = ? AND tax_status = ? AND create_time >= ? AND create_time < ?", globalkey.DelStateNo, 2, monthStart, monthEnd)
|
||||
monthTaxIncome, err := l.svcCtx.AgentWithdrawalTaxModel.FindSum(l.ctx, monthTaxIncomeBuilder, "tax_amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
// 当月API调用成本
|
||||
monthApiCost := 0.0
|
||||
if l.svcCtx.TianyuanapiCallLogService != nil {
|
||||
logx.Infof("开始获取当月API调用成本,时间范围: %v 到 %v", monthStart, monthEnd)
|
||||
monthApiStats, err := l.svcCtx.TianyuanapiCallLogService.GetStatistics(l.ctx, service.StatisticsFilter{
|
||||
StartDate: monthStart,
|
||||
EndDate: monthEnd,
|
||||
})
|
||||
if err != nil {
|
||||
logx.Errorf("获取当月API调用成本失败: %v", err)
|
||||
} else {
|
||||
monthApiCost = monthApiStats.TotalCost
|
||||
logx.Infof("当月API调用成本统计完成,总成本: %f", monthApiCost)
|
||||
}
|
||||
} else {
|
||||
logx.Errorf("TianyuanapiCallLogService 未初始化,无法获取API调用成本")
|
||||
}
|
||||
// 当月利润
|
||||
stats.MonthProfit = monthRevenue - monthCommission - monthRebate - monthCompanyTax - monthApiCost + monthTaxIncome
|
||||
if monthRevenue > 0 {
|
||||
stats.MonthProfitRate = stats.MonthProfit / monthRevenue * 100
|
||||
}
|
||||
// 当月明细
|
||||
stats.MonthDetail = types.AdminProfitDetail{
|
||||
Revenue: monthRevenue,
|
||||
Commission: monthCommission,
|
||||
Rebate: monthRebate,
|
||||
CompanyTax: monthCompanyTax,
|
||||
ApiCost: monthApiCost,
|
||||
TaxIncome: monthTaxIncome,
|
||||
Profit: stats.MonthProfit,
|
||||
ProfitRate: stats.MonthProfitRate,
|
||||
}
|
||||
|
||||
// 总利润计算
|
||||
// 总营收
|
||||
totalRevenue := revenueStats.TotalAmount
|
||||
// 总佣金
|
||||
totalCommissionBuilder := l.svcCtx.AgentCommissionModel.SelectBuilder().
|
||||
Where("del_state = ? AND status != ?", globalkey.DelStateNo, 3)
|
||||
totalCommission, err := l.svcCtx.AgentCommissionModel.FindSum(l.ctx, totalCommissionBuilder, "amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
// 总返利
|
||||
totalRebateBuilder := l.svcCtx.AgentRebateModel.SelectBuilder().
|
||||
Where("status != ?", 3)
|
||||
totalRebate, err := l.svcCtx.AgentRebateModel.FindSum(l.ctx, totalRebateBuilder, "rebate_amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
// 总税务成本
|
||||
totalCompanyTax := totalRevenue * companyTaxRate
|
||||
// 总提现收税
|
||||
totalTaxIncomeBuilder := l.svcCtx.AgentWithdrawalTaxModel.SelectBuilder().
|
||||
Where("tax_status = ?", 2)
|
||||
totalTaxIncome, err := l.svcCtx.AgentWithdrawalTaxModel.FindSum(l.ctx, totalTaxIncomeBuilder, "tax_amount")
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
// 总API调用成本
|
||||
totalApiCost := 0.0
|
||||
if l.svcCtx.TianyuanapiCallLogService != nil {
|
||||
logx.Infof("开始获取总API调用成本(无时间限制)")
|
||||
totalApiStats, err := l.svcCtx.TianyuanapiCallLogService.GetStatistics(l.ctx, service.StatisticsFilter{})
|
||||
if err != nil {
|
||||
logx.Errorf("获取总API调用成本失败: %v", err)
|
||||
} else {
|
||||
totalApiCost = totalApiStats.TotalCost
|
||||
logx.Infof("总API调用成本统计完成,总成本: %f", totalApiCost)
|
||||
}
|
||||
} else {
|
||||
logx.Errorf("TianyuanapiCallLogService 未初始化,无法获取API调用成本")
|
||||
}
|
||||
// 总利润
|
||||
stats.TotalProfit = totalRevenue - totalCommission - totalRebate - totalCompanyTax - totalApiCost + totalTaxIncome
|
||||
if totalRevenue > 0 {
|
||||
stats.TotalProfitRate = stats.TotalProfit / totalRevenue * 100
|
||||
}
|
||||
// 总计明细
|
||||
stats.TotalDetail = types.AdminProfitDetail{
|
||||
Revenue: totalRevenue,
|
||||
Commission: totalCommission,
|
||||
Rebate: totalRebate,
|
||||
CompanyTax: totalCompanyTax,
|
||||
ApiCost: totalApiCost,
|
||||
TaxIncome: totalTaxIncome,
|
||||
Profit: stats.TotalProfit,
|
||||
ProfitRate: stats.TotalProfitRate,
|
||||
}
|
||||
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
// calculateOrderTrend 计算订单趋势(最近7天)
|
||||
func (l *AdminGetDashboardStatisticsLogic) calculateOrderTrend(now time.Time, loc *time.Location) ([]types.AdminTrendData, error) {
|
||||
var trend []types.AdminTrendData
|
||||
|
||||
// 计算最近7天的日期
|
||||
for i := 6; i >= 0; i-- {
|
||||
date := now.AddDate(0, 0, -i)
|
||||
dateStart := time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, loc)
|
||||
dateEnd := dateStart.AddDate(0, 0, 1)
|
||||
|
||||
// 查询当天的订单数
|
||||
builder := l.svcCtx.OrderModel.SelectBuilder().
|
||||
Where("status = ? AND create_time >= ? AND create_time < ?", "paid", dateStart, dateEnd)
|
||||
count, err := l.svcCtx.OrderModel.FindCount(l.ctx, builder, "id")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
trend = append(trend, types.AdminTrendData{
|
||||
Date: date.Format("01-02"),
|
||||
Value: float64(count),
|
||||
})
|
||||
}
|
||||
|
||||
return trend, nil
|
||||
}
|
||||
|
||||
// calculateRevenueTrend 计算营收趋势(最近7天)
|
||||
func (l *AdminGetDashboardStatisticsLogic) calculateRevenueTrend(now time.Time, loc *time.Location) ([]types.AdminTrendData, error) {
|
||||
var trend []types.AdminTrendData
|
||||
|
||||
// 计算最近7天的日期
|
||||
for i := 6; i >= 0; i-- {
|
||||
date := now.AddDate(0, 0, -i)
|
||||
dateStart := time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, loc)
|
||||
dateEnd := dateStart.AddDate(0, 0, 1)
|
||||
|
||||
// 查询当天的营收
|
||||
builder := l.svcCtx.OrderModel.SelectBuilder().
|
||||
Where("status = ? AND create_time >= ? AND create_time < ?", "paid", dateStart, dateEnd)
|
||||
amount, err := l.svcCtx.OrderModel.FindSum(l.ctx, builder, "amount")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
trend = append(trend, types.AdminTrendData{
|
||||
Date: date.Format("01-02"),
|
||||
Value: amount,
|
||||
})
|
||||
}
|
||||
|
||||
return trend, nil
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
package admin_feature
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"context"
|
||||
"encoding/hex"
|
||||
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/pkg/lzkit/crypto"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/pkg/lzkit/crypto"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type AdminConfigFeatureExampleLogic struct {
|
||||
@@ -62,11 +63,12 @@ func (l *AdminConfigFeatureExampleLogic) AdminConfigFeatureExample(req *types.Ad
|
||||
}
|
||||
|
||||
// 4. 准备示例数据
|
||||
exampleData := &model.Example{
|
||||
ApiId: feature.ApiId,
|
||||
FeatureId: req.FeatureId,
|
||||
Content: encryptedData,
|
||||
}
|
||||
exampleData := &model.Example{
|
||||
Id: uuid.NewString(),
|
||||
ApiId: feature.ApiId,
|
||||
FeatureId: req.FeatureId,
|
||||
Content: encryptedData,
|
||||
}
|
||||
|
||||
// 4. 根据是否存在决定新增或更新
|
||||
if existingExample == nil {
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
@@ -29,9 +30,18 @@ func NewAdminCreateFeatureLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
func (l *AdminCreateFeatureLogic) AdminCreateFeature(req *types.AdminCreateFeatureReq) (resp *types.AdminCreateFeatureResp, err error) {
|
||||
// 1. 数据转换
|
||||
data := &model.Feature{
|
||||
Id: uuid.NewString(),
|
||||
ApiId: req.ApiId,
|
||||
Name: req.Name,
|
||||
}
|
||||
// 设置白名单屏蔽价格
|
||||
if req.WhitelistPrice != nil {
|
||||
data.WhitelistPrice = *req.WhitelistPrice
|
||||
}
|
||||
// 设置成本价
|
||||
if req.CostPrice != nil {
|
||||
data.CostPrice = *req.CostPrice
|
||||
}
|
||||
|
||||
// 2. 数据库操作
|
||||
result, err := l.svcCtx.FeatureModel.Insert(l.ctx, nil, data)
|
||||
@@ -41,6 +51,6 @@ func (l *AdminCreateFeatureLogic) AdminCreateFeature(req *types.AdminCreateFeatu
|
||||
}
|
||||
|
||||
// 3. 返回结果
|
||||
id, _ := result.LastInsertId()
|
||||
return &types.AdminCreateFeatureResp{Id: id}, nil
|
||||
_ = result
|
||||
return &types.AdminCreateFeatureResp{Id: data.Id}, nil
|
||||
}
|
||||
|
||||
@@ -35,11 +35,13 @@ func (l *AdminGetFeatureDetailLogic) AdminGetFeatureDetail(req *types.AdminGetFe
|
||||
|
||||
// 2. 构建响应
|
||||
resp = &types.AdminGetFeatureDetailResp{
|
||||
Id: record.Id,
|
||||
ApiId: record.ApiId,
|
||||
Name: record.Name,
|
||||
CreateTime: record.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
UpdateTime: record.UpdateTime.Format("2006-01-02 15:04:05"),
|
||||
Id: record.Id,
|
||||
ApiId: record.ApiId,
|
||||
Name: record.Name,
|
||||
WhitelistPrice: record.WhitelistPrice,
|
||||
CostPrice: record.CostPrice,
|
||||
CreateTime: record.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
UpdateTime: record.UpdateTime.Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
|
||||
@@ -35,7 +35,7 @@ func (l *AdminGetFeatureExampleLogic) AdminGetFeatureExample(req *types.AdminGet
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
// 示例数据不存在,返回空数据
|
||||
return &types.AdminGetFeatureExampleResp{
|
||||
Id: 0,
|
||||
Id: "",
|
||||
FeatureId: req.FeatureId,
|
||||
ApiId: "",
|
||||
Data: "",
|
||||
|
||||
@@ -49,11 +49,13 @@ func (l *AdminGetFeatureListLogic) AdminGetFeatureList(req *types.AdminGetFeatur
|
||||
items := make([]types.FeatureListItem, 0, len(list))
|
||||
for _, item := range list {
|
||||
listItem := types.FeatureListItem{
|
||||
Id: item.Id,
|
||||
ApiId: item.ApiId,
|
||||
Name: item.Name,
|
||||
CreateTime: item.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
UpdateTime: item.UpdateTime.Format("2006-01-02 15:04:05"),
|
||||
Id: item.Id,
|
||||
ApiId: item.ApiId,
|
||||
Name: item.Name,
|
||||
WhitelistPrice: item.WhitelistPrice,
|
||||
CostPrice: item.CostPrice,
|
||||
CreateTime: item.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
UpdateTime: item.UpdateTime.Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
items = append(items, listItem)
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ func NewAdminUpdateFeatureLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
|
||||
func (l *AdminUpdateFeatureLogic) AdminUpdateFeature(req *types.AdminUpdateFeatureReq) (resp *types.AdminUpdateFeatureResp, err error) {
|
||||
// 1. 参数验证
|
||||
if req.Id <= 0 {
|
||||
if req.Id == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.PARAM_VERIFICATION_ERROR),
|
||||
"功能ID必须大于0, id: %d", req.Id)
|
||||
"功能ID不能为空, id: %s", req.Id)
|
||||
}
|
||||
|
||||
// 2. 查询记录是否存在
|
||||
@@ -46,6 +46,12 @@ func (l *AdminUpdateFeatureLogic) AdminUpdateFeature(req *types.AdminUpdateFeatu
|
||||
if req.Name != nil && *req.Name != "" {
|
||||
record.Name = *req.Name
|
||||
}
|
||||
if req.WhitelistPrice != nil {
|
||||
record.WhitelistPrice = *req.WhitelistPrice
|
||||
}
|
||||
if req.CostPrice != nil {
|
||||
record.CostPrice = *req.CostPrice
|
||||
}
|
||||
|
||||
// 4. 执行更新操作
|
||||
err = l.svcCtx.FeatureModel.UpdateWithVersion(l.ctx, nil, record)
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package admin_menu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"time"
|
||||
"context"
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type CreateMenuLogic struct {
|
||||
@@ -48,13 +49,13 @@ func (l *CreateMenuLogic) CreateMenu(req *types.CreateMenuReq) (resp *types.Crea
|
||||
}
|
||||
|
||||
// 3. 检查父菜单是否存在(如果不是根菜单)
|
||||
if req.Pid > 0 {
|
||||
if req.Pid != "" {
|
||||
parentMenu, err := l.svcCtx.AdminMenuModel.FindOne(l.ctx, req.Pid)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查询父菜单失败, id: %d, err: %v", req.Pid, err)
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查询父菜单失败, id: %s, err: %v", req.Pid, err)
|
||||
}
|
||||
if parentMenu == nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "父菜单不存在, id: %d", req.Pid)
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "父菜单不存在, id: %s", req.Pid)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,18 +66,19 @@ func (l *CreateMenuLogic) CreateMenu(req *types.CreateMenuReq) (resp *types.Crea
|
||||
}
|
||||
|
||||
// 5. 创建菜单记录
|
||||
menu := &model.AdminMenu{
|
||||
Pid: req.Pid,
|
||||
Name: req.Name,
|
||||
Path: req.Path,
|
||||
Component: req.Component,
|
||||
Redirect: sql.NullString{String: req.Redirect, Valid: req.Redirect != ""},
|
||||
Status: req.Status,
|
||||
Type: typeValue,
|
||||
Sort: req.Sort,
|
||||
CreateTime: time.Now(),
|
||||
UpdateTime: time.Now(),
|
||||
}
|
||||
menu := &model.AdminMenu{
|
||||
Id: uuid.NewString(),
|
||||
Pid: sql.NullString{String: req.Pid, Valid: req.Pid != ""},
|
||||
Name: req.Name,
|
||||
Path: req.Path,
|
||||
Component: req.Component,
|
||||
Redirect: sql.NullString{String: req.Redirect, Valid: req.Redirect != ""},
|
||||
Status: req.Status,
|
||||
Type: typeValue,
|
||||
Sort: req.Sort,
|
||||
CreateTime: time.Now(),
|
||||
UpdateTime: time.Now(),
|
||||
}
|
||||
|
||||
// 将Meta转换为JSON字符串
|
||||
metaJson, err := json.Marshal(req.Meta)
|
||||
|
||||
@@ -27,16 +27,16 @@ func NewDeleteMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
|
||||
|
||||
func (l *DeleteMenuLogic) DeleteMenu(req *types.DeleteMenuReq) (resp *types.DeleteMenuResp, err error) {
|
||||
// 1. 参数验证
|
||||
if req.Id <= 0 {
|
||||
if req.Id == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.PARAM_VERIFICATION_ERROR),
|
||||
"菜单ID必须大于0, id: %d", req.Id)
|
||||
"菜单ID不能为空, id: %s", req.Id)
|
||||
}
|
||||
|
||||
// 2. 查询菜单是否存在
|
||||
menu, err := l.svcCtx.AdminMenuModel.FindOne(l.ctx, req.Id)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR),
|
||||
"查找菜单失败, err: %v, id: %d", err, req.Id)
|
||||
"查找菜单失败, err: %v, id: %s", err, req.Id)
|
||||
}
|
||||
|
||||
// 3. 检查是否有子菜单
|
||||
|
||||
@@ -2,8 +2,8 @@ package admin_menu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
@@ -38,14 +38,14 @@ func (l *GetMenuAllLogic) GetMenuAll(req *types.GetMenuAllReq) (resp *[]types.Ge
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "获取用户ID失败, %+v", err)
|
||||
}
|
||||
|
||||
// 使用MapReduceVoid并发获取用户角色
|
||||
var roleIds []int64
|
||||
// 使用MapReduceVoid并发获取用户角色(UUID 字符串)
|
||||
var roleIds []string
|
||||
var permissions []*struct {
|
||||
RoleId int64
|
||||
RoleId string
|
||||
}
|
||||
|
||||
type UserRoleResult struct {
|
||||
RoleId int64
|
||||
RoleId string
|
||||
}
|
||||
|
||||
err = mr.MapReduceVoid(
|
||||
@@ -67,7 +67,7 @@ func (l *GetMenuAllLogic) GetMenuAll(req *types.GetMenuAllReq) (resp *[]types.Ge
|
||||
},
|
||||
func(pipe <-chan *UserRoleResult, cancel func(error)) {
|
||||
for item := range pipe {
|
||||
permissions = append(permissions, &struct{ RoleId int64 }{RoleId: item.RoleId})
|
||||
permissions = append(permissions, &struct{ RoleId string }{RoleId: item.RoleId})
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -79,14 +79,14 @@ func (l *GetMenuAllLogic) GetMenuAll(req *types.GetMenuAllReq) (resp *[]types.Ge
|
||||
roleIds = append(roleIds, permission.RoleId)
|
||||
}
|
||||
|
||||
// 使用MapReduceVoid并发获取角色菜单
|
||||
var menuIds []int64
|
||||
// 使用MapReduceVoid并发获取角色菜单(UUID 字符串)
|
||||
var menuIds []string
|
||||
var roleMenus []*struct {
|
||||
MenuId int64
|
||||
MenuId string
|
||||
}
|
||||
|
||||
type RoleMenuResult struct {
|
||||
MenuId int64
|
||||
MenuId string
|
||||
}
|
||||
|
||||
err = mr.MapReduceVoid(
|
||||
@@ -108,7 +108,7 @@ func (l *GetMenuAllLogic) GetMenuAll(req *types.GetMenuAllReq) (resp *[]types.Ge
|
||||
},
|
||||
func(pipe <-chan *RoleMenuResult, cancel func(error)) {
|
||||
for item := range pipe {
|
||||
roleMenus = append(roleMenus, &struct{ MenuId int64 }{MenuId: item.MenuId})
|
||||
roleMenus = append(roleMenus, &struct{ MenuId string }{MenuId: item.MenuId})
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -122,8 +122,8 @@ func (l *GetMenuAllLogic) GetMenuAll(req *types.GetMenuAllReq) (resp *[]types.Ge
|
||||
|
||||
// 使用MapReduceVoid并发获取菜单
|
||||
type AdminMenuStruct struct {
|
||||
Id int64
|
||||
Pid int64
|
||||
Id string
|
||||
Pid sql.NullString
|
||||
Name string
|
||||
Path string
|
||||
Component string
|
||||
@@ -199,8 +199,7 @@ func (l *GetMenuAllLogic) GetMenuAll(req *types.GetMenuAllReq) (resp *[]types.Ge
|
||||
return ""
|
||||
}()
|
||||
|
||||
menuId := strconv.FormatInt(menu.Id, 10)
|
||||
menuMap[menuId] = types.GetMenuAllResp{
|
||||
menuMap[menu.Id] = types.GetMenuAllResp{
|
||||
Name: menu.Name,
|
||||
Path: menu.Path,
|
||||
Redirect: redirect,
|
||||
@@ -211,14 +210,17 @@ func (l *GetMenuAllLogic) GetMenuAll(req *types.GetMenuAllReq) (resp *[]types.Ge
|
||||
}
|
||||
}
|
||||
|
||||
// 按ParentId将菜单分组
|
||||
menuGroups := lo.GroupBy(menus, func(item *AdminMenuStruct) int64 {
|
||||
return item.Pid
|
||||
// 按ParentId将菜单分组(字符串键)
|
||||
menuGroups := lo.GroupBy(menus, func(item *AdminMenuStruct) string {
|
||||
if item.Pid.Valid {
|
||||
return item.Pid.String
|
||||
}
|
||||
return "0"
|
||||
})
|
||||
|
||||
// 递归构建菜单树
|
||||
var buildMenuTree func(parentId int64) []types.GetMenuAllResp
|
||||
buildMenuTree = func(parentId int64) []types.GetMenuAllResp {
|
||||
// 递归构建菜单树(字符串键)
|
||||
var buildMenuTree func(parentId string) []types.GetMenuAllResp
|
||||
buildMenuTree = func(parentId string) []types.GetMenuAllResp {
|
||||
children := make([]types.GetMenuAllResp, 0)
|
||||
|
||||
childMenus, ok := menuGroups[parentId]
|
||||
@@ -232,8 +234,7 @@ func (l *GetMenuAllLogic) GetMenuAll(req *types.GetMenuAllReq) (resp *[]types.Ge
|
||||
})
|
||||
|
||||
for _, childMenu := range childMenus {
|
||||
menuId := strconv.FormatInt(childMenu.Id, 10)
|
||||
if menu, exists := menuMap[menuId]; exists && childMenu.Status == 1 {
|
||||
if menu, exists := menuMap[childMenu.Id]; exists && childMenu.Status == 1 {
|
||||
// 递归构建子菜单
|
||||
menu.Children = buildMenuTree(childMenu.Id)
|
||||
children = append(children, menu)
|
||||
@@ -243,8 +244,8 @@ func (l *GetMenuAllLogic) GetMenuAll(req *types.GetMenuAllReq) (resp *[]types.Ge
|
||||
return children
|
||||
}
|
||||
|
||||
// 从根菜单开始构建(ParentId为0的是根菜单)
|
||||
menuTree := buildMenuTree(0)
|
||||
// 从根菜单开始构建(ParentId为"0"的是根菜单)
|
||||
menuTree := buildMenuTree("0")
|
||||
|
||||
return &menuTree, nil
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ func (l *GetMenuListLogic) GetMenuList(req *types.GetMenuListReq) (resp []types.
|
||||
}
|
||||
|
||||
// 将菜单按ID存入map
|
||||
menuMap := make(map[int64]types.MenuListItem)
|
||||
menuMap := make(map[string]types.MenuListItem)
|
||||
for _, menu := range menus {
|
||||
var meta map[string]interface{}
|
||||
err := json.Unmarshal([]byte(menu.Meta), &meta)
|
||||
@@ -69,7 +69,7 @@ func (l *GetMenuListLogic) GetMenuList(req *types.GetMenuListReq) (resp []types.
|
||||
}
|
||||
item := types.MenuListItem{
|
||||
Id: menu.Id,
|
||||
Pid: menu.Pid,
|
||||
Pid: menu.Pid.String,
|
||||
Name: menu.Name,
|
||||
Path: menu.Path,
|
||||
Component: menu.Component,
|
||||
@@ -86,13 +86,13 @@ func (l *GetMenuListLogic) GetMenuList(req *types.GetMenuListReq) (resp []types.
|
||||
|
||||
// 构建父子关系
|
||||
for _, menu := range menus {
|
||||
if menu.Pid > 0 {
|
||||
if menu.Pid.Valid && menu.Pid.String != "0" {
|
||||
// 找到父菜单
|
||||
if parent, exists := menuMap[menu.Pid]; exists {
|
||||
if parent, exists := menuMap[menu.Pid.String]; exists {
|
||||
// 添加当前菜单到父菜单的子菜单列表
|
||||
children := append(parent.Children, menuMap[menu.Id])
|
||||
parent.Children = children
|
||||
menuMap[menu.Pid] = parent
|
||||
menuMap[menu.Pid.String] = parent
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ func (l *GetMenuListLogic) GetMenuList(req *types.GetMenuListReq) (resp []types.
|
||||
// 提取顶级菜单(ParentId为0)到响应列表
|
||||
result := make([]types.MenuListItem, 0)
|
||||
for _, menu := range menus {
|
||||
if menu.Pid == 0 {
|
||||
if menu.Pid.Valid && menu.Pid.String == "0" {
|
||||
result = append(result, menuMap[menu.Id])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,13 +45,13 @@ func (l *UpdateMenuLogic) UpdateMenu(req *types.UpdateMenuReq) (resp *types.Upda
|
||||
}
|
||||
|
||||
// 3. 检查父菜单是否存在(如果不是根菜单)
|
||||
if req.Pid > 0 {
|
||||
parentMenu, err := l.svcCtx.AdminMenuModel.FindOne(l.ctx, req.Pid)
|
||||
if req.Pid != nil && *req.Pid != "0" {
|
||||
parentMenu, err := l.svcCtx.AdminMenuModel.FindOne(l.ctx, *req.Pid)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查询父菜单失败, id: %d, err: %v", req.Pid, err)
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查询父菜单失败, id: %s, err: %v", *req.Pid, err)
|
||||
}
|
||||
if parentMenu == nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "父菜单不存在, id: %d", req.Pid)
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "父菜单不存在, id: %s", *req.Pid)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ func (l *UpdateMenuLogic) UpdateMenu(req *types.UpdateMenuReq) (resp *types.Upda
|
||||
|
||||
// 5. 更新菜单信息
|
||||
|
||||
menu.Pid = req.Pid
|
||||
menu.Pid = sql.NullString{String: *req.Pid, Valid: req.Pid != nil}
|
||||
menu.Name = req.Name
|
||||
menu.Path = req.Path
|
||||
menu.Component = req.Component
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
@@ -32,6 +33,7 @@ func (l *AdminCreateNotificationLogic) AdminCreateNotification(req *types.AdminC
|
||||
startDate, _ := time.Parse("2006-01-02", req.StartDate)
|
||||
endDate, _ := time.Parse("2006-01-02", req.EndDate)
|
||||
data := &model.GlobalNotifications{
|
||||
Id: uuid.NewString(),
|
||||
Title: req.Title,
|
||||
Content: req.Content,
|
||||
NotificationPage: req.NotificationPage,
|
||||
@@ -45,6 +47,6 @@ func (l *AdminCreateNotificationLogic) AdminCreateNotification(req *types.AdminC
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "创建通知失败, err: %v, req: %+v", err, req)
|
||||
}
|
||||
id, _ := result.LastInsertId()
|
||||
return &types.AdminCreateNotificationResp{Id: id}, nil
|
||||
_ = result
|
||||
return &types.AdminCreateNotificationResp{Id: data.Id}, nil
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
@@ -48,6 +49,7 @@ func (l *AdminCreateOrderLogic) AdminCreateOrder(req *types.AdminCreateOrderReq)
|
||||
|
||||
// 创建订单对象
|
||||
order := &model.Order{
|
||||
Id: uuid.NewString(),
|
||||
OrderNo: orderNo,
|
||||
PlatformOrderId: sql.NullString{String: req.PlatformOrderId, Valid: req.PlatformOrderId != ""},
|
||||
ProductId: product.Id,
|
||||
@@ -58,19 +60,14 @@ func (l *AdminCreateOrderLogic) AdminCreateOrder(req *types.AdminCreateOrderReq)
|
||||
}
|
||||
|
||||
// 使用事务处理订单创建
|
||||
var orderId int64
|
||||
var orderId string
|
||||
err = l.svcCtx.OrderModel.Trans(l.ctx, func(ctx context.Context, session sqlx.Session) error {
|
||||
// 插入订单
|
||||
result, err := l.svcCtx.OrderModel.Insert(ctx, session, order)
|
||||
_, err := l.svcCtx.OrderModel.Insert(ctx, session, order)
|
||||
if err != nil {
|
||||
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminCreateOrder, 创建订单失败 err: %v", err)
|
||||
}
|
||||
|
||||
// 获取订单ID
|
||||
orderId, err = result.LastInsertId()
|
||||
if err != nil {
|
||||
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminCreateOrder, 获取订单ID失败 err: %v", err)
|
||||
}
|
||||
orderId = order.Id
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
"ycc-server/app/main/api/internal/types"
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/globalkey"
|
||||
"ycc-server/common/xerr"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -84,7 +83,6 @@ func (l *AdminGetOrderDetailLogic) AdminGetOrderDetail(req *types.AdminGetOrderD
|
||||
// 查询清理日志
|
||||
cleanupBuilder := l.svcCtx.QueryCleanupDetailModel.SelectBuilder().
|
||||
Where("order_id = ?", order.Id).
|
||||
Where("del_state = ?", globalkey.DelStateNo).
|
||||
OrderBy("create_time DESC").
|
||||
Limit(1)
|
||||
cleanupDetails, err := l.svcCtx.QueryCleanupDetailModel.FindAll(l.ctx, cleanupBuilder, "")
|
||||
|
||||
@@ -2,6 +2,8 @@ package admin_order
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"ycc-server/app/main/api/internal/svc"
|
||||
@@ -9,6 +11,7 @@ import (
|
||||
"ycc-server/app/main/model"
|
||||
"ycc-server/common/globalkey"
|
||||
"ycc-server/common/xerr"
|
||||
"ycc-server/pkg/lzkit/crypto"
|
||||
|
||||
"github.com/Masterminds/squirrel"
|
||||
"github.com/pkg/errors"
|
||||
@@ -73,6 +76,44 @@ func (l *AdminGetOrderListLogic) AdminGetOrderList(req *types.AdminGetOrderListR
|
||||
if req.RefundTimeEnd != "" {
|
||||
builder = builder.Where("refund_time <= ?", req.RefundTimeEnd)
|
||||
}
|
||||
if req.QuerySubjectName != "" || req.QuerySubjectMobile != "" || req.QuerySubjectIdCard != "" {
|
||||
key, decodeErr := hex.DecodeString(l.svcCtx.Config.Encrypt.SecretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR),
|
||||
"AdminGetOrderList, AES密钥解析失败 err: %v", decodeErr)
|
||||
}
|
||||
conds := []string{"del_state = ?"}
|
||||
args := []interface{}{globalkey.DelStateNo}
|
||||
if req.QuerySubjectName != "" {
|
||||
enc, _, encErr := crypto.EncryptDeterministicOptional(req.QuerySubjectName, key)
|
||||
if encErr != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR),
|
||||
"AdminGetOrderList, 加密筛选姓名失败 err: %v", encErr)
|
||||
}
|
||||
conds = append(conds, "enc_real_name = ?")
|
||||
args = append(args, enc)
|
||||
}
|
||||
if req.QuerySubjectMobile != "" {
|
||||
enc, encErr := crypto.EncryptMobile(req.QuerySubjectMobile, l.svcCtx.Config.Encrypt.SecretKey)
|
||||
if encErr != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR),
|
||||
"AdminGetOrderList, 加密筛选手机号失败 err: %v", encErr)
|
||||
}
|
||||
conds = append(conds, "enc_mobile = ?")
|
||||
args = append(args, enc)
|
||||
}
|
||||
if req.QuerySubjectIdCard != "" {
|
||||
enc, encErr := crypto.EncryptIDCard(req.QuerySubjectIdCard, key)
|
||||
if encErr != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR),
|
||||
"AdminGetOrderList, 加密筛选身份证失败 err: %v", encErr)
|
||||
}
|
||||
conds = append(conds, "enc_id_card = ?")
|
||||
args = append(args, enc)
|
||||
}
|
||||
subSQL := "id IN (SELECT order_id FROM query_subject_index WHERE " + strings.Join(conds, " AND ") + ")"
|
||||
builder = builder.Where(subSQL, args...)
|
||||
}
|
||||
|
||||
// 并发获取总数和列表
|
||||
var total int64
|
||||
@@ -86,7 +127,7 @@ func (l *AdminGetOrderListLogic) AdminGetOrderList(req *types.AdminGetOrderListR
|
||||
return nil
|
||||
}, func() error {
|
||||
var err error
|
||||
orders, err = l.svcCtx.OrderModel.FindPageListByPage(l.ctx, builder, req.Page, req.PageSize, "id DESC")
|
||||
orders, err = l.svcCtx.OrderModel.FindPageListByPage(l.ctx, builder, req.Page, req.PageSize, "create_time DESC")
|
||||
if err != nil {
|
||||
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "AdminGetOrderList, 查询订单列表失败 err: %v", err)
|
||||
}
|
||||
@@ -97,16 +138,16 @@ func (l *AdminGetOrderListLogic) AdminGetOrderList(req *types.AdminGetOrderListR
|
||||
}
|
||||
|
||||
// 并发获取产品信息和查询状态
|
||||
productMap := make(map[int64]string)
|
||||
queryStateMap := make(map[int64]string)
|
||||
agentOrderMap := make(map[int64]bool) // 代理订单映射
|
||||
agentProcessStatusMap := make(map[int64]string) // 代理处理状态映射
|
||||
productMap := make(map[string]string)
|
||||
queryStateMap := make(map[string]string)
|
||||
agentOrderMap := make(map[string]bool) // 代理订单映射
|
||||
agentProcessStatusMap := make(map[string]string) // 代理处理状态映射
|
||||
|
||||
var mu sync.Mutex
|
||||
|
||||
// 批量获取查询状态
|
||||
if len(orders) > 0 {
|
||||
orderIds := make([]int64, 0, len(orders))
|
||||
orderIds := make([]string, 0, len(orders))
|
||||
for _, order := range orders {
|
||||
orderIds = append(orderIds, order.Id)
|
||||
}
|
||||
@@ -121,14 +162,14 @@ func (l *AdminGetOrderListLogic) AdminGetOrderList(req *types.AdminGetOrderListR
|
||||
}
|
||||
|
||||
// 2. 记录已找到查询状态的订单ID
|
||||
foundOrderIds := make(map[int64]bool)
|
||||
foundOrderIds := make(map[string]bool)
|
||||
for _, query := range queries {
|
||||
queryStateMap[query.OrderId] = query.QueryState
|
||||
foundOrderIds[query.OrderId] = true
|
||||
}
|
||||
|
||||
// 3. 查找未找到查询状态的订单是否在清理日志中
|
||||
notFoundOrderIds := make([]int64, 0)
|
||||
notFoundOrderIds := make([]string, 0)
|
||||
for _, orderId := range orderIds {
|
||||
if !foundOrderIds[orderId] {
|
||||
notFoundOrderIds = append(notFoundOrderIds, orderId)
|
||||
@@ -139,7 +180,6 @@ func (l *AdminGetOrderListLogic) AdminGetOrderList(req *types.AdminGetOrderListR
|
||||
// 查询清理日志
|
||||
cleanupBuilder := l.svcCtx.QueryCleanupDetailModel.SelectBuilder().
|
||||
Where(squirrel.Eq{"order_id": notFoundOrderIds}).
|
||||
Where("del_state = ?", globalkey.DelStateNo).
|
||||
OrderBy("create_time DESC")
|
||||
cleanupDetails, err := l.svcCtx.QueryCleanupDetailModel.FindAll(l.ctx, cleanupBuilder, "")
|
||||
if err != nil && !errors.Is(err, model.ErrNotFound) {
|
||||
@@ -175,7 +215,7 @@ func (l *AdminGetOrderListLogic) AdminGetOrderList(req *types.AdminGetOrderListR
|
||||
|
||||
// 对于代理订单,查询代理处理状态
|
||||
if len(agentOrders) > 0 {
|
||||
agentOrderIds := make([]int64, 0, len(agentOrders))
|
||||
agentOrderIds := make([]string, 0, len(agentOrders))
|
||||
for _, agentOrder := range agentOrders {
|
||||
agentOrderIds = append(agentOrderIds, agentOrder.OrderId)
|
||||
}
|
||||
@@ -188,13 +228,13 @@ func (l *AdminGetOrderListLogic) AdminGetOrderList(req *types.AdminGetOrderListR
|
||||
}
|
||||
|
||||
// 记录有佣金记录的订单为处理成功
|
||||
processedOrderIds := make(map[int64]bool)
|
||||
processedOrderIds := make(map[string]bool)
|
||||
for _, commission := range commissions {
|
||||
processedOrderIds[commission.OrderId] = true
|
||||
}
|
||||
|
||||
// 创建订单状态映射,避免重复查找
|
||||
orderStatusMap := make(map[int64]string)
|
||||
orderStatusMap := make(map[string]string)
|
||||
for _, order := range orders {
|
||||
orderStatusMap[order.Id] = order.Status
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user