实现用户领取任务时,创建对应的奖励记录
This commit is contained in:
@ -27,8 +27,8 @@ type CreateReq struct {
|
|||||||
RewardTypeId int64 `json:"rewardTypeId" v:"required#奖励类型ID不能为空" dc:"奖励类型ID"`
|
RewardTypeId int64 `json:"rewardTypeId" v:"required#奖励类型ID不能为空" dc:"奖励类型ID"`
|
||||||
GameId int64 `json:"gameId" dc:"游戏ID"`
|
GameId int64 `json:"gameId" dc:"游戏ID"`
|
||||||
RewardImg string `json:"rewardImg" dc:"奖励图片"`
|
RewardImg string `json:"rewardImg" dc:"奖励图片"`
|
||||||
QQGoodsId string `json:"qqGoodsId" v:"required#不能为空" dc:"QQ网吧物品ID"`
|
QQGoodsId string `json:"qqGoodsId" dc:"QQ网吧物品ID"`
|
||||||
QQGoodsIdStr string `json:"qqGoodsIdStr" v:"required#不能为空" dc:"QQ网吧物品ID字符串"`
|
QQGoodsIdStr string `json:"qqGoodsIdStr" dc:"QQ网吧物品ID字符串"`
|
||||||
Status int `json:"status" dc:"状态" d:"1:启用 2:禁用"`
|
Status int `json:"status" dc:"状态" d:"1:启用 2:禁用"`
|
||||||
ExpireType int `json:"expireType" v:"required#过期类型只能为1或2" dc:"过期类型"`
|
ExpireType int `json:"expireType" v:"required#过期类型只能为1或2" dc:"过期类型"`
|
||||||
ValidFrom *gtime.Time `json:"validFrom" dc:"有效开始时间(expire_type=1 时使用)"`
|
ValidFrom *gtime.Time `json:"validFrom" dc:"有效开始时间(expire_type=1 时使用)"`
|
||||||
|
|||||||
@ -75,10 +75,10 @@ type SelectorRes struct {
|
|||||||
// GetTaskReq 添加任务记录
|
// GetTaskReq 添加任务记录
|
||||||
type GetTaskReq struct {
|
type GetTaskReq struct {
|
||||||
g.Meta `path:"/task/get" method:"post" tags:"Task" summary:"(PC)任务领取"`
|
g.Meta `path:"/task/get" method:"post" tags:"Task" summary:"(PC)任务领取"`
|
||||||
TaskId int `json:"taskId" v:"required#任务id不能为空" dc:"任务id"`
|
TaskId string `json:"taskId" v:"required#任务id不能为空" dc:"任务id"`
|
||||||
StoreId int `json:"storeId" dc:"门店 id、网关账号必传一个"`
|
StoreId int `json:"storeId" dc:"门店 id、网关账号必传一个"`
|
||||||
NetBarAccount string `json:"netBarAccount" dc:"门店 id、网关账号必传一个"`
|
NetBarAccount string `json:"netBarAccount" dc:"门店 id、网关账号必传一个"`
|
||||||
GameId int `json:"gid" v:"required#游戏唯一id不能为空" dc:"游戏唯一id"`
|
GameId int `json:"gameId" v:"required#游戏唯一id不能为空" dc:"游戏唯一id"`
|
||||||
TaskName string `json:"taskName" v:"required#任务名称不能为空" dc:"任务名称"`
|
TaskName string `json:"taskName" v:"required#任务名称不能为空" dc:"任务名称"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gogf/gf/v2/database/gdb"
|
"github.com/gogf/gf/v2/database/gdb"
|
||||||
|
"github.com/gogf/gf/v2/util/guid"
|
||||||
"server/internal/consts"
|
"server/internal/consts"
|
||||||
"server/internal/dao"
|
"server/internal/dao"
|
||||||
"server/internal/model"
|
"server/internal/model"
|
||||||
@ -359,6 +360,7 @@ func (s *sTask) GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.Ge
|
|||||||
return ecode.Fail.Sub("创建用户任务记录失败")
|
return ecode.Fail.Sub("创建用户任务记录失败")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snowid.GetSnowClient()
|
||||||
// 查询该任务相关联的奖励, 创建对应奖励下发记录id
|
// 查询该任务相关联的奖励, 创建对应奖励下发记录id
|
||||||
array, err := dao.TaskRewards.Ctx(ctx).Where(do.TaskRewards{TaskId: in.TaskId}).Fields(dao.TaskRewards.Columns().RewardId).Array()
|
array, err := dao.TaskRewards.Ctx(ctx).Where(do.TaskRewards{TaskId: in.TaskId}).Fields(dao.TaskRewards.Columns().RewardId).Array()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -369,6 +371,7 @@ func (s *sTask) GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.Ge
|
|||||||
UserTaskId: id,
|
UserTaskId: id,
|
||||||
RewardId: v.Int64(),
|
RewardId: v.Int64(),
|
||||||
Status: consts.RewardInitStatus,
|
Status: consts.RewardInitStatus,
|
||||||
|
InnerOrderId: fmt.Sprintf("reward%s", guid.S()),
|
||||||
}).Insert()
|
}).Insert()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ecode.Fail.Sub("创建用户任务奖励记录失败")
|
return ecode.Fail.Sub("创建用户任务奖励记录失败")
|
||||||
|
|||||||
@ -59,7 +59,7 @@ type LoginUserRankingNum struct {
|
|||||||
|
|
||||||
// GetTaskIn 添加任务记录入参
|
// GetTaskIn 添加任务记录入参
|
||||||
type GetTaskIn struct {
|
type GetTaskIn struct {
|
||||||
TaskId int `json:"taskId"`
|
TaskId string `json:"taskId"`
|
||||||
StoreId int `json:"storeId"`
|
StoreId int `json:"storeId"`
|
||||||
NetBarAccount string `json:"netBarAccount"`
|
NetBarAccount string `json:"netBarAccount"`
|
||||||
UserId int `json:"userId"`
|
UserId int `json:"userId"`
|
||||||
|
|||||||
Reference in New Issue
Block a user