修改奖励领取,新增奖励物品详情查询

This commit is contained in:
chy
2025-06-23 16:10:36 +08:00
parent bbd3968429
commit effc4113dc
29 changed files with 495 additions and 161 deletions

View File

@ -185,13 +185,13 @@ type CallbackRes struct {
}
type GetLiftReq struct {
g.Meta `path:"/reward/getLift" method:"post" tags:"Reward" summary:"(tencent)回调"`
TaskId int64 `json:"taskId" v:"required#任务id不能为空" dc:"任务Id"`
AreaId int64 `json:"areaId" dc:"大区Id"`
GameId int64 `json:"gid" v:"required#游戏id不能为空" dc:"游戏Id"`
RoleIdx string `json:"roleIdx" dc:"角色索引"`
RewradType []int64 `json:"rewardType" v:"required#奖励类型不能为空" dc:"奖励类型"`
Water Water `json:"water" v:"required#物品流水从背包列表获取的water透传回来water类型参考GetGift接口的water结构" dc:"礼包列表"`
g.Meta `path:"/reward/getLift" method:"post" tags:"Reward" summary:"(tencent)奖励领取"`
TaskId string `json:"taskId" v:"required#任务id不能为空" dc:"任务Id"`
AreaId int64 `json:"areaId" dc:"大区Id"`
GameId int64 `json:"gameId" v:"required#游戏id不能为空" dc:"游戏Id"`
RoleIdx string `json:"roleIdx" dc:"角色索引"`
RewradType []int64 `json:"rewardType" dc:"奖励类型"`
PopenId string `json:"popenid" dc:""`
}
type GetLiftRes struct {
@ -238,5 +238,5 @@ type GetGoodsDetailsReq struct {
IsDetail int64 `json:"isDetail" dc:"是否需要物品详情 0默认需要 1不需要"`
}
type GetGoodsDetailsRes struct {
Water *Water `json:"water" dc:"流水信息"`
Water interface{} `json:"water" dc:"流水信息"`
}

View File

@ -17,12 +17,16 @@ func (c *ControllerV1) Callback(ctx context.Context, req *v1.CallbackReq) (res *
timestamp := fromCtx.Header.Get("Custom-Data-Timestamp")
nonce := fromCtx.Header.Get("Custom-Data-Nonce")
auth := fromCtx.Header.Get("Custom-Data-Auth")
glog.Infof(ctx, fmt.Sprintf("appid:%s,timestamp:%s,nonce:%s,auth:%s", appid, timestamp, nonce, auth))
data := fmt.Sprintf("%s%s%s%s%d%d%d%s%s%s#%s", req.Uid, req.OrderId, req.PrizeChannelId, req.PrizeId, req.PrizeType, req.PrizeSubType, req.Num, appid, timestamp, nonce, auth)
stateOri := md5.Sum([]byte(data))
state := hex.EncodeToString(stateOri[:])
myAuth := strings.ToUpper(state)
glog.Infof(ctx, fmt.Sprintf("myAuth:%s,auth:%s", myAuth, auth))
if myAuth != auth {
glog.Infof(ctx, fmt.Sprintf("myAuth:%s,auth:%s", myAuth, auth))
return &v1.CallbackRes{Errcode: 252151000, OrderId: req.OrderId, Datas: []v1.CallbackData{{PrizeCode: req.OrderId}}}, err
}
glog.Infof(ctx, fmt.Sprintf("%s,%s,%s,%s,%d,%d,%d,%s,%s,%s,#%s", req.Uid, req.OrderId, req.PrizeChannelId, req.PrizeId, req.PrizeType, req.PrizeSubType, req.Num, appid, timestamp, nonce, auth))

View File

@ -10,7 +10,7 @@ import (
func (c *ControllerV1) GetGoodsDetails(ctx context.Context, req *v1.GetGoodsDetailsReq) (res *v1.GetGoodsDetailsRes, err error) {
_, err = service.Reward().GetGoodsDetails(ctx, &model.QueryUserGoodsDetailParam{
out, err := service.Reward().GetGoodsDetails(ctx, &model.QueryUserGoodsDetailParam{
WinningTime: req.Winningtime,
OrderId: req.Orderid,
IsActInfo: req.IsActinfo,
@ -22,5 +22,5 @@ func (c *ControllerV1) GetGoodsDetails(ctx context.Context, req *v1.GetGoodsDeta
return nil, err
}
return &v1.GetGoodsDetailsRes{Water: nil}, nil
return &v1.GetGoodsDetailsRes{Water: out.Water}, nil
}

View File

@ -3,22 +3,22 @@ package reward
import (
"context"
"server/api/reward/v1"
"server/internal/model"
"server/internal/service"
)
func (c *ControllerV1) GetLift(ctx context.Context, req *v1.GetLiftReq) (res *v1.GetLiftRes, err error) {
//out, err := service.Reward().GetLift(ctx, &model.GetGoodsGetIn{
// Water: req.Water,
// AreaId: req.AreaId,
// GameId: req.GameId,
// RoleIdx: req.RoleIdx,
//})
//
//if err != nil {
// return nil, err
//}
//return &v1.GetLiftRes{
// List: out.List,
// Result: out.Result,
//}, nil
return nil, err
out, err := service.Reward().GetLift(ctx, &model.GetRewardIn{
GameId: int(req.GameId),
TaskId: req.TaskId,
PopenId: req.PopenId,
})
if err != nil {
return nil, err
}
return &v1.GetLiftRes{
List: out.List,
Result: int64(out.Result),
}, nil
}

View File

@ -13,9 +13,10 @@ import (
// AdminsDao is the data access object for the table admins.
type AdminsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminsColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns AdminsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// AdminsColumns defines and stores column names for the table admins.
@ -49,11 +50,12 @@ var adminsColumns = AdminsColumns{
}
// NewAdminsDao creates and returns a new DAO object for table data access.
func NewAdminsDao() *AdminsDao {
func NewAdminsDao(handlers ...gdb.ModelHandler) *AdminsDao {
return &AdminsDao{
group: "default",
table: "admins",
columns: adminsColumns,
group: "default",
table: "admins",
columns: adminsColumns,
handlers: handlers,
}
}
@ -79,7 +81,11 @@ func (dao *AdminsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *AdminsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// FeedbacksDao is the data access object for the table feedbacks.
type FeedbacksDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns FeedbacksColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns FeedbacksColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// FeedbacksColumns defines and stores column names for the table feedbacks.
@ -51,11 +52,12 @@ var feedbacksColumns = FeedbacksColumns{
}
// NewFeedbacksDao creates and returns a new DAO object for table data access.
func NewFeedbacksDao() *FeedbacksDao {
func NewFeedbacksDao(handlers ...gdb.ModelHandler) *FeedbacksDao {
return &FeedbacksDao{
group: "default",
table: "feedbacks",
columns: feedbacksColumns,
group: "default",
table: "feedbacks",
columns: feedbacksColumns,
handlers: handlers,
}
}
@ -81,7 +83,11 @@ func (dao *FeedbacksDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *FeedbacksDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// GamesDao is the data access object for the table games.
type GamesDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns GamesColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns GamesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// GamesColumns defines and stores column names for the table games.
@ -45,11 +46,12 @@ var gamesColumns = GamesColumns{
}
// NewGamesDao creates and returns a new DAO object for table data access.
func NewGamesDao() *GamesDao {
func NewGamesDao(handlers ...gdb.ModelHandler) *GamesDao {
return &GamesDao{
group: "default",
table: "games",
columns: gamesColumns,
group: "default",
table: "games",
columns: gamesColumns,
handlers: handlers,
}
}
@ -75,7 +77,11 @@ func (dao *GamesDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *GamesDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// MerchantAdminsDao is the data access object for the table merchant_admins.
type MerchantAdminsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns MerchantAdminsColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns MerchantAdminsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// MerchantAdminsColumns defines and stores column names for the table merchant_admins.
@ -57,11 +58,12 @@ var merchantAdminsColumns = MerchantAdminsColumns{
}
// NewMerchantAdminsDao creates and returns a new DAO object for table data access.
func NewMerchantAdminsDao() *MerchantAdminsDao {
func NewMerchantAdminsDao(handlers ...gdb.ModelHandler) *MerchantAdminsDao {
return &MerchantAdminsDao{
group: "default",
table: "merchant_admins",
columns: merchantAdminsColumns,
group: "default",
table: "merchant_admins",
columns: merchantAdminsColumns,
handlers: handlers,
}
}
@ -87,7 +89,11 @@ func (dao *MerchantAdminsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *MerchantAdminsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// MerchantsDao is the data access object for the table merchants.
type MerchantsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns MerchantsColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns MerchantsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// MerchantsColumns defines and stores column names for the table merchants.
@ -71,11 +72,12 @@ var merchantsColumns = MerchantsColumns{
}
// NewMerchantsDao creates and returns a new DAO object for table data access.
func NewMerchantsDao() *MerchantsDao {
func NewMerchantsDao(handlers ...gdb.ModelHandler) *MerchantsDao {
return &MerchantsDao{
group: "default",
table: "merchants",
columns: merchantsColumns,
group: "default",
table: "merchants",
columns: merchantsColumns,
handlers: handlers,
}
}
@ -101,7 +103,11 @@ func (dao *MerchantsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *MerchantsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// RewardTypesDao is the data access object for the table reward_types.
type RewardTypesDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns RewardTypesColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns RewardTypesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// RewardTypesColumns defines and stores column names for the table reward_types.
@ -45,11 +46,12 @@ var rewardTypesColumns = RewardTypesColumns{
}
// NewRewardTypesDao creates and returns a new DAO object for table data access.
func NewRewardTypesDao() *RewardTypesDao {
func NewRewardTypesDao(handlers ...gdb.ModelHandler) *RewardTypesDao {
return &RewardTypesDao{
group: "default",
table: "reward_types",
columns: rewardTypesColumns,
group: "default",
table: "reward_types",
columns: rewardTypesColumns,
handlers: handlers,
}
}
@ -75,7 +77,11 @@ func (dao *RewardTypesDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *RewardTypesDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -0,0 +1,95 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// RewardWatersDao is the data access object for the table reward_waters.
type RewardWatersDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns RewardWatersColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// RewardWatersColumns defines and stores column names for the table reward_waters.
type RewardWatersColumns struct {
Id string //
OrderId string // 订单号
Uid string // 用户账号
TaskId string // 任务 id
Water string // 兑换流水
Status string // 兑换状态 1:奖励发放成功 2:奖励兑换失败(礼包发放背包环节成功,需重新引导领奖) 3:针对只需要发背包,然后引导用户到人生应用背包领奖的奖励类型,发奖成功了 4:water错误(一般是 orderid),不做兑换操作
CreatedAt string //
UpdatedAt string //
DeletedAt string //
}
// rewardWatersColumns holds the columns for the table reward_waters.
var rewardWatersColumns = RewardWatersColumns{
Id: "id",
OrderId: "order_id",
Uid: "uid",
TaskId: "task_id",
Water: "water",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewRewardWatersDao creates and returns a new DAO object for table data access.
func NewRewardWatersDao(handlers ...gdb.ModelHandler) *RewardWatersDao {
return &RewardWatersDao{
group: "default",
table: "reward_waters",
columns: rewardWatersColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *RewardWatersDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *RewardWatersDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *RewardWatersDao) Columns() RewardWatersColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *RewardWatersDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *RewardWatersDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *RewardWatersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -13,9 +13,10 @@ import (
// RewardsDao is the data access object for the table rewards.
type RewardsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns RewardsColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns RewardsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// RewardsColumns defines and stores column names for the table rewards.
@ -53,11 +54,12 @@ var rewardsColumns = RewardsColumns{
}
// NewRewardsDao creates and returns a new DAO object for table data access.
func NewRewardsDao() *RewardsDao {
func NewRewardsDao(handlers ...gdb.ModelHandler) *RewardsDao {
return &RewardsDao{
group: "default",
table: "rewards",
columns: rewardsColumns,
group: "default",
table: "rewards",
columns: rewardsColumns,
handlers: handlers,
}
}
@ -83,7 +85,11 @@ func (dao *RewardsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *RewardsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// RolesDao is the data access object for the table roles.
type RolesDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns RolesColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns RolesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// RolesColumns defines and stores column names for the table roles.
@ -47,11 +48,12 @@ var rolesColumns = RolesColumns{
}
// NewRolesDao creates and returns a new DAO object for table data access.
func NewRolesDao() *RolesDao {
func NewRolesDao(handlers ...gdb.ModelHandler) *RolesDao {
return &RolesDao{
group: "default",
table: "roles",
columns: rolesColumns,
group: "default",
table: "roles",
columns: rolesColumns,
handlers: handlers,
}
}
@ -77,7 +79,11 @@ func (dao *RolesDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *RolesDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// StoreAdminsDao is the data access object for the table store_admins.
type StoreAdminsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoreAdminsColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoreAdminsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// StoreAdminsColumns defines and stores column names for the table store_admins.
@ -57,11 +58,12 @@ var storeAdminsColumns = StoreAdminsColumns{
}
// NewStoreAdminsDao creates and returns a new DAO object for table data access.
func NewStoreAdminsDao() *StoreAdminsDao {
func NewStoreAdminsDao(handlers ...gdb.ModelHandler) *StoreAdminsDao {
return &StoreAdminsDao{
group: "default",
table: "store_admins",
columns: storeAdminsColumns,
group: "default",
table: "store_admins",
columns: storeAdminsColumns,
handlers: handlers,
}
}
@ -87,7 +89,11 @@ func (dao *StoreAdminsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoreAdminsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// StoreDesktopSettingsDao is the data access object for the table store_desktop_settings.
type StoreDesktopSettingsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoreDesktopSettingsColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoreDesktopSettingsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// StoreDesktopSettingsColumns defines and stores column names for the table store_desktop_settings.
@ -33,11 +34,12 @@ var storeDesktopSettingsColumns = StoreDesktopSettingsColumns{
}
// NewStoreDesktopSettingsDao creates and returns a new DAO object for table data access.
func NewStoreDesktopSettingsDao() *StoreDesktopSettingsDao {
func NewStoreDesktopSettingsDao(handlers ...gdb.ModelHandler) *StoreDesktopSettingsDao {
return &StoreDesktopSettingsDao{
group: "default",
table: "store_desktop_settings",
columns: storeDesktopSettingsColumns,
group: "default",
table: "store_desktop_settings",
columns: storeDesktopSettingsColumns,
handlers: handlers,
}
}
@ -63,7 +65,11 @@ func (dao *StoreDesktopSettingsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoreDesktopSettingsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// StoreRolesDao is the data access object for the table store_roles.
type StoreRolesDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoreRolesColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoreRolesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// StoreRolesColumns defines and stores column names for the table store_roles.
@ -39,11 +40,12 @@ var storeRolesColumns = StoreRolesColumns{
}
// NewStoreRolesDao creates and returns a new DAO object for table data access.
func NewStoreRolesDao() *StoreRolesDao {
func NewStoreRolesDao(handlers ...gdb.ModelHandler) *StoreRolesDao {
return &StoreRolesDao{
group: "default",
table: "store_roles",
columns: storeRolesColumns,
group: "default",
table: "store_roles",
columns: storeRolesColumns,
handlers: handlers,
}
}
@ -69,7 +71,11 @@ func (dao *StoreRolesDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoreRolesDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// StoreTaskRewardsDao is the data access object for the table store_task_rewards.
type StoreTaskRewardsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoreTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoreTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// StoreTaskRewardsColumns defines and stores column names for the table store_task_rewards.
@ -41,11 +42,12 @@ var storeTaskRewardsColumns = StoreTaskRewardsColumns{
}
// NewStoreTaskRewardsDao creates and returns a new DAO object for table data access.
func NewStoreTaskRewardsDao() *StoreTaskRewardsDao {
func NewStoreTaskRewardsDao(handlers ...gdb.ModelHandler) *StoreTaskRewardsDao {
return &StoreTaskRewardsDao{
group: "default",
table: "store_task_rewards",
columns: storeTaskRewardsColumns,
group: "default",
table: "store_task_rewards",
columns: storeTaskRewardsColumns,
handlers: handlers,
}
}
@ -71,7 +73,11 @@ func (dao *StoreTaskRewardsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoreTaskRewardsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// StoresDao is the data access object for the table stores.
type StoresDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoresColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoresColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// StoresColumns defines and stores column names for the table stores.
@ -51,11 +52,12 @@ var storesColumns = StoresColumns{
}
// NewStoresDao creates and returns a new DAO object for table data access.
func NewStoresDao() *StoresDao {
func NewStoresDao(handlers ...gdb.ModelHandler) *StoresDao {
return &StoresDao{
group: "default",
table: "stores",
columns: storesColumns,
group: "default",
table: "stores",
columns: storesColumns,
handlers: handlers,
}
}
@ -81,7 +83,11 @@ func (dao *StoresDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoresDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// TasksDao is the data access object for the table tasks.
type TasksDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns TasksColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns TasksColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// TasksColumns defines and stores column names for the table tasks.
@ -57,11 +58,12 @@ var tasksColumns = TasksColumns{
}
// NewTasksDao creates and returns a new DAO object for table data access.
func NewTasksDao() *TasksDao {
func NewTasksDao(handlers ...gdb.ModelHandler) *TasksDao {
return &TasksDao{
group: "default",
table: "tasks",
columns: tasksColumns,
group: "default",
table: "tasks",
columns: tasksColumns,
handlers: handlers,
}
}
@ -87,7 +89,11 @@ func (dao *TasksDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *TasksDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// UserTasksDao is the data access object for the table user_tasks.
type UserTasksDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns UserTasksColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns UserTasksColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// UserTasksColumns defines and stores column names for the table user_tasks.
@ -51,11 +52,12 @@ var userTasksColumns = UserTasksColumns{
}
// NewUserTasksDao creates and returns a new DAO object for table data access.
func NewUserTasksDao() *UserTasksDao {
func NewUserTasksDao(handlers ...gdb.ModelHandler) *UserTasksDao {
return &UserTasksDao{
group: "default",
table: "user_tasks",
columns: userTasksColumns,
group: "default",
table: "user_tasks",
columns: userTasksColumns,
handlers: handlers,
}
}
@ -81,7 +83,11 @@ func (dao *UserTasksDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *UserTasksDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// UsersDao is the data access object for the table users.
type UsersDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns UsersColumns // columns contains all the column names of Table for convenient usage.
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns UsersColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// UsersColumns defines and stores column names for the table users.
@ -59,11 +60,12 @@ var usersColumns = UsersColumns{
}
// NewUsersDao creates and returns a new DAO object for table data access.
func NewUsersDao() *UsersDao {
func NewUsersDao(handlers ...gdb.ModelHandler) *UsersDao {
return &UsersDao{
group: "default",
table: "users",
columns: usersColumns,
group: "default",
table: "users",
columns: usersColumns,
handlers: handlers,
}
}
@ -89,7 +91,11 @@ func (dao *UsersDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *UsersDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -0,0 +1,22 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// rewardWatersDao is the data access object for the table reward_waters.
// You can define custom methods on it to extend its functionality as needed.
type rewardWatersDao struct {
*internal.RewardWatersDao
}
var (
// RewardWaters is a globally accessible object for table reward_waters operations.
RewardWaters = rewardWatersDao{internal.NewRewardWatersDao()}
)
// Add your custom methods and functionality below.

View File

@ -2,6 +2,7 @@ package reward
import (
"context"
"encoding/json"
"fmt"
"server/internal/consts"
"server/internal/dao"
@ -319,7 +320,8 @@ func (s *sReward) List(ctx context.Context, in *model.RewardListIn) (out *model.
}, nil
}
func (s *sReward) GetLift(ctx context.Context, in *model.RewardCallbackIn) (out *model.RewardCallbackOut, err error) {
// GetLift 领取奖励
func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *model.GetRewardOut, err error) {
// 遍历奖励类型列表
//for _, v := range in.RewradTypeId {
@ -332,22 +334,40 @@ func (s *sReward) GetLift(ctx context.Context, in *model.RewardCallbackIn) (out
// }
//}
activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{ServiceName: consts.GetGift, GiftParam: model.GiftParam{
activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{PopenId: in.PopenId, ServiceName: consts.GetGift, GiftParam: model.GiftParam{
TaskId: in.TaskId,
AreaId: in.AreaId,
Gid: in.GameId,
RoleIdx: in.RoleIdx,
}})
_, ok := activity.(*model.GiftResponse)
if err != nil {
return nil, err
}
result, ok := activity.(*model.GiftResponse)
if !ok {
return nil, ecode.Fail.Sub("数据类型转换失败")
}
// 存储数据库记录
//for _, item := range result.GiftItem {
// item.Result
//}
for _, item := range result.GiftItem {
marshal, err := json.Marshal(item.Water)
if err != nil {
return nil, ecode.Fail.Sub("序列化 json 数据出现异常")
}
_, err = dao.RewardWaters.Ctx(ctx).Insert(model.RewardWaters{
OrderId: item.Water.OrderId,
Status: int64(item.Water.Status),
Uid: item.Water.Uid,
TaskId: "BZD",
Water: string(marshal),
})
if err != nil {
return nil, ecode.Fail.Sub("添加奖励领取记录异常")
}
}
return nil, err
}
@ -399,5 +419,25 @@ func (s *sReward) GetGoods(ctx context.Context, in *model.GetGoodsGetIn) (out *m
func (s *sReward) GetGoodsDetails(ctx context.Context, in *model.QueryUserGoodsDetailParam) (out *model.QueryUserGoodsDetailResponse, err error) {
//
return nil, err
activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{ServiceName: consts.QueryUserGoodsDetail, QueryUserGoodsDetailParam: model.QueryUserGoodsDetailParam{
Gid: in.Gid,
WinningTime: in.WinningTime,
OrderId: in.OrderId,
IsActInfo: in.IsActInfo,
IsDocument: in.IsDocument,
IsDetail: in.IsDetail,
}})
if err != nil {
return nil, err
}
result, ok := activity.(*model.QueryUserGoodsDetailResponse)
if !ok {
return nil, ecode.Fail.Sub("数据类型转换失败")
}
return &model.QueryUserGoodsDetailResponse{
Water: result.Water,
}, nil
}

View File

@ -0,0 +1,24 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// RewardWaters is the golang structure of table reward_waters for DAO operations like Where/Data.
type RewardWaters struct {
g.Meta `orm:"table:reward_waters, do:true"`
Id interface{} //
OrderId interface{} // 订单号
Uid interface{} // 用户账号
TaskId interface{} // 任务 id
Water interface{} // 兑换流水
Status interface{} // 兑换状态 1:奖励发放成功 2:奖励兑换失败(礼包发放背包环节成功,需重新引导领奖) 3:针对只需要发背包,然后引导用户到人生应用背包领奖的奖励类型,发奖成功了 4:water错误(一般是 orderid),不做兑换操作
CreatedAt *gtime.Time //
UpdatedAt *gtime.Time //
DeletedAt *gtime.Time //
}

View File

@ -0,0 +1,22 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// RewardWaters is the golang structure for table reward_waters.
type RewardWaters struct {
Id int64 `json:"id" orm:"id" description:""` //
OrderId string `json:"orderId" orm:"order_id" description:"订单号"` // 订单号
Uid string `json:"uid" orm:"uid" description:"用户账号"` // 用户账号
TaskId string `json:"taskId" orm:"task_id" description:"任务 id"` // 任务 id
Water string `json:"water" orm:"water" description:"兑换流水"` // 兑换流水
Status int64 `json:"status" orm:"status" description:"兑换状态 1:奖励发放成功 2:奖励兑换失败(礼包发放背包环节成功,需重新引导领奖) 3:针对只需要发背包,然后引导用户到人生应用背包领奖的奖励类型,发奖成功了 4:water错误(一般是 orderid),不做兑换操作"` // 兑换状态 1:奖励发放成功 2:奖励兑换失败(礼包发放背包环节成功,需重新引导领奖) 3:针对只需要发背包,然后引导用户到人生应用背包领奖的奖励类型,发奖成功了 4:water错误(一般是 orderid),不做兑换操作
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:""` //
}

View File

@ -100,6 +100,20 @@ type RewardCallbackIn struct {
TaskId string
}
type GetRewardIn struct {
AreaId int
GameId int
RewradTypeId []int
RoleIdx string
TaskId string
PopenId string
}
type GetRewardOut struct {
List interface{} `json:"list"`
Result int64 `json:"result"`
Water Water `json:"water"`
}
type Water struct {
}

View File

@ -0,0 +1,15 @@
package model
import "github.com/gogf/gf/v2/os/gtime"
type RewardWaters struct {
Id int64 `json:"id" orm:"id" description:""` //
OrderId string `json:"orderId" orm:"order_id" description:"订单号"` // 订单号
Uid string `json:"uid" orm:"uid" description:"用户账号"` // 用户账号
TaskId string `json:"taskId" orm:"task_id" description:"任务 id"` // 任务 id
Water string `json:"water" orm:"water" description:"兑换流水"` // 兑换流水
Status int64 `json:"status" orm:"status" description:"兑换状态 1:奖励发放成功 2:奖励兑换失败(礼包发放背包环节成功,需重新引导领奖) 3:针对只需要发背包,然后引导用户到人生应用背包领奖的奖励类型,发奖成功了 4:water错误(一般是 orderid),不做兑换操作"` // 兑换状态 1:奖励发放成功 2:奖励兑换失败(礼包发放背包环节成功,需重新引导领奖) 3:针对只需要发背包,然后引导用户到人生应用背包领奖的奖励类型,发奖成功了 4:water错误(一般是 orderid),不做兑换操作
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:""` //
}

View File

@ -20,7 +20,7 @@ type (
Delete(ctx context.Context, in *model.RewardDeleteIn) (out *model.RewardDeleteOut, err error)
// List 奖励列表
List(ctx context.Context, in *model.RewardListIn) (out *model.RewardListOut, err error)
GetLift(ctx context.Context, in *model.RewardCallbackIn) (out *model.RewardCallbackOut, err error)
GetLift(ctx context.Context, in *model.GetRewardIn) (out *model.GetRewardOut, err error)
// GetGoodsList 调用外部获取物品列表
GetGoodsList(ctx context.Context, in *model.GetGoodsListIn) (out *model.GetGoodsListOut, err error)
// GetGoods 物品兑换

View File

@ -47,6 +47,8 @@ func init() {
// 游戏列表
enforcer.AddPolicy("guest", "/x/game", "GET", "获取游戏列表")
enforcer.AddPolicy("guest", "/x/reward/callback", "POST", "tencent奖励回调")
enforcer.AddPolicy("guest", "/x/reward/getLift", "POST", "tencent奖励领取")
}
// 用户
{