修改奖励类型
This commit is contained in:
@ -3,6 +3,7 @@ package rewardType
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/glog"
|
||||
"server/internal/model"
|
||||
"server/internal/service"
|
||||
|
||||
@ -13,17 +14,25 @@ func (c *ControllerV1) Create(ctx context.Context, req *v1.CreateReq) (res *v1.C
|
||||
fromCtx := g.RequestFromCtx(ctx)
|
||||
operatorId := fromCtx.GetCtxVar("id").Int64()
|
||||
operatorRole := fromCtx.GetCtxVar("role").String()
|
||||
|
||||
glog.Infof(ctx, "请求创建奖励类型,操作用户ID:%d,角色:%s,名称:%s,来源:%d,门店ID:%d,腾讯类型ID:%d",
|
||||
operatorId, operatorRole, req.Name, req.Source, req.StoreId, req.TencentTypeId,
|
||||
)
|
||||
|
||||
out, err := service.RewardType().Create(ctx, &model.RewardTypeCreateIn{
|
||||
OperatorId: operatorId,
|
||||
OperatorRole: operatorRole,
|
||||
Name: req.Name,
|
||||
Description: req.Description,
|
||||
Source: req.Source,
|
||||
Status: req.Status,
|
||||
StoreId: req.StoreId})
|
||||
OperatorId: operatorId,
|
||||
OperatorRole: operatorRole,
|
||||
Name: req.Name,
|
||||
Source: req.Source,
|
||||
StoreId: req.StoreId,
|
||||
TencentTypeId: req.TencentTypeId,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
glog.Warningf(ctx, "创建奖励类型失败,操作用户ID:%d,角色:%s,错误信息:%v", operatorId, operatorRole, err)
|
||||
return nil, err
|
||||
}
|
||||
return &v1.CreateRes{Id: out.Id}, nil
|
||||
|
||||
glog.Infof(ctx, "创建奖励类型成功,ID:%d,操作用户ID:%d,角色:%s", out.Id, operatorId, operatorRole)
|
||||
return &v1.CreateRes{Id: out.Id}, nil
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package rewardType
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/glog"
|
||||
"server/internal/model"
|
||||
"server/internal/service"
|
||||
|
||||
@ -13,9 +14,20 @@ func (c *ControllerV1) Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.D
|
||||
fromCtx := g.RequestFromCtx(ctx)
|
||||
operatorId := fromCtx.GetCtxVar("id").Int64()
|
||||
operatorRole := fromCtx.GetCtxVar("role").String()
|
||||
out, err := service.RewardType().Delete(ctx, &model.RewardTypeDeleteIn{Id: req.Id, OperatorId: operatorId, OperatorRole: operatorRole})
|
||||
|
||||
glog.Infof(ctx, "请求删除奖励类型,操作用户ID:%d,角色:%s,奖励类型ID:%d", operatorId, operatorRole, req.Id)
|
||||
|
||||
out, err := service.RewardType().Delete(ctx, &model.RewardTypeDeleteIn{
|
||||
Id: req.Id,
|
||||
OperatorId: operatorId,
|
||||
OperatorRole: operatorRole,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
glog.Warningf(ctx, "删除奖励类型失败,操作用户ID:%d,角色:%s,奖励类型ID:%d,错误信息:%v", operatorId, operatorRole, req.Id, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
glog.Infof(ctx, "删除奖励类型成功,操作用户ID:%d,角色:%s,奖励类型ID:%d", operatorId, operatorRole, req.Id)
|
||||
return &v1.DeleteRes{Success: out.Success}, nil
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package rewardType
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/glog"
|
||||
"server/internal/model"
|
||||
"server/internal/service"
|
||||
|
||||
@ -13,10 +14,28 @@ func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListR
|
||||
fromCtx := g.RequestFromCtx(ctx)
|
||||
operatorId := fromCtx.GetCtxVar("id").Int64()
|
||||
operatorRole := fromCtx.GetCtxVar("role").String()
|
||||
out, err := service.RewardType().List(ctx, &model.RewardTypeListIn{Page: req.Page, Size: req.Size, OperatorId: operatorId, OperatorRole: operatorRole, StoreId: req.StoreId, Name: req.Name, Status: req.Status})
|
||||
|
||||
glog.Infof(ctx, "获取奖励类型列表,操作用户ID:%d,角色:%s,页码:%d,每页大小:%d,门店ID:%d,名称过滤:%s,来源过滤:%d",
|
||||
operatorId, operatorRole, req.Page, req.Size, req.StoreId, req.Name, req.Source,
|
||||
)
|
||||
|
||||
out, err := service.RewardType().List(ctx, &model.RewardTypeListIn{
|
||||
Page: req.Page,
|
||||
Size: req.Size,
|
||||
OperatorId: operatorId,
|
||||
OperatorRole: operatorRole,
|
||||
StoreId: req.StoreId,
|
||||
Name: req.Name,
|
||||
Source: req.Source,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
glog.Warningf(ctx, "获取奖励类型列表失败,操作用户ID:%d,角色:%s,错误信息:%v", operatorId, operatorRole, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
glog.Infof(ctx, "获取奖励类型列表成功,操作用户ID:%d,角色:%s,结果总数:%d", operatorId, operatorRole, out.Total)
|
||||
|
||||
return &v1.ListRes{
|
||||
List: out.List,
|
||||
Total: out.Total,
|
||||
|
||||
@ -3,6 +3,7 @@ package rewardType
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/glog"
|
||||
"server/internal/model"
|
||||
"server/internal/service"
|
||||
|
||||
@ -13,17 +14,24 @@ func (c *ControllerV1) Update(ctx context.Context, req *v1.UpdateReq) (res *v1.U
|
||||
fromCtx := g.RequestFromCtx(ctx)
|
||||
operatorId := fromCtx.GetCtxVar("id").Int64()
|
||||
operatorRole := fromCtx.GetCtxVar("role").String()
|
||||
|
||||
glog.Infof(ctx, "更新奖励类型开始,操作用户ID:%d,角色:%s,奖励类型ID:%d,名称:%s,腾讯类型ID:%d,门店ID:%d",
|
||||
operatorId, operatorRole, req.Id, req.Name, req.TencentTypeId, req.StoreId,
|
||||
)
|
||||
|
||||
out, err := service.RewardType().Update(ctx, &model.RewardTypeUpdateIn{
|
||||
Id: req.Id,
|
||||
Name: req.Name,
|
||||
Description: req.Description,
|
||||
Status: req.Status,
|
||||
OperatorId: operatorId,
|
||||
OperatorRole: operatorRole,
|
||||
StoreId: req.StoreId,
|
||||
Id: req.Id,
|
||||
Name: req.Name,
|
||||
TencentTypeId: req.TencentTypeId,
|
||||
StoreId: req.StoreId,
|
||||
OperatorId: operatorId,
|
||||
OperatorRole: operatorRole,
|
||||
})
|
||||
if err != nil {
|
||||
glog.Warningf(ctx, "更新奖励类型失败,操作用户ID:%d,角色:%s,错误信息:%v", operatorId, operatorRole, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
glog.Infof(ctx, "更新奖励类型成功,操作用户ID:%d,角色:%s,奖励类型ID:%d", operatorId, operatorRole, req.Id)
|
||||
return &v1.UpdateRes{Success: out.Success}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user