生成奖励相关代码,实现新增门店奖励
This commit is contained in:
22
api/reward/reward.go
Normal file
22
api/reward/reward.go
Normal file
@ -0,0 +1,22 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package reward
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"server/api/reward/v1"
|
||||
)
|
||||
|
||||
type IRewardV1 interface {
|
||||
CreateSystemReward(ctx context.Context, req *v1.CreateSystemRewardReq) (res *v1.CreateSystemRewardRes, err error)
|
||||
CreateStoreReward(ctx context.Context, req *v1.CreateStoreRewardReq) (res *v1.CreateStoreRewardRes, err error)
|
||||
ListSystemReward(ctx context.Context, req *v1.ListSystemRewardReq) (res *v1.ListSystemRewardRes, err error)
|
||||
ListStoreReward(ctx context.Context, req *v1.ListStoreRewardReq) (res *v1.ListStoreRewardRes, err error)
|
||||
UpdateSystemReward(ctx context.Context, req *v1.UpdateSystemRewardReq) (res *v1.UpdateSystemRewardRes, err error)
|
||||
UpdateStoreReward(ctx context.Context, req *v1.UpdateStoreRewardReq) (res *v1.UpdateStoreRewardRes, err error)
|
||||
DeleteSystemReward(ctx context.Context, req *v1.DeleteSystemRewardReq) (res *v1.DeleteSystemRewardRes, err error)
|
||||
DeleteStoreReward(ctx context.Context, req *v1.DeleteStoreRewardReq) (res *v1.DeleteStoreRewardRes, err error)
|
||||
}
|
||||
133
api/reward/v1/reward.go
Normal file
133
api/reward/v1/reward.go
Normal file
@ -0,0 +1,133 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// CreateSystemRewardReq 创建系统奖励请求
|
||||
type CreateSystemRewardReq struct {
|
||||
g.Meta `path:"/reward/system" method:"post" tags:"Reward" summary:"创建系统奖励"`
|
||||
RewardTypeId int64 `v:"required|min:1#奖励类型ID不能为空|奖励类型ID无效" json:"rewardTypeId" dc:"奖励类型ID"`
|
||||
Name string `v:"required|length:1,100#奖励名称不能为空|奖励名称长度为1-100" json:"name" dc:"奖励名称"`
|
||||
Description string `v:"length:0,255#奖励描述长度为0-255" json:"description" dc:"奖励描述,可选"`
|
||||
Status int `v:"in:1,2#状态必须为1或2" json:"status" dc:"状态:1=启用,2=禁用,默认1" d:"1"`
|
||||
Stock int `v:"min:0#库存不能为负" json:"stock" dc:"奖励库存,0表示无限制" d:"0"`
|
||||
StartAt *gtime.Time `v:"date#开始时间格式无效" json:"startAt" dc:"奖励有效开始时间,可选"`
|
||||
ExpireAt *gtime.Time `v:"date|after-equal:start_at#结束时间格式无效|结束时间必须晚于开始时间" json:"expireAt" dc:"奖励有效结束时间,可选"`
|
||||
}
|
||||
|
||||
// CreateSystemRewardRes 创建系统奖励响应
|
||||
type CreateSystemRewardRes struct {
|
||||
Id int64 `json:"id" dc:"创建的奖励ID"`
|
||||
}
|
||||
|
||||
// CreateStoreRewardReq 创建门店奖励请求
|
||||
type CreateStoreRewardReq struct {
|
||||
g.Meta `path:"/reward/store" method:"post" tags:"Reward" summary:"创建门店奖励"`
|
||||
StoreIds []int64 `v:"required|distinct|min-length:1#门店ID列表不能为空|门店ID不能重复|门店ID列表不能为空" json:"storeIds" dc:"门店ID列表"`
|
||||
RewardTypeId int64 `v:"required|min:1#奖励类型ID不能为空|奖励类型ID无效" json:"rewardTypeId" dc:"奖励类型ID"`
|
||||
Name string `v:"required|length:1,100#奖励名称不能为空|奖励名称长度为1-100" json:"name" dc:"奖励名称"`
|
||||
Description string `v:"length:0,255#奖励描述长度为0-255" json:"description" dc:"奖励描述,可选"`
|
||||
Status int `v:"in:1,2#状态必须为1或2" json:"status" dc:"状态:1=启用,2=禁用,默认1" d:"1"`
|
||||
Stock int `v:"min:0#库存不能为负" json:"stock" dc:"奖励库存,0表示无限制" d:"0"`
|
||||
StartAt *gtime.Time `v:"date#开始时间格式无效" json:"startAt" dc:"奖励有效开始时间,可选"`
|
||||
ExpireAt *gtime.Time `v:"date|after-equal:start_at#结束时间格式无效|结束时间必须晚于开始时间" json:"expireAt" dc:"奖励有效结束时间,可选"`
|
||||
}
|
||||
|
||||
// CreateStoreRewardRes 创建门店奖励响应
|
||||
type CreateStoreRewardRes struct {
|
||||
Id int64 `json:"id" dc:"创建的奖励ID"`
|
||||
}
|
||||
|
||||
// ListSystemRewardReq 查询系统奖励列表请求
|
||||
type ListSystemRewardReq struct {
|
||||
g.Meta `path:"/reward/system" method:"get" tags:"Reward" summary:"获取系统奖励列表"`
|
||||
Page int `v:"min:1#页码必须大于0" json:"page" d:"1" dc:"页码"`
|
||||
PageSize int `v:"min:1|max:100#每页数量必须为1-100" json:"pageSize" d:"10" dc:"每页数量"`
|
||||
Name string `json:"name" dc:"奖励名称,模糊查询,可选"`
|
||||
Status int `v:"in:0,1,2#状态无效" json:"status" d:"0" dc:"状态:0=全部,1=启用,2=禁用,可选"`
|
||||
RewardTypeId int64 `v:"min:0#奖励类型ID无效" json:"rewardTypeId" d:"0" dc:"奖励类型ID,0=全部,可选"`
|
||||
}
|
||||
|
||||
// ListSystemRewardRes 查询系统奖励列表响应
|
||||
type ListSystemRewardRes struct {
|
||||
List interface{} `json:"list" dc:"奖励列表"`
|
||||
Total int `json:"total" dc:"总记录数"`
|
||||
}
|
||||
|
||||
// ListStoreRewardReq 查询门店奖励列表请求
|
||||
type ListStoreRewardReq struct {
|
||||
g.Meta `path:"/reward/store" method:"get" tags:"Reward" summary:"获取门店奖励列表"`
|
||||
Page int `v:"min:1#页码必须大于0" json:"page" d:"1" dc:"页码"`
|
||||
PageSize int `v:"min:1|max:100#每页数量必须为1-100" json:"pageSize" d:"10" dc:"每页数量"`
|
||||
StoreId int64 `v:"min:0#门店ID无效" json:"storeId" d:"0" dc:"门店ID,0=全部(管理员使用),其他值过滤该门店可见的奖励,可选"`
|
||||
Name string `json:"name" dc:"奖励名称,模糊查询,可选"`
|
||||
Status int `v:"in:0,1,2#状态无效" json:"status" d:"0" dc:"状态:0=全部,1=启用,2=禁用,可选"`
|
||||
RewardTypeId int64 `v:"min:0#奖励类型ID无效" json:"rewardTypeId" d:"0" dc:"奖励类型ID,0=全部,可选"`
|
||||
}
|
||||
|
||||
// ListStoreRewardRes 查询门店奖励列表响应
|
||||
type ListStoreRewardRes struct {
|
||||
List interface{} `json:"list" dc:"奖励列表"`
|
||||
Total int `json:"total" dc:"总记录数"`
|
||||
}
|
||||
|
||||
// UpdateSystemRewardReq 更新系统奖励请求
|
||||
type UpdateSystemRewardReq struct {
|
||||
g.Meta `path:"/reward/system/{id}" method:"put" tags:"Reward" summary:"更新系统奖励"`
|
||||
Id uint64 `v:"required|min:1#奖励ID不能为空|奖励ID无效" json:"id" dc:"奖励ID"`
|
||||
RewardTypeId int64 `v:"required|min:1#奖励类型ID不能为空|奖励类型ID无效" json:"rewardTypeId" dc:"奖励类型ID"`
|
||||
Name string `v:"required|length:1,100#奖励名称不能为空|奖励名称长度为1-100" json:"name" dc:"奖励名称"`
|
||||
Description string `v:"length:0,255#奖励描述长度为0-255" json:"description" dc:"奖励描述,可选"`
|
||||
Status int `v:"in:1,2#状态必须为1或2" json:"status" dc:"状态:1=启用,2=禁用"`
|
||||
Stock int `v:"min:0#库存不能为负" json:"stock" dc:"奖励库存,0表示无限制"`
|
||||
StartAt *gtime.Time `v:"date#开始时间格式无效" json:"startAt" dc:"奖励有效开始时间,可选"`
|
||||
ExpireAt *gtime.Time `v:"date|after-equal:start_at#结束时间格式无效|结束时间必须晚于开始时间" json:"expireAt" dc:"奖励有效结束时间,可选"`
|
||||
}
|
||||
|
||||
// UpdateSystemRewardRes 更新系统奖励响应
|
||||
type UpdateSystemRewardRes struct {
|
||||
Success bool `json:"success" dc:"更新成功"`
|
||||
}
|
||||
|
||||
// UpdateStoreRewardReq 更新门店奖励请求
|
||||
type UpdateStoreRewardReq struct {
|
||||
g.Meta `path:"/reward/store/{id}" method:"put" tags:"Reward" summary:"更新门店奖励"`
|
||||
Id uint64 `v:"required|min:1#奖励ID不能为空|奖励ID无效" json:"id" dc:"奖励ID"`
|
||||
StoreIds []int64 `v:"required|distinct|min-length:1#门店ID列表不能为空|门店ID不能重复|至少指定一个门店ID" json:"storeIds" dc:"关联门店ID列表"`
|
||||
RewardTypeId int64 `v:"required|min:1#奖励类型ID不能为空|奖励类型ID无效" json:"rewardTypeId" dc:"奖励类型ID"`
|
||||
Name string `v:"required|length:1,100#奖励名称不能为空|奖励名称长度为1-100" json:"name" dc:"奖励名称"`
|
||||
Description string `v:"length:0,255#奖励描述长度为0-255" json:"description" dc:"奖励描述,可选"`
|
||||
Status int `v:"in:1,2#状态必须为1或2" json:"status" dc:"状态:1=启用,2=禁用"`
|
||||
Stock int `v:"min:0#库存不能为负" json:"stock" dc:"奖励库存,0表示无限制"`
|
||||
StartAt *gtime.Time `v:"date#开始时间格式无效" json:"startAt" dc:"奖励有效开始时间,可选"`
|
||||
ExpireAt *gtime.Time `v:"date|after-equal:start_at#结束时间格式无效|结束时间必须晚于开始时间" json:"expireAt" dc:"奖励有效结束时间,可选"`
|
||||
}
|
||||
|
||||
// UpdateStoreRewardRes 更新门店奖励响应
|
||||
type UpdateStoreRewardRes struct {
|
||||
Success bool `json:"success" dc:"更新成功"`
|
||||
}
|
||||
|
||||
// DeleteSystemRewardReq 删除系统奖励请求
|
||||
type DeleteSystemRewardReq struct {
|
||||
g.Meta `path:"/reward/system/{id}" method:"delete" tags:"Reward" summary:"删除系统奖励"`
|
||||
Id uint64 `v:"required|min:1#奖励ID不能为空|奖励ID无效" json:"id" dc:"奖励ID"`
|
||||
}
|
||||
|
||||
// DeleteSystemRewardRes 删除系统奖励响应
|
||||
type DeleteSystemRewardRes struct {
|
||||
Success bool `json:"success" dc:"删除成功"`
|
||||
}
|
||||
|
||||
// DeleteStoreRewardReq 删除门店奖励请求
|
||||
type DeleteStoreRewardReq struct {
|
||||
g.Meta `path:"/reward/store/{id}" method:"delete" tags:"Reward" summary:"删除门店奖励"`
|
||||
Id uint64 `v:"required|min:1#奖励ID不能为空|奖励ID无效" json:"id" dc:"奖励ID"`
|
||||
}
|
||||
|
||||
// DeleteStoreRewardRes 删除门店奖励响应
|
||||
type DeleteStoreRewardRes struct {
|
||||
Success bool `json:"success" dc:"删除成功"`
|
||||
}
|
||||
Reference in New Issue
Block a user