解决 bug
This commit is contained in:
@ -87,11 +87,12 @@ type GetIpListRes struct {
|
||||
Total int64 `json:"total" dc:"总数"`
|
||||
}
|
||||
type DetailReq struct {
|
||||
g.Meta `path:"/store/detail" method:"get" tags:"Backend/Store" summary:"(系统、商户门店后台)门店详情"`
|
||||
NetbarAccount string `json:"netbarAccount" v:"required" dc:"门店账号"`
|
||||
g.Meta `path:"/store/detail" method:"get" tags:"Backend/Store" summary:"(系统、商户门店后台)门店详情"`
|
||||
StoreId int64 `json:"storeId" v:"required" dc:"门店ID"`
|
||||
}
|
||||
type DetailRes struct {
|
||||
Id int64 `json:"id" dc:"门店ID"`
|
||||
Id int64 `json:"id" dc:"门店ID"`
|
||||
NetbarAccount string `json:"netbarAccount" dc:"门店账号"`
|
||||
}
|
||||
|
||||
type StoreMemberLevelReq struct {
|
||||
|
||||
@ -7,8 +7,11 @@ type InfoReq struct {
|
||||
}
|
||||
|
||||
type InfoRes struct {
|
||||
Id int64 `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Id int64 `json:"id"`
|
||||
StoreId int64 `json:"storeId"`
|
||||
Username string `json:"username"`
|
||||
Realname string `json:"realname"`
|
||||
IsPrimary bool `json:"isPrimary"`
|
||||
}
|
||||
type ListReq struct {
|
||||
g.Meta `path:"/store/admin" method:"get" tags:"Backend/StoreAdmin" summary:"(系统、商户门店后台)门店管理员列表"`
|
||||
|
||||
@ -9,9 +9,9 @@ import (
|
||||
)
|
||||
|
||||
func (c *ControllerV1) Detail(ctx context.Context, req *v1.DetailReq) (res *v1.DetailRes, err error) {
|
||||
out, err := service.Store().Detail(ctx, &model.StoreDetailIn{NetbarAccount: req.NetbarAccount})
|
||||
out, err := service.Store().Detail(ctx, &model.StoreDetailIn{StoreId: req.StoreId})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.DetailRes{Id: out.Id}, nil
|
||||
return &v1.DetailRes{Id: out.Id, NetbarAccount: out.NetbarAccount}, nil
|
||||
}
|
||||
|
||||
@ -3,14 +3,17 @@ package storeAdmin
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"server/internal/model"
|
||||
"server/internal/service"
|
||||
|
||||
"server/api/storeAdmin/v1"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) Info(ctx context.Context, req *v1.InfoReq) (res *v1.InfoRes, err error) {
|
||||
g.RequestFromCtx(ctx)
|
||||
return nil, gerror.NewCode(gcode.CodeNotImplemented)
|
||||
storeAdminId := g.RequestFromCtx(ctx).GetCtxVar("id").Int64()
|
||||
out, err := service.StoreAdmin().Info(ctx, &model.StoreAdminInfoIn{StoreAdminId: storeAdminId})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.InfoRes{Id: out.Id, StoreId: out.StoreId, Username: out.Username, Realname: out.RealName, IsPrimary: out.IsPrimary}, nil
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ func (s *sStore) DeleteIP(ctx context.Context, in *model.IPDeleteIn) (*model.IPD
|
||||
}
|
||||
|
||||
func (s *sStore) Detail(ctx context.Context, in *model.StoreDetailIn) (out *model.StoreDetailOut, err error) {
|
||||
one, err := dao.Stores.Ctx(ctx).Where(do.Stores{NetbarAccount: in.NetbarAccount}).One()
|
||||
one, err := dao.Stores.Ctx(ctx).Where(do.Stores{Id: in.StoreId}).One()
|
||||
if err != nil {
|
||||
return nil, ecode.Fail.Sub("查询门店出现异常")
|
||||
}
|
||||
@ -274,7 +274,8 @@ func (s *sStore) Detail(ctx context.Context, in *model.StoreDetailIn) (out *mode
|
||||
return nil, ecode.Params.Sub("门店不存在")
|
||||
}
|
||||
return &model.StoreDetailOut{
|
||||
Id: one[dao.Stores.Columns().Id].Int64(),
|
||||
Id: one[dao.Stores.Columns().Id].Int64(),
|
||||
NetbarAccount: one[dao.Stores.Columns().NetbarAccount].String(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +97,11 @@ func (s *sStoreAdmin) Info(ctx context.Context, in *model.StoreAdminInfoIn) (out
|
||||
return nil, ecode.Fail.Sub("查询门店管理员失败")
|
||||
}
|
||||
out = &model.StoreAdminInfoOut{
|
||||
Username: storeAdmin.Username,
|
||||
Id: storeAdmin.Id,
|
||||
StoreId: storeAdmin.StoreId,
|
||||
Username: storeAdmin.Username,
|
||||
RealName: storeAdmin.RealName,
|
||||
IsPrimary: storeAdmin.IsPrimary,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -523,10 +523,11 @@ func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out
|
||||
result.TaskList[i].Status = 1
|
||||
} else {
|
||||
// 存在用户记录,自行判断用户是否完成任务
|
||||
if v.UserTimes-one["user_times"].Int64() >= v.TargetTimes {
|
||||
completeTime := gtime.Now()
|
||||
userTaskStatus := one["status"].Int64()
|
||||
if userTaskStatus == 1 {
|
||||
userTaskStatus := one["status"].Int64()
|
||||
|
||||
if userTaskStatus == 1 {
|
||||
if v.UserTimes-one["user_times"].Int64() >= v.TargetTimes {
|
||||
completeTime := gtime.Now()
|
||||
if err := dao.UserTasks.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
|
||||
// 用户任务完成修改任务记录完成时间
|
||||
_, err = dao.UserTasks.Ctx(ctx).Where(do.UserTasks{UserId: in.UserId, TaskId: v.TaskID}).Data(do.UserTasks{CompletedAt: completeTime}).Update()
|
||||
@ -569,16 +570,17 @@ func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out
|
||||
return nil, err
|
||||
}
|
||||
result.TaskList[i].Status = 2
|
||||
} else if userTaskStatus == 3 {
|
||||
result.TaskList[i].Status = 2
|
||||
} else {
|
||||
result.TaskList[i].Status = 3
|
||||
result.TaskList[i].UserTimes -= one["user_times"].Int64()
|
||||
result.TaskList[i].Status = 1
|
||||
}
|
||||
} else if userTaskStatus == 3 {
|
||||
result.TaskList[i].Status = 2
|
||||
} else {
|
||||
result.TaskList[i].UserTimes -= one["user_times"].Int64()
|
||||
result.TaskList[i].Status = 1
|
||||
result.TaskList[i].Status = 3
|
||||
}
|
||||
result.TaskList[i].UserTaskId = one["id"].Int64()
|
||||
|
||||
}
|
||||
}
|
||||
out.PageIdx = result.PageIdx
|
||||
|
||||
@ -112,9 +112,11 @@ type IPCreateOut struct {
|
||||
}
|
||||
type StoreDetailIn struct {
|
||||
NetbarAccount string
|
||||
StoreId int64
|
||||
}
|
||||
type StoreDetailOut struct {
|
||||
Id int64 `json:"id"`
|
||||
Id int64 `json:"id"`
|
||||
NetbarAccount string `json:"netbarAccount"`
|
||||
}
|
||||
|
||||
type StoreByNetbarAccountIn struct {
|
||||
|
||||
@ -5,7 +5,11 @@ type StoreAdminInfoIn struct {
|
||||
}
|
||||
|
||||
type StoreAdminInfoOut struct {
|
||||
Username string
|
||||
Id int64
|
||||
StoreId int64
|
||||
Username string
|
||||
RealName string
|
||||
IsPrimary bool
|
||||
}
|
||||
|
||||
type StoreAdminLoginIn struct {
|
||||
|
||||
@ -103,6 +103,7 @@ func init() {
|
||||
enforcer.AddPolicy("store", "/x/store/netfeeSetting", "POST", "修改门店网费设置")
|
||||
// 门店:修改
|
||||
enforcer.AddPolicy("store", "/x/task/sync", "POST", "同步任务")
|
||||
enforcer.AddPolicy("store", "/x/store/detail", "GET", "获取门店详情")
|
||||
// 奖励类型
|
||||
enforcer.AddPolicy("store", "/x/rewardType", "GET", "获取奖励类型列表")
|
||||
enforcer.AddPolicy("store", "/x/rewardType", "POST", "添加奖励类型")
|
||||
|
||||
Reference in New Issue
Block a user