修改获取奖励类型列表
This commit is contained in:
@ -20,11 +20,13 @@ func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListR
|
|||||||
)
|
)
|
||||||
|
|
||||||
out, err := service.RewardType().List(ctx, &model.RewardTypeListIn{
|
out, err := service.RewardType().List(ctx, &model.RewardTypeListIn{
|
||||||
Page: req.Page,
|
Page: req.Page,
|
||||||
Size: req.Size,
|
Size: req.Size,
|
||||||
StoreId: req.StoreId,
|
StoreId: req.StoreId,
|
||||||
Name: req.Name,
|
Name: req.Name,
|
||||||
Source: req.Source,
|
Source: req.Source,
|
||||||
|
OperatorId: operatorId,
|
||||||
|
OperatorRole: operatorRole,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -108,13 +108,21 @@ func (s *sRewardType) Delete(ctx context.Context, in *model.RewardTypeDeleteIn)
|
|||||||
func (s *sRewardType) List(ctx context.Context, in *model.RewardTypeListIn) (out *model.RewardTypeListOut, err error) {
|
func (s *sRewardType) List(ctx context.Context, in *model.RewardTypeListIn) (out *model.RewardTypeListOut, err error) {
|
||||||
mod := dao.RewardTypes.Ctx(ctx).Where("deleted_at IS NULL")
|
mod := dao.RewardTypes.Ctx(ctx).Where("deleted_at IS NULL")
|
||||||
|
|
||||||
|
if in.OperatorRole == consts.AdminRoleCode {
|
||||||
|
mod = mod.Where("source", 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if in.OperatorRole == consts.MerchantRoleCode || in.OperatorRole == consts.StoreRoleCode {
|
||||||
|
mod.Where("source", 2)
|
||||||
|
}
|
||||||
|
|
||||||
// 其余过滤条件
|
// 其余过滤条件
|
||||||
if in.Name != "" {
|
if in.Name != "" {
|
||||||
mod = mod.WhereLike("name", "%"+in.Name+"%")
|
mod = mod.WhereLike("name", "%"+in.Name+"%")
|
||||||
}
|
}
|
||||||
if in.Source > 0 {
|
//if in.Source > 0 {
|
||||||
mod = mod.Where("source", in.Source)
|
// mod = mod.Where("source", in.Source)
|
||||||
}
|
//}
|
||||||
|
|
||||||
count, err := mod.Count()
|
count, err := mod.Count()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -60,12 +60,14 @@ type RewardTypeDeleteOut struct {
|
|||||||
|
|
||||||
// RewardTypeListIn 获取奖励类型列表入参
|
// RewardTypeListIn 获取奖励类型列表入参
|
||||||
type RewardTypeListIn struct {
|
type RewardTypeListIn struct {
|
||||||
Page int
|
Page int
|
||||||
Size int
|
Size int
|
||||||
Name string
|
Name string
|
||||||
StoreId int64
|
StoreId int64
|
||||||
Status int
|
Status int
|
||||||
Source int
|
Source int
|
||||||
|
OperatorId int64
|
||||||
|
OperatorRole string
|
||||||
}
|
}
|
||||||
|
|
||||||
// RewardTypeListOut 获取奖励类型列表出参
|
// RewardTypeListOut 获取奖励类型列表出参
|
||||||
|
|||||||
Reference in New Issue
Block a user