修改获取奖励类型列表
This commit is contained in:
@ -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) {
|
||||
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 != "" {
|
||||
mod = mod.WhereLike("name", "%"+in.Name+"%")
|
||||
}
|
||||
if in.Source > 0 {
|
||||
mod = mod.Where("source", in.Source)
|
||||
}
|
||||
//if in.Source > 0 {
|
||||
// mod = mod.Where("source", in.Source)
|
||||
//}
|
||||
|
||||
count, err := mod.Count()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user