Compare commits
13 Commits
de3b26b062
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f35548fe2 | |||
| 6aa28533bd | |||
| 7e93ce31a3 | |||
| 1462018682 | |||
| 9113dab102 | |||
| 1fd809ebfe | |||
| d1025e0d77 | |||
| 4ae70786d3 | |||
| e991da6dca | |||
| 49fd919fe1 | |||
| c63553df32 | |||
| f0e210ef2d | |||
| 65c71c574b |
@ -49,7 +49,7 @@ type MerchantRegisterRes struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type StoreLoginReq struct {
|
type StoreLoginReq struct {
|
||||||
g.Meta `path:"/store/login" method:"post" tags:"Backend/Store" summary:"(商户门店后台)门店登录"`
|
g.Meta `path:"/store/login" method:"post" tags:"PC-Server" summary:"(商户门店后台)门店登录"`
|
||||||
Username string `json:"username" v:"required" dc:"用户名"`
|
Username string `json:"username" v:"required" dc:"用户名"`
|
||||||
Password string `json:"password" v:"required" dc:"密码"`
|
Password string `json:"password" v:"required" dc:"密码"`
|
||||||
}
|
}
|
||||||
@ -63,9 +63,9 @@ type StoreLoginRes struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Quan8AutologinReq struct {
|
type Quan8AutologinReq struct {
|
||||||
g.Meta `path:"/quan8/autologin" method:"post" tags:"PC/Auth" summary:"8圈用户自动登录该系统"`
|
g.Meta `path:"/quan8/autologin" method:"post" tags:"PC-Server" summary:"8圈用户自动登录该系统"`
|
||||||
UUID string `json:"uuid" v:"required#UUID不能为空" dc:"UUID"`
|
UUID string `json:"uuid" v:"required#UUID不能为空" dc:"UUID"`
|
||||||
StoreId int64
|
StoreId int64 `json:"storeId" v:"required#门店ID不能为空" dc:"门店ID"`
|
||||||
}
|
}
|
||||||
type Quan8AutologinRes struct {
|
type Quan8AutologinRes struct {
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
|
|||||||
@ -3,7 +3,7 @@ package v1
|
|||||||
import "github.com/gogf/gf/v2/frame/g"
|
import "github.com/gogf/gf/v2/frame/g"
|
||||||
|
|
||||||
type GetReq struct {
|
type GetReq struct {
|
||||||
g.Meta `path:"/desktop" method:"get" tags:"PC/Desktop" summary:"(PC)获取桌面信息"`
|
g.Meta `path:"/desktop" method:"get" tags:"PC-Server" summary:"(PC)获取桌面信息"`
|
||||||
StoreId int64 `json:"storeId" v:"required#请选择店铺" dc:"门店id"`
|
StoreId int64 `json:"storeId" v:"required#请选择店铺" dc:"门店id"`
|
||||||
}
|
}
|
||||||
type GetRes struct {
|
type GetRes struct {
|
||||||
|
|||||||
@ -88,10 +88,11 @@ type GetIpListRes struct {
|
|||||||
}
|
}
|
||||||
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 {
|
||||||
|
|||||||
@ -8,7 +8,10 @@ type InfoReq struct {
|
|||||||
|
|
||||||
type InfoRes struct {
|
type InfoRes struct {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
|
StoreId int64 `json:"storeId"`
|
||||||
Username string `json:"username"`
|
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:"(系统、商户门店后台)门店管理员列表"`
|
||||||
|
|||||||
@ -103,7 +103,7 @@ type GetUserTaskRecordsListReq struct {
|
|||||||
Page int `json:"page" dc:"页数"`
|
Page int `json:"page" dc:"页数"`
|
||||||
Size int `json:"size" dc:"条数"`
|
Size int `json:"size" dc:"条数"`
|
||||||
TimeType int `json:"timeType" dc:"时间类型,1:一周,2:一月,3:一年, 不传就是不加时间限制"` //TODO
|
TimeType int `json:"timeType" dc:"时间类型,1:一周,2:一月,3:一年, 不传就是不加时间限制"` //TODO
|
||||||
BindType int `json:"bindType" v:"required#不能为空" dc:"绑定类型 1: QQ 2:微信"`
|
BindType int `json:"bindType" dc:"绑定类型 1: QQ 2:微信"`
|
||||||
}
|
}
|
||||||
type GetUserTaskRecordsListRes struct {
|
type GetUserTaskRecordsListRes struct {
|
||||||
List interface{} `json:"list"`
|
List interface{} `json:"list"`
|
||||||
|
|||||||
@ -54,6 +54,8 @@ func (c *ControllerV1) Callback(ctx context.Context, req *v1.CallbackReq) (res *
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glog.Infof(ctx, "回调响应:%s", marshal)
|
||||||
|
|
||||||
g.RequestFromCtx(ctx).Response.Write(marshal)
|
g.RequestFromCtx(ctx).Response.Write(marshal)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package task
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
|
"github.com/gogf/gf/v2/os/glog"
|
||||||
"server/internal/model"
|
"server/internal/model"
|
||||||
"server/internal/service"
|
"server/internal/service"
|
||||||
|
|
||||||
@ -11,6 +12,8 @@ import (
|
|||||||
|
|
||||||
func (c *ControllerV1) GetTaskList(ctx context.Context, req *v1.GetTaskListReq) (res *v1.GetTaskListRes, err error) {
|
func (c *ControllerV1) GetTaskList(ctx context.Context, req *v1.GetTaskListReq) (res *v1.GetTaskListRes, err error) {
|
||||||
|
|
||||||
|
glog.Info(ctx, req)
|
||||||
|
|
||||||
userId := g.RequestFromCtx(ctx).GetCtxVar("id").Int64()
|
userId := g.RequestFromCtx(ctx).GetCtxVar("id").Int64()
|
||||||
list, err := service.Task().GetTaskList(ctx, &model.GetTaskListV2In{
|
list, err := service.Task().GetTaskList(ctx, &model.GetTaskListV2In{
|
||||||
Gid: req.Gid,
|
Gid: req.Gid,
|
||||||
@ -26,6 +29,8 @@ func (c *ControllerV1) GetTaskList(ctx context.Context, req *v1.GetTaskListReq)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
glog.Infof(ctx, "The return task length of Game %d: %d", req.Gid, len(list.Data))
|
||||||
|
glog.Info(ctx, list)
|
||||||
return &v1.GetTaskListRes{
|
return &v1.GetTaskListRes{
|
||||||
List: list,
|
List: list,
|
||||||
}, nil
|
}, nil
|
||||||
|
|||||||
@ -32,6 +32,9 @@ type RewardCallbackColumns struct {
|
|||||||
CustomInfo string // 透传字段 (json串)
|
CustomInfo string // 透传字段 (json串)
|
||||||
AppId string // 业务 id(标识业务方,由游戏人生提供)
|
AppId string // 业务 id(标识业务方,由游戏人生提供)
|
||||||
InnerOrderId string // 系统内部订单ID
|
InnerOrderId string // 系统内部订单ID
|
||||||
|
CreatedAt string //
|
||||||
|
UpdatedAt string //
|
||||||
|
DeletedAt string //
|
||||||
}
|
}
|
||||||
|
|
||||||
// rewardCallbackColumns holds the columns for the table reward_callback.
|
// rewardCallbackColumns holds the columns for the table reward_callback.
|
||||||
@ -47,6 +50,9 @@ var rewardCallbackColumns = RewardCallbackColumns{
|
|||||||
CustomInfo: "custom_info",
|
CustomInfo: "custom_info",
|
||||||
AppId: "app_id",
|
AppId: "app_id",
|
||||||
InnerOrderId: "inner_order_id",
|
InnerOrderId: "inner_order_id",
|
||||||
|
CreatedAt: "created_at",
|
||||||
|
UpdatedAt: "updated_at",
|
||||||
|
DeletedAt: "deleted_at",
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRewardCallbackDao creates and returns a new DAO object for table data access.
|
// NewRewardCallbackDao creates and returns a new DAO object for table data access.
|
||||||
|
|||||||
@ -35,7 +35,7 @@ type UserTasksColumns struct {
|
|||||||
GameId string // 游戏 id
|
GameId string // 游戏 id
|
||||||
TaskType string // 1: 每日任务 3: 周期任务
|
TaskType string // 1: 每日任务 3: 周期任务
|
||||||
UserTimes string // 用户完成次数
|
UserTimes string // 用户完成次数
|
||||||
BindType string // 当前账号类型
|
BindType string // 1:qq 2:wx
|
||||||
}
|
}
|
||||||
|
|
||||||
// userTasksColumns holds the columns for the table user_tasks.
|
// userTasksColumns holds the columns for the table user_tasks.
|
||||||
|
|||||||
@ -605,9 +605,40 @@ func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *mode
|
|||||||
glog.Info(ctx, "调用 tencent开始")
|
glog.Info(ctx, "调用 tencent开始")
|
||||||
activity, err2 := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{PopenId: in.PopenId, ServiceName: consts.GetGift, GiftParam: giftParam})
|
activity, err2 := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{PopenId: in.PopenId, ServiceName: consts.GetGift, GiftParam: giftParam})
|
||||||
|
|
||||||
if err2 != nil {
|
//if err2 != nil {
|
||||||
|
if err2 != nil && err2.Error() == "奖励领取超出限制,-1" {
|
||||||
|
// 修改奖励领取状态为5
|
||||||
|
//_, err2 = dao.UserTaskRewards.Ctx(ctx).Where(do.UserTaskRewards{Id: in.Id}).Data(do.UserTaskRewards{
|
||||||
|
// Status: consts.RewardFailedStatus,
|
||||||
|
//}).Update()
|
||||||
|
//
|
||||||
|
//if err2 != nil {
|
||||||
|
// return nil, ecode.Fail.Sub("修改用奖励领取状态失败")
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//// 判断奖励是否领完,修改用户任务记录为 2
|
||||||
|
//exist, err2 := dao.UserTaskRewards.Ctx(ctx).Where(do.UserTaskRewards{UserTaskId: in.UserTaskId}).WhereIn(dao.UserTaskRewards.Columns().Status, []int{2, 3}).Exist()
|
||||||
|
//if err2 != nil {
|
||||||
|
// return nil, ecode.Fail.Sub("查询用户任务奖励失败")
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//if !exist {
|
||||||
|
// // 修改用户任务记录为 2
|
||||||
|
// _, err2 = dao.UserTasks.Ctx(ctx).Where(do.UserTasks{Id: in.UserTaskId}).Data(do.UserTasks{
|
||||||
|
// Status: 2,
|
||||||
|
// }).Update()
|
||||||
|
//
|
||||||
|
// if err2 != nil {
|
||||||
|
// return nil, ecode.Fail.Sub("修改用户任务状态失败")
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
return nil, ecode.RewardExceedLimited
|
||||||
|
} else if err2 != nil {
|
||||||
return nil, err2
|
return nil, err2
|
||||||
}
|
}
|
||||||
|
//return nil, err2
|
||||||
|
//}
|
||||||
glog.Info(ctx, "调用 tencent结束")
|
glog.Info(ctx, "调用 tencent结束")
|
||||||
fmt.Print(activity)
|
fmt.Print(activity)
|
||||||
|
|
||||||
|
|||||||
@ -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("查询门店出现异常")
|
||||||
}
|
}
|
||||||
@ -275,6 +275,7 @@ func (s *sStore) Detail(ctx context.Context, in *model.StoreDetailIn) (out *mode
|
|||||||
}
|
}
|
||||||
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{
|
||||||
|
Id: storeAdmin.Id,
|
||||||
|
StoreId: storeAdmin.StoreId,
|
||||||
Username: storeAdmin.Username,
|
Username: storeAdmin.Username,
|
||||||
|
RealName: storeAdmin.RealName,
|
||||||
|
IsPrimary: storeAdmin.IsPrimary,
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -446,8 +446,11 @@ func (s *sTask) GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.Ge
|
|||||||
func (s *sTask) GetUserTaskRecordsList(ctx context.Context, in *model.UserTaskRecordsListIn) (out *model.UserTaskRecordsListOut, err error) {
|
func (s *sTask) GetUserTaskRecordsList(ctx context.Context, in *model.UserTaskRecordsListIn) (out *model.UserTaskRecordsListOut, err error) {
|
||||||
list := make([]model.UserTask2, 0)
|
list := make([]model.UserTask2, 0)
|
||||||
var total int
|
var total int
|
||||||
orm := dao.UserTasks.Ctx(ctx).Where(dao.UserTasks.Columns().UserId, in.UserId, dao.UserTasks.Columns().BindType, in.BindType)
|
orm := dao.UserTasks.Ctx(ctx).Where(dao.UserTasks.Columns().UserId, in.UserId)
|
||||||
|
|
||||||
|
if in.BindType != 0 {
|
||||||
|
orm = orm.Where(dao.UserTasks.Columns().BindType, in.BindType)
|
||||||
|
}
|
||||||
if in.StoreId != 0 && in.NetBarAccount == "" {
|
if in.StoreId != 0 && in.NetBarAccount == "" {
|
||||||
orm = orm.Where(dao.UserTasks.Columns().StoreId, in.StoreId)
|
orm = orm.Where(dao.UserTasks.Columns().StoreId, in.StoreId)
|
||||||
}
|
}
|
||||||
@ -497,6 +500,7 @@ func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil, ecode.Fail.Sub("数据类型转换失败")
|
return nil, ecode.Fail.Sub("数据类型转换失败")
|
||||||
}
|
}
|
||||||
|
glog.Infof(ctx, "The tencent task length of Game %d: %d", in.Gid, len(result.TaskList))
|
||||||
for i, v := range result.TaskList {
|
for i, v := range result.TaskList {
|
||||||
// 获取任务奖励列表
|
// 获取任务奖励列表
|
||||||
err := dao.TaskRewards.Ctx(ctx).Where(do.TaskRewards{TaskId: v.TaskID}).WhereOr(do.TaskRewards{TaskId: v.TaskID, NetbarAccount: in.NetBarAccount}).
|
err := dao.TaskRewards.Ctx(ctx).Where(do.TaskRewards{TaskId: v.TaskID}).WhereOr(do.TaskRewards{TaskId: v.TaskID, NetbarAccount: in.NetBarAccount}).
|
||||||
@ -520,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 {
|
||||||
// 存在用户记录,自行判断用户是否完成任务
|
// 存在用户记录,自行判断用户是否完成任务
|
||||||
|
userTaskStatus := one["status"].Int64()
|
||||||
|
|
||||||
|
if userTaskStatus == 1 {
|
||||||
if v.UserTimes-one["user_times"].Int64() >= v.TargetTimes {
|
if v.UserTimes-one["user_times"].Int64() >= v.TargetTimes {
|
||||||
completeTime := gtime.Now()
|
completeTime := gtime.Now()
|
||||||
userTaskStatus := one["status"].Int64()
|
|
||||||
if userTaskStatus == 1 {
|
|
||||||
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()
|
||||||
@ -557,7 +562,7 @@ func (s *sTask) GetTaskList(ctx context.Context, in *model.GetTaskListV2In) (out
|
|||||||
updateData.IssueQuantity = quantity
|
updateData.IssueQuantity = quantity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if _, err := dao.UserTaskRewards.Ctx(ctx).Data(updateData).Update(); err != nil {
|
if _, err := dao.UserTaskRewards.Ctx(ctx).Data(updateData).Where(do.UserTaskRewards{Id: record["id"].Int64()}).Update(); err != nil {
|
||||||
return ecode.Fail.Sub("修改用户任务奖励失败")
|
return ecode.Fail.Sub("修改用户任务奖励失败")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -566,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 {
|
||||||
|
result.TaskList[i].UserTimes -= one["user_times"].Int64()
|
||||||
|
result.TaskList[i].Status = 1
|
||||||
|
}
|
||||||
} else if userTaskStatus == 3 {
|
} else if userTaskStatus == 3 {
|
||||||
result.TaskList[i].Status = 2
|
result.TaskList[i].Status = 2
|
||||||
} else {
|
} else {
|
||||||
result.TaskList[i].Status = 3
|
result.TaskList[i].Status = 3
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
result.TaskList[i].UserTimes -= one["user_times"].Int64()
|
|
||||||
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
|
||||||
|
|||||||
@ -296,6 +296,9 @@ func (s *sUser) BindPhone(ctx context.Context, in *model.UserBindPhoneIn) (out *
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ecode.Fail.Sub("绑定手机号失败")
|
return nil, ecode.Fail.Sub("绑定手机号失败")
|
||||||
}
|
}
|
||||||
|
if _, err := g.Redis().Del(ctx, fmt.Sprintf(consts.UserBindPhoneKey, in.Phone)); err != nil {
|
||||||
|
return nil, ecode.Fail.Sub("删除验证码失败")
|
||||||
|
}
|
||||||
return &model.UserBindPhoneOut{
|
return &model.UserBindPhoneOut{
|
||||||
Success: true,
|
Success: true,
|
||||||
}, nil
|
}, nil
|
||||||
|
|||||||
@ -6,6 +6,7 @@ package do
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
|
"github.com/gogf/gf/v2/os/gtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RewardCallback is the golang structure of table reward_callback for DAO operations like Where/Data.
|
// RewardCallback is the golang structure of table reward_callback for DAO operations like Where/Data.
|
||||||
@ -22,4 +23,7 @@ type RewardCallback struct {
|
|||||||
CustomInfo interface{} // 透传字段 (json串)
|
CustomInfo interface{} // 透传字段 (json串)
|
||||||
AppId interface{} // 业务 id(标识业务方,由游戏人生提供)
|
AppId interface{} // 业务 id(标识业务方,由游戏人生提供)
|
||||||
InnerOrderId interface{} // 系统内部订单ID
|
InnerOrderId interface{} // 系统内部订单ID
|
||||||
|
CreatedAt *gtime.Time //
|
||||||
|
UpdatedAt *gtime.Time //
|
||||||
|
DeletedAt *gtime.Time //
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,5 +26,5 @@ type UserTasks struct {
|
|||||||
GameId interface{} // 游戏 id
|
GameId interface{} // 游戏 id
|
||||||
TaskType interface{} // 1: 每日任务 3: 周期任务
|
TaskType interface{} // 1: 每日任务 3: 周期任务
|
||||||
UserTimes interface{} // 用户完成次数
|
UserTimes interface{} // 用户完成次数
|
||||||
BindType interface{} // 当前账号类型
|
BindType interface{} // 1:qq 2:wx
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
package entity
|
package entity
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gogf/gf/v2/os/gtime"
|
||||||
|
)
|
||||||
|
|
||||||
// RewardCallback is the golang structure for table reward_callback.
|
// RewardCallback is the golang structure for table reward_callback.
|
||||||
type RewardCallback struct {
|
type RewardCallback struct {
|
||||||
Id int64 `json:"id" orm:"id" description:""` //
|
Id int64 `json:"id" orm:"id" description:""` //
|
||||||
@ -17,4 +21,7 @@ type RewardCallback struct {
|
|||||||
CustomInfo string `json:"customInfo" orm:"custom_info" description:"透传字段 (json串)"` // 透传字段 (json串)
|
CustomInfo string `json:"customInfo" orm:"custom_info" description:"透传字段 (json串)"` // 透传字段 (json串)
|
||||||
AppId string `json:"appId" orm:"app_id" description:"业务 id(标识业务方,由游戏人生提供)"` // 业务 id(标识业务方,由游戏人生提供)
|
AppId string `json:"appId" orm:"app_id" description:"业务 id(标识业务方,由游戏人生提供)"` // 业务 id(标识业务方,由游戏人生提供)
|
||||||
InnerOrderId string `json:"innerOrderId" orm:"inner_order_id" description:"系统内部订单ID"` // 系统内部订单ID
|
InnerOrderId string `json:"innerOrderId" orm:"inner_order_id" description:"系统内部订单ID"` // 系统内部订单ID
|
||||||
|
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:""` //
|
||||||
|
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:""` //
|
||||||
|
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:""` //
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,5 +24,5 @@ type UserTasks struct {
|
|||||||
GameId int64 `json:"gameId" orm:"game_id" description:"游戏 id"` // 游戏 id
|
GameId int64 `json:"gameId" orm:"game_id" description:"游戏 id"` // 游戏 id
|
||||||
TaskType int64 `json:"taskType" orm:"task_type" description:"1: 每日任务 3: 周期任务"` // 1: 每日任务 3: 周期任务
|
TaskType int64 `json:"taskType" orm:"task_type" description:"1: 每日任务 3: 周期任务"` // 1: 每日任务 3: 周期任务
|
||||||
UserTimes int64 `json:"userTimes" orm:"user_times" description:"用户完成次数"` // 用户完成次数
|
UserTimes int64 `json:"userTimes" orm:"user_times" description:"用户完成次数"` // 用户完成次数
|
||||||
BindType int `json:"bindType" orm:"bind_type" description:"当前账号类型"` // 当前账号类型
|
BindType int `json:"bindType" orm:"bind_type" description:"1:qq 2:wx"` // 1:qq 2:wx
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 {
|
||||||
|
Id int64
|
||||||
|
StoreId int64
|
||||||
Username string
|
Username string
|
||||||
|
RealName string
|
||||||
|
IsPrimary bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type StoreAdminLoginIn struct {
|
type StoreAdminLoginIn struct {
|
||||||
|
|||||||
@ -36,6 +36,7 @@ type UserTask2 struct {
|
|||||||
Id int64 `json:"id" orm:"id" description:"用户任务唯一标识符"` // 用户任务唯一标识符
|
Id int64 `json:"id" orm:"id" description:"用户任务唯一标识符"` // 用户任务唯一标识符
|
||||||
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
|
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
|
||||||
TaskId string `json:"taskId" orm:"task_id" description:"腾讯任务ID"` // 腾讯任务ID
|
TaskId string `json:"taskId" orm:"task_id" description:"腾讯任务ID"` // 腾讯任务ID
|
||||||
|
BindType int `json:"bindType" orm:"bind_type"`
|
||||||
Status int `json:"status" orm:"status" description:"任务状态:1=进行中,2=已完成中,3=未完成"` // 任务状态:1=进行中(显示领取按钮),2=已完成
|
Status int `json:"status" orm:"status" description:"任务状态:1=进行中,2=已完成中,3=未完成"` // 任务状态:1=进行中(显示领取按钮),2=已完成
|
||||||
SerialNumber string `json:"serialNumber" orm:"serial_number" description:"流水号,确保用户任务唯一性"` // 流水号,确保用户任务唯一性
|
SerialNumber string `json:"serialNumber" orm:"serial_number" description:"流水号,确保用户任务唯一性"` // 流水号,确保用户任务唯一性
|
||||||
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
|
||||||
|
|||||||
@ -13,4 +13,5 @@ var (
|
|||||||
Auth = New(1000, "账户名或密码不正确")
|
Auth = New(1000, "账户名或密码不正确")
|
||||||
Password = New(1001, "密码不正确")
|
Password = New(1001, "密码不正确")
|
||||||
EmailExist = New(1002, "该邮箱已被注册")
|
EmailExist = New(1002, "该邮箱已被注册")
|
||||||
|
RewardExceedLimited = New(-1, "奖励领取数量超出限制")
|
||||||
)
|
)
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package gamelife
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"server/internal/dao"
|
"server/internal/dao"
|
||||||
@ -423,6 +424,22 @@ func (s *gamelifeClient) RequestActivity(ctx context.Context, in *model.QQNetbar
|
|||||||
if err != nil || resp.IsError() {
|
if err != nil || resp.IsError() {
|
||||||
return nil, ecode.Fail.Sub("请求出现异常")
|
return nil, ecode.Fail.Sub("请求出现异常")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断是否为 -1 的异常
|
||||||
|
type RespData struct {
|
||||||
|
Ret int `json:"ret"`
|
||||||
|
ErrMsg string `json:"err_msg"`
|
||||||
|
ErrDesc string `json:"err_desc"`
|
||||||
|
}
|
||||||
|
var respData RespData
|
||||||
|
if err = json.Unmarshal(resp.Body(), &respData); err != nil {
|
||||||
|
return nil, ecode.Fail.Sub("解析请求结果失败")
|
||||||
|
}
|
||||||
|
if respData.Ret == -1 {
|
||||||
|
glog.Info(ctx, "奖励领取超出限制,-1")
|
||||||
|
return nil, errors.New("奖励领取超出限制,-1")
|
||||||
|
}
|
||||||
|
|
||||||
if result == nil {
|
if result == nil {
|
||||||
return nil, ecode.Fail.Sub("请求结果为空")
|
return nil, ecode.Fail.Sub("请求结果为空")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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