Compare commits

..

1 Commits

Author SHA1 Message Date
0493efefc7 v2.0 2025-05-11 01:49:52 +08:00
445 changed files with 3547 additions and 26766 deletions

View File

@@ -1,186 +0,0 @@
# Cursor 工作流程和规范
## 目录结构说明
### API 定义目录 (`app/main/api/desc/`)
```
desc/
├── admin/ # 后台管理接口
│ ├── admin_user.api # 管理员用户相关接口
│ ├── platform_user.api # 平台用户相关接口
│ ├── order.api # 订单管理接口
│ ├── promotion.api # 促销活动接口
│ ├── menu.api # 菜单管理接口
│ ├── role.api # 角色权限接口
│ └── auth.api # 后台认证接口
├── front/ # 前台业务接口
│ ├── user.api # 用户相关接口
│ ├── product.api # 产品相关接口
│ ├── pay.api # 支付相关接口
│ ├── query.api # 查询相关接口
│ ├── auth/ # 前台认证相关子模块
│ ├── product/ # 产品相关子模块
│ ├── query/ # 查询相关子模块
│ ├── user/ # 用户相关子模块
│ └── pay/ # 支付相关子模块
└── main.api # API 主入口文件,用于引入所有子模块
```
### 目录规范
1. 后台管理接口统一放在 `admin/` 目录下
- 所有后台管理相关的 API 定义文件都放在此目录
- 文件名应清晰表明模块功能,如 `order.api`、`user.api` 等
- 后台接口统一使用 `/api/v1/admin/` 前缀
2. 前台业务接口统一放在 `front/` 目录下
- 所有面向用户的 API 定义文件都放在此目录
- 可以根据业务模块创建子目录,如 `user/`、`product/` 等
- 前台接口统一使用 `/api/v1/` 前缀
3. 主入口文件 `main.api`
- 用于引入所有子模块的 API 定义
- 保持清晰的模块分类和注释
## API 开发流程
### 1. API 定义
- 根据业务类型选择正确的目录:
- 后台管理接口:`app/main/api/desc/admin/` 目录
- 前台业务接口:`app/main/api/desc/front/` 目录
- 创建新的 `.api` 文件,遵循以下命名规范:
- 后台接口:`[模块名].api`,如 `order.api`、`user.api`
- 前台接口:`[模块名].api`,如 `product.api`、`pay.api`
- API 定义规范:
- 使用 RESTful 风格
- 请求/响应结构体命名规范:`[模块名][操作名][Req/Resp]`
- 字段类型使用 string 而不是 int64 来存储枚举值
- 添加必要的注释说明
- 请求/响应参数定义规范:
```go
type (
// 创建类请求(必填字段)
AdminCreateXXXReq {
Field1 string `json:"field1"` // 字段1说明
Field2 int64 `json:"field2"` // 字段2说明
Field3 string `json:"field3"` // 字段3说明
}
// 更新类请求(可选字段使用指针类型)
AdminUpdateXXXReq {
Id int64 `path:"id"` // ID路径参数
Field1 *string `json:"field1,optional"` // 字段1说明可选
Field2 *int64 `json:"field2,optional"` // 字段2说明可选
Field3 *string `json:"field3,optional"` // 字段3说明可选
}
// 查询列表请求(分页参数 + 可选查询条件)
AdminGetXXXListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
Field1 *string `form:"field1,optional"` // 查询条件1可选
Field2 *int64 `form:"field2,optional"` // 查询条件2可选
Field3 *string `form:"field3,optional"` // 查询条件3可选
}
// 列表项结构体(用于列表响应)
XXXListItem {
Id int64 `json:"id"` // ID
Field1 string `json:"field1"` // 字段1
Field2 string `json:"field2"` // 字段2
Field3 string `json:"field3"` // 字段3
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
// 列表响应
AdminGetXXXListResp {
Total int64 `json:"total"` // 总数
Items []XXXListItem `json:"items"` // 列表数据
}
)
```
- 参数定义注意事项:
1. 创建类请求Create
- 所有字段都是必填的,使用普通类型(非指针)
- 使用 `json` 标签,不需要 `optional` 标记
- 必须添加字段说明注释
2. 更新类请求Update
- 除 ID 外的所有字段都是可选的,使用指针类型(如 `*string`、`*int64`
- 使用 `json` 标签,并添加 `optional` 标记
- ID 字段使用 `path` 标签,因为是路径参数
- 必须添加字段说明注释
3. 查询列表请求GetList
- 分页参数page、pageSize使用普通类型
- 查询条件字段都是可选的,使用指针类型
- 使用 `form` 标签,并添加 `optional` 标记
- 必须添加字段说明注释
4. 响应结构体:
- 列表响应使用 `Total` 和 `Items` 字段
- 列表项使用单独的结构体定义
- 时间字段统一使用 string 类型
- 必须添加字段说明注释
5. 标签使用规范:
- 路径参数:`path:"id"`
- JSON 参数:`json:"field_name"`
- 表单参数:`form:"field_name"`
- 可选字段:添加 `optional` 标记
- 所有字段必须添加说明注释
- 示例:
```go
// 通知管理接口
@server(
prefix: /api/v1/admin/notification
group: admin_notification
)
service main {
// 创建通知
@handler AdminCreateNotification
post /create (AdminCreateNotificationReq) returns (AdminCreateNotificationResp)
// 更新通知
@handler AdminUpdateNotification
put /update/:id (AdminUpdateNotificationReq) returns (AdminUpdateNotificationResp)
// 获取通知列表
@handler AdminGetNotificationList
get /list (AdminGetNotificationListReq) returns (AdminGetNotificationListResp)
}
```
### 2. 引入 API
- 在 `app/main/api/main.api` 中引入新定义的 API 文件:
```go
import "desc/order.api"
```
### 3. 生成代码
- 在项目根目录运行 `gen_api.ps1` 脚本生成相关代码:
```powershell
./gen_api.ps1
```
- 生成的文件包括:
- `app/main/api/internal/handler/` - 处理器
- `app/main/api/internal/logic/` - 业务逻辑
- `app/main/api/internal/svc/` - 服务上下文
- `app/main/api/internal/types/` - 类型定义
### 4. 实现业务逻辑
- 在 `app/main/api/internal/logic/` 目录下实现各个接口的业务逻辑
- 具体实现规范请参考 `logic.mdc` 文件
## 注意事项
1. 所有枚举类型使用 string 而不是 int64
2. 错误处理必须使用 errors.Wrapf 和 xerr 包
3. 涉及多表操作时使用事务
4. 并发操作时注意使用互斥锁保护共享资源
5. 时间类型统一使用 "2006-01-02 15:04:05" 格式
6. 代码生成后需要检查并完善业务逻辑实现
7. 保持代码风格统一,添加必要的注释

View File

@@ -1,270 +0,0 @@
# Your rule content
- You can @ files here
- You can use markdown but dont have to
# Logic 实现规范
## 目录结构
```
app/main/api/internal/logic/
├── admin_notification/ # 通知管理模块
│ ├── admincreatenotificationlogic.go # 创建通知
│ ├── admindeletnotificationlogic.go # 删除通知
│ ├── admingetnotificationdetaillogic.go # 获取通知详情
│ ├── admingetnotificationlistlogic.go # 获取通知列表
│ └── adminupdatenotificationlogic.go # 更新通知
└── [其他模块]/
```
## Logic 实现规范
### 1. 基础结构
每个 Logic 文件都应包含以下基础结构:
```go
package [模块名]
import (
"context"
"tyc-server/app/main/api/internal/svc"
"tyc-server/app/main/api/internal/types"
"tyc-server/common/xerr"
"github.com/pkg/errors"
"github.com/zeromicro/go-zero/core/logx"
)
type [操作名]Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func New[操作名]Logic(ctx context.Context, svcCtx *svc.ServiceContext) *[操作名]Logic {
return &[操作名]Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
```
### 2. 增删改查实现规范
#### 2.1 创建操作Create
```go
func (l *[操作名]Logic) [操作名](req *types.[操作名]Req) (resp *types.[操作名]Resp, err error) {
// 1. 数据转换和验证
data := &model.[表名]{
Field1: req.Field1,
Field2: req.Field2,
// ... 其他字段映射
}
// 2. 数据库操作
result, err := l.svcCtx.[表名]Model.Insert(l.ctx, nil, data)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR),
"创建[操作对象]失败, err: %v, req: %+v", err, req)
}
// 3. 返回结果
id, _ := result.LastInsertId()
return &types.[操作名]Resp{Id: id}, nil
}
```
#### 2.2 删除操作Delete
```go
func (l *[操作名]Logic) [操作名](req *types.[操作名]Req) (resp *types.[操作名]Resp, err error) {
// 1. 查询记录是否存在
record, err := l.svcCtx.[表名]Model.FindOne(l.ctx, req.Id)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR),
"查找[操作对象]失败, err: %v, id: %d", err, req.Id)
}
// 2. 执行删除操作(软删除)
err = l.svcCtx.[表名]Model.DeleteSoft(l.ctx, nil, record)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR),
"删除[操作对象]失败, err: %v, id: %d", err, req.Id)
}
// 3. 返回结果
return &types.[操作名]Resp{Success: true}, nil
}
```
#### 2.3 更新操作Update
```go
func (l *[操作名]Logic) [操作名](req *types.[操作名]Req) (resp *types.[操作名]Resp, err error) {
// 1. 查询记录是否存在
record, err := l.svcCtx.[表名]Model.FindOne(l.ctx, req.Id)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR),
"查找[操作对象]失败, err: %v, id: %d", err, req.Id)
}
// 2. 更新字段(使用指针判断是否更新)
if req.Field1 != nil {
record.Field1 = *req.Field1
}
if req.Field2 != nil {
record.Field2 = *req.Field2
}
// ... 其他字段更新
// 3. 执行更新操作
_, err = l.svcCtx.[表名]Model.Update(l.ctx, nil, record)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR),
"更新[操作对象]失败, err: %v, req: %+v", err, req)
}
// 4. 返回结果
return &types.[操作名]Resp{Success: true}, nil
}
```
#### 2.4 查询详情GetDetail
```go
func (l *[操作名]Logic) [操作名](req *types.[操作名]Req) (resp *types.[操作名]Resp, err error) {
// 1. 查询记录
record, err := l.svcCtx.[表名]Model.FindOne(l.ctx, req.Id)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR),
"查找[操作对象]失败, err: %v, id: %d", err, req.Id)
}
// 2. 构建响应
resp = &types.[操作名]Resp{
Id: record.Id,
Field1: record.Field1,
Field2: record.Field2,
CreateTime: record.CreateTime.Format("2006-01-02 15:04:05"),
UpdateTime: record.UpdateTime.Format("2006-01-02 15:04:05"),
}
// 3. 处理可选字段(如时间字段)
if record.OptionalField.Valid {
resp.OptionalField = record.OptionalField.Time.Format("2006-01-02")
}
return resp, nil
}
```
#### 2.5 查询列表GetList
```go
func (l *[操作名]Logic) [操作名](req *types.[操作名]Req) (resp *types.[操作名]Resp, err error) {
// 1. 构建查询条件
builder := l.svcCtx.[表名]Model.SelectBuilder()
// 2. 添加查询条件(使用指针判断是否添加条件)
if req.Field1 != nil {
builder = builder.Where("field1 LIKE ?", "%"+*req.Field1+"%")
}
if req.Field2 != nil {
builder = builder.Where("field2 = ?", *req.Field2)
}
// ... 其他查询条件
// 3. 执行分页查询
list, total, err := l.svcCtx.[表名]Model.FindPageListByPageWithTotal(
l.ctx, builder, req.Page, req.PageSize, "id DESC")
if err != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR),
"查询[操作对象]列表失败, err: %v, req: %+v", err, req)
}
// 4. 构建响应列表
items := make([]types.[列表项类型], 0, len(list))
for _, item := range list {
listItem := types.[列表项类型]{
Id: item.Id,
Field1: item.Field1,
Field2: item.Field2,
CreateTime: item.CreateTime.Format("2006-01-02 15:04:05"),
UpdateTime: item.UpdateTime.Format("2006-01-02 15:04:05"),
}
// 处理可选字段
if item.OptionalField.Valid {
listItem.OptionalField = item.OptionalField.Time.Format("2006-01-02")
}
items = append(items, listItem)
}
// 5. 返回结果
return &types.[操作名]Resp{
Total: total,
Items: items,
}, nil
}
```
### 3. 错误处理规范
1. 使用 `errors.Wrapf` 包装错误
2. 使用 `xerr.NewErrCode` 创建业务错误
3. 错误信息应包含:
- 操作类型(创建/更新/删除/查询)
- 具体错误描述
- 相关参数信息ID、请求参数等
### 4. 时间处理规范
1. 时间格式化:
- 日期时间:`"2006-01-02 15:04:05"`
- 仅日期:`"2006-01-02"`
2. 可选时间字段处理:
```go
if field.Valid {
resp.Field = field.Time.Format("2006-01-02")
}
```
### 5. 数据库操作规范
1. 查询条件构建:
```go
builder := l.svcCtx.[表名]Model.SelectBuilder()
builder = builder.Where("field = ?", value)
```
2. 分页查询:
```go
list, total, err := l.svcCtx.[表名]Model.FindPageListByPageWithTotal(
ctx, builder, page, pageSize, "id DESC")
```
3. 事务处理:
```go
err = l.svcCtx.[表名]Model.Trans(l.ctx, func(ctx context.Context, session sqlx.Session) error {
// 事务操作
return nil
})
```
### 6. 并发处理规范
```go
var mu sync.Mutex
err = mr.MapReduceVoid(func(source chan<- interface{}) {
// 并发处理
}, func(item interface{}, writer mr.Writer[struct{}], cancel func(error)) {
// 处理单个项目
}, func(pipe <-chan struct{}, cancel func(error)) {
// 完成处理
})
```
### 7. 注意事项
1. 所有数据库操作必须进行错误处理
2. 更新操作必须使用指针类型判断字段是否更新
3. 查询列表必须支持分页
4. 时间字段必须统一格式化
5. 可选字段必须进行空值判断
6. 保持代码风格统一,添加必要的注释
7. 涉及多表操作时使用事务
8. 并发操作时注意使用互斥锁保护共享资源
9. 错误处理必须使用 errors.Wrapf 和 xerr 包
10. 时间类型统一使用 "2006-01-02 15:04:05" 格式
# Your rule content
- You can @ files here
- You can use markdown but dont have to

View File

@@ -1,385 +0,0 @@
syntax = "v1"
info (
title: "后台代理管理服务"
desc: "后台代理相关接口"
author: "team"
version: "v1"
)
// 代理管理接口
@server(
prefix: /api/v1/admin/agent
group: admin_agent
)
service main {
// 代理分页查询
@handler AdminGetAgentList
get /list (AdminGetAgentListReq) returns (AdminGetAgentListResp)
// 代理推广链接分页查询
@handler AdminGetAgentLinkList
get /agent-link/list (AdminGetAgentLinkListReq) returns (AdminGetAgentLinkListResp)
// 代理佣金分页查询
@handler AdminGetAgentCommissionList
get /agent-commission/list (AdminGetAgentCommissionListReq) returns (AdminGetAgentCommissionListResp)
// 代理奖励分页查询
@handler AdminGetAgentRewardList
get /agent-reward/list (AdminGetAgentRewardListReq) returns (AdminGetAgentRewardListResp)
// 代理提现分页查询
@handler AdminGetAgentWithdrawalList
get /agent-withdrawal/list (AdminGetAgentWithdrawalListReq) returns (AdminGetAgentWithdrawalListResp)
// 代理上级抽佣分页查询
@handler AdminGetAgentCommissionDeductionList
get /agent-commission-deduction/list (AdminGetAgentCommissionDeductionListReq) returns (AdminGetAgentCommissionDeductionListResp)
// 平台抽佣分页查询
@handler AdminGetAgentPlatformDeductionList
get /agent-platform-deduction/list (AdminGetAgentPlatformDeductionListReq) returns (AdminGetAgentPlatformDeductionListResp)
// 代理产品配置分页查询
@handler AdminGetAgentProductionConfigList
get /agent-production-config/list (AdminGetAgentProductionConfigListReq) returns (AdminGetAgentProductionConfigListResp)
// 代理产品配置编辑
@handler AdminUpdateAgentProductionConfig
post /agent-production-config/update (AdminUpdateAgentProductionConfigReq) returns (AdminUpdateAgentProductionConfigResp)
// 代理会员充值订单分页查询
@handler AdminGetAgentMembershipRechargeOrderList
get /agent-membership-recharge-order/list (AdminGetAgentMembershipRechargeOrderListReq) returns (AdminGetAgentMembershipRechargeOrderListResp)
// 代理会员配置分页查询
@handler AdminGetAgentMembershipConfigList
get /agent-membership-config/list (AdminGetAgentMembershipConfigListReq) returns (AdminGetAgentMembershipConfigListResp)
// 代理会员配置编辑
@handler AdminUpdateAgentMembershipConfig
post /agent-membership-config/update (AdminUpdateAgentMembershipConfigReq) returns (AdminUpdateAgentMembershipConfigResp)
}
type (
// 代理分页查询请求
AdminGetAgentListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
Mobile *string `form:"mobile,optional"` // 手机号(可选)
Region *string `form:"region,optional"` // 区域(可选)
ParentAgentId *int64 `form:"parent_agent_id,optional"` // 上级代理ID可选
}
// 代理列表项
AgentListItem {
Id int64 `json:"id"` // 主键
UserId int64 `json:"user_id"` // 用户ID
ParentAgentId int64 `json:"parent_agent_id"` // 上级代理ID
LevelName string `json:"level_name"` // 等级名称
Region string `json:"region"` // 区域
Mobile string `json:"mobile"` // 手机号
MembershipExpiryTime string `json:"membership_expiry_time"` // 会员到期时间
Balance float64 `json:"balance"` // 钱包余额
TotalEarnings float64 `json:"total_earnings"` // 累计收益
FrozenBalance float64 `json:"frozen_balance"` // 冻结余额
WithdrawnAmount float64 `json:"withdrawn_amount"` // 提现总额
CreateTime string `json:"create_time"` // 创建时间
IsRealNameVerified bool `json:"is_real_name_verified"` // 是否已实名认证
RealName string `json:"real_name"` // 实名姓名
IdCard string `json:"id_card"` // 身份证号
RealNameStatus string `json:"real_name_status"` // 实名状态pending/approved/rejected
}
// 代理分页查询响应
AdminGetAgentListResp {
Total int64 `json:"total"` // 总数
Items []AgentListItem `json:"items"` // 列表数据
}
// 代理推广链接分页查询请求
AdminGetAgentLinkListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *int64 `form:"agent_id,optional"` // 代理ID可选
ProductName *string `form:"product_name,optional"` // 产品名(可选)
LinkIdentifier *string `form:"link_identifier,optional"` // 推广码(可选)
}
// 代理推广链接列表项
AgentLinkListItem {
AgentId int64 `json:"agent_id"` // 代理ID
ProductName string `json:"product_name"` // 产品名
Price float64 `json:"price"` // 价格
LinkIdentifier string `json:"link_identifier"` // 推广码
CreateTime string `json:"create_time"` // 创建时间
}
// 代理推广链接分页查询响应
AdminGetAgentLinkListResp {
Total int64 `json:"total"` // 总数
Items []AgentLinkListItem `json:"items"` // 列表数据
}
// 代理佣金分页查询请求
AdminGetAgentCommissionListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *int64 `form:"agent_id,optional"` // 代理ID可选
ProductName *string `form:"product_name,optional"` // 产品名(可选)
Status *int64 `form:"status,optional"` // 状态(可选)
}
// 代理佣金列表项
AgentCommissionListItem {
Id int64 `json:"id"` // 主键
AgentId int64 `json:"agent_id"` // 代理ID
OrderId int64 `json:"order_id"` // 订单ID
Amount float64 `json:"amount"` // 金额
ProductName string `json:"product_name"` // 产品名
Status int64 `json:"status"` // 状态
CreateTime string `json:"create_time"` // 创建时间
}
// 代理佣金分页查询响应
AdminGetAgentCommissionListResp {
Total int64 `json:"total"` // 总数
Items []AgentCommissionListItem `json:"items"` // 列表数据
}
// 代理奖励分页查询请求
AdminGetAgentRewardListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *int64 `form:"agent_id,optional"` // 代理ID可选
RelationAgentId *int64 `form:"relation_agent_id,optional"` // 关联代理ID可选
Type *string `form:"type,optional"` // 奖励类型(可选)
}
// 代理奖励列表项
AgentRewardListItem {
Id int64 `json:"id"` // 主键
AgentId int64 `json:"agent_id"` // 代理ID
RelationAgentId int64 `json:"relation_agent_id"` // 关联代理ID
Amount float64 `json:"amount"` // 金额
Type string `json:"type"` // 奖励类型
CreateTime string `json:"create_time"` // 创建时间
}
// 代理奖励分页查询响应
AdminGetAgentRewardListResp {
Total int64 `json:"total"` // 总数
Items []AgentRewardListItem `json:"items"` // 列表数据
}
// 代理提现分页查询请求
AdminGetAgentWithdrawalListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *int64 `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"` // 金额
Status int64 `json:"status"` // 状态
PayeeAccount string `json:"payee_account"` // 收款账户
Remark string `json:"remark"` // 备注
CreateTime string `json:"create_time"` // 创建时间
}
// 代理提现分页查询响应
AdminGetAgentWithdrawalListResp {
Total int64 `json:"total"` // 总数
Items []AgentWithdrawalListItem `json:"items"` // 列表数据
}
// 代理抽佣分页查询请求
AdminGetAgentCommissionDeductionListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *int64 `form:"agent_id,optional"` // 代理ID可选
ProductName *string `form:"product_name,optional"` // 产品名(可选)
Type *string `form:"type,optional"` // 类型cost/pricing可选
Status *int64 `form:"status,optional"` // 状态(可选)
}
// 代理抽佣列表项
AgentCommissionDeductionListItem {
Id int64 `json:"id"` // 主键
AgentId int64 `json:"agent_id"` // 代理ID
DeductedAgentId int64 `json:"deducted_agent_id"` // 被扣代理ID
Amount float64 `json:"amount"` // 金额
ProductName string `json:"product_name"` // 产品名
Type string `json:"type"` // 类型cost/pricing
Status int64 `json:"status"` // 状态
CreateTime string `json:"create_time"` // 创建时间
}
// 代理抽佣分页查询响应
AdminGetAgentCommissionDeductionListResp {
Total int64 `json:"total"` // 总数
Items []AgentCommissionDeductionListItem `json:"items"` // 列表数据
}
// 平台抽佣分页查询请求
AdminGetAgentPlatformDeductionListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
AgentId *int64 `form:"agent_id,optional"` // 代理ID可选
Type *string `form:"type,optional"` // 类型cost/pricing可选
Status *int64 `form:"status,optional"` // 状态(可选)
}
// 平台抽佣列表项
AgentPlatformDeductionListItem {
Id int64 `json:"id"` // 主键
AgentId int64 `json:"agent_id"` // 代理ID
Amount float64 `json:"amount"` // 金额
Type string `json:"type"` // 类型cost/pricing
Status int64 `json:"status"` // 状态
CreateTime string `json:"create_time"` // 创建时间
}
// 平台抽佣分页查询响应
AdminGetAgentPlatformDeductionListResp {
Total int64 `json:"total"` // 总数
Items []AgentPlatformDeductionListItem `json:"items"` // 列表数据
}
// 代理产品配置分页查询请求
AdminGetAgentProductionConfigListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
ProductName *string `form:"product_name,optional"` // 产品名(可选)
Id *int64 `form:"id,optional"` // 配置ID可选
}
// 代理产品配置分页查询响应
AdminGetAgentProductionConfigListResp {
Total int64 `json:"total"` // 总数
Items []AgentProductionConfigItem `json:"items"` // 列表数据
}
// 代理产品配置列表项
AgentProductionConfigItem {
Id int64 `json:"id"` // 主键
ProductName string `json:"product_name"` // 产品名
CostPrice float64 `json:"cost_price"` // 成本
PriceRangeMin float64 `json:"price_range_min"` // 最低定价
PriceRangeMax float64 `json:"price_range_max"` // 最高定价
PricingStandard float64 `json:"pricing_standard"` // 定价标准
OverpricingRatio float64 `json:"overpricing_ratio"` // 超价比例
CreateTime string `json:"create_time"` // 创建时间
}
// 代理产品配置编辑请求
AdminUpdateAgentProductionConfigReq {
Id int64 `json:"id"` // 主键
CostPrice float64 `json:"cost_price"` // 成本
PriceRangeMin float64 `json:"price_range_min"` // 最低定价
PriceRangeMax float64 `json:"price_range_max"` // 最高定价
PricingStandard float64 `json:"pricing_standard"` // 定价标准
OverpricingRatio float64 `json:"overpricing_ratio"` // 超价比例
}
// 代理产品配置编辑响应
AdminUpdateAgentProductionConfigResp {
Success bool `json:"success"` // 是否成功
}
// 代理会员充值订单分页查询请求
AdminGetAgentMembershipRechargeOrderListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
UserId *int64 `form:"user_id,optional"` // 用户ID可选
AgentId *int64 `form:"agent_id,optional"` // 代理ID可选
OrderNo *string `form:"order_no,optional"` // 订单号(可选)
PlatformOrderId *string `form:"platform_order_id,optional"` // 平台订单号(可选)
Status *string `form:"status,optional"` // 状态(可选)
PaymentMethod *string `form:"payment_method,optional"` // 支付方式(可选)
}
// 代理会员充值订单列表项
AgentMembershipRechargeOrderListItem {
Id int64 `json:"id"` // 主键
UserId int64 `json:"user_id"` // 用户ID
AgentId int64 `json:"agent_id"` // 代理ID
LevelName string `json:"level_name"` // 等级名称
Amount float64 `json:"amount"` // 金额
PaymentMethod string `json:"payment_method"` // 支付方式
OrderNo string `json:"order_no"` // 订单号
PlatformOrderId string `json:"platform_order_id"` // 平台订单号
Status string `json:"status"` // 状态
CreateTime string `json:"create_time"` // 创建时间
}
// 代理会员充值订单分页查询响应
AdminGetAgentMembershipRechargeOrderListResp {
Total int64 `json:"total"` // 总数
Items []AgentMembershipRechargeOrderListItem `json:"items"` // 列表数据
}
// 代理会员配置分页查询请求
AdminGetAgentMembershipConfigListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
LevelName *string `form:"level_name,optional"` // 会员级别名称(可选)
}
// 代理会员配置分页查询响应
AdminGetAgentMembershipConfigListResp {
Total int64 `json:"total"` // 总数
Items []AgentMembershipConfigListItem `json:"items"` // 列表数据
}
// 代理会员配置列表项
AgentMembershipConfigListItem {
Id int64 `json:"id"` // 主键
LevelName string `json:"level_name"` // 会员级别名称
Price *float64 `json:"price"` // 会员年费
ReportCommission *float64 `json:"report_commission"` // 直推报告收益
LowerActivityReward *float64 `json:"lower_activity_reward"` // 下级活跃奖励金额
NewActivityReward *float64 `json:"new_activity_reward"` // 新增活跃奖励金额
LowerStandardCount *int64 `json:"lower_standard_count"` // 活跃下级达标个数
NewLowerStandardCount *int64 `json:"new_lower_standard_count"` // 新增活跃下级达标个数
LowerWithdrawRewardRatio *float64 `json:"lower_withdraw_reward_ratio"` // 下级提现奖励比例
LowerConvertVipReward *float64 `json:"lower_convert_vip_reward"` // 下级转化VIP奖励
LowerConvertSvipReward *float64 `json:"lower_convert_svip_reward"` // 下级转化SVIP奖励
ExemptionAmount *float64 `json:"exemption_amount"` // 免责金额
PriceIncreaseMax *float64 `json:"price_increase_max"` // 提价最高金额
PriceRatio *float64 `json:"price_ratio"` // 提价区间收取比例
PriceIncreaseAmount *float64 `json:"price_increase_amount"` // 在原本成本上加价的金额
CreateTime string `json:"create_time"` // 创建时间
}
// 代理会员配置编辑请求
AdminUpdateAgentMembershipConfigReq {
Id int64 `json:"id"` // 主键
LevelName string `json:"level_name"` // 会员级别名称
Price float64 `json:"price"` // 会员年费
ReportCommission float64 `json:"report_commission"` // 直推报告收益
LowerActivityReward *float64 `json:"lower_activity_reward,optional,omitempty"` // 下级活跃奖励金额
NewActivityReward *float64 `json:"new_activity_reward,optional,omitempty"` // 新增活跃奖励金额
LowerStandardCount *int64 `json:"lower_standard_count,optional,omitempty"` // 活跃下级达标个数
NewLowerStandardCount *int64 `json:"new_lower_standard_count,optional,omitempty"` // 新增活跃下级达标个数
LowerWithdrawRewardRatio *float64 `json:"lower_withdraw_reward_ratio,optional,omitempty"` // 下级提现奖励比例
LowerConvertVipReward *float64 `json:"lower_convert_vip_reward,optional,omitempty"` // 下级转化VIP奖励
LowerConvertSvipReward *float64 `json:"lower_convert_svip_reward,optional,omitempty"` // 下级转化SVIP奖励
ExemptionAmount *float64 `json:"exemption_amount,optional,omitempty"` // 免责金额
PriceIncreaseMax *float64 `json:"price_increase_max,optional,omitempty"` // 提价最高金额
PriceRatio *float64 `json:"price_ratio,optional,omitempty"` // 提价区间收取比例
PriceIncreaseAmount *float64 `json:"price_increase_amount,optional,omitempty"` // 在原本成本上加价的金额
}
// 代理会员配置编辑响应
AdminUpdateAgentMembershipConfigResp {
Success bool `json:"success"` // 是否成功
}
)

View File

@@ -1,108 +0,0 @@
syntax = "v1"
info (
title: "后台功能管理服务"
desc: "后台功能管理相关接口"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
// 功能管理接口
@server(
prefix: /api/v1/admin/feature
group: admin_feature
)
service main {
// 创建功能
@handler AdminCreateFeature
post /create (AdminCreateFeatureReq) returns (AdminCreateFeatureResp)
// 更新功能
@handler AdminUpdateFeature
put /update/:id (AdminUpdateFeatureReq) returns (AdminUpdateFeatureResp)
// 删除功能
@handler AdminDeleteFeature
delete /delete/:id (AdminDeleteFeatureReq) returns (AdminDeleteFeatureResp)
// 获取功能列表
@handler AdminGetFeatureList
get /list (AdminGetFeatureListReq) returns (AdminGetFeatureListResp)
// 获取功能详情
@handler AdminGetFeatureDetail
get /detail/:id (AdminGetFeatureDetailReq) returns (AdminGetFeatureDetailResp)
}
type (
// 创建功能请求
AdminCreateFeatureReq {
ApiId string `json:"api_id"` // API标识
Name string `json:"name"` // 描述
}
// 创建功能响应
AdminCreateFeatureResp {
Id int64 `json:"id"` // 功能ID
}
// 更新功能请求
AdminUpdateFeatureReq {
Id int64 `path:"id"` // 功能ID
ApiId *string `json:"api_id,optional"` // API标识
Name *string `json:"name,optional"` // 描述
}
// 更新功能响应
AdminUpdateFeatureResp {
Success bool `json:"success"` // 是否成功
}
// 删除功能请求
AdminDeleteFeatureReq {
Id int64 `path:"id"` // 功能ID
}
// 删除功能响应
AdminDeleteFeatureResp {
Success bool `json:"success"` // 是否成功
}
// 获取功能列表请求
AdminGetFeatureListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
ApiId *string `form:"api_id,optional"` // API标识
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"` // 更新时间
}
// 获取功能列表响应
AdminGetFeatureListResp {
Total int64 `json:"total"` // 总数
Items []FeatureListItem `json:"items"` // 列表数据
}
// 获取功能详情请求
AdminGetFeatureDetailReq {
Id int64 `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"` // 更新时间
}
)

View File

@@ -1,175 +0,0 @@
syntax = "v1"
info (
title: "后台产品管理服务"
desc: "后台产品管理相关接口"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
// 产品管理接口
@server(
prefix: /api/v1/admin/product
group: admin_product
)
service main {
// 创建产品
@handler AdminCreateProduct
post /create (AdminCreateProductReq) returns (AdminCreateProductResp)
// 更新产品
@handler AdminUpdateProduct
put /update/:id (AdminUpdateProductReq) returns (AdminUpdateProductResp)
// 删除产品
@handler AdminDeleteProduct
delete /delete/:id (AdminDeleteProductReq) returns (AdminDeleteProductResp)
// 获取产品列表
@handler AdminGetProductList
get /list (AdminGetProductListReq) returns (AdminGetProductListResp)
// 获取产品详情
@handler AdminGetProductDetail
get /detail/:id (AdminGetProductDetailReq) returns (AdminGetProductDetailResp)
// 获取产品功能列表
@handler AdminGetProductFeatureList
get /feature/list/:product_id (AdminGetProductFeatureListReq) returns ([]AdminGetProductFeatureListResp)
// 更新产品功能关联(批量)
@handler AdminUpdateProductFeatures
put /feature/update/:product_id (AdminUpdateProductFeaturesReq) returns (AdminUpdateProductFeaturesResp)
}
type (
// 创建产品请求
AdminCreateProductReq {
ProductName string `json:"product_name"` // 服务名
ProductEn string `json:"product_en"` // 英文名
Description string `json:"description"` // 描述
Notes string `json:"notes,optional"` // 备注
CostPrice float64 `json:"cost_price"` // 成本
SellPrice float64 `json:"sell_price"` // 售价
}
// 创建产品响应
AdminCreateProductResp {
Id int64 `json:"id"` // 产品ID
}
// 更新产品请求
AdminUpdateProductReq {
Id int64 `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"` // 售价
}
// 更新产品响应
AdminUpdateProductResp {
Success bool `json:"success"` // 是否成功
}
// 删除产品请求
AdminDeleteProductReq {
Id int64 `path:"id"` // 产品ID
}
// 删除产品响应
AdminDeleteProductResp {
Success bool `json:"success"` // 是否成功
}
// 获取产品列表请求
AdminGetProductListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
ProductName *string `form:"product_name,optional"` // 服务名
ProductEn *string `form:"product_en,optional"` // 英文名
}
// 产品列表项
ProductListItem {
Id int64 `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"` // 更新时间
}
// 获取产品列表响应
AdminGetProductListResp {
Total int64 `json:"total"` // 总数
Items []ProductListItem `json:"items"` // 列表数据
}
// 获取产品详情请求
AdminGetProductDetailReq {
Id int64 `path:"id"` // 产品ID
}
// 获取产品详情响应
AdminGetProductDetailResp {
Id int64 `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
}
// 获取产品功能列表响应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 {
// Items []ProductFeatureListItem `json:"items"` // 列表数据
// }
// 产品功能关联项
ProductFeatureItem {
FeatureId int64 `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"` // 功能列表
}
// 更新产品功能关联响应
AdminUpdateProductFeaturesResp {
Success bool `json:"success"` // 是否成功
}
)

View File

@@ -1,135 +0,0 @@
syntax = "v1"
info (
title: "查询服务"
desc: "查询服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
@server (
prefix: api/v1/admin/query
group: admin_query
jwt: JwtAuth
)
service main {
@doc "获取查询详情"
@handler AdminGetQueryDetailByOrderId
get /detail/:order_id (AdminGetQueryDetailByOrderIdReq) returns (AdminGetQueryDetailByOrderIdResp)
@doc "获取清理日志列表"
@handler AdminGetQueryCleanupLogList
get /cleanup/logs (AdminGetQueryCleanupLogListReq) returns (AdminGetQueryCleanupLogListResp)
@doc "获取清理详情列表"
@handler AdminGetQueryCleanupDetailList
get /cleanup/details/:log_id (AdminGetQueryCleanupDetailListReq) returns (AdminGetQueryCleanupDetailListResp)
@doc "获取清理配置列表"
@handler AdminGetQueryCleanupConfigList
get /cleanup/configs (AdminGetQueryCleanupConfigListReq) returns (AdminGetQueryCleanupConfigListResp)
@doc "更新清理配置"
@handler AdminUpdateQueryCleanupConfig
put /cleanup/config (AdminUpdateQueryCleanupConfigReq) returns (AdminUpdateQueryCleanupConfigResp)
}
type AdminGetQueryDetailByOrderIdReq {
OrderId int64 `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 AdminQueryItem {
Feature interface{} `json:"feature"`
Data interface{} `json:"data"` // 这里可以是 map 或 具体的 struct
}
// 清理日志相关请求响应定义
type AdminGetQueryCleanupLogListReq {
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"page_size,default=20"` // 每页数量
Status int64 `form:"status,optional"` // 状态1-成功2-失败
StartTime string `form:"start_time,optional"` // 开始时间
EndTime string `form:"end_time,optional"` // 结束时间
}
type AdminGetQueryCleanupLogListResp {
Total int64 `json:"total"` // 总数
Items []QueryCleanupLogItem `json:"items"` // 列表
}
type QueryCleanupLogItem {
Id int64 `json:"id"` // 主键ID
CleanupTime string `json:"cleanup_time"` // 清理时间
CleanupBefore string `json:"cleanup_before"` // 清理截止时间
Status int64 `json:"status"` // 状态1-成功2-失败
AffectedRows int64 `json:"affected_rows"` // 影响行数
ErrorMsg string `json:"error_msg"` // 错误信息
Remark string `json:"remark"` // 备注
CreateTime string `json:"create_time"` // 创建时间
}
// 清理详情相关请求响应定义
type AdminGetQueryCleanupDetailListReq {
LogId int64 `path:"log_id"` // 清理日志ID
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"page_size,default=20"` // 每页数量
}
type AdminGetQueryCleanupDetailListResp {
Total int64 `json:"total"` // 总数
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
ProductName string `json:"product_name"` // 产品名称
QueryState string `json:"query_state"` // 查询状态
CreateTimeOld string `json:"create_time_old"` // 原创建时间
CreateTime string `json:"create_time"` // 创建时间
}
// 清理配置相关请求响应定义
type AdminGetQueryCleanupConfigListReq {
Status int64 `form:"status,optional"` // 状态1-启用0-禁用
}
type AdminGetQueryCleanupConfigListResp {
Items []QueryCleanupConfigItem `json:"items"` // 配置列表
}
type QueryCleanupConfigItem {
Id int64 `json:"id"` // 主键ID
ConfigKey string `json:"config_key"` // 配置键
ConfigValue string `json:"config_value"` // 配置值
ConfigDesc string `json:"config_desc"` // 配置描述
Status int64 `json:"status"` // 状态1-启用0-禁用
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
type AdminUpdateQueryCleanupConfigReq {
Id int64 `json:"id"` // 主键ID
ConfigValue string `json:"config_value"` // 配置值
Status int64 `json:"status"` // 状态1-启用0-禁用
}
type AdminUpdateQueryCleanupConfigResp {
Success bool `json:"success"` // 是否成功
}

View File

@@ -1,131 +0,0 @@
syntax = "v1"
info (
title: "后台用户中心服务"
desc: "后台用户中心服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
@server (
prefix: api/v1/admin/user
group: admin_user
jwt: JwtAuth
)
service main {
@doc "获取用户列表"
@handler AdminGetUserList
get /list (AdminGetUserListReq) returns (AdminGetUserListResp)
@doc "获取用户详情"
@handler AdminGetUserDetail
get /detail/:id (AdminGetUserDetailReq) returns (AdminGetUserDetailResp)
@doc "创建用户"
@handler AdminCreateUser
post /create (AdminCreateUserReq) returns (AdminCreateUserResp)
@doc "更新用户"
@handler AdminUpdateUser
put /update/:id (AdminUpdateUserReq) returns (AdminUpdateUserResp)
@doc "删除用户"
@handler AdminDeleteUser
delete /delete/:id (AdminDeleteUserReq) returns (AdminDeleteUserResp)
@doc "用户信息"
@handler AdminUserInfo
get /info (AdminUserInfoReq) returns (AdminUserInfoResp)
}
type (
// 列表请求
AdminGetUserListReq {
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"pageSize,default=20"` // 每页数量
Username string `form:"username,optional"` // 用户名
RealName string `form:"real_name,optional"` // 真实姓名
Status int64 `form:"status,optional,default=-1"` // 状态0-禁用1-启用
}
// 列表响应
AdminGetUserListResp {
Total int64 `json:"total"` // 总数
Items []AdminUserListItem `json:"items"` // 列表
}
// 列表项
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列表
}
// 详情请求
AdminGetUserDetailReq {
Id int64 `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列表
}
// 创建请求
AdminCreateUserReq {
Username string `json:"username"` // 用户名
RealName string `json:"real_name"` // 真实姓名
Status int64 `json:"status,default=1"` // 状态0-禁用1-启用
RoleIds []int64 `json:"role_ids"` // 关联的角色ID列表
}
// 创建响应
AdminCreateUserResp {
Id int64 `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列表
}
// 更新响应
AdminUpdateUserResp {
Success bool `json:"success"` // 是否成功
}
// 删除请求
AdminDeleteUserReq {
Id int64 `path:"id"` // 用户ID
}
// 删除响应
AdminDeleteUserResp {
Success bool `json:"success"` // 是否成功
}
// 用户信息请求
AdminUserInfoReq {
}
// 用户信息响应
AdminUserInfoResp {
Username string `json:"username"` // 用户名
RealName string `json:"real_name"` // 真实姓名
Roles []string `json:"roles"` // 角色编码列表
}
)

View File

@@ -1,34 +0,0 @@
syntax = "v1"
info (
title: "认证中心服务"
desc: "认证中心服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
@server (
prefix: api/v1/admin/auth
group: admin_auth
)
service main {
@doc "登录"
@handler AdminLogin
post /login (AdminLoginReq) returns (AdminLoginResp)
}
type (
AdminLoginReq {
Username string `json:"username" validate:"required"`
Password string `json:"password" validate:"required"`
Captcha bool `json:"captcha" validate:"required"`
}
AdminLoginResp {
AccessToken string `json:"access_token"`
AccessExpire int64 `json:"access_expire"`
RefreshAfter int64 `json:"refresh_after"`
Roles []string `json:"roles"`
}
)

View File

@@ -1,149 +0,0 @@
syntax = "v1"
info (
title: "菜单中心服务"
desc: "菜单中心服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
@server (
prefix: api/v1/admin/menu
group: admin_menu
jwt: JwtAuth
)
service main {
@doc "获取菜单列表"
@handler GetMenuList
get /list (GetMenuListReq) returns ([]MenuListItem)
@doc "获取菜单详情"
@handler GetMenuDetail
get /detail/:id (GetMenuDetailReq) returns (GetMenuDetailResp)
@doc "创建菜单"
@handler CreateMenu
post /create (CreateMenuReq) returns (CreateMenuResp)
@doc "更新菜单"
@handler UpdateMenu
put /update/:id (UpdateMenuReq) returns (UpdateMenuResp)
@doc "删除菜单"
@handler DeleteMenu
delete /delete/:id (DeleteMenuReq) returns (DeleteMenuResp)
@doc "获取所有菜单(树形结构)"
@handler GetMenuAll
get /all (GetMenuAllReq) returns ([]GetMenuAllResp)
}
type (
// 列表请求
GetMenuListReq {
Name string `form:"name,optional"` // 菜单名称
Path string `form:"path,optional"` // 路由路径
Status int64 `form:"status,optional,default=-1"` // 状态0-禁用1-启用
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"` // 排序
CreateTime string `json:"createTime"` // 创建时间
Children []MenuListItem `json:"children"` // 子菜单
}
// 详情请求
GetMenuDetailReq {
Id int64 `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"` // 排序
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"` // 路由元数据
Status int64 `json:"status,optional,default=1"` // 状态0-禁用1-启用
Type string `json:"type"` // 类型
Sort int64 `json:"sort,optional"` // 排序
}
// 创建响应
CreateMenuResp {
Id int64 `json:"id"` // 菜单ID
}
// 更新请求
UpdateMenuReq {
Id int64 `path:"id"` // 菜单ID
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"` // 路由元数据
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
}
// 删除响应
DeleteMenuResp {
Success bool `json:"success"` // 是否成功
}
// 获取所有菜单请求
GetMenuAllReq {
}
// 获取所有菜单响应
GetMenuAllResp {
Name string `json:"name"`
Path string `json:"path"`
Redirect string `json:"redirect,omitempty"`
Component string `json:"component,omitempty"`
Sort int64 `json:"sort"`
Meta map[string]interface{} `json:"meta"`
Children []GetMenuAllResp `json:"children"`
}
)

View File

@@ -1,127 +0,0 @@
syntax = "v1"
type (
// 创建通知请求
AdminCreateNotificationReq {
Title string `json:"title"` // 通知标题
NotificationPage string `json:"notification_page"` // 通知页面
Content string `json:"content"` // 通知内容
StartDate string `json:"start_date"` // 生效开始日期yyyy-MM-dd
StartTime string `json:"start_time"` // 生效开始时间HH:mm:ss
EndDate string `json:"end_date"` // 生效结束日期yyyy-MM-dd
EndTime string `json:"end_time"` // 生效结束时间HH:mm:ss
Status int64 `json:"status"` // 状态1-启用0-禁用
}
// 创建通知响应
AdminCreateNotificationResp {
Id int64 `json:"id"` // 通知ID
}
// 更新通知请求
AdminUpdateNotificationReq {
Id int64 `path:"id"` // 通知ID
Title *string `json:"title,optional"` // 通知标题
Content *string `json:"content,optional"` // 通知内容
NotificationPage *string `json:"notification_page,optional"` // 通知页面
StartDate *string `json:"start_date,optional"` // 生效开始日期
StartTime *string `json:"start_time,optional"` // 生效开始时间
EndDate *string `json:"end_date,optional"` // 生效结束日期
EndTime *string `json:"end_time,optional"` // 生效结束时间
Status *int64 `json:"status,optional"` // 状态
}
// 更新通知响应
AdminUpdateNotificationResp {
Success bool `json:"success"` // 是否成功
}
// 删除通知请求
AdminDeleteNotificationReq {
Id int64 `path:"id"` // 通知ID
}
// 删除通知响应
AdminDeleteNotificationResp {
Success bool `json:"success"` // 是否成功
}
// 获取通知详情请求
AdminGetNotificationDetailReq {
Id int64 `path:"id"` // 通知ID
}
// 获取通知详情响应
AdminGetNotificationDetailResp {
Id int64 `json:"id"` // 通知ID
Title string `json:"title"` // 通知标题
Content string `json:"content"` // 通知内容
NotificationPage string `json:"notification_page"` // 通知页面
StartDate string `json:"start_date"` // 生效开始日期
StartTime string `json:"start_time"` // 生效开始时间
EndDate string `json:"end_date"` // 生效结束日期
EndTime string `json:"end_time"` // 生效结束时间
Status int64 `json:"status"` // 状态
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
// 获取通知列表请求
AdminGetNotificationListReq {
Page int64 `form:"page"` // 页码
PageSize int64 `form:"pageSize"` // 每页数量
Title *string `form:"title,optional"` // 通知标题(可选)
NotificationPage *string `form:"notification_page,optional"` // 通知页面(可选)
Status *int64 `form:"status,optional"` // 状态(可选)
StartDate *string `form:"start_date,optional"` // 开始日期范围(可选)
EndDate *string `form:"end_date,optional"` // 结束日期范围(可选)
}
// 通知列表项
NotificationListItem {
Id int64 `json:"id"` // 通知ID
Title string `json:"title"` // 通知标题
NotificationPage string `json:"notification_page"` // 通知页面
Content string `json:"content"` // 通知内容
StartDate string `json:"start_date"` // 生效开始日期
StartTime string `json:"start_time"` // 生效开始时间
EndDate string `json:"end_date"` // 生效结束日期
EndTime string `json:"end_time"` // 生效结束时间
Status int64 `json:"status"` // 状态
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
// 获取通知列表响应
AdminGetNotificationListResp {
Total int64 `json:"total"` // 总数
Items []NotificationListItem `json:"items"` // 列表数据
}
)
// 通知管理接口
@server(
prefix: /api/v1/admin/notification
group: admin_notification
)
service main {
// 创建通知
@handler AdminCreateNotification
post /create (AdminCreateNotificationReq) returns (AdminCreateNotificationResp)
// 更新通知
@handler AdminUpdateNotification
put /update/:id (AdminUpdateNotificationReq) returns (AdminUpdateNotificationResp)
// 删除通知
@handler AdminDeleteNotification
delete /delete/:id (AdminDeleteNotificationReq) returns (AdminDeleteNotificationResp)
// 获取通知详情
@handler AdminGetNotificationDetail
get /detail/:id (AdminGetNotificationDetailReq) returns (AdminGetNotificationDetailResp)
// 获取通知列表
@handler AdminGetNotificationList
get /list (AdminGetNotificationListReq) returns (AdminGetNotificationListResp)
}

View File

@@ -1,169 +0,0 @@
syntax = "v1"
info (
title: "订单服务"
desc: "订单服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
@server (
prefix: api/v1/admin/order
group: admin_order
jwt: JwtAuth
)
service main {
@doc "获取订单列表"
@handler AdminGetOrderList
get /list (AdminGetOrderListReq) returns (AdminGetOrderListResp)
@doc "获取订单详情"
@handler AdminGetOrderDetail
get /detail/:id (AdminGetOrderDetailReq) returns (AdminGetOrderDetailResp)
@doc "创建订单"
@handler AdminCreateOrder
post /create (AdminCreateOrderReq) returns (AdminCreateOrderResp)
@doc "更新订单"
@handler AdminUpdateOrder
put /update/:id (AdminUpdateOrderReq) returns (AdminUpdateOrderResp)
@doc "删除订单"
@handler AdminDeleteOrder
delete /delete/:id (AdminDeleteOrderReq) returns (AdminDeleteOrderResp)
@doc "订单退款"
@handler AdminRefundOrder
post /refund/:id (AdminRefundOrderReq) returns (AdminRefundOrderResp)
}
type (
// 列表请求
AdminGetOrderListReq {
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"pageSize,default=20"` // 每页数量
OrderNo string `form:"order_no,optional"` // 商户订单号
PlatformOrderId string `form:"platform_order_id,optional"` // 支付订单号
ProductName string `form:"product_name,optional"` // 产品名称
PaymentPlatform string `form:"payment_platform,optional"` // 支付方式
PaymentScene string `form:"payment_scene,optional"` // 支付平台
Amount float64 `form:"amount,optional"` // 金额
Status string `form:"status,optional"` // 支付状态pending-待支付paid-已支付refunded-已退款closed-已关闭failed-支付失败
IsPromotion int64 `form:"is_promotion,optional,default=-1"` // 是否推广订单0-否1-是
CreateTimeStart string `form:"create_time_start,optional"` // 创建时间开始
CreateTimeEnd string `form:"create_time_end,optional"` // 创建时间结束
PayTimeStart string `form:"pay_time_start,optional"` // 支付时间开始
PayTimeEnd string `form:"pay_time_end,optional"` // 支付时间结束
RefundTimeStart string `form:"refund_time_start,optional"` // 退款时间开始
RefundTimeEnd string `form:"refund_time_end,optional"` // 退款时间结束
}
// 列表响应
AdminGetOrderListResp {
Total int64 `json:"total"` // 总数
Items []OrderListItem `json:"items"` // 列表
}
// 列表项
OrderListItem {
Id int64 `json:"id"` // 订单ID
OrderNo string `json:"order_no"` // 商户订单号
PlatformOrderId string `json:"platform_order_id"` // 支付订单号
ProductName string `json:"product_name"` // 产品名称
PaymentPlatform string `json:"payment_platform"` // 支付方式
PaymentScene string `json:"payment_scene"` // 支付平台
Amount float64 `json:"amount"` // 金额
Status string `json:"status"` // 支付状态pending-待支付paid-已支付refunded-已退款closed-已关闭failed-支付失败
QueryState string `json:"query_state"` // 查询状态pending-待查询success-查询成功failed-查询失败 processing-查询中
CreateTime string `json:"create_time"` // 创建时间
PayTime string `json:"pay_time"` // 支付时间
RefundTime string `json:"refund_time"` // 退款时间
IsPromotion int64 `json:"is_promotion"` // 是否推广订单0-否1-是
}
// 详情请求
AdminGetOrderDetailReq {
Id int64 `path:"id"` // 订单ID
}
// 详情响应
AdminGetOrderDetailResp {
Id int64 `json:"id"` // 订单ID
OrderNo string `json:"order_no"` // 商户订单号
PlatformOrderId string `json:"platform_order_id"` // 支付订单号
ProductName string `json:"product_name"` // 产品名称
PaymentPlatform string `json:"payment_platform"` // 支付方式
PaymentScene string `json:"payment_scene"` // 支付平台
Amount float64 `json:"amount"` // 金额
Status string `json:"status"` // 支付状态pending-待支付paid-已支付refunded-已退款closed-已关闭failed-支付失败
QueryState string `json:"query_state"` // 查询状态pending-待查询success-查询成功failed-查询失败 processing-查询中
CreateTime string `json:"create_time"` // 创建时间
PayTime string `json:"pay_time"` // 支付时间
RefundTime string `json:"refund_time"` // 退款时间
IsPromotion int64 `json:"is_promotion"` // 是否推广订单0-否1-是
UpdateTime string `json:"update_time"` // 更新时间
}
// 创建请求
AdminCreateOrderReq {
OrderNo string `json:"order_no"` // 商户订单号
PlatformOrderId string `json:"platform_order_id"` // 支付订单号
ProductName string `json:"product_name"` // 产品名称
PaymentPlatform string `json:"payment_platform"` // 支付方式
PaymentScene string `json:"payment_scene"` // 支付平台
Amount float64 `json:"amount"` // 金额
Status string `json:"status,default=pending"` // 支付状态pending-待支付paid-已支付refunded-已退款closed-已关闭failed-支付失败
IsPromotion int64 `json:"is_promotion,default=0"` // 是否推广订单0-否1-是
}
// 创建响应
AdminCreateOrderResp {
Id int64 `json:"id"` // 订单ID
}
// 更新请求
AdminUpdateOrderReq {
Id int64 `path:"id"` // 订单ID
OrderNo *string `json:"order_no,optional"` // 商户订单号
PlatformOrderId *string `json:"platform_order_id,optional"` // 支付订单号
ProductName *string `json:"product_name,optional"` // 产品名称
PaymentPlatform *string `json:"payment_platform,optional"` // 支付方式
PaymentScene *string `json:"payment_scene,optional"` // 支付平台
Amount *float64 `json:"amount,optional"` // 金额
Status *string `json:"status,optional"` // 支付状态pending-待支付paid-已支付refunded-已退款closed-已关闭failed-支付失败
PayTime *string `json:"pay_time,optional"` // 支付时间
RefundTime *string `json:"refund_time,optional"` // 退款时间
IsPromotion *int64 `json:"is_promotion,optional"` // 是否推广订单0-否1-是
}
// 更新响应
AdminUpdateOrderResp {
Success bool `json:"success"` // 是否成功
}
// 删除请求
AdminDeleteOrderReq {
Id int64 `path:"id"` // 订单ID
}
// 删除响应
AdminDeleteOrderResp {
Success bool `json:"success"` // 是否成功
}
// 退款请求
AdminRefundOrderReq {
Id int64 `path:"id"` // 订单ID
RefundAmount float64 `json:"refund_amount"` // 退款金额
RefundReason string `json:"refund_reason"` // 退款原因
}
// 退款响应
AdminRefundOrderResp {
Status string `json:"status"` // 退款状态
RefundNo string `json:"refund_no"` // 退款单号
Amount float64 `json:"amount"` // 退款金额
}
)

View File

@@ -1,124 +0,0 @@
syntax = "v1"
info (
title: "平台用户管理"
desc: "平台用户管理"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
// 平台用户管理接口
@server(
prefix: /api/v1/admin/platform_user
group: admin_platform_user
jwt: JwtAuth
)
service main {
// 创建平台用户
@handler AdminCreatePlatformUser
post /create (AdminCreatePlatformUserReq) returns (AdminCreatePlatformUserResp)
// 更新平台用户
@handler AdminUpdatePlatformUser
put /update/:id (AdminUpdatePlatformUserReq) returns (AdminUpdatePlatformUserResp)
// 删除平台用户
@handler AdminDeletePlatformUser
delete /delete/:id (AdminDeletePlatformUserReq) returns (AdminDeletePlatformUserResp)
// 获取平台用户分页列表
@handler AdminGetPlatformUserList
get /list (AdminGetPlatformUserListReq) returns (AdminGetPlatformUserListResp)
// 获取平台用户详情
@handler AdminGetPlatformUserDetail
get /detail/:id (AdminGetPlatformUserDetailReq) returns (AdminGetPlatformUserDetailResp)
}
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-否
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"` // 排序类型
}
// 分页列表响应
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-否
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
// 详情请求
AdminGetPlatformUserDetailReq {
Id int64 `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-否
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
}
// 创建请求
AdminCreatePlatformUserReq {
Mobile string `json:"mobile"` // 手机号
Password string `json:"password"` // 密码
Nickname string `json:"nickname"` // 昵称
Info string `json:"info"` // 备注信息
Inside int64 `json:"inside"` // 是否内部用户 1-是 0-否
}
// 创建响应
AdminCreatePlatformUserResp {
Id int64 `json:"id"` // 用户ID
}
// 更新请求
AdminUpdatePlatformUserReq {
Id int64 `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-否
}
// 更新响应
AdminUpdatePlatformUserResp {
Success bool `json:"success"` // 是否成功
}
// 删除请求
AdminDeletePlatformUserReq {
Id int64 `path:"id"` // 用户ID
}
// 删除响应
AdminDeletePlatformUserResp {
Success bool `json:"success"` // 是否成功
}
)

View File

@@ -1,183 +0,0 @@
syntax = "v1"
info (
title: "推广服务"
desc: "推广服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
@server (
prefix: api/v1/admin/promotion/link
group: admin_promotion
jwt: JwtAuth
)
service main {
@doc "获取推广链接列表"
@handler GetPromotionLinkList
get /list (GetPromotionLinkListReq) returns (GetPromotionLinkListResp)
@doc "获取推广链接详情"
@handler GetPromotionLinkDetail
get /detail/:id (GetPromotionLinkDetailReq) returns (GetPromotionLinkDetailResp)
@doc "创建推广链接"
@handler CreatePromotionLink
post /create (CreatePromotionLinkReq) returns (CreatePromotionLinkResp)
@doc "更新推广链接"
@handler UpdatePromotionLink
put /update/:id (UpdatePromotionLinkReq) returns (UpdatePromotionLinkResp)
@doc "删除推广链接"
@handler DeletePromotionLink
delete /delete/:id (DeletePromotionLinkReq) returns (DeletePromotionLinkResp)
}
type (
// 列表请求
GetPromotionLinkListReq {
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"pageSize,default=20"` // 每页数量
Name string `form:"name,optional"` // 链接名称
Url string `form:"url,optional"` // 推广链接URL
}
// 列表响应
GetPromotionLinkListResp {
Total int64 `json:"total"` // 总数
Items []PromotionLinkItem `json:"items"` // 列表
}
// 列表项
PromotionLinkItem {
Id int64 `json:"id"` // 链接ID
Name string `json:"name"` // 链接名称
Url string `json:"url"` // 推广链接URL
ClickCount int64 `json:"click_count"` // 点击数
PayCount int64 `json:"pay_count"` // 付费次数
PayAmount string `json:"pay_amount"` // 付费金额
CreateTime string `json:"create_time"` // 创建时间
LastClickTime string `json:"last_click_time,optional"` // 最后点击时间
LastPayTime string `json:"last_pay_time,optional"` // 最后付费时间
}
// 详情请求
GetPromotionLinkDetailReq {
Id int64 `path:"id"` // 链接ID
}
// 详情响应
GetPromotionLinkDetailResp {
Name string `json:"name"` // 链接名称
Url string `json:"url"` // 推广链接URL
ClickCount int64 `json:"click_count"` // 点击数
PayCount int64 `json:"pay_count"` // 付费次数
PayAmount string `json:"pay_amount"` // 付费金额
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
LastClickTime string `json:"last_click_time,optional"` // 最后点击时间
LastPayTime string `json:"last_pay_time,optional"` // 最后付费时间
}
// 创建请求
CreatePromotionLinkReq {
Name string `json:"name"` // 链接名称
}
// 创建响应
CreatePromotionLinkResp {
Id int64 `json:"id"` // 链接ID
Url string `json:"url"` // 生成的推广链接URL
}
// 更新请求
UpdatePromotionLinkReq {
Id int64 `path:"id"` // 链接ID
Name *string `json:"name,optional"` // 链接名称
}
// 更新响应
UpdatePromotionLinkResp {
Success bool `json:"success"` // 是否成功
}
// 删除请求
DeletePromotionLinkReq {
Id int64 `path:"id"` // 链接ID
}
// 删除响应
DeletePromotionLinkResp {
Success bool `json:"success"` // 是否成功
}
)
@server (
prefix: api/v1/admin/promotion/link
group: admin_promotion
)
service main {
@doc "记录链接点击"
@handler RecordLinkClick
get /record/:path (RecordLinkClickReq) returns (RecordLinkClickResp)
}
type (
// 记录链接点击请求
RecordLinkClickReq {
Path string `path:"path"` // 链接路径
}
// 记录链接点击响应
RecordLinkClickResp {
Success bool `json:"success"` // 是否成功
}
)
@server (
prefix: api/v1/admin/promotion/stats
group: admin_promotion
jwt: JwtAuth
)
service main {
@doc "获取推广历史记录"
@handler GetPromotionStatsHistory
get /history (GetPromotionStatsHistoryReq) returns ([]PromotionStatsHistoryItem)
@doc "获取推广总统计"
@handler GetPromotionStatsTotal
get /total (GetPromotionStatsTotalReq) returns (GetPromotionStatsTotalResp)
}
type (
// 获取推广历史记录请求
GetPromotionStatsHistoryReq {
StartDate string `form:"start_date"` // 开始日期格式YYYY-MM-DD
EndDate string `form:"end_date"` // 结束日期格式YYYY-MM-DD
}
// 推广历史记录项
PromotionStatsHistoryItem {
Id int64 `json:"id"` // 记录ID
LinkId int64 `json:"link_id"` // 链接ID
PayAmount float64 `json:"pay_amount"` // 金额
ClickCount int64 `json:"click_count"` // 点击数
PayCount int64 `json:"pay_count"` // 付费次数
StatsDate string `json:"stats_date"` // 统计日期
}
// 获取推广总统计请求
GetPromotionStatsTotalReq {
}
// 获取推广总统计响应
GetPromotionStatsTotalResp {
TodayPayAmount float64 `json:"today_pay_amount"` // 今日金额
TodayClickCount int64 `json:"today_click_count"` // 今日点击数
TodayPayCount int64 `json:"today_pay_count"` // 今日付费次数
TotalPayAmount float64 `json:"total_pay_amount"` // 总金额
TotalClickCount int64 `json:"total_click_count"` // 总点击数
TotalPayCount int64 `json:"total_pay_count"` // 总付费次数
}
)

View File

@@ -1,124 +0,0 @@
syntax = "v1"
info (
title: "角色服务"
desc: "角色服务"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
@server (
prefix: api/v1/admin/role
group: admin_role
jwt: JwtAuth
)
service main {
@doc "获取角色列表"
@handler GetRoleList
get /list (GetRoleListReq) returns (GetRoleListResp)
@doc "获取角色详情"
@handler GetRoleDetail
get /detail/:id (GetRoleDetailReq) returns (GetRoleDetailResp)
@doc "创建角色"
@handler CreateRole
post /create (CreateRoleReq) returns (CreateRoleResp)
@doc "更新角色"
@handler UpdateRole
put /update/:id (UpdateRoleReq) returns (UpdateRoleResp)
@doc "删除角色"
@handler DeleteRole
delete /delete/:id (DeleteRoleReq) returns (DeleteRoleResp)
}
type (
// 列表请求
GetRoleListReq {
Page int64 `form:"page,default=1"` // 页码
PageSize int64 `form:"pageSize,default=20"` // 每页数量
Name string `form:"name,optional"` // 角色名称
Code string `form:"code,optional"` // 角色编码
Status int64 `form:"status,optional,default=-1"` // 状态0-禁用1-启用
}
// 列表响应
GetRoleListResp {
Total int64 `json:"total"` // 总数
Items []RoleListItem `json:"items"` // 列表
}
// 列表项
RoleListItem {
Id int64 `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列表
}
// 详情请求
GetRoleDetailReq {
Id int64 `path:"id"` // 角色ID
}
// 详情响应
GetRoleDetailResp {
Id int64 `json:"id"` // 角色ID
RoleName string `json:"role_name"` // 角色名称
RoleCode string `json:"role_code"` // 角色编码
Description string `json:"description"` // 角色描述
Status int64 `json:"status"` // 状态0-禁用1-启用
Sort int64 `json:"sort"` // 排序
CreateTime string `json:"create_time"` // 创建时间
UpdateTime string `json:"update_time"` // 更新时间
MenuIds []int64 `json:"menu_ids"` // 关联的菜单ID列表
}
// 创建请求
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列表
}
// 创建响应
CreateRoleResp {
Id int64 `json:"id"` // 角色ID
}
// 更新请求
UpdateRoleReq {
Id int64 `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列表
}
// 更新响应
UpdateRoleResp {
Success bool `json:"success"` // 是否成功
}
// 删除请求
DeleteRoleReq {
Id int64 `path:"id"` // 角色ID
}
// 删除响应
DeleteRoleResp {
Success bool `json:"success"` // 是否成功
}
)

View File

@@ -1,30 +0,0 @@
syntax = "v1"
info (
title: "单体服务中心"
desc: "单体服务中心"
author: "Liangzai"
email: "2440983361@qq.com"
version: "v1"
)
// 前台
import "./front/user.api"
import "./front/query.api"
import "./front/pay.api"
import "./front/product.api"
import "./front/agent.api"
import "./front/app.api"
// 后台
import "./admin/auth.api"
import "./admin/menu.api"
import "./admin/role.api"
import "./admin/promotion.api"
import "./admin/order.api"
import "./admin/admin_user.api"
import "./admin/platform_user.api"
import "./admin/notification.api"
import "./admin/admin_product.api"
import "./admin/admin_feature.api"
import "./admin/admin_query.api"
import "./admin/admin_agent.api"

View File

@@ -1,29 +0,0 @@
package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetAgentCommissionDeductionListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetAgentCommissionDeductionListReq
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.NewAdminGetAgentCommissionDeductionListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetAgentCommissionDeductionList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetAgentCommissionListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetAgentCommissionListReq
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.NewAdminGetAgentCommissionListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetAgentCommissionList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetAgentLinkListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetAgentLinkListReq
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.NewAdminGetAgentLinkListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetAgentLinkList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetAgentListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetAgentListReq
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.NewAdminGetAgentListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetAgentList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetAgentMembershipConfigListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetAgentMembershipConfigListReq
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.NewAdminGetAgentMembershipConfigListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetAgentMembershipConfigList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetAgentMembershipRechargeOrderListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetAgentMembershipRechargeOrderListReq
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.NewAdminGetAgentMembershipRechargeOrderListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetAgentMembershipRechargeOrderList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetAgentPlatformDeductionListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetAgentPlatformDeductionListReq
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.NewAdminGetAgentPlatformDeductionListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetAgentPlatformDeductionList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetAgentProductionConfigListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetAgentProductionConfigListReq
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.NewAdminGetAgentProductionConfigListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetAgentProductionConfigList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetAgentRewardListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetAgentRewardListReq
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.NewAdminGetAgentRewardListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetAgentRewardList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetAgentWithdrawalListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetAgentWithdrawalListReq
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.NewAdminGetAgentWithdrawalListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetAgentWithdrawalList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminUpdateAgentMembershipConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminUpdateAgentMembershipConfigReq
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.NewAdminUpdateAgentMembershipConfigLogic(r.Context(), svcCtx)
resp, err := l.AdminUpdateAgentMembershipConfig(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminUpdateAgentProductionConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminUpdateAgentProductionConfigReq
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.NewAdminUpdateAgentProductionConfigLogic(r.Context(), svcCtx)
resp, err := l.AdminUpdateAgentProductionConfig(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_auth
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_auth"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminLoginReq
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_auth.NewAdminLoginLogic(r.Context(), svcCtx)
resp, err := l.AdminLogin(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_feature
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_feature"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminCreateFeatureHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminCreateFeatureReq
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_feature.NewAdminCreateFeatureLogic(r.Context(), svcCtx)
resp, err := l.AdminCreateFeature(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_feature
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_feature"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminDeleteFeatureHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminDeleteFeatureReq
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_feature.NewAdminDeleteFeatureLogic(r.Context(), svcCtx)
resp, err := l.AdminDeleteFeature(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_feature
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_feature"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetFeatureDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetFeatureDetailReq
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_feature.NewAdminGetFeatureDetailLogic(r.Context(), svcCtx)
resp, err := l.AdminGetFeatureDetail(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_feature
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_feature"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetFeatureListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetFeatureListReq
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_feature.NewAdminGetFeatureListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetFeatureList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_feature
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_feature"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminUpdateFeatureHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminUpdateFeatureReq
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_feature.NewAdminUpdateFeatureLogic(r.Context(), svcCtx)
resp, err := l.AdminUpdateFeature(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_menu
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_menu"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func CreateMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateMenuReq
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_menu.NewCreateMenuLogic(r.Context(), svcCtx)
resp, err := l.CreateMenu(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_menu
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_menu"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func DeleteMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteMenuReq
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_menu.NewDeleteMenuLogic(r.Context(), svcCtx)
resp, err := l.DeleteMenu(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_menu
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_menu"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func GetMenuAllHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetMenuAllReq
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_menu.NewGetMenuAllLogic(r.Context(), svcCtx)
resp, err := l.GetMenuAll(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_menu
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_menu"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func GetMenuDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetMenuDetailReq
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_menu.NewGetMenuDetailLogic(r.Context(), svcCtx)
resp, err := l.GetMenuDetail(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_menu
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_menu"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func UpdateMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UpdateMenuReq
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_menu.NewUpdateMenuLogic(r.Context(), svcCtx)
resp, err := l.UpdateMenu(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_notification
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_notification"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminCreateNotificationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminCreateNotificationReq
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_notification.NewAdminCreateNotificationLogic(r.Context(), svcCtx)
resp, err := l.AdminCreateNotification(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_notification
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_notification"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminDeleteNotificationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminDeleteNotificationReq
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_notification.NewAdminDeleteNotificationLogic(r.Context(), svcCtx)
resp, err := l.AdminDeleteNotification(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_notification
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_notification"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetNotificationDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetNotificationDetailReq
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_notification.NewAdminGetNotificationDetailLogic(r.Context(), svcCtx)
resp, err := l.AdminGetNotificationDetail(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_notification
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_notification"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetNotificationListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetNotificationListReq
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_notification.NewAdminGetNotificationListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetNotificationList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_notification
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_notification"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminUpdateNotificationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminUpdateNotificationReq
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_notification.NewAdminUpdateNotificationLogic(r.Context(), svcCtx)
resp, err := l.AdminUpdateNotification(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_order
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_order"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminCreateOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminCreateOrderReq
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_order.NewAdminCreateOrderLogic(r.Context(), svcCtx)
resp, err := l.AdminCreateOrder(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_order
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_order"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminDeleteOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminDeleteOrderReq
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_order.NewAdminDeleteOrderLogic(r.Context(), svcCtx)
resp, err := l.AdminDeleteOrder(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_order
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_order"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetOrderDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetOrderDetailReq
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_order.NewAdminGetOrderDetailLogic(r.Context(), svcCtx)
resp, err := l.AdminGetOrderDetail(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_order
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_order"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetOrderListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetOrderListReq
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_order.NewAdminGetOrderListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetOrderList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_order
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_order"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminRefundOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminRefundOrderReq
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_order.NewAdminRefundOrderLogic(r.Context(), svcCtx)
resp, err := l.AdminRefundOrder(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_order
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_order"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminUpdateOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminUpdateOrderReq
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_order.NewAdminUpdateOrderLogic(r.Context(), svcCtx)
resp, err := l.AdminUpdateOrder(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_platform_user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_platform_user"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminCreatePlatformUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminCreatePlatformUserReq
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_platform_user.NewAdminCreatePlatformUserLogic(r.Context(), svcCtx)
resp, err := l.AdminCreatePlatformUser(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_platform_user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_platform_user"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminDeletePlatformUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminDeletePlatformUserReq
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_platform_user.NewAdminDeletePlatformUserLogic(r.Context(), svcCtx)
resp, err := l.AdminDeletePlatformUser(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_platform_user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_platform_user"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetPlatformUserDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetPlatformUserDetailReq
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_platform_user.NewAdminGetPlatformUserDetailLogic(r.Context(), svcCtx)
resp, err := l.AdminGetPlatformUserDetail(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_platform_user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_platform_user"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetPlatformUserListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetPlatformUserListReq
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_platform_user.NewAdminGetPlatformUserListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetPlatformUserList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_platform_user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_platform_user"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminUpdatePlatformUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminUpdatePlatformUserReq
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_platform_user.NewAdminUpdatePlatformUserLogic(r.Context(), svcCtx)
resp, err := l.AdminUpdatePlatformUser(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_product
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_product"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminCreateProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminCreateProductReq
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_product.NewAdminCreateProductLogic(r.Context(), svcCtx)
resp, err := l.AdminCreateProduct(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_product
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_product"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminDeleteProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminDeleteProductReq
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_product.NewAdminDeleteProductLogic(r.Context(), svcCtx)
resp, err := l.AdminDeleteProduct(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_product
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_product"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetProductDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetProductDetailReq
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_product.NewAdminGetProductDetailLogic(r.Context(), svcCtx)
resp, err := l.AdminGetProductDetail(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_product
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_product"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetProductFeatureListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetProductFeatureListReq
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_product.NewAdminGetProductFeatureListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetProductFeatureList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_product
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_product"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetProductListReq
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_product.NewAdminGetProductListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetProductList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_product
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_product"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminUpdateProductFeaturesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminUpdateProductFeaturesReq
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_product.NewAdminUpdateProductFeaturesLogic(r.Context(), svcCtx)
resp, err := l.AdminUpdateProductFeatures(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_product
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_product"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminUpdateProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminUpdateProductReq
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_product.NewAdminUpdateProductLogic(r.Context(), svcCtx)
resp, err := l.AdminUpdateProduct(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_promotion
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_promotion"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func CreatePromotionLinkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreatePromotionLinkReq
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_promotion.NewCreatePromotionLinkLogic(r.Context(), svcCtx)
resp, err := l.CreatePromotionLink(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,30 +0,0 @@
package admin_promotion
import (
"net/http"
"tydata-server/app/main/api/internal/logic/admin_promotion"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
"github.com/zeromicro/go-zero/rest/httpx"
)
func DeletePromotionLinkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeletePromotionLinkReq
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_promotion.NewDeletePromotionLinkLogic(r.Context(), svcCtx)
err := l.DeletePromotionLink(&req)
result.HttpResult(r, w, nil, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_promotion
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_promotion"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func GetPromotionLinkDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetPromotionLinkDetailReq
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_promotion.NewGetPromotionLinkDetailLogic(r.Context(), svcCtx)
resp, err := l.GetPromotionLinkDetail(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_promotion
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_promotion"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func GetPromotionStatsHistoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetPromotionStatsHistoryReq
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_promotion.NewGetPromotionStatsHistoryLogic(r.Context(), svcCtx)
resp, err := l.GetPromotionStatsHistory(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_promotion
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_promotion"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func GetPromotionStatsTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetPromotionStatsTotalReq
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_promotion.NewGetPromotionStatsTotalLogic(r.Context(), svcCtx)
resp, err := l.GetPromotionStatsTotal(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_promotion
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_promotion"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func RecordLinkClickHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RecordLinkClickReq
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_promotion.NewRecordLinkClickLogic(r.Context(), svcCtx)
resp, err := l.RecordLinkClick(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,30 +0,0 @@
package admin_promotion
import (
"net/http"
"tydata-server/app/main/api/internal/logic/admin_promotion"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
"github.com/zeromicro/go-zero/rest/httpx"
)
func UpdatePromotionLinkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UpdatePromotionLinkReq
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_promotion.NewUpdatePromotionLinkLogic(r.Context(), svcCtx)
err := l.UpdatePromotionLink(&req)
result.HttpResult(r, w, nil, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_query
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_query"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetQueryCleanupConfigListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetQueryCleanupConfigListReq
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.NewAdminGetQueryCleanupConfigListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetQueryCleanupConfigList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_query
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_query"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetQueryCleanupDetailListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetQueryCleanupDetailListReq
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.NewAdminGetQueryCleanupDetailListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetQueryCleanupDetailList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_query
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_query"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetQueryCleanupLogListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetQueryCleanupLogListReq
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.NewAdminGetQueryCleanupLogListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetQueryCleanupLogList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_query
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_query"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetQueryDetailByOrderIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetQueryDetailByOrderIdReq
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.NewAdminGetQueryDetailByOrderIdLogic(r.Context(), svcCtx)
resp, err := l.AdminGetQueryDetailByOrderId(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_query
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_query"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminUpdateQueryCleanupConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminUpdateQueryCleanupConfigReq
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.NewAdminUpdateQueryCleanupConfigLogic(r.Context(), svcCtx)
resp, err := l.AdminUpdateQueryCleanupConfig(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_role
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_role"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func CreateRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateRoleReq
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_role.NewCreateRoleLogic(r.Context(), svcCtx)
resp, err := l.CreateRole(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_role
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_role"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func DeleteRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteRoleReq
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_role.NewDeleteRoleLogic(r.Context(), svcCtx)
resp, err := l.DeleteRole(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_role
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_role"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func GetRoleDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetRoleDetailReq
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_role.NewGetRoleDetailLogic(r.Context(), svcCtx)
resp, err := l.GetRoleDetail(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_role
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_role"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func GetRoleListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetRoleListReq
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_role.NewGetRoleListLogic(r.Context(), svcCtx)
resp, err := l.GetRoleList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_role
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_role"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func UpdateRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UpdateRoleReq
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_role.NewUpdateRoleLogic(r.Context(), svcCtx)
resp, err := l.UpdateRole(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_user"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminCreateUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminCreateUserReq
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_user.NewAdminCreateUserLogic(r.Context(), svcCtx)
resp, err := l.AdminCreateUser(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_user"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminDeleteUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminDeleteUserReq
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_user.NewAdminDeleteUserLogic(r.Context(), svcCtx)
resp, err := l.AdminDeleteUser(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_user"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetUserDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetUserDetailReq
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_user.NewAdminGetUserDetailLogic(r.Context(), svcCtx)
resp, err := l.AdminGetUserDetail(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_user"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminGetUserListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetUserListReq
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_user.NewAdminGetUserListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetUserList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_user"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminUpdateUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminUpdateUserReq
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_user.NewAdminUpdateUserLogic(r.Context(), svcCtx)
resp, err := l.AdminUpdateUser(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,29 +0,0 @@
package admin_user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_user"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func AdminUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminUserInfoReq
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_user.NewAdminUserInfoLogic(r.Context(), svcCtx)
resp, err := l.AdminUserInfo(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,36 +0,0 @@
package agent
import (
"net/http"
"tydata-server/app/main/api/internal/logic/agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
"github.com/zeromicro/go-zero/rest/httpx"
)
func GetAgentPromotionQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetAgentPromotionQrcodeReq
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
}
// 注意:这里传入了 ResponseWriter用于直接写入图片数据
l := agent.NewGetAgentPromotionQrcodeLogic(r.Context(), svcCtx, w)
err := l.GetAgentPromotionQrcode(&req)
if err != nil {
// 如果处理过程中出错返回JSON错误响应
result.HttpResult(r, w, nil, err)
}
// 成功时图片数据已经通过logic直接写入ResponseWriter不需要额外处理
}
}

View File

@@ -1,29 +0,0 @@
package agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
)
func GetAgentWithdrawalTaxExemptionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetWithdrawalTaxExemptionReq
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.NewGetAgentWithdrawalTaxExemptionLogic(r.Context(), svcCtx)
resp, err := l.GetAgentWithdrawalTaxExemption(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,30 +0,0 @@
package query
import (
"net/http"
"tydata-server/app/main/api/internal/logic/query"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
"github.com/zeromicro/go-zero/rest/httpx"
)
func QueryGenerateShareLinkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.QueryGenerateShareLinkReq
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 := query.NewQueryGenerateShareLinkLogic(r.Context(), svcCtx)
resp, err := l.QueryGenerateShareLink(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -1,955 +0,0 @@
// Code generated by goctl. DO NOT EDIT.
package handler
import (
"net/http"
admin_agent "tydata-server/app/main/api/internal/handler/admin_agent"
admin_auth "tydata-server/app/main/api/internal/handler/admin_auth"
admin_feature "tydata-server/app/main/api/internal/handler/admin_feature"
admin_menu "tydata-server/app/main/api/internal/handler/admin_menu"
admin_notification "tydata-server/app/main/api/internal/handler/admin_notification"
admin_order "tydata-server/app/main/api/internal/handler/admin_order"
admin_platform_user "tydata-server/app/main/api/internal/handler/admin_platform_user"
admin_product "tydata-server/app/main/api/internal/handler/admin_product"
admin_promotion "tydata-server/app/main/api/internal/handler/admin_promotion"
admin_query "tydata-server/app/main/api/internal/handler/admin_query"
admin_role "tydata-server/app/main/api/internal/handler/admin_role"
admin_user "tydata-server/app/main/api/internal/handler/admin_user"
agent "tydata-server/app/main/api/internal/handler/agent"
app "tydata-server/app/main/api/internal/handler/app"
auth "tydata-server/app/main/api/internal/handler/auth"
notification "tydata-server/app/main/api/internal/handler/notification"
pay "tydata-server/app/main/api/internal/handler/pay"
product "tydata-server/app/main/api/internal/handler/product"
query "tydata-server/app/main/api/internal/handler/query"
user "tydata-server/app/main/api/internal/handler/user"
"tydata-server/app/main/api/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/agent-commission-deduction/list",
Handler: admin_agent.AdminGetAgentCommissionDeductionListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-commission/list",
Handler: admin_agent.AdminGetAgentCommissionListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-link/list",
Handler: admin_agent.AdminGetAgentLinkListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-membership-config/list",
Handler: admin_agent.AdminGetAgentMembershipConfigListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/agent-membership-config/update",
Handler: admin_agent.AdminUpdateAgentMembershipConfigHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-membership-recharge-order/list",
Handler: admin_agent.AdminGetAgentMembershipRechargeOrderListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-platform-deduction/list",
Handler: admin_agent.AdminGetAgentPlatformDeductionListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-production-config/list",
Handler: admin_agent.AdminGetAgentProductionConfigListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/agent-production-config/update",
Handler: admin_agent.AdminUpdateAgentProductionConfigHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-reward/list",
Handler: admin_agent.AdminGetAgentRewardListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/agent-withdrawal/list",
Handler: admin_agent.AdminGetAgentWithdrawalListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/list",
Handler: admin_agent.AdminGetAgentListHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/admin/agent"),
)
server.AddRoutes(
[]rest.Route{
{
// 登录
Method: http.MethodPost,
Path: "/login",
Handler: admin_auth.AdminLoginHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/admin/auth"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/create",
Handler: admin_feature.AdminCreateFeatureHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_feature.AdminDeleteFeatureHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_feature.AdminGetFeatureDetailHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/list",
Handler: admin_feature.AdminGetFeatureListHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_feature.AdminUpdateFeatureHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/admin/feature"),
)
server.AddRoutes(
[]rest.Route{
{
// 获取所有菜单(树形结构)
Method: http.MethodGet,
Path: "/all",
Handler: admin_menu.GetMenuAllHandler(serverCtx),
},
{
// 创建菜单
Method: http.MethodPost,
Path: "/create",
Handler: admin_menu.CreateMenuHandler(serverCtx),
},
{
// 删除菜单
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_menu.DeleteMenuHandler(serverCtx),
},
{
// 获取菜单详情
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_menu.GetMenuDetailHandler(serverCtx),
},
{
// 获取菜单列表
Method: http.MethodGet,
Path: "/list",
Handler: admin_menu.GetMenuListHandler(serverCtx),
},
{
// 更新菜单
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_menu.UpdateMenuHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/menu"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/create",
Handler: admin_notification.AdminCreateNotificationHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_notification.AdminDeleteNotificationHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_notification.AdminGetNotificationDetailHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/list",
Handler: admin_notification.AdminGetNotificationListHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_notification.AdminUpdateNotificationHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/admin/notification"),
)
server.AddRoutes(
[]rest.Route{
{
// 创建订单
Method: http.MethodPost,
Path: "/create",
Handler: admin_order.AdminCreateOrderHandler(serverCtx),
},
{
// 删除订单
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_order.AdminDeleteOrderHandler(serverCtx),
},
{
// 获取订单详情
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_order.AdminGetOrderDetailHandler(serverCtx),
},
{
// 获取订单列表
Method: http.MethodGet,
Path: "/list",
Handler: admin_order.AdminGetOrderListHandler(serverCtx),
},
{
// 订单退款
Method: http.MethodPost,
Path: "/refund/:id",
Handler: admin_order.AdminRefundOrderHandler(serverCtx),
},
{
// 更新订单
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_order.AdminUpdateOrderHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/order"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/create",
Handler: admin_platform_user.AdminCreatePlatformUserHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_platform_user.AdminDeletePlatformUserHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_platform_user.AdminGetPlatformUserDetailHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/list",
Handler: admin_platform_user.AdminGetPlatformUserListHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_platform_user.AdminUpdatePlatformUserHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/platform_user"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/create",
Handler: admin_product.AdminCreateProductHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_product.AdminDeleteProductHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_product.AdminGetProductDetailHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/feature/list/:product_id",
Handler: admin_product.AdminGetProductFeatureListHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/feature/update/:product_id",
Handler: admin_product.AdminUpdateProductFeaturesHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/list",
Handler: admin_product.AdminGetProductListHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_product.AdminUpdateProductHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/admin/product"),
)
server.AddRoutes(
[]rest.Route{
{
// 创建推广链接
Method: http.MethodPost,
Path: "/create",
Handler: admin_promotion.CreatePromotionLinkHandler(serverCtx),
},
{
// 删除推广链接
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_promotion.DeletePromotionLinkHandler(serverCtx),
},
{
// 获取推广链接详情
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_promotion.GetPromotionLinkDetailHandler(serverCtx),
},
{
// 获取推广链接列表
Method: http.MethodGet,
Path: "/list",
Handler: admin_promotion.GetPromotionLinkListHandler(serverCtx),
},
{
// 更新推广链接
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_promotion.UpdatePromotionLinkHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/promotion/link"),
)
server.AddRoutes(
[]rest.Route{
{
// 记录链接点击
Method: http.MethodGet,
Path: "/record/:path",
Handler: admin_promotion.RecordLinkClickHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/admin/promotion/link"),
)
server.AddRoutes(
[]rest.Route{
{
// 获取推广历史记录
Method: http.MethodGet,
Path: "/history",
Handler: admin_promotion.GetPromotionStatsHistoryHandler(serverCtx),
},
{
// 获取推广总统计
Method: http.MethodGet,
Path: "/total",
Handler: admin_promotion.GetPromotionStatsTotalHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/promotion/stats"),
)
server.AddRoutes(
[]rest.Route{
{
// 更新清理配置
Method: http.MethodPut,
Path: "/cleanup/config",
Handler: admin_query.AdminUpdateQueryCleanupConfigHandler(serverCtx),
},
{
// 获取清理配置列表
Method: http.MethodGet,
Path: "/cleanup/configs",
Handler: admin_query.AdminGetQueryCleanupConfigListHandler(serverCtx),
},
{
// 获取清理详情列表
Method: http.MethodGet,
Path: "/cleanup/details/:log_id",
Handler: admin_query.AdminGetQueryCleanupDetailListHandler(serverCtx),
},
{
// 获取清理日志列表
Method: http.MethodGet,
Path: "/cleanup/logs",
Handler: admin_query.AdminGetQueryCleanupLogListHandler(serverCtx),
},
{
// 获取查询详情
Method: http.MethodGet,
Path: "/detail/:order_id",
Handler: admin_query.AdminGetQueryDetailByOrderIdHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/query"),
)
server.AddRoutes(
[]rest.Route{
{
// 创建角色
Method: http.MethodPost,
Path: "/create",
Handler: admin_role.CreateRoleHandler(serverCtx),
},
{
// 删除角色
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_role.DeleteRoleHandler(serverCtx),
},
{
// 获取角色详情
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_role.GetRoleDetailHandler(serverCtx),
},
{
// 获取角色列表
Method: http.MethodGet,
Path: "/list",
Handler: admin_role.GetRoleListHandler(serverCtx),
},
{
// 更新角色
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_role.UpdateRoleHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/role"),
)
server.AddRoutes(
[]rest.Route{
{
// 创建用户
Method: http.MethodPost,
Path: "/create",
Handler: admin_user.AdminCreateUserHandler(serverCtx),
},
{
// 删除用户
Method: http.MethodDelete,
Path: "/delete/:id",
Handler: admin_user.AdminDeleteUserHandler(serverCtx),
},
{
// 获取用户详情
Method: http.MethodGet,
Path: "/detail/:id",
Handler: admin_user.AdminGetUserDetailHandler(serverCtx),
},
{
// 用户信息
Method: http.MethodGet,
Path: "/info",
Handler: admin_user.AdminUserInfoHandler(serverCtx),
},
{
// 获取用户列表
Method: http.MethodGet,
Path: "/list",
Handler: admin_user.AdminGetUserListHandler(serverCtx),
},
{
// 更新用户
Method: http.MethodPut,
Path: "/update/:id",
Handler: admin_user.AdminUpdateUserHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/admin/user"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/promotion/qrcode",
Handler: agent.GetAgentPromotionQrcodeHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/agent"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/info",
Handler: agent.GetAgentInfoHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/revenue",
Handler: agent.GetAgentRevenueInfoHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/agent"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.UserAuthInterceptor},
[]rest.Route{
{
Method: http.MethodGet,
Path: "/audit/status",
Handler: agent.GetAgentAuditStatusHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/generating_link",
Handler: agent.GeneratingLinkHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/product_config",
Handler: agent.GetAgentProductConfigHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/real_name",
Handler: agent.AgentRealNameHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/subordinate/contribution/detail",
Handler: agent.GetAgentSubordinateContributionDetailHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/subordinate/list",
Handler: agent.GetAgentSubordinateListHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/agent"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.UserAuthInterceptor},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/membership/save_user_config",
Handler: agent.SaveAgentMembershipUserConfigHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/membership/user_config",
Handler: agent.GetAgentMembershipProductConfigHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/agent"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.UserAuthInterceptor},
[]rest.Route{
{
Method: http.MethodGet,
Path: "/commission",
Handler: agent.GetAgentCommissionHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/membership/activate",
Handler: agent.ActivateAgentMembershipHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/rewards",
Handler: agent.GetAgentRewardsHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/withdrawal",
Handler: agent.GetAgentWithdrawalHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/withdrawal",
Handler: agent.AgentWithdrawalHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/withdrawal/tax/exemption",
Handler: agent.GetAgentWithdrawalTaxExemptionHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
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.MethodGet,
Path: "/link",
Handler: agent.GetLinkDataHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/v1/agent"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/app/version",
Handler: app.GetAppVersionHandler(serverCtx),
},
{
// 心跳检测接口
Method: http.MethodGet,
Path: "/health/check",
Handler: app.HealthCheckHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
// get mobile verify code
Method: http.MethodPost,
Path: "/auth/sendSms",
Handler: auth.SendSmsHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
// get notifications
Method: http.MethodGet,
Path: "/notification/list",
Handler: notification.GetNotificationsHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/pay/alipay/callback",
Handler: pay.AlipayCallbackHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/pay/wechat/callback",
Handler: pay.WechatPayCallbackHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/pay/wechat/refund_callback",
Handler: pay.WechatPayRefundCallbackHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.UserAuthInterceptor},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/pay/check",
Handler: pay.PaymentCheckHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/pay/iap_callback",
Handler: pay.IapCallbackHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/pay/payment",
Handler: pay.PaymentHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.UserAuthInterceptor},
[]rest.Route{
{
Method: http.MethodGet,
Path: "/:id",
Handler: product.GetProductByIDHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/en/:product_en",
Handler: product.GetProductByEnHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/product"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/app_en/:product_en",
Handler: product.GetProductAppByEnHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/product"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthInterceptor},
[]rest.Route{
{
// query service agent
Method: http.MethodPost,
Path: "/query/service_agent/:product",
Handler: query.QueryServiceAgentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/query/service_app/:product",
Handler: query.QueryServiceAppHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.UserAuthInterceptor},
[]rest.Route{
{
// query service
Method: http.MethodPost,
Path: "/query/service/:product",
Handler: query.QueryServiceHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.UserAuthInterceptor},
[]rest.Route{
{
// 生成分享链接
Method: http.MethodPost,
Path: "/query/generate_share_link",
Handler: query.QueryGenerateShareLinkHandler(serverCtx),
},
{
// 查询列表
Method: http.MethodGet,
Path: "/query/list",
Handler: query.QueryListHandler(serverCtx),
},
{
// 查询详情 按订单号 付款查询时
Method: http.MethodGet,
Path: "/query/orderId/:order_id",
Handler: query.QueryDetailByOrderIdHandler(serverCtx),
},
{
// 查询详情 按订单号
Method: http.MethodGet,
Path: "/query/orderNo/:order_no",
Handler: query.QueryDetailByOrderNoHandler(serverCtx),
},
{
// 获取查询临时订单
Method: http.MethodGet,
Path: "/query/provisional_order/:id",
Handler: query.QueryProvisionalOrderHandler(serverCtx),
},
{
// 重试查询
Method: http.MethodPost,
Path: "/query/retry/:id",
Handler: query.QueryRetryHandler(serverCtx),
},
{
// 更新查询数据
Method: http.MethodPost,
Path: "/query/update_data",
Handler: query.UpdateQueryDataHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
// 查询示例
Method: http.MethodGet,
Path: "/query/example",
Handler: query.QueryExampleHandler(serverCtx),
},
{
// 查询详情
Method: http.MethodGet,
Path: "/query/share/:id",
Handler: query.QueryShareDetailHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/query/single/test",
Handler: query.QuerySingleTestHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
// mobile code login
Method: http.MethodPost,
Path: "/user/mobileCodeLogin",
Handler: user.MobileCodeLoginHandler(serverCtx),
},
{
// wechat mini auth
Method: http.MethodPost,
Path: "/user/wxMiniAuth",
Handler: user.WxMiniAuthHandler(serverCtx),
},
{
// wechat h5 auth
Method: http.MethodPost,
Path: "/user/wxh5Auth",
Handler: user.WxH5AuthHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AuthInterceptor},
[]rest.Route{
{
// 绑定手机号
Method: http.MethodPost,
Path: "/user/bindMobile",
Handler: user.BindMobileHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/user/cancelOut",
Handler: user.CancelOutHandler(serverCtx),
},
{
// get user info
Method: http.MethodGet,
Path: "/user/detail",
Handler: user.DetailHandler(serverCtx),
},
{
// get new token
Method: http.MethodPost,
Path: "/user/getToken",
Handler: user.GetTokenHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1"),
)
}

View File

@@ -1,84 +0,0 @@
package admin_agent
import (
"context"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"github.com/Masterminds/squirrel"
"github.com/jinzhu/copier"
"github.com/zeromicro/go-zero/core/logx"
)
type AdminGetAgentCommissionDeductionListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAdminGetAgentCommissionDeductionListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetAgentCommissionDeductionListLogic {
return &AdminGetAgentCommissionDeductionListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *AdminGetAgentCommissionDeductionListLogic) AdminGetAgentCommissionDeductionList(req *types.AdminGetAgentCommissionDeductionListReq) (resp *types.AdminGetAgentCommissionDeductionListResp, err error) {
builder := l.svcCtx.AgentCommissionDeductionModel.SelectBuilder()
if req.AgentId != nil {
builder = builder.Where(squirrel.Eq{"agent_id": *req.AgentId})
}
if req.Type != nil && *req.Type != "" {
builder = builder.Where(squirrel.Eq{"type": *req.Type})
}
if req.Status != nil {
builder = builder.Where(squirrel.Eq{"status": *req.Status})
}
// 产品名筛选需先查product_id
if req.ProductName != nil && *req.ProductName != "" {
products, err := l.svcCtx.ProductModel.FindAll(l.ctx, l.svcCtx.ProductModel.SelectBuilder().Where(squirrel.Eq{"product_name": *req.ProductName}), "")
if err != nil || len(products) == 0 {
return &types.AdminGetAgentCommissionDeductionListResp{Total: 0, Items: []types.AgentCommissionDeductionListItem{}}, nil
}
builder = builder.Where("product_id = ?", products[0].Id)
}
list, total, err := l.svcCtx.AgentCommissionDeductionModel.FindPageListByPageWithTotal(l.ctx, builder, req.Page, req.PageSize, "create_time DESC")
if err != nil {
return nil, err
}
// 批量查product_id->name
productIds := make(map[int64]struct{})
for _, v := range list {
productIds[v.ProductId] = struct{}{}
}
productIdArr := make([]int64, 0, len(productIds))
for id := range productIds {
productIdArr = append(productIdArr, id)
}
productNameMap := make(map[int64]string)
if len(productIdArr) > 0 {
build := l.svcCtx.ProductModel.SelectBuilder().Where(squirrel.Eq{"id": productIdArr})
products, _ := l.svcCtx.ProductModel.FindAll(l.ctx, build, "")
for _, p := range products {
productNameMap[p.Id] = p.ProductName
}
}
items := make([]types.AgentCommissionDeductionListItem, 0, len(list))
for _, v := range list {
item := types.AgentCommissionDeductionListItem{}
_ = copier.Copy(&item, v)
item.ProductName = productNameMap[v.ProductId]
item.CreateTime = v.CreateTime.Format("2006-01-02 15:04:05")
items = append(items, item)
}
resp = &types.AdminGetAgentCommissionDeductionListResp{
Total: total,
Items: items,
}
return
}

View File

@@ -1,84 +0,0 @@
package admin_agent
import (
"context"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"github.com/Masterminds/squirrel"
"github.com/jinzhu/copier"
"github.com/zeromicro/go-zero/core/logx"
)
type AdminGetAgentCommissionListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAdminGetAgentCommissionListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetAgentCommissionListLogic {
return &AdminGetAgentCommissionListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *AdminGetAgentCommissionListLogic) AdminGetAgentCommissionList(req *types.AdminGetAgentCommissionListReq) (resp *types.AdminGetAgentCommissionListResp, err error) {
builder := l.svcCtx.AgentCommissionModel.SelectBuilder()
if req.AgentId != nil {
builder = builder.Where(squirrel.Eq{"agent_id": *req.AgentId})
}
if req.Status != nil {
builder = builder.Where(squirrel.Eq{"status": *req.Status})
}
// 先查出所有product_id对应的product_name如有product_name筛选需反查id
var productIdFilter int64
if req.ProductName != nil && *req.ProductName != "" {
// 只支持精确匹配,如需模糊可扩展
products, err := l.svcCtx.ProductModel.FindAll(l.ctx, l.svcCtx.ProductModel.SelectBuilder().Where(squirrel.Eq{"product_name": *req.ProductName}), "")
if err != nil || len(products) == 0 {
return &types.AdminGetAgentCommissionListResp{Total: 0, Items: []types.AgentCommissionListItem{}}, nil
}
productIdFilter = products[0].Id
builder = builder.Where("product_id = ?", productIdFilter)
}
list, total, err := l.svcCtx.AgentCommissionModel.FindPageListByPageWithTotal(l.ctx, builder, req.Page, req.PageSize, "create_time DESC")
if err != nil {
return nil, err
}
// 批量查product_name
productIds := make(map[int64]struct{})
for _, v := range list {
productIds[v.ProductId] = struct{}{}
}
productNameMap := make(map[int64]string)
if len(productIds) > 0 {
ids := make([]int64, 0, len(productIds))
for id := range productIds {
ids = append(ids, id)
}
builder := l.svcCtx.ProductModel.SelectBuilder().Where(squirrel.Eq{"id": ids})
products, _ := l.svcCtx.ProductModel.FindAll(l.ctx, builder, "")
for _, p := range products {
productNameMap[p.Id] = p.ProductName
}
}
items := make([]types.AgentCommissionListItem, 0, len(list))
for _, v := range list {
item := types.AgentCommissionListItem{}
_ = copier.Copy(&item, v)
item.ProductName = productNameMap[v.ProductId]
item.CreateTime = v.CreateTime.Format("2006-01-02 15:04:05")
items = append(items, item)
}
resp = &types.AdminGetAgentCommissionListResp{
Total: total,
Items: items,
}
return
}

View File

@@ -1,86 +0,0 @@
package admin_agent
import (
"context"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"github.com/Masterminds/squirrel"
"github.com/zeromicro/go-zero/core/logx"
)
type AdminGetAgentLinkListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAdminGetAgentLinkListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetAgentLinkListLogic {
return &AdminGetAgentLinkListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *AdminGetAgentLinkListLogic) AdminGetAgentLinkList(req *types.AdminGetAgentLinkListReq) (resp *types.AdminGetAgentLinkListResp, err error) {
builder := l.svcCtx.AgentLinkModel.SelectBuilder()
if req.AgentId != nil {
builder = builder.Where("agent_id = ?", *req.AgentId)
}
if req.LinkIdentifier != nil && *req.LinkIdentifier != "" {
builder = builder.Where("link_identifier = ?", *req.LinkIdentifier)
}
// 先查出所有product_id对应的product_name如有product_name筛选需反查id
var productIdFilter int64
if req.ProductName != nil && *req.ProductName != "" {
// 只支持精确匹配,如需模糊可扩展
products, err := l.svcCtx.ProductModel.FindAll(l.ctx, l.svcCtx.ProductModel.SelectBuilder().Where(squirrel.Eq{"product_name": *req.ProductName}), "")
if err != nil || len(products) == 0 {
return &types.AdminGetAgentLinkListResp{Total: 0, Items: []types.AgentLinkListItem{}}, nil
}
productIdFilter = products[0].Id
builder = builder.Where("product_id = ?", productIdFilter)
}
links, total, err := l.svcCtx.AgentLinkModel.FindPageListByPageWithTotal(l.ctx, builder, req.Page, req.PageSize, "id DESC")
if err != nil {
return nil, err
}
// 批量查product_id->name避免N+1
productIdSet := make(map[int64]struct{})
for _, link := range links {
productIdSet[link.ProductId] = struct{}{}
}
productIdList := make([]int64, 0, len(productIdSet))
for id := range productIdSet {
productIdList = append(productIdList, id)
}
productNameMap := make(map[int64]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 {
productNameMap[p.Id] = p.ProductName
}
}
items := make([]types.AgentLinkListItem, 0, len(links))
for _, link := range links {
items = append(items, types.AgentLinkListItem{
AgentId: link.AgentId,
ProductName: productNameMap[link.ProductId],
Price: link.Price,
LinkIdentifier: link.LinkIdentifier,
CreateTime: link.CreateTime.Format("2006-01-02 15:04:05"),
})
}
resp = &types.AdminGetAgentLinkListResp{
Total: total,
Items: items,
}
return
}

View File

@@ -1,115 +0,0 @@
package admin_agent
import (
"context"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/app/main/model"
"tydata-server/common/xerr"
"tydata-server/pkg/lzkit/crypto"
"github.com/pkg/errors"
"github.com/zeromicro/go-zero/core/logx"
)
type AdminGetAgentListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAdminGetAgentListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetAgentListLogic {
return &AdminGetAgentListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *AdminGetAgentListLogic) AdminGetAgentList(req *types.AdminGetAgentListReq) (resp *types.AdminGetAgentListResp, err error) {
builder := l.svcCtx.AgentModel.SelectBuilder()
if req.Mobile != nil && *req.Mobile != "" {
builder = builder.Where("mobile = ?", *req.Mobile)
}
if req.Region != nil && *req.Region != "" {
builder = builder.Where("region = ?", *req.Region)
}
// 新增如果传入ParentAgentId则查找其所有1级下级代理
if req.ParentAgentId != nil {
closureBuilder := l.svcCtx.AgentClosureModel.SelectBuilder().Where("ancestor_id = ? AND depth = 1", *req.ParentAgentId)
closures, cerr := l.svcCtx.AgentClosureModel.FindAll(l.ctx, closureBuilder, "")
if cerr != nil {
return nil, cerr
}
if len(closures) == 0 {
resp = &types.AdminGetAgentListResp{Total: 0, Items: []types.AgentListItem{}}
return resp, nil
}
ids := make([]int64, 0, len(closures))
for _, c := range closures {
ids = append(ids, c.DescendantId)
}
builder = builder.Where("id IN (?)", ids)
}
agents, total, err := l.svcCtx.AgentModel.FindPageListByPageWithTotal(l.ctx, builder, req.Page, req.PageSize, "id DESC")
if err != nil {
return nil, err
}
items := make([]types.AgentListItem, 0, len(agents))
for _, agent := range agents {
item := types.AgentListItem{
Id: agent.Id,
UserId: agent.UserId,
LevelName: agent.LevelName,
Region: agent.Region,
CreateTime: agent.CreateTime.Format("2006-01-02 15:04:05"),
}
if req.ParentAgentId != nil {
item.ParentAgentId = *req.ParentAgentId
}
agent.Mobile, err = crypto.DecryptMobile(agent.Mobile, l.svcCtx.Config.Encrypt.SecretKey)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "获取代理信息, 解密手机号失败: %v", err)
}
item.Mobile = agent.Mobile
if agent.MembershipExpiryTime.Valid {
item.MembershipExpiryTime = agent.MembershipExpiryTime.Time.Format("2006-01-02 15:04:05")
}
// 查询钱包信息
wallet, _ := l.svcCtx.AgentWalletModel.FindOneByAgentId(l.ctx, agent.Id)
if wallet != nil {
item.Balance = wallet.Balance
item.TotalEarnings = wallet.TotalEarnings
item.FrozenBalance = wallet.FrozenBalance
item.WithdrawnAmount = wallet.WithdrawnAmount
}
// 查询实名认证信息
realNameInfo, _ := l.svcCtx.AgentRealNameModel.FindOneByAgentId(l.ctx, agent.Id)
if realNameInfo != nil {
item.IsRealNameVerified = realNameInfo.Status == model.AgentRealNameStatusApproved
item.RealName = realNameInfo.Name
item.IdCard = realNameInfo.IdCard
item.RealNameStatus = realNameInfo.Status
} else {
item.IsRealNameVerified = false
item.RealName = ""
item.IdCard = ""
item.RealNameStatus = ""
}
items = append(items, item)
}
resp = &types.AdminGetAgentListResp{
Total: total,
Items: items,
}
return
}

View File

@@ -1,51 +0,0 @@
package admin_agent
import (
"context"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"github.com/Masterminds/squirrel"
"github.com/jinzhu/copier"
"github.com/zeromicro/go-zero/core/logx"
)
type AdminGetAgentMembershipConfigListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAdminGetAgentMembershipConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetAgentMembershipConfigListLogic {
return &AdminGetAgentMembershipConfigListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *AdminGetAgentMembershipConfigListLogic) AdminGetAgentMembershipConfigList(req *types.AdminGetAgentMembershipConfigListReq) (resp *types.AdminGetAgentMembershipConfigListResp, err error) {
builder := l.svcCtx.AgentMembershipConfigModel.SelectBuilder()
if req.LevelName != nil && *req.LevelName != "" {
builder = builder.Where(squirrel.Eq{"level_name": *req.LevelName})
}
list, total, err := l.svcCtx.AgentMembershipConfigModel.FindPageListByPageWithTotal(l.ctx, builder, req.Page, req.PageSize, "id DESC")
if err != nil {
return nil, err
}
items := make([]types.AgentMembershipConfigListItem, 0, len(list))
for _, v := range list {
var item types.AgentMembershipConfigListItem
if err := copier.Copy(&item, v); err != nil {
l.Logger.Errorf("copy error: %v", err)
continue
}
item.CreateTime = v.CreateTime.Format("2006-01-02 15:04:05")
items = append(items, item)
}
resp = &types.AdminGetAgentMembershipConfigListResp{
Total: total,
Items: items,
}
return
}

View File

@@ -1,64 +0,0 @@
package admin_agent
import (
"context"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"github.com/Masterminds/squirrel"
"github.com/jinzhu/copier"
"github.com/zeromicro/go-zero/core/logx"
)
type AdminGetAgentMembershipRechargeOrderListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAdminGetAgentMembershipRechargeOrderListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetAgentMembershipRechargeOrderListLogic {
return &AdminGetAgentMembershipRechargeOrderListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *AdminGetAgentMembershipRechargeOrderListLogic) AdminGetAgentMembershipRechargeOrderList(req *types.AdminGetAgentMembershipRechargeOrderListReq) (resp *types.AdminGetAgentMembershipRechargeOrderListResp, err error) {
builder := l.svcCtx.AgentMembershipRechargeOrderModel.SelectBuilder()
if req.UserId != nil {
builder = builder.Where(squirrel.Eq{"user_id": *req.UserId})
}
if req.AgentId != nil {
builder = builder.Where(squirrel.Eq{"agent_id": *req.AgentId})
}
if req.OrderNo != nil && *req.OrderNo != "" {
builder = builder.Where(squirrel.Eq{"order_no": *req.OrderNo})
}
if req.PlatformOrderId != nil && *req.PlatformOrderId != "" {
builder = builder.Where(squirrel.Eq{"platform_order_id": *req.PlatformOrderId})
}
if req.Status != nil && *req.Status != "" {
builder = builder.Where(squirrel.Eq{"status": *req.Status})
}
if req.PaymentMethod != nil && *req.PaymentMethod != "" {
builder = builder.Where(squirrel.Eq{"payment_method": *req.PaymentMethod})
}
list, total, err := l.svcCtx.AgentMembershipRechargeOrderModel.FindPageListByPageWithTotal(l.ctx, builder, req.Page, req.PageSize, "create_time DESC")
if err != nil {
return nil, err
}
items := make([]types.AgentMembershipRechargeOrderListItem, 0, len(list))
for _, v := range list {
item := types.AgentMembershipRechargeOrderListItem{}
_ = copier.Copy(&item, v)
item.CreateTime = v.CreateTime.Format("2006-01-02 15:04:05")
items = append(items, item)
}
resp = &types.AdminGetAgentMembershipRechargeOrderListResp{
Total: total,
Items: items,
}
return
}

View File

@@ -1,57 +0,0 @@
package admin_agent
import (
"context"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"github.com/Masterminds/squirrel"
"github.com/jinzhu/copier"
"github.com/zeromicro/go-zero/core/logx"
)
type AdminGetAgentPlatformDeductionListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAdminGetAgentPlatformDeductionListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetAgentPlatformDeductionListLogic {
return &AdminGetAgentPlatformDeductionListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *AdminGetAgentPlatformDeductionListLogic) AdminGetAgentPlatformDeductionList(req *types.AdminGetAgentPlatformDeductionListReq) (resp *types.AdminGetAgentPlatformDeductionListResp, err error) {
builder := l.svcCtx.AgentPlatformDeductionModel.SelectBuilder()
if req.AgentId != nil {
builder = builder.Where(squirrel.Eq{"agent_id": *req.AgentId})
}
if req.Type != nil && *req.Type != "" {
builder = builder.Where(squirrel.Eq{"type": *req.Type})
}
if req.Status != nil {
builder = builder.Where(squirrel.Eq{"status": *req.Status})
}
list, total, err := l.svcCtx.AgentPlatformDeductionModel.FindPageListByPageWithTotal(l.ctx, builder, req.Page, req.PageSize, "create_time DESC")
if err != nil {
return nil, err
}
items := make([]types.AgentPlatformDeductionListItem, 0, len(list))
for _, v := range list {
item := types.AgentPlatformDeductionListItem{}
_ = copier.Copy(&item, v)
item.CreateTime = v.CreateTime.Format("2006-01-02 15:04:05")
items = append(items, item)
}
resp = &types.AdminGetAgentPlatformDeductionListResp{
Total: total,
Items: items,
}
return
}

View File

@@ -1,74 +0,0 @@
package admin_agent
import (
"context"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"github.com/Masterminds/squirrel"
"github.com/jinzhu/copier"
"github.com/zeromicro/go-zero/core/logx"
)
type AdminGetAgentProductionConfigListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAdminGetAgentProductionConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetAgentProductionConfigListLogic {
return &AdminGetAgentProductionConfigListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *AdminGetAgentProductionConfigListLogic) AdminGetAgentProductionConfigList(req *types.AdminGetAgentProductionConfigListReq) (resp *types.AdminGetAgentProductionConfigListResp, err error) {
builder := l.svcCtx.AgentProductConfigModel.SelectBuilder()
if req.ProductName != nil && *req.ProductName != "" {
products, err := l.svcCtx.ProductModel.FindAll(l.ctx, l.svcCtx.ProductModel.SelectBuilder().Where(squirrel.Eq{"product_name": *req.ProductName}), "")
if err != nil || len(products) == 0 {
return &types.AdminGetAgentProductionConfigListResp{Total: 0, Items: []types.AgentProductionConfigItem{}}, nil
}
builder = builder.Where(squirrel.Eq{"product_id": products[0].Id})
}
if req.Id != nil {
builder = builder.Where(squirrel.Eq{"id": *req.Id})
}
list, total, err := l.svcCtx.AgentProductConfigModel.FindPageListByPageWithTotal(l.ctx, builder, req.Page, req.PageSize, "create_time DESC")
if err != nil {
return nil, err
}
// 查询所有涉及到的product_id对应的product_name
productIdSet := make(map[int64]struct{})
for _, v := range list {
productIdSet[v.ProductId] = struct{}{}
}
productIdArr := make([]int64, 0, len(productIdSet))
for id := range productIdSet {
productIdArr = append(productIdArr, id)
}
productNameMap := make(map[int64]string)
if len(productIdArr) > 0 {
build := l.svcCtx.ProductModel.SelectBuilder().Where(squirrel.Eq{"id": productIdArr})
products, _ := l.svcCtx.ProductModel.FindAll(l.ctx, build, "")
for _, p := range products {
productNameMap[p.Id] = p.ProductName
}
}
items := make([]types.AgentProductionConfigItem, 0, len(list))
for _, v := range list {
item := types.AgentProductionConfigItem{}
_ = copier.Copy(&item, v)
item.ProductName = productNameMap[v.ProductId]
item.CreateTime = v.CreateTime.Format("2006-01-02 15:04:05")
items = append(items, item)
}
resp = &types.AdminGetAgentProductionConfigListResp{
Total: total,
Items: items,
}
return
}

View File

@@ -1,58 +0,0 @@
package admin_agent
import (
"context"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"github.com/Masterminds/squirrel"
"github.com/jinzhu/copier"
"github.com/zeromicro/go-zero/core/logx"
)
type AdminGetAgentRewardListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAdminGetAgentRewardListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetAgentRewardListLogic {
return &AdminGetAgentRewardListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *AdminGetAgentRewardListLogic) AdminGetAgentRewardList(req *types.AdminGetAgentRewardListReq) (resp *types.AdminGetAgentRewardListResp, err error) {
builder := l.svcCtx.AgentRewardsModel.SelectBuilder()
if req.AgentId != nil {
builder = builder.Where(squirrel.Eq{"agent_id": *req.AgentId})
}
if req.RelationAgentId != nil {
builder = builder.Where(squirrel.Eq{"relation_agent_id": *req.RelationAgentId})
}
if req.Type != nil && *req.Type != "" {
builder = builder.Where(squirrel.Eq{"type": *req.Type})
}
list, total, err := l.svcCtx.AgentRewardsModel.FindPageListByPageWithTotal(l.ctx, builder, req.Page, req.PageSize, "create_time DESC")
if err != nil {
return nil, err
}
items := make([]types.AgentRewardListItem, 0, len(list))
for _, v := range list {
item := types.AgentRewardListItem{}
_ = copier.Copy(&item, v)
item.CreateTime = v.CreateTime.Format("2006-01-02 15:04:05")
if v.RelationAgentId.Valid {
item.RelationAgentId = v.RelationAgentId.Int64
}
items = append(items, item)
}
resp = &types.AdminGetAgentRewardListResp{
Total: total,
Items: items,
}
return
}

View File

@@ -1,59 +0,0 @@
package admin_agent
import (
"context"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"github.com/Masterminds/squirrel"
"github.com/jinzhu/copier"
"github.com/zeromicro/go-zero/core/logx"
)
type AdminGetAgentWithdrawalListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAdminGetAgentWithdrawalListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminGetAgentWithdrawalListLogic {
return &AdminGetAgentWithdrawalListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *AdminGetAgentWithdrawalListLogic) AdminGetAgentWithdrawalList(req *types.AdminGetAgentWithdrawalListReq) (resp *types.AdminGetAgentWithdrawalListResp, err error) {
builder := l.svcCtx.AgentWithdrawalModel.SelectBuilder()
if req.AgentId != nil {
builder = builder.Where(squirrel.Eq{"agent_id": *req.AgentId})
}
if req.Status != nil {
builder = builder.Where(squirrel.Eq{"status": *req.Status})
}
if req.WithdrawNo != nil && *req.WithdrawNo != "" {
builder = builder.Where(squirrel.Eq{"withdraw_no": *req.WithdrawNo})
}
list, total, err := l.svcCtx.AgentWithdrawalModel.FindPageListByPageWithTotal(l.ctx, builder, req.Page, req.PageSize, "create_time DESC")
if err != nil {
return nil, err
}
items := make([]types.AgentWithdrawalListItem, 0, len(list))
for _, v := range list {
item := types.AgentWithdrawalListItem{}
_ = copier.Copy(&item, v)
item.Remark = ""
if v.Remark.Valid {
item.Remark = v.Remark.String
}
item.CreateTime = v.CreateTime.Format("2006-01-02 15:04:05")
items = append(items, item)
}
resp = &types.AdminGetAgentWithdrawalListResp{
Total: total,
Items: items,
}
return
}

View File

@@ -1,96 +0,0 @@
package admin_agent
import (
"context"
"database/sql"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type AdminUpdateAgentMembershipConfigLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAdminUpdateAgentMembershipConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminUpdateAgentMembershipConfigLogic {
return &AdminUpdateAgentMembershipConfigLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *AdminUpdateAgentMembershipConfigLogic) AdminUpdateAgentMembershipConfig(req *types.AdminUpdateAgentMembershipConfigReq) (resp *types.AdminUpdateAgentMembershipConfigResp, err error) {
cfg, err := l.svcCtx.AgentMembershipConfigModel.FindOne(l.ctx, req.Id)
if err != nil {
return nil, err
}
cfg.LevelName = req.LevelName
cfg.Price = sql.NullFloat64{Float64: req.Price, Valid: true}
cfg.ReportCommission = sql.NullFloat64{Float64: req.ReportCommission, Valid: true}
if req.LowerActivityReward == nil {
cfg.LowerActivityReward = sql.NullFloat64{Valid: false}
} else {
cfg.LowerActivityReward = sql.NullFloat64{Float64: *req.LowerActivityReward, Valid: true}
}
if req.NewActivityReward == nil {
cfg.NewActivityReward = sql.NullFloat64{Valid: false}
} else {
cfg.NewActivityReward = sql.NullFloat64{Float64: *req.NewActivityReward, Valid: true}
}
if req.LowerStandardCount == nil {
cfg.LowerStandardCount = sql.NullInt64{Valid: false}
} else {
cfg.LowerStandardCount = sql.NullInt64{Int64: *req.LowerStandardCount, Valid: true}
}
if req.NewLowerStandardCount == nil {
cfg.NewLowerStandardCount = sql.NullInt64{Valid: false}
} else {
cfg.NewLowerStandardCount = sql.NullInt64{Int64: *req.NewLowerStandardCount, Valid: true}
}
if req.LowerWithdrawRewardRatio == nil {
cfg.LowerWithdrawRewardRatio = sql.NullFloat64{Valid: false}
} else {
cfg.LowerWithdrawRewardRatio = sql.NullFloat64{Float64: *req.LowerWithdrawRewardRatio, Valid: true}
}
if req.LowerConvertVipReward == nil {
cfg.LowerConvertVipReward = sql.NullFloat64{Valid: false}
} else {
cfg.LowerConvertVipReward = sql.NullFloat64{Float64: *req.LowerConvertVipReward, Valid: true}
}
if req.LowerConvertSvipReward == nil {
cfg.LowerConvertSvipReward = sql.NullFloat64{Valid: false}
} else {
cfg.LowerConvertSvipReward = sql.NullFloat64{Float64: *req.LowerConvertSvipReward, Valid: true}
}
if req.ExemptionAmount == nil {
cfg.ExemptionAmount = sql.NullFloat64{Valid: false}
} else {
cfg.ExemptionAmount = sql.NullFloat64{Float64: *req.ExemptionAmount, Valid: true}
}
if req.PriceIncreaseMax == nil {
cfg.PriceIncreaseMax = sql.NullFloat64{Valid: false}
} else {
cfg.PriceIncreaseMax = sql.NullFloat64{Float64: *req.PriceIncreaseMax, Valid: true}
}
if req.PriceRatio == nil {
cfg.PriceRatio = sql.NullFloat64{Valid: false}
} else {
cfg.PriceRatio = sql.NullFloat64{Float64: *req.PriceRatio, Valid: true}
}
if req.PriceIncreaseAmount == nil {
cfg.PriceIncreaseAmount = sql.NullFloat64{Valid: false}
} else {
cfg.PriceIncreaseAmount = sql.NullFloat64{Float64: *req.PriceIncreaseAmount, Valid: true}
}
_, err = l.svcCtx.AgentMembershipConfigModel.Update(l.ctx, nil, cfg)
if err != nil {
return nil, err
}
resp = &types.AdminUpdateAgentMembershipConfigResp{Success: true}
return
}

View File

@@ -1,42 +0,0 @@
package admin_agent
import (
"context"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type AdminUpdateAgentProductionConfigLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewAdminUpdateAgentProductionConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminUpdateAgentProductionConfigLogic {
return &AdminUpdateAgentProductionConfigLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *AdminUpdateAgentProductionConfigLogic) AdminUpdateAgentProductionConfig(req *types.AdminUpdateAgentProductionConfigReq) (resp *types.AdminUpdateAgentProductionConfigResp, err error) {
cfg, err := l.svcCtx.AgentProductConfigModel.FindOne(l.ctx, req.Id)
if err != nil {
return nil, err
}
cfg.CostPrice = req.CostPrice
cfg.PriceRangeMin = req.PriceRangeMin
cfg.PriceRangeMax = req.PriceRangeMax
cfg.PricingStandard = req.PricingStandard
cfg.OverpricingRatio = req.OverpricingRatio
_, err = l.svcCtx.AgentProductConfigModel.Update(l.ctx, nil, cfg)
if err != nil {
return nil, err
}
resp = &types.AdminUpdateAgentProductionConfigResp{Success: true}
return
}

Some files were not shown because too many files have changed in this diff Show More