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