Compare commits
88 Commits
29f248f1b4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ff976e19fc | |||
| 9e99f91ee6 | |||
| 3b98574a5c | |||
| 281540928b | |||
| 13068fe49a | |||
| 800d21bace | |||
| 8c9bb0a368 | |||
| 2a3c5cbb89 | |||
| b18f20dbe0 | |||
| 408ce1a22c | |||
| 8ea08e74a0 | |||
| 8de41412c2 | |||
| e81d495210 | |||
| 525eb09f5a | |||
| d4d6e46125 | |||
| 541b6df302 | |||
| d3cddddbde | |||
| be6231c296 | |||
| e76c5dff54 | |||
| 4be4d6b6da | |||
| 30ace3faa2 | |||
| 10eeeef95e | |||
| fb3879526a | |||
| e5a53eebbc | |||
| 053a302c80 | |||
| fb30503997 | |||
| 59816b1b7d | |||
| 018244cb4e | |||
| 54479c13ba | |||
| aa2e2b9195 | |||
| 2074215180 | |||
| d34e2d17f4 | |||
| f4ad8eac51 | |||
| 43b926d668 | |||
| 8de5bbc71e | |||
| 3c3037a049 | |||
| 97e50d11d6 | |||
| 0bc383eba4 | |||
| 740464a8ec | |||
| d82cd261c4 | |||
| 5db9dc5720 | |||
| 820a9e89ee | |||
| 26588ec703 | |||
| 15baf2bb13 | |||
| 698f386d78 | |||
| c0dddc67e5 | |||
| 8e4a0d3dac | |||
| 79e1ba2616 | |||
| ca66cc91d4 | |||
| 830d9ae9d9 | |||
| 28879b02fb | |||
| e43e76697b | |||
| d268234c1b | |||
| 00c2f07769 | |||
| 8003431fdb | |||
| 2aea96db2c | |||
| b60f6ffb3e | |||
| 7c590a206a | |||
| b70b7abcda | |||
| e7c2de0d55 | |||
| 3671c40c46 | |||
| bb79a92176 | |||
| 0f8503984b | |||
| 8af7189a5f | |||
| 52e88b1cbf | |||
| ab282e4bcc | |||
| 04fe5f8ac0 | |||
| 68804850c7 | |||
| 6f898888a4 | |||
| 28c2f0bd4f | |||
| 36de254ced | |||
| ab5a80df5e | |||
| 70922e885e | |||
| f0c9e49de7 | |||
| 735599db6d | |||
| f630c515e7 | |||
| f740d1516a | |||
| 07b33ec35d | |||
| f6a38a1246 | |||
| 1d46f6a9a2 | |||
| e340813938 | |||
| 78dbb3a175 | |||
| 43916f00f0 | |||
| c53d5fdf2a | |||
| b18c3d58ab | |||
| 32fcdd7ad1 | |||
| b9ca357448 | |||
| 9059458433 |
@@ -4,7 +4,7 @@ tmp_dir = "tmp"
|
|||||||
|
|
||||||
[build]
|
[build]
|
||||||
# 入口文件
|
# 入口文件
|
||||||
cmd = "go build -o ./tmp/main.exe ./app/user/cmd/api/main.go"
|
cmd = "go build -o ./tmp/main.exe ./app/main/api/main.go"
|
||||||
# 二进制文件
|
# 二进制文件
|
||||||
bin = "$env:ENV = 'development' && ./tmp/main.exe"
|
bin = "$env:ENV = 'development' && ./tmp/main.exe"
|
||||||
# 运行时的参数
|
# 运行时的参数
|
||||||
|
|||||||
186
.cursor/rules/api.mdc
Normal file
186
.cursor/rules/api.mdc
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
# 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. 保持代码风格统一,添加必要的注释
|
||||||
270
.cursor/rules/logic.mdc
Normal file
270
.cursor/rules/logic.mdc
Normal file
@@ -0,0 +1,270 @@
|
|||||||
|
# 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
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -13,10 +13,6 @@ data/*
|
|||||||
# gitlab ci
|
# gitlab ci
|
||||||
.cache
|
.cache
|
||||||
|
|
||||||
#vscode
|
|
||||||
.vscode
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
# 临时文件
|
# 临时文件
|
||||||
/tmp
|
/tmp
|
||||||
/tmp/*
|
/tmp/*
|
||||||
|
|||||||
24
.vscode/launch.json
vendored
Normal file
24
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Launch Package",
|
||||||
|
"type": "go",
|
||||||
|
"request": "launch",
|
||||||
|
"mode": "auto",
|
||||||
|
"program": "${fileDirname}",
|
||||||
|
"args": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "调试API服务",
|
||||||
|
"type": "go",
|
||||||
|
"request": "launch",
|
||||||
|
"mode": "auto",
|
||||||
|
"program": "${workspaceFolder}/app/main/api/main.go",
|
||||||
|
"args": ["-f", "etc/main.dev.yaml"],
|
||||||
|
"env": {
|
||||||
|
"ENV": "development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
21
1.json
Normal file
21
1.json
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"apiID": "QCXG9P1C",
|
||||||
|
"data": {
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"plateColor": 0,
|
||||||
|
"plateNum": "粤A9***1",
|
||||||
|
"vehicleType": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"plateColor": 1,
|
||||||
|
"plateNum": "粤A9***2",
|
||||||
|
"vehicleType": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vehicleCount": 2
|
||||||
|
},
|
||||||
|
"sort": 1,
|
||||||
|
"success": true,
|
||||||
|
"timestamp": "2025-03-21 21:05:58"
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.22.4-alpine AS builder
|
FROM golang:1.23.4-alpine AS builder
|
||||||
|
|
||||||
LABEL stage=gobuilder
|
LABEL stage=gobuilder
|
||||||
|
|
||||||
@@ -14,8 +14,8 @@ ADD go.mod .
|
|||||||
ADD go.sum .
|
ADD go.sum .
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY app/user/cmd/api/etc /app/etc
|
COPY app/main/api/etc /app/etc
|
||||||
RUN go build -ldflags="-s -w" -o /app/user app/user/cmd/api/main.go
|
RUN go build -ldflags="-s -w" -o /app/main app/main/api/main.go
|
||||||
|
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
@@ -25,7 +25,7 @@ COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/S
|
|||||||
ENV TZ Asia/Shanghai
|
ENV TZ Asia/Shanghai
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /app/user /app/user
|
COPY --from=builder /app/main /app/main
|
||||||
COPY --from=builder /app/etc /app/etc
|
COPY --from=builder /app/etc /app/etc
|
||||||
|
|
||||||
CMD ["./user", "-f", "etc/main.yaml"]
|
CMD ["./main", "-f", "etc/main.yaml"]
|
||||||
BIN
app/main/api/__debug_bin1457748911.exe
Normal file
BIN
app/main/api/__debug_bin1457748911.exe
Normal file
Binary file not shown.
75
app/main/api/desc/admin/admin.md
Normal file
75
app/main/api/desc/admin/admin.md
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
# 后台管理面板功能说明
|
||||||
|
|
||||||
|
## 1. 统计中心
|
||||||
|
|
||||||
|
- **数据概览**
|
||||||
|
展示平台核心数据指标,包括用户数、订单数、收入等关键指标的实时统计。
|
||||||
|
- **趋势分析**
|
||||||
|
提供各项数据的趋势图表,支持按日、周、月、年等维度查看数据变化。
|
||||||
|
- **转化分析**
|
||||||
|
分析用户行为路径和转化率,帮助优化业务流程。
|
||||||
|
- **地域分布**
|
||||||
|
展示用户和订单的地域分布情况,支持地图可视化。
|
||||||
|
|
||||||
|
## 2. 系统管理
|
||||||
|
|
||||||
|
- **用户管理**
|
||||||
|
管理平台所有用户信息,包括用户的基本资料、状态、权限等。
|
||||||
|
- **角色管理**
|
||||||
|
管理系统角色,分配不同角色的权限,支持角色的增删改查。
|
||||||
|
- **菜单管理**
|
||||||
|
配置后台左侧菜单栏的结构和显示内容,支持菜单的自定义和排序。
|
||||||
|
|
||||||
|
## 3. 推广管理
|
||||||
|
|
||||||
|
- **推广数据分析**
|
||||||
|
查看和分析推广相关的数据报表,支持多维度统计和导出。
|
||||||
|
- **推广链接管理**
|
||||||
|
管理推广渠道和推广链接,支持生成、分发和统计推广链接的效果。
|
||||||
|
|
||||||
|
## 4. 订单管理
|
||||||
|
|
||||||
|
- 管理平台所有订单,支持订单的查询、退款、导出等操作。
|
||||||
|
|
||||||
|
## 5. 平台用户管理
|
||||||
|
|
||||||
|
- **用户信息管理**
|
||||||
|
基于 user 表,管理平台所有注册用户的详细信息。
|
||||||
|
- **用户认证管理**
|
||||||
|
基于 userAuth 表,管理用户的认证信息(如第三方登录、手机号、邮箱等)。
|
||||||
|
|
||||||
|
## 6. 通知管理
|
||||||
|
|
||||||
|
- 管理平台的系统通知,包括通知的发布、编辑、删除和推送历史。
|
||||||
|
|
||||||
|
## 7. 产品与功能管理
|
||||||
|
|
||||||
|
- **产品管理**
|
||||||
|
管理平台所有产品的信息,包括产品的价格、介绍、上下架等。
|
||||||
|
- **功能管理**
|
||||||
|
管理平台所有功能点,支持功能的增删改查。
|
||||||
|
- **产品功能配置**
|
||||||
|
支持为每个产品配置可用的功能,实现产品与功能的灵活绑定。
|
||||||
|
|
||||||
|
## 8. 示例管理
|
||||||
|
|
||||||
|
- 管理产品的示例内容,支持为不同产品配置不同的示例,便于用户参考和体验。
|
||||||
|
|
||||||
|
## 9. 平台配置管理
|
||||||
|
|
||||||
|
- 用于管理平台的全局配置项,如站点信息、支付配置、第三方集成等。
|
||||||
|
|
||||||
|
## 10. 版本更新管理
|
||||||
|
|
||||||
|
- **版本发布**
|
||||||
|
管理平台版本更新,包括版本号、更新内容、发布时间等。
|
||||||
|
- **更新记录**
|
||||||
|
维护版本更新历史,支持查看历史版本信息和回滚操作。
|
||||||
|
- **强制更新**
|
||||||
|
配置版本强制更新策略,确保用户使用最新版本。
|
||||||
|
- **灰度发布**
|
||||||
|
支持新版本灰度发布,可控制更新推送比例和范围。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> 以上为后台管理面板的主要功能模块规划,后续可根据业务发展持续扩展和优化。
|
||||||
108
app/main/api/desc/admin/admin_feature.api
Normal file
108
app/main/api/desc/admin/admin_feature.api
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
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"` // 更新时间
|
||||||
|
}
|
||||||
|
)
|
||||||
175
app/main/api/desc/admin/admin_product.api
Normal file
175
app/main/api/desc/admin/admin_product.api
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
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"` // 是否成功
|
||||||
|
}
|
||||||
|
)
|
||||||
42
app/main/api/desc/admin/admin_query.api
Normal file
42
app/main/api/desc/admin/admin_query.api
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
131
app/main/api/desc/admin/admin_user.api
Normal file
131
app/main/api/desc/admin/admin_user.api
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
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"` // 角色编码列表
|
||||||
|
}
|
||||||
|
)
|
||||||
34
app/main/api/desc/admin/auth.api
Normal file
34
app/main/api/desc/admin/auth.api
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
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"`
|
||||||
|
}
|
||||||
|
)
|
||||||
149
app/main/api/desc/admin/menu.api
Normal file
149
app/main/api/desc/admin/menu.api
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
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"`
|
||||||
|
}
|
||||||
|
)
|
||||||
127
app/main/api/desc/admin/notification.api
Normal file
127
app/main/api/desc/admin/notification.api
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
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)
|
||||||
|
}
|
||||||
169
app/main/api/desc/admin/order.api
Normal file
169
app/main/api/desc/admin/order.api
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
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"` // 退款金额
|
||||||
|
}
|
||||||
|
)
|
||||||
124
app/main/api/desc/admin/platform_user.api
Normal file
124
app/main/api/desc/admin/platform_user.api
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
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"` // 是否成功
|
||||||
|
}
|
||||||
|
)
|
||||||
183
app/main/api/desc/admin/promotion.api
Normal file
183
app/main/api/desc/admin/promotion.api
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
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"` // 总付费次数
|
||||||
|
}
|
||||||
|
)
|
||||||
124
app/main/api/desc/admin/role.api
Normal file
124
app/main/api/desc/admin/role.api
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
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"` // 是否成功
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -33,7 +33,6 @@ service main {
|
|||||||
prefix: api/v1
|
prefix: api/v1
|
||||||
group: pay
|
group: pay
|
||||||
jwt: JwtAuth
|
jwt: JwtAuth
|
||||||
middleware: SourceInterceptor
|
|
||||||
)
|
)
|
||||||
service main {
|
service main {
|
||||||
// 支付
|
// 支付
|
||||||
33
app/main/api/desc/front/product.api
Normal file
33
app/main/api/desc/front/product.api
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "产品服务"
|
||||||
|
desc: "产品服务"
|
||||||
|
author: "Liangzai"
|
||||||
|
email: "2440983361@qq.com"
|
||||||
|
version: "v1"
|
||||||
|
)
|
||||||
|
import (
|
||||||
|
"product/product.api"
|
||||||
|
)
|
||||||
|
@server (
|
||||||
|
prefix: api/v1/product
|
||||||
|
group: product
|
||||||
|
jwt: JwtAuth
|
||||||
|
)
|
||||||
|
service main {
|
||||||
|
@handler GetProductByID
|
||||||
|
get /:id (GetProductByIDRequest) returns (ProductResponse)
|
||||||
|
|
||||||
|
@handler GetProductByEn
|
||||||
|
get /en/:product_en (GetProductByEnRequest) returns (ProductResponse)
|
||||||
|
}
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: api/v1/product
|
||||||
|
group: product
|
||||||
|
)
|
||||||
|
service main {
|
||||||
|
@handler GetProductRenderList
|
||||||
|
get /render_list/:module (GetProductRenderListRequest) returns (GetProductRenderListResponse)
|
||||||
|
}
|
||||||
@@ -65,5 +65,10 @@ service main {
|
|||||||
service main {
|
service main {
|
||||||
@handler querySingleTest
|
@handler querySingleTest
|
||||||
post /query/single/test (QuerySingleTestReq) returns (QuerySingleTestResp)
|
post /query/single/test (QuerySingleTestReq) returns (QuerySingleTestResp)
|
||||||
|
|
||||||
|
|
||||||
|
@doc "更新查询数据"
|
||||||
|
@handler updateQueryData
|
||||||
|
post /query/update_data (UpdateQueryDataReq) returns (UpdateQueryDataResp)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,12 +32,15 @@ type Query {
|
|||||||
UserId int64 `json:"user_id"` // 用户ID
|
UserId int64 `json:"user_id"` // 用户ID
|
||||||
ProductName string `json:"product_name"` // 产品ID
|
ProductName string `json:"product_name"` // 产品ID
|
||||||
QueryParams map[string]interface{} `json:"query_params"`
|
QueryParams map[string]interface{} `json:"query_params"`
|
||||||
QueryData []map[string]interface{} `json:"query_data"`
|
QueryData []QueryItem `json:"query_data"`
|
||||||
CreateTime string `json:"create_time"` // 创建时间
|
CreateTime string `json:"create_time"` // 创建时间
|
||||||
UpdateTime string `json:"update_time"` // 更新时间
|
UpdateTime string `json:"update_time"` // 更新时间
|
||||||
QueryState string `json:"query_state"` // 查询状态
|
QueryState string `json:"query_state"` // 查询状态
|
||||||
}
|
}
|
||||||
|
type QueryItem {
|
||||||
|
Feature interface{} `json:"feature"`
|
||||||
|
Data interface{} `json:"data"` // 这里可以是 map 或 具体的 struct
|
||||||
|
}
|
||||||
// 获取查询临时订单
|
// 获取查询临时订单
|
||||||
type (
|
type (
|
||||||
QueryProvisionalOrderReq {
|
QueryProvisionalOrderReq {
|
||||||
@@ -113,3 +116,13 @@ type QuerySingleTestResp {
|
|||||||
Api string `json:"api"`
|
Api string `json:"api"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type (
|
||||||
|
UpdateQueryDataReq {
|
||||||
|
Id int64 `json:"id"` // 查询ID
|
||||||
|
QueryData string `json:"query_data"` // 查询数据(未加密的JSON)
|
||||||
|
}
|
||||||
|
UpdateQueryDataResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
UpdatedAt string `json:"updated_at"` // 更新时间
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -36,10 +36,12 @@ service main {
|
|||||||
@handler wxMiniAuth
|
@handler wxMiniAuth
|
||||||
post /user/wxMiniAuth (WXMiniAuthReq) returns (WXMiniAuthResp)
|
post /user/wxMiniAuth (WXMiniAuthReq) returns (WXMiniAuthResp)
|
||||||
|
|
||||||
|
|
||||||
@doc "wechat h5 auth"
|
@doc "wechat h5 auth"
|
||||||
@handler wxH5Auth
|
@handler wxH5Auth
|
||||||
post /user/wxh5Auth (WXH5AuthReq) returns (WXH5AuthResp)
|
post /user/wxh5Auth (WXH5AuthReq) returns (WXH5AuthResp)
|
||||||
|
|
||||||
|
@handler DecryptMobile
|
||||||
|
post /user/decryptMobile
|
||||||
}
|
}
|
||||||
|
|
||||||
//need login
|
//need login
|
||||||
25
app/main/api/desc/main.api
Normal file
25
app/main/api/desc/main.api
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "Main Service"
|
||||||
|
desc: "Main Service"
|
||||||
|
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 "./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"
|
||||||
117
app/main/api/etc/main.dev.yaml
Normal file
117
app/main/api/etc/main.dev.yaml
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
Name: main
|
||||||
|
Host: 0.0.0.0
|
||||||
|
Port: 8888
|
||||||
|
DataSource: "tyc:5vg67b3UNHu8@tcp(127.0.0.1:20001)/tyc?charset=utf8mb4&parseTime=True&loc=Local"
|
||||||
|
CacheRedis:
|
||||||
|
- Host: "127.0.0.1:20002"
|
||||||
|
Pass: "3m3WsgyCKWqz" # Redis 密码,如果未设置则留空
|
||||||
|
Type: "node" # 单节点模式
|
||||||
|
JwtAuth:
|
||||||
|
AccessSecret: "WUvoIwL-FK0qnlxhvxR9tV6SjfOpeJMpKmY2QvT99lA"
|
||||||
|
AccessExpire: 2592000
|
||||||
|
RefreshAfter: 1296000
|
||||||
|
VerifyCode:
|
||||||
|
AccessKeyID: "LTAI5tKGB3TVJbMHSoZN3yr9"
|
||||||
|
AccessKeySecret: "OCQ30GWp4yENMjmfOAaagksE18bp65"
|
||||||
|
EndpointURL: "dysmsapi.aliyuncs.com"
|
||||||
|
SignName: "全能查"
|
||||||
|
TemplateCode: "SMS_302641455"
|
||||||
|
ValidTime: 300
|
||||||
|
Encrypt:
|
||||||
|
SecretKey: "ff83609b2b24fc73196aac3d3dfb874f"
|
||||||
|
WestConfig:
|
||||||
|
Url: "http://proxy.tianyuanapi.com/api/invoke"
|
||||||
|
Key: "121a1e41fc1690dd6b90afbcacd80cf4"
|
||||||
|
SecretId: "449159"
|
||||||
|
SecretSecondId: "296804"
|
||||||
|
YushanConfig:
|
||||||
|
ApiKey: "4c566c4a4b543164535455685655316c"
|
||||||
|
AcctID: "YSSJ843926726"
|
||||||
|
Url: "http://proxy.tianyuanapi.com/credit-gw/service"
|
||||||
|
TianjuConfig:
|
||||||
|
ApiKey: "479bcac2a77b56e976d044ff2bd996f4"
|
||||||
|
BaseURL: "https://apis.tianapi.com"
|
||||||
|
Alipay:
|
||||||
|
Enabled: true
|
||||||
|
AppID: "2021004161631930"
|
||||||
|
PrivateKey: "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCOh6r6Ce7ZgMf5mWqVsU8sYNdU0HRlZbgYUQ2wF65PzWU3vL52+LG89ATbtHeKUy6esuuaAyYhuDrqU9f6mUl5QJGsWCF6JqqyberVIMJfdsdOTbgooSSUBxIsMYfoRZPdsZ9dHomDxfi2oGWJdAnaruTxKw7W8EPJwqc9/vopzdxLsT8t/eMzr4jvHIBVHtkMbmgNJ8b05tqJ1FViK3Yt78YBkt3PLdyjLzqRuKlVpmNceBEhzNbg4menGBzpJHTWO4uGk0KzUgY7wCSfyjrA9IPyWnDqlhws+9LwFKgkNpqxmwGgMihLysDRFOD5D1VLfry/yYT22UrwAzXFQYUvAgMBAAECggEAfKGfXXMwG5sjwltnuyvHepvXzz9UeJHgz8qYeIHMl9WYC4wM1IWVDhAm62M8IIWqP3Ve1VapklTBl8PnGSfO+qr+dsC9zU1geBPrg6BYtxdrIkqNnWGDVbl1J5XMLMwih3nZS5j3UHXdjPxmrTH9p+7FHSm0mTiRXizLB0gdwk0E+H+btJKLpCvqqIoEucowzbjY/ch86ASojpQGZiWapbi+03Xke6/wlGCbNzgGmQQo/C6XAbxl2ZKJxS/yp0JxGfO6gPJYx3xkuf+Pwr0U3imN8yDB/xo0LVamoxQggWua+mQXt72J4zD2imIU7TB4JFJV3kUd+45KLOccOsOuCQKBgQDLfsBxU/LiNn+zW6yus+dCu7JzQSN2K57XF+PSXhQTSjIu4K4y8v4WZHdSwkAGQSU3MLq66QD7ELYHGDBakFFj3sX7z2CHshFlu2I/DYP+0LPVRlIblsSDFn6rYBLOPXc3VkuEFcA0PpO3vW6yF7h2d9OpGaiYmpTvXa/6oPLQfQKBgQCzTgxTTrzZjLXCv85fzX3aYu9ceP4N0jaOwveEMvKNClSomUIDfHLn4sUTmAvHBdJz4Xqy/7+v/YpI0ifC0KouX0t6h3+YA6n4hCvpBMlUVACtHUfx+mzjj+KLxEvmm6ZJCmV5DC3yYvaDTANafM3PzyQRs/jw5WPWywezFfooGwKBgQC4Fq9TFkWYHQNDJ0C9PqSL+y7BEwFYireED+maSl9Q4AMr4zfTgX0YlsRXSsEOp2paVivmoJixh3mUS26azwnCFir21LCXsSAJ7w0+yyRIpVa6LoZizO5zRCtNL3lzt6kcl2VzVRXubVnGk4kLdWf7TAVfaYXan6TyMcfcLDPdJQKBgCwtV6YS6T6kh4fjICLEi3SKGbVr7hRTrbOA3+EHeHE9kVw03mnjeKAfZDUOqiAwFAkPDd8aWg0vZ6nHdZpvNO7V9c/LoKlAhdlAH117G2uWgtAkPbyl2bw7kDKle5nm0ZJ/aD7pvExTC6+Pw+fAhijkPVvLPtODgRTD0zLRgF/vAoGBAMdxes5p7u+Eoa41c3Y39dGvY30QiiGPB4oWLTdmyh4VQfC7DU7ihUCRsk5w4i/BuTNNlJauWM2MMX7YeRBt6ncq59vBAU2OeLd6oRsOkE2ZkH7tNDnGxZuOZkiSFnYUQLMBPnVe4JkS7ZvRWSyuIi9SE8TDpTLbH1kfEmIMq4dR"
|
||||||
|
AlipayPublicKey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAomw6g4rBmCr/QoX3NI3DVLyDpkaUytZ2uFhdfQaegIDAuUfZfgpTCASlAtO82t8ISAbSOSyp9CUpwdGV4EYOiCBbLxMYB6taaHPiIjJ1zNT1EakJzWgU53hz1AVeABB9kdAvMqSvjH6KLoVupmqm4Li8ZwDW9M2ANAmyDfKgiF0Lt4aUUnaZktoCrTWTkpmtfRZCHNACj851IllvN2wyC4OL7dJq5UzOFxmn07Dy/2z4UAhaaSAyRVawpOui5AIYJTXZERLYL3KMyRnMuZoFq3xltzVTzRPM06nRa9RfeVNVwWVtGBIe/r8tcg5wyhI57KUszGNOmUIm/se6G2lnAQIDAQAB"
|
||||||
|
IsProduction: true
|
||||||
|
NotifyUrl: "https://6m4685017o.goho.co/api/v1/pay/alipay/callback"
|
||||||
|
ReturnURL: "http://localhost:5678/inquire"
|
||||||
|
Wxpay:
|
||||||
|
Enabled: false
|
||||||
|
AppID: "wxba8424db4771cc18"
|
||||||
|
AppSecret: "89646203d7f76eb7aef0d926b9efffaa"
|
||||||
|
MchID: "1682635136"
|
||||||
|
MchCertificateSerialNumber: "5369B8AEEBDCF7AF274510252E6A8C0659C30F61"
|
||||||
|
MchApiv3Key: "e3ea4cf0765f1e71b01bb387dfcdbc9f"
|
||||||
|
MchPrivateKeyPath: "etc/merchant/apiclient_key.pem"
|
||||||
|
NotifyUrl: "https://6m4685017o.goho.co/api/v1/pay/wechat/callback"
|
||||||
|
RefundNotifyUrl: "https://6m4685017o.goho.co/api/v1/wechat/refund_callback"
|
||||||
|
Applepay:
|
||||||
|
Enabled: false
|
||||||
|
ProductionVerifyURL: "https://api.storekit.itunes.apple.com/inApps/v1/transactions/receipt"
|
||||||
|
SandboxVerifyURL: "https://api.storekit-sandbox.itunes.apple.com/inApps/v1/transactions/receipt"
|
||||||
|
Sandbox: false
|
||||||
|
BundleID: "com.allinone.check"
|
||||||
|
IssuerID: "bf828d85-5269-4914-9660-c066e09cd6ef"
|
||||||
|
KeyID: "LAY65829DQ"
|
||||||
|
LoadPrivateKeyPath: "etc/merchant/AuthKey_LAY65829DQ.p8"
|
||||||
|
Ali:
|
||||||
|
Code: "d55b58829efb41c8aa8e86769cba4844"
|
||||||
|
AdminConfig:
|
||||||
|
AccessSecret: "jK8nP3qR7tV2xZ5aB9cD1eF6gH4iJ0kL8mN5oP6qR7sT"
|
||||||
|
AccessExpire: 604800
|
||||||
|
RefreshAfter: 302400
|
||||||
|
AdminPromotion:
|
||||||
|
URLDomain: "https://tianyuancha.cn/p"
|
||||||
|
CleanTask:
|
||||||
|
Enabled: true
|
||||||
|
Time: "0 3 * * *"
|
||||||
|
Days: 15
|
||||||
|
Log:
|
||||||
|
ServiceName: "tyc-server"
|
||||||
|
Mode: "console"
|
||||||
|
Level: "info"
|
||||||
|
Encoding: "json"
|
||||||
|
Rotation: "daily"
|
||||||
|
TimeFormat: "2006-01-02T15:04:05.000Z07:00"
|
||||||
|
MaxSize: 3
|
||||||
|
Categories:
|
||||||
|
- "system" # 系统日志
|
||||||
|
- "access" # 访问日志
|
||||||
|
- "error" # 错误日志
|
||||||
|
- "stat" # 统计日志
|
||||||
|
- "business" # 业务日志
|
||||||
|
- "security" # 安全日志
|
||||||
|
Tianyuanapi:
|
||||||
|
AccessID: "3c042bb99b240ccc"
|
||||||
|
Key: "2732f526167c2de9b8dc6aa0f24ba8b7"
|
||||||
|
BaseURL: "https://api.tianyuanapi.com"
|
||||||
|
Timeout: 60
|
||||||
|
VerifyConfig:
|
||||||
|
TwoFactor: true
|
||||||
|
Security:
|
||||||
|
RateLimit:
|
||||||
|
Enabled: true
|
||||||
|
WindowSize: 30
|
||||||
|
MaxRequests: 50
|
||||||
|
TriggerThreshold: 3 # 触发5次频率限制后加入黑名单
|
||||||
|
TriggerWindow: 24 # 24小时内统计触发次数
|
||||||
|
IPBlacklist:
|
||||||
|
Enabled: true
|
||||||
|
UserBlacklist:
|
||||||
|
Enabled: true
|
||||||
|
AnomalyDetection:
|
||||||
|
Enabled: true
|
||||||
|
BurstAttack:
|
||||||
|
Enabled: true # 启用短时并发攻击检测
|
||||||
|
TimeWindow: 1 # 1秒内检测
|
||||||
|
MaxConcurrent: 15 # 最大20个并发请求
|
||||||
|
Logging:
|
||||||
|
UserOperationLogDir: "./logs/user_operations"
|
||||||
|
MaxFileSize: 104857600 # 100MB
|
||||||
|
LogLevel: "info"
|
||||||
|
EnableConsole: true
|
||||||
|
EnableFile: true
|
||||||
104
app/main/api/etc/main.yaml
Normal file
104
app/main/api/etc/main.yaml
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
Name: main
|
||||||
|
Host: 0.0.0.0
|
||||||
|
Port: 8888
|
||||||
|
DataSource: "tyc:5vg67b3UNHu8@tcp(tyc_mysql:3306)/tyc?charset=utf8mb4&parseTime=True&loc=Local"
|
||||||
|
CacheRedis:
|
||||||
|
- Host: "tyc_redis:6379"
|
||||||
|
Pass: "3m3WsgyCKWqz" # Redis 密码,如果未设置则留空
|
||||||
|
Type: "node" # 单节点模式
|
||||||
|
|
||||||
|
JwtAuth:
|
||||||
|
AccessSecret: "WUvoIwL-FK0qnlxhvxR9tV6SjfOpeJMpKmY2QvT99lA"
|
||||||
|
AccessExpire: 2592000
|
||||||
|
RefreshAfter: 1296000
|
||||||
|
|
||||||
|
VerifyCode:
|
||||||
|
AccessKeyID: "LTAI5tKGB3TVJbMHSoZN3yr9"
|
||||||
|
AccessKeySecret: "OCQ30GWp4yENMjmfOAaagksE18bp65"
|
||||||
|
EndpointURL: "dysmsapi.aliyuncs.com"
|
||||||
|
SignName: "天远查"
|
||||||
|
TemplateCode: "SMS_302641455"
|
||||||
|
ValidTime: 300
|
||||||
|
Encrypt:
|
||||||
|
SecretKey: "ff83609b2b24fc73196aac3d3dfb874f"
|
||||||
|
WestConfig:
|
||||||
|
Url: "https://apimaster.westdex.com.cn/api/invoke"
|
||||||
|
Key: "121a1e41fc1690dd6b90afbcacd80cf4"
|
||||||
|
SecretId: "449159"
|
||||||
|
SecretSecondId: "296804"
|
||||||
|
YushanConfig:
|
||||||
|
ApiKey: "4c566c4a4b543164535455685655316c"
|
||||||
|
AcctID: "YSSJ843926726"
|
||||||
|
Url: "https://api.yushanshuju.com/credit-gw/service"
|
||||||
|
TianjuConfig:
|
||||||
|
ApiKey: "479bcac2a77b56e976d044ff2bd996f4"
|
||||||
|
BaseURL: "https://apis.tianapi.com"
|
||||||
|
Alipay:
|
||||||
|
Enabled: true
|
||||||
|
AppID: "2021004161631930"
|
||||||
|
PrivateKey: "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCOh6r6Ce7ZgMf5mWqVsU8sYNdU0HRlZbgYUQ2wF65PzWU3vL52+LG89ATbtHeKUy6esuuaAyYhuDrqU9f6mUl5QJGsWCF6JqqyberVIMJfdsdOTbgooSSUBxIsMYfoRZPdsZ9dHomDxfi2oGWJdAnaruTxKw7W8EPJwqc9/vopzdxLsT8t/eMzr4jvHIBVHtkMbmgNJ8b05tqJ1FViK3Yt78YBkt3PLdyjLzqRuKlVpmNceBEhzNbg4menGBzpJHTWO4uGk0KzUgY7wCSfyjrA9IPyWnDqlhws+9LwFKgkNpqxmwGgMihLysDRFOD5D1VLfry/yYT22UrwAzXFQYUvAgMBAAECggEAfKGfXXMwG5sjwltnuyvHepvXzz9UeJHgz8qYeIHMl9WYC4wM1IWVDhAm62M8IIWqP3Ve1VapklTBl8PnGSfO+qr+dsC9zU1geBPrg6BYtxdrIkqNnWGDVbl1J5XMLMwih3nZS5j3UHXdjPxmrTH9p+7FHSm0mTiRXizLB0gdwk0E+H+btJKLpCvqqIoEucowzbjY/ch86ASojpQGZiWapbi+03Xke6/wlGCbNzgGmQQo/C6XAbxl2ZKJxS/yp0JxGfO6gPJYx3xkuf+Pwr0U3imN8yDB/xo0LVamoxQggWua+mQXt72J4zD2imIU7TB4JFJV3kUd+45KLOccOsOuCQKBgQDLfsBxU/LiNn+zW6yus+dCu7JzQSN2K57XF+PSXhQTSjIu4K4y8v4WZHdSwkAGQSU3MLq66QD7ELYHGDBakFFj3sX7z2CHshFlu2I/DYP+0LPVRlIblsSDFn6rYBLOPXc3VkuEFcA0PpO3vW6yF7h2d9OpGaiYmpTvXa/6oPLQfQKBgQCzTgxTTrzZjLXCv85fzX3aYu9ceP4N0jaOwveEMvKNClSomUIDfHLn4sUTmAvHBdJz4Xqy/7+v/YpI0ifC0KouX0t6h3+YA6n4hCvpBMlUVACtHUfx+mzjj+KLxEvmm6ZJCmV5DC3yYvaDTANafM3PzyQRs/jw5WPWywezFfooGwKBgQC4Fq9TFkWYHQNDJ0C9PqSL+y7BEwFYireED+maSl9Q4AMr4zfTgX0YlsRXSsEOp2paVivmoJixh3mUS26azwnCFir21LCXsSAJ7w0+yyRIpVa6LoZizO5zRCtNL3lzt6kcl2VzVRXubVnGk4kLdWf7TAVfaYXan6TyMcfcLDPdJQKBgCwtV6YS6T6kh4fjICLEi3SKGbVr7hRTrbOA3+EHeHE9kVw03mnjeKAfZDUOqiAwFAkPDd8aWg0vZ6nHdZpvNO7V9c/LoKlAhdlAH117G2uWgtAkPbyl2bw7kDKle5nm0ZJ/aD7pvExTC6+Pw+fAhijkPVvLPtODgRTD0zLRgF/vAoGBAMdxes5p7u+Eoa41c3Y39dGvY30QiiGPB4oWLTdmyh4VQfC7DU7ihUCRsk5w4i/BuTNNlJauWM2MMX7YeRBt6ncq59vBAU2OeLd6oRsOkE2ZkH7tNDnGxZuOZkiSFnYUQLMBPnVe4JkS7ZvRWSyuIi9SE8TDpTLbH1kfEmIMq4dR"
|
||||||
|
AlipayPublicKey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAomw6g4rBmCr/QoX3NI3DVLyDpkaUytZ2uFhdfQaegIDAuUfZfgpTCASlAtO82t8ISAbSOSyp9CUpwdGV4EYOiCBbLxMYB6taaHPiIjJ1zNT1EakJzWgU53hz1AVeABB9kdAvMqSvjH6KLoVupmqm4Li8ZwDW9M2ANAmyDfKgiF0Lt4aUUnaZktoCrTWTkpmtfRZCHNACj851IllvN2wyC4OL7dJq5UzOFxmn07Dy/2z4UAhaaSAyRVawpOui5AIYJTXZERLYL3KMyRnMuZoFq3xltzVTzRPM06nRa9RfeVNVwWVtGBIe/r8tcg5wyhI57KUszGNOmUIm/se6G2lnAQIDAQAB"
|
||||||
|
IsProduction: true
|
||||||
|
NotifyUrl: "https://www.tianyuancha.cn/api/v1/pay/alipay/callback"
|
||||||
|
ReturnURL: "https://www.tianyuancha.cn/report"
|
||||||
|
Wxpay:
|
||||||
|
Enabled: false
|
||||||
|
AppID: "wxba8424db4771cc18"
|
||||||
|
AppSecret: "89646203d7f76eb7aef0d926b9efffaa"
|
||||||
|
MchID: "1682635136"
|
||||||
|
MchCertificateSerialNumber: "5369B8AEEBDCF7AF274510252E6A8C0659C30F61"
|
||||||
|
MchApiv3Key: "e3ea4cf0765f1e71b01bb387dfcdbc9f"
|
||||||
|
MchPrivateKeyPath: "etc/merchant/apiclient_key.pem"
|
||||||
|
NotifyUrl: "https://www.tianyuancha.cn/api/v1/pay/wechat/callback"
|
||||||
|
RefundNotifyUrl: "https://www.tianyuancha.cn/api/v1/wechat/refund_callback"
|
||||||
|
Applepay:
|
||||||
|
Enabled: false
|
||||||
|
ProductionVerifyURL: "https://api.storekit.itunes.apple.com/inApps/v1/transactions/receipt"
|
||||||
|
SandboxVerifyURL: "https://api.storekit-sandbox.itunes.apple.com/inApps/v1/transactions/receipt"
|
||||||
|
Sandbox: false
|
||||||
|
BundleID: "com.allinone.check"
|
||||||
|
IssuerID: "bf828d85-5269-4914-9660-c066e09cd6ef"
|
||||||
|
KeyID: "LAY65829DQ"
|
||||||
|
LoadPrivateKeyPath: "etc/merchant/AuthKey_LAY65829DQ.p8"
|
||||||
|
Ali:
|
||||||
|
Code: "d55b58829efb41c8aa8e86769cba4844"
|
||||||
|
AdminConfig:
|
||||||
|
AccessSecret: "jK8nP3qR7tV2xZ5aB9cD1eF6gH4iJ0kL8mN5oP6qR7sT"
|
||||||
|
AccessExpire: 604800
|
||||||
|
RefreshAfter: 302400
|
||||||
|
AdminPromotion:
|
||||||
|
URLDomain: "https://tianyuancha.cn/p"
|
||||||
|
CleanTask:
|
||||||
|
Enabled: true
|
||||||
|
Time: "0 3 * * *"
|
||||||
|
Days: 15
|
||||||
|
Tianyuanapi:
|
||||||
|
AccessID: "7f8a9b2c4d5e6f1a"
|
||||||
|
Key: "9e4f8a1b3c6d7e2f5a8b9c0d1e4f7a2b"
|
||||||
|
BaseURL: "https://api.tianyuanapi.com"
|
||||||
|
Timeout: 60
|
||||||
|
VerifyConfig:
|
||||||
|
TwoFactor: true
|
||||||
|
Security:
|
||||||
|
RateLimit:
|
||||||
|
Enabled: true
|
||||||
|
WindowSize: 30
|
||||||
|
MaxRequests: 50
|
||||||
|
TriggerThreshold: 3 # 触发5次频率限制后加入黑名单
|
||||||
|
TriggerWindow: 24 # 24小时内统计触发次数
|
||||||
|
IPBlacklist:
|
||||||
|
Enabled: true
|
||||||
|
UserBlacklist:
|
||||||
|
Enabled: true
|
||||||
|
AnomalyDetection:
|
||||||
|
Enabled: true
|
||||||
|
BurstAttack:
|
||||||
|
Enabled: true # 启用短时并发攻击检测
|
||||||
|
TimeWindow: 1 # 1秒内检测
|
||||||
|
MaxConcurrent: 50 # 最大20个并发请求
|
||||||
|
Logging:
|
||||||
|
UserOperationLogDir: "./logs/user_operations"
|
||||||
|
MaxFileSize: 104857600 # 100MB
|
||||||
|
LogLevel: "info"
|
||||||
|
EnableConsole: true
|
||||||
|
EnableFile: true
|
||||||
@@ -19,7 +19,13 @@ type Config struct {
|
|||||||
WestConfig WestConfig
|
WestConfig WestConfig
|
||||||
YushanConfig YushanConfig
|
YushanConfig YushanConfig
|
||||||
TianjuConfig TianjuConfig
|
TianjuConfig TianjuConfig
|
||||||
SystemConfig SystemConfig
|
AdminConfig AdminConfig
|
||||||
|
AdminPromotion AdminPromotion
|
||||||
|
CleanTask CleanTask
|
||||||
|
Tianyuanapi TianyuanapiConfig
|
||||||
|
VerifyConfig VerifyConfig
|
||||||
|
Security SecurityConfig // 安全配置
|
||||||
|
Logging LoggingConfig // 日志配置
|
||||||
}
|
}
|
||||||
|
|
||||||
// JwtAuth 用于 JWT 鉴权配置
|
// JwtAuth 用于 JWT 鉴权配置
|
||||||
@@ -41,6 +47,7 @@ type Encrypt struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AlipayConfig struct {
|
type AlipayConfig struct {
|
||||||
|
Enabled bool
|
||||||
AppID string
|
AppID string
|
||||||
PrivateKey string
|
PrivateKey string
|
||||||
AlipayPublicKey string
|
AlipayPublicKey string
|
||||||
@@ -49,6 +56,7 @@ type AlipayConfig struct {
|
|||||||
ReturnURL string
|
ReturnURL string
|
||||||
}
|
}
|
||||||
type WxpayConfig struct {
|
type WxpayConfig struct {
|
||||||
|
Enabled bool
|
||||||
AppID string
|
AppID string
|
||||||
AppSecret string
|
AppSecret string
|
||||||
MchID string
|
MchID string
|
||||||
@@ -62,6 +70,7 @@ type AliConfig struct {
|
|||||||
Code string
|
Code string
|
||||||
}
|
}
|
||||||
type ApplepayConfig struct {
|
type ApplepayConfig struct {
|
||||||
|
Enabled bool
|
||||||
ProductionVerifyURL string
|
ProductionVerifyURL string
|
||||||
SandboxVerifyURL string // 沙盒环境的验证 URL
|
SandboxVerifyURL string // 沙盒环境的验证 URL
|
||||||
Sandbox bool
|
Sandbox bool
|
||||||
@@ -85,6 +94,27 @@ type TianjuConfig struct {
|
|||||||
ApiKey string
|
ApiKey string
|
||||||
BaseURL string
|
BaseURL string
|
||||||
}
|
}
|
||||||
type SystemConfig struct {
|
|
||||||
ThreeVerify bool
|
type AdminConfig struct {
|
||||||
|
AccessSecret string
|
||||||
|
AccessExpire int64
|
||||||
|
RefreshAfter int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminPromotion struct {
|
||||||
|
URLDomain string
|
||||||
|
}
|
||||||
|
type CleanTask struct {
|
||||||
|
Enabled bool
|
||||||
|
Time string
|
||||||
|
Days int
|
||||||
|
}
|
||||||
|
type TianyuanapiConfig struct {
|
||||||
|
AccessID string
|
||||||
|
Key string
|
||||||
|
BaseURL string
|
||||||
|
Timeout int64
|
||||||
|
}
|
||||||
|
type VerifyConfig struct {
|
||||||
|
TwoFactor bool
|
||||||
}
|
}
|
||||||
10
app/main/api/internal/config/logging.go
Normal file
10
app/main/api/internal/config/logging.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
// LoggingConfig 日志配置
|
||||||
|
type LoggingConfig struct {
|
||||||
|
UserOperationLogDir string `json:"userOperationLogDir" yaml:"userOperationLogDir"` // 用户操作日志目录
|
||||||
|
MaxFileSize int64 `json:"maxFileSize" yaml:"maxFileSize"` // 单个日志文件最大大小(字节)
|
||||||
|
LogLevel string `json:"logLevel" yaml:"logLevel"` // 日志级别
|
||||||
|
EnableConsole bool `json:"enableConsole" yaml:"enableConsole"` // 是否启用控制台输出
|
||||||
|
EnableFile bool `json:"enableFile" yaml:"enableFile"` // 是否启用文件输出
|
||||||
|
}
|
||||||
36
app/main/api/internal/config/security.go
Normal file
36
app/main/api/internal/config/security.go
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
// SecurityConfig 安全配置
|
||||||
|
type SecurityConfig struct {
|
||||||
|
// 频率限制配置
|
||||||
|
RateLimit struct {
|
||||||
|
Enabled bool `json:"enabled" yaml:"enabled"` // 是否启用频率限制
|
||||||
|
WindowSize int64 `json:"windowSize" yaml:"windowSize"` // 时间窗口大小(秒)
|
||||||
|
MaxRequests int64 `json:"maxRequests" yaml:"maxRequests"` // 最大请求次数
|
||||||
|
// 频率限制触发后的黑名单升级配置
|
||||||
|
TriggerThreshold int64 `json:"triggerThreshold" yaml:"triggerThreshold"` // 触发多少次频率限制后加入黑名单
|
||||||
|
TriggerWindow int64 `json:"triggerWindow" yaml:"triggerWindow"` // 触发次数统计时间窗口(小时)
|
||||||
|
} `json:"rateLimit" yaml:"rateLimit"`
|
||||||
|
|
||||||
|
// IP黑名单配置
|
||||||
|
IPBlacklist struct {
|
||||||
|
Enabled bool `json:"enabled" yaml:"enabled"` // 是否启用IP黑名单
|
||||||
|
} `json:"ipBlacklist" yaml:"ipBlacklist"`
|
||||||
|
|
||||||
|
// 用户黑名单配置
|
||||||
|
UserBlacklist struct {
|
||||||
|
Enabled bool `json:"enabled" yaml:"enabled"` // 是否启用用户黑名单
|
||||||
|
} `json:"userBlacklist" yaml:"userBlacklist"`
|
||||||
|
|
||||||
|
// 异常检测配置
|
||||||
|
AnomalyDetection struct {
|
||||||
|
Enabled bool `json:"enabled" yaml:"enabled"` // 是否启用异常检测
|
||||||
|
} `json:"anomalyDetection" yaml:"anomalyDetection"`
|
||||||
|
|
||||||
|
// 短时并发攻击检测配置
|
||||||
|
BurstAttack struct {
|
||||||
|
Enabled bool `json:"enabled" yaml:"enabled"` // 是否启用短时并发攻击检测
|
||||||
|
TimeWindow int64 `json:"timeWindow" yaml:"timeWindow"` // 检测时间窗口(秒)
|
||||||
|
MaxConcurrent int64 `json:"maxConcurrent" yaml:"maxConcurrent"` // 最大并发请求数
|
||||||
|
} `json:"burstAttack" yaml:"burstAttack"`
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_auth
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_auth"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_feature
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_feature"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_feature
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_feature"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_feature
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_feature"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_feature
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_feature"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_feature
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_feature"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_menu
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_menu"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_menu
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_menu"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_menu
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_menu"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_menu
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_menu"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_menu
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_menu"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-server/pkg/lzkit/validator"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetMenuListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.GetMenuListReq
|
||||||
|
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.NewGetMenuListLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetMenuList(&req)
|
||||||
|
result.HttpResult(r, w, resp, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_menu
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_menu"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_notification
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_notification"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_notification
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_notification"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_notification
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_notification"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_notification
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_notification"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_notification
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_notification"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_order
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_order"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_order
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_order"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_order
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_order"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_order
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_order"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_order
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_order"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_order
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_order"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_platform_user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_platform_user"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_platform_user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_platform_user"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_platform_user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_platform_user"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_platform_user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_platform_user"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_platform_user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_platform_user"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_product
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_product"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_product
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_product"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_product
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_product"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_product
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_product"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_product
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_product"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_product
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_product"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_product
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_product"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_promotion
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_promotion"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package admin_promotion
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_promotion"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_promotion
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_promotion"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_promotion
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_promotion"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-server/pkg/lzkit/validator"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetPromotionLinkListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.GetPromotionLinkListReq
|
||||||
|
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.NewGetPromotionLinkListLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetPromotionLinkList(&req)
|
||||||
|
result.HttpResult(r, w, resp, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_promotion
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_promotion"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_promotion
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_promotion"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_promotion
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_promotion"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package admin_promotion
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_promotion"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_query
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_query"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_role
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_role"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_role
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_role"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_role
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_role"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_role
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_role"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_role
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_role"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_user"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_user"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_user"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package admin_user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_user"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-server/pkg/lzkit/validator"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_user"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package admin_user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"tyc-server/app/main/api/internal/logic/admin_user"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,12 +3,13 @@ package auth
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"tyc-server/app/main/api/internal/logic/auth"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-server/pkg/lzkit/validator"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"qnc-server/app/user/cmd/api/internal/logic/auth"
|
|
||||||
"qnc-server/app/user/cmd/api/internal/svc"
|
|
||||||
"qnc-server/app/user/cmd/api/internal/types"
|
|
||||||
"qnc-server/common/result"
|
|
||||||
"qnc-server/pkg/lzkit/validator"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func SendSmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func SendSmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
@@ -3,9 +3,9 @@ package notification
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"qnc-server/app/user/cmd/api/internal/logic/notification"
|
"tyc-server/app/main/api/internal/logic/notification"
|
||||||
"qnc-server/app/user/cmd/api/internal/svc"
|
"tyc-server/app/main/api/internal/svc"
|
||||||
"qnc-server/common/result"
|
"tyc-server/common/result"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetNotificationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetNotificationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
@@ -3,9 +3,9 @@ package pay
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"qnc-server/app/user/cmd/api/internal/logic/pay"
|
"tyc-server/app/main/api/internal/logic/pay"
|
||||||
"qnc-server/app/user/cmd/api/internal/svc"
|
"tyc-server/app/main/api/internal/svc"
|
||||||
"qnc-server/common/result"
|
"tyc-server/common/result"
|
||||||
)
|
)
|
||||||
|
|
||||||
func AlipayCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func AlipayCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
@@ -3,12 +3,13 @@ package pay
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"tyc-server/app/main/api/internal/logic/pay"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-server/pkg/lzkit/validator"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"qnc-server/app/user/cmd/api/internal/logic/pay"
|
|
||||||
"qnc-server/app/user/cmd/api/internal/svc"
|
|
||||||
"qnc-server/app/user/cmd/api/internal/types"
|
|
||||||
"qnc-server/common/result"
|
|
||||||
"qnc-server/pkg/lzkit/validator"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func IapCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func IapCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
@@ -3,12 +3,13 @@ package pay
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"tyc-server/app/main/api/internal/logic/pay"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-server/pkg/lzkit/validator"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"qnc-server/app/user/cmd/api/internal/logic/pay"
|
|
||||||
"qnc-server/app/user/cmd/api/internal/svc"
|
|
||||||
"qnc-server/app/user/cmd/api/internal/types"
|
|
||||||
"qnc-server/common/result"
|
|
||||||
"qnc-server/pkg/lzkit/validator"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func PaymentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func PaymentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
@@ -3,9 +3,9 @@ package pay
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"qnc-server/app/user/cmd/api/internal/logic/pay"
|
"tyc-server/app/main/api/internal/logic/pay"
|
||||||
"qnc-server/app/user/cmd/api/internal/svc"
|
"tyc-server/app/main/api/internal/svc"
|
||||||
"qnc-server/common/result"
|
"tyc-server/common/result"
|
||||||
)
|
)
|
||||||
|
|
||||||
func WechatPayCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func WechatPayCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
@@ -3,9 +3,9 @@ package pay
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"qnc-server/app/user/cmd/api/internal/logic/pay"
|
"tyc-server/app/main/api/internal/logic/pay"
|
||||||
"qnc-server/app/user/cmd/api/internal/svc"
|
"tyc-server/app/main/api/internal/svc"
|
||||||
"qnc-server/common/result"
|
"tyc-server/common/result"
|
||||||
)
|
)
|
||||||
|
|
||||||
func WechatPayRefundCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func WechatPayRefundCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
@@ -3,12 +3,13 @@ package product
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"tyc-server/app/main/api/internal/logic/product"
|
||||||
|
"tyc-server/app/main/api/internal/svc"
|
||||||
|
"tyc-server/app/main/api/internal/types"
|
||||||
|
"tyc-server/common/result"
|
||||||
|
"tyc-server/pkg/lzkit/validator"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"qnc-server/app/user/cmd/api/internal/logic/product"
|
|
||||||
"qnc-server/app/user/cmd/api/internal/svc"
|
|
||||||
"qnc-server/app/user/cmd/api/internal/types"
|
|
||||||
"qnc-server/common/result"
|
|
||||||
"qnc-server/pkg/lzkit/validator"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetProductByEnHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetProductByEnHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user