新增奖励回调接口,调整奖励领取接口

This commit is contained in:
chy
2025-06-25 20:57:41 +08:00
parent 853ee2190a
commit ecee39efff
33 changed files with 679 additions and 179 deletions

View File

@ -202,21 +202,23 @@ type CallbackData struct {
Comment string `json:"comment"` Comment string `json:"comment"`
} }
type CallbackRes struct { type CallbackRes struct {
Errcode int32 `json:"errcode"` Errcode int32 `json:"errcode"`
Errmsg string `json:"errmsg"` Errmsg string `json:"errmsg"`
AppId string `json:"appid"` AppId string `json:"appid"`
OrderId string `json:"order_id"` OrderId string `json:"order_id"`
Datas []CallbackData `json:"data"` //Datas []CallbackData `json:"data"`
Datas interface{} `json:"data"`
} }
type GetLiftReq struct { type GetLiftReq struct {
g.Meta `path:"/reward/getLift" method:"post" tags:"Reward" summary:"(tencent)奖励领取"` g.Meta `path:"/reward/getLift" method:"post" tags:"Reward" summary:"(tencent)奖励领取"`
TaskId string `json:"taskId" v:"required#任务id不能为空" dc:"任务Id"` TaskId string `json:"taskId" v:"required#任务id不能为空" dc:"任务Id"`
AreaId int64 `json:"areaId" dc:"大区Id"` AreaId int64 `json:"areaId" dc:"大区Id"`
GameId int64 `json:"gameId" v:"required#游戏id不能为空" dc:"游戏Id"` GameId int64 `json:"gameId" v:"required#游戏id不能为空" dc:"游戏Id"`
RoleIdx string `json:"roleIdx" dc:"角色索引"` RoleIdx string `json:"roleIdx" dc:"角色索引"`
RewradType []int64 `json:"rewardType" dc:"奖励类型"` RewradType int64 `json:"rewardType" v:"required#奖励类型不能为空" dc:"奖励类型"`
PopenId string `json:"popenid" dc:""` PopenId string `json:"popenid" dc:""`
Source int `json:"source" v:"required#来源不能为空" dc:"来源" d:"1:系统 2:门店"`
} }
type GetLiftRes struct { type GetLiftRes struct {

View File

@ -8,6 +8,8 @@ import (
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/glog" "github.com/gogf/gf/v2/os/glog"
"server/api/reward/v1" "server/api/reward/v1"
"server/internal/model"
"server/internal/service"
"strings" "strings"
) )
@ -30,5 +32,29 @@ func (c *ControllerV1) Callback(ctx context.Context, req *v1.CallbackReq) (res *
return &v1.CallbackRes{Errcode: 252151000, OrderId: req.OrderId, Datas: []v1.CallbackData{{PrizeCode: req.OrderId}}}, err 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)) 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))
return &v1.CallbackRes{Errcode: 0, OrderId: req.OrderId, Datas: []v1.CallbackData{{PrizeCode: req.OrderId}}}, err
out, err := service.Reward().CallBack(ctx, &model.RewardCallbackIn{
Uid: req.Uid,
CustomInfo: req.CustomInfo,
OrderId: req.OrderId,
PrizeChannelId: req.PrizeChannelId,
PrizeId: req.PrizeId,
PrizeType: int(req.PrizeType),
PrizeSubType: int(req.PrizeSubType),
Num: int(req.Num),
})
if err != nil {
return nil, err
}
return &v1.CallbackRes{
AppId: appid,
Datas: out.Datas,
Errcode: out.Errcode,
Errmsg: out.Errmsg,
OrderId: out.OrderId,
}, nil
//return &v1.CallbackRes{Errcode: 0, OrderId: req.OrderId, Datas: []v1.CallbackData{{PrizeCode: req.OrderId}}}, err
} }

View File

@ -9,9 +9,13 @@ import (
func (c *ControllerV1) GetLift(ctx context.Context, req *v1.GetLiftReq) (res *v1.GetLiftRes, err error) { func (c *ControllerV1) GetLift(ctx context.Context, req *v1.GetLiftReq) (res *v1.GetLiftRes, err error) {
out, err := service.Reward().GetLift(ctx, &model.GetRewardIn{ out, err := service.Reward().GetLift(ctx, &model.GetRewardIn{
GameId: int(req.GameId), GameId: int(req.GameId),
TaskId: req.TaskId, TaskId: req.TaskId,
PopenId: req.PopenId, PopenId: req.PopenId,
RewradTypeId: int(req.RewradType),
RoleIdx: req.RoleIdx,
AreaId: int(req.AreaId),
Source: req.Source,
}) })
if err != nil { if err != nil {

View File

@ -13,9 +13,10 @@ import (
// AdminsDao is the data access object for the table admins. // AdminsDao is the data access object for the table admins.
type AdminsDao struct { type AdminsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewAdminsDao creates and returns a new DAO object for table data access.
func NewAdminsDao() *AdminsDao { func NewAdminsDao(handlers ...gdb.ModelHandler) *AdminsDao {
return &AdminsDao{ return &AdminsDao{
group: "default", group: "default",
table: "admins", table: "admins",
columns: adminsColumns, 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. // 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 { 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. // 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. // FeedbacksDao is the data access object for the table feedbacks.
type FeedbacksDao struct { type FeedbacksDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewFeedbacksDao creates and returns a new DAO object for table data access.
func NewFeedbacksDao() *FeedbacksDao { func NewFeedbacksDao(handlers ...gdb.ModelHandler) *FeedbacksDao {
return &FeedbacksDao{ return &FeedbacksDao{
group: "default", group: "default",
table: "feedbacks", table: "feedbacks",
columns: feedbacksColumns, 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. // 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 { 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. // 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. // GamesDao is the data access object for the table games.
type GamesDao struct { type GamesDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewGamesDao creates and returns a new DAO object for table data access.
func NewGamesDao() *GamesDao { func NewGamesDao(handlers ...gdb.ModelHandler) *GamesDao {
return &GamesDao{ return &GamesDao{
group: "default", group: "default",
table: "games", table: "games",
columns: gamesColumns, 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. // 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 { 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. // 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. // MerchantAdminsDao is the data access object for the table merchant_admins.
type MerchantAdminsDao struct { type MerchantAdminsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewMerchantAdminsDao creates and returns a new DAO object for table data access.
func NewMerchantAdminsDao() *MerchantAdminsDao { func NewMerchantAdminsDao(handlers ...gdb.ModelHandler) *MerchantAdminsDao {
return &MerchantAdminsDao{ return &MerchantAdminsDao{
group: "default", group: "default",
table: "merchant_admins", table: "merchant_admins",
columns: merchantAdminsColumns, 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. // 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 { 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. // 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. // MerchantsDao is the data access object for the table merchants.
type MerchantsDao struct { type MerchantsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewMerchantsDao creates and returns a new DAO object for table data access.
func NewMerchantsDao() *MerchantsDao { func NewMerchantsDao(handlers ...gdb.ModelHandler) *MerchantsDao {
return &MerchantsDao{ return &MerchantsDao{
group: "default", group: "default",
table: "merchants", table: "merchants",
columns: merchantsColumns, 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. // 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 { 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. // Transaction wraps the transaction logic using function f.

View File

@ -0,0 +1,99 @@
// ==========================================================================
// 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"
)
// NoticesDao is the data access object for the table notices.
type NoticesDao 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 NoticesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// NoticesColumns defines and stores column names for the table notices.
type NoticesColumns struct {
Id string // 通知ID
Title string // 通知标题
Content string // 通知内容
Type string // 通知类型1=系统公告2=活动通知3=维护通知
Status string // 状态0=关闭1=发布
VisibleTo string // 可见范围1=所有人2=仅门店3=仅用户
MerchantId string // 所属商户ID
StoreId string // 所属门店ID
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// noticesColumns holds the columns for the table notices.
var noticesColumns = NoticesColumns{
Id: "id",
Title: "title",
Content: "content",
Type: "type",
Status: "status",
VisibleTo: "visible_to",
MerchantId: "merchant_id",
StoreId: "store_id",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewNoticesDao creates and returns a new DAO object for table data access.
func NewNoticesDao(handlers ...gdb.ModelHandler) *NoticesDao {
return &NoticesDao{
group: "default",
table: "notices",
columns: noticesColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *NoticesDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *NoticesDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *NoticesDao) Columns() NoticesColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *NoticesDao) 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 *NoticesDao) 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 *NoticesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, 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"
)
// RewardCallbackDao is the data access object for the table reward_callback.
type RewardCallbackDao 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 RewardCallbackColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// RewardCallbackColumns defines and stores column names for the table reward_callback.
type RewardCallbackColumns struct {
Id string //
Uid string // 用户账号
OrderId string // 订单号必须保证全局唯一(保证接口幂等)
PrizeChannelId string // 券渠道 ID
PrizeId string // 券 ID
PrizeType string // 奖励类型1 网鱼积分2 网鱼经验值3 网鱼兑换码
PrizeSubType string // 奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等
Num string // 奖励个数,默认 1比如经验值 10
CustomInfo string // 透传字段 (json串)
}
// rewardCallbackColumns holds the columns for the table reward_callback.
var rewardCallbackColumns = RewardCallbackColumns{
Id: "id",
Uid: "uid",
OrderId: "order_id",
PrizeChannelId: "prize_channel_id",
PrizeId: "prize_id",
PrizeType: "prize_type",
PrizeSubType: "prize_sub_type",
Num: "num",
CustomInfo: "custom_info",
}
// NewRewardCallbackDao creates and returns a new DAO object for table data access.
func NewRewardCallbackDao(handlers ...gdb.ModelHandler) *RewardCallbackDao {
return &RewardCallbackDao{
group: "default",
table: "reward_callback",
columns: rewardCallbackColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *RewardCallbackDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *RewardCallbackDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *RewardCallbackDao) Columns() RewardCallbackColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *RewardCallbackDao) 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 *RewardCallbackDao) 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 *RewardCallbackDao) 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 (
// RewardTypesDao is the data access object for the table reward_types. // RewardTypesDao is the data access object for the table reward_types.
type RewardTypesDao struct { type RewardTypesDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // RewardTypesColumns defines and stores column names for the table reward_types.
@ -43,11 +44,12 @@ var rewardTypesColumns = RewardTypesColumns{
} }
// NewRewardTypesDao creates and returns a new DAO object for table data access. // NewRewardTypesDao creates and returns a new DAO object for table data access.
func NewRewardTypesDao() *RewardTypesDao { func NewRewardTypesDao(handlers ...gdb.ModelHandler) *RewardTypesDao {
return &RewardTypesDao{ return &RewardTypesDao{
group: "default", group: "default",
table: "reward_types", table: "reward_types",
columns: rewardTypesColumns, columns: rewardTypesColumns,
handlers: handlers,
} }
} }
@ -73,7 +75,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. // 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 { 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. // Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// RewardsDao is the data access object for the table rewards. // RewardsDao is the data access object for the table rewards.
type RewardsDao struct { type RewardsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // RewardsColumns defines and stores column names for the table rewards.
@ -71,11 +72,12 @@ var rewardsColumns = RewardsColumns{
} }
// NewRewardsDao creates and returns a new DAO object for table data access. // NewRewardsDao creates and returns a new DAO object for table data access.
func NewRewardsDao() *RewardsDao { func NewRewardsDao(handlers ...gdb.ModelHandler) *RewardsDao {
return &RewardsDao{ return &RewardsDao{
group: "default", group: "default",
table: "rewards", table: "rewards",
columns: rewardsColumns, columns: rewardsColumns,
handlers: handlers,
} }
} }
@ -101,7 +103,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. // 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 { 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. // 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. // RolesDao is the data access object for the table roles.
type RolesDao struct { type RolesDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewRolesDao creates and returns a new DAO object for table data access.
func NewRolesDao() *RolesDao { func NewRolesDao(handlers ...gdb.ModelHandler) *RolesDao {
return &RolesDao{ return &RolesDao{
group: "default", group: "default",
table: "roles", table: "roles",
columns: rolesColumns, 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. // 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 { 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. // 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. // StoreAdminsDao is the data access object for the table store_admins.
type StoreAdminsDao struct { type StoreAdminsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewStoreAdminsDao creates and returns a new DAO object for table data access.
func NewStoreAdminsDao() *StoreAdminsDao { func NewStoreAdminsDao(handlers ...gdb.ModelHandler) *StoreAdminsDao {
return &StoreAdminsDao{ return &StoreAdminsDao{
group: "default", group: "default",
table: "store_admins", table: "store_admins",
columns: storeAdminsColumns, 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. // 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 { 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. // 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. // StoreDesktopSettingsDao is the data access object for the table store_desktop_settings.
type StoreDesktopSettingsDao struct { type StoreDesktopSettingsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewStoreDesktopSettingsDao creates and returns a new DAO object for table data access.
func NewStoreDesktopSettingsDao() *StoreDesktopSettingsDao { func NewStoreDesktopSettingsDao(handlers ...gdb.ModelHandler) *StoreDesktopSettingsDao {
return &StoreDesktopSettingsDao{ return &StoreDesktopSettingsDao{
group: "default", group: "default",
table: "store_desktop_settings", table: "store_desktop_settings",
columns: storeDesktopSettingsColumns, 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. // 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 { 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. // Transaction wraps the transaction logic using function f.

View File

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

View File

@ -13,9 +13,10 @@ import (
// StoreNetfeeAreaLevelDao is the data access object for the table store_netfee_area_level. // StoreNetfeeAreaLevelDao is the data access object for the table store_netfee_area_level.
type StoreNetfeeAreaLevelDao struct { type StoreNetfeeAreaLevelDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns StoreNetfeeAreaLevelColumns // columns contains all the column names of Table for convenient usage. columns StoreNetfeeAreaLevelColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// StoreNetfeeAreaLevelColumns defines and stores column names for the table store_netfee_area_level. // StoreNetfeeAreaLevelColumns defines and stores column names for the table store_netfee_area_level.
@ -49,11 +50,12 @@ var storeNetfeeAreaLevelColumns = StoreNetfeeAreaLevelColumns{
} }
// NewStoreNetfeeAreaLevelDao creates and returns a new DAO object for table data access. // NewStoreNetfeeAreaLevelDao creates and returns a new DAO object for table data access.
func NewStoreNetfeeAreaLevelDao() *StoreNetfeeAreaLevelDao { func NewStoreNetfeeAreaLevelDao(handlers ...gdb.ModelHandler) *StoreNetfeeAreaLevelDao {
return &StoreNetfeeAreaLevelDao{ return &StoreNetfeeAreaLevelDao{
group: "default", group: "default",
table: "store_netfee_area_level", table: "store_netfee_area_level",
columns: storeNetfeeAreaLevelColumns, columns: storeNetfeeAreaLevelColumns,
handlers: handlers,
} }
} }
@ -79,7 +81,11 @@ func (dao *StoreNetfeeAreaLevelDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoreNetfeeAreaLevelDao) Ctx(ctx context.Context) *gdb.Model { func (dao *StoreNetfeeAreaLevelDao) 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. // 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. // StoreRolesDao is the data access object for the table store_roles.
type StoreRolesDao struct { type StoreRolesDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewStoreRolesDao creates and returns a new DAO object for table data access.
func NewStoreRolesDao() *StoreRolesDao { func NewStoreRolesDao(handlers ...gdb.ModelHandler) *StoreRolesDao {
return &StoreRolesDao{ return &StoreRolesDao{
group: "default", group: "default",
table: "store_roles", table: "store_roles",
columns: storeRolesColumns, 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. // 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 { 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. // 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. // StoresDao is the data access object for the table stores.
type StoresDao struct { type StoresDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewStoresDao creates and returns a new DAO object for table data access.
func NewStoresDao() *StoresDao { func NewStoresDao(handlers ...gdb.ModelHandler) *StoresDao {
return &StoresDao{ return &StoresDao{
group: "default", group: "default",
table: "stores", table: "stores",
columns: storesColumns, 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. // 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 { 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. // Transaction wraps the transaction logic using function f.

View File

@ -13,9 +13,10 @@ import (
// TaskRewardsDao is the data access object for the table task_rewards. // TaskRewardsDao is the data access object for the table task_rewards.
type TaskRewardsDao struct { type TaskRewardsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns TaskRewardsColumns // columns contains all the column names of Table for convenient usage. columns TaskRewardsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// TaskRewardsColumns defines and stores column names for the table task_rewards. // TaskRewardsColumns defines and stores column names for the table task_rewards.
@ -31,11 +32,12 @@ var taskRewardsColumns = TaskRewardsColumns{
} }
// NewTaskRewardsDao creates and returns a new DAO object for table data access. // NewTaskRewardsDao creates and returns a new DAO object for table data access.
func NewTaskRewardsDao() *TaskRewardsDao { func NewTaskRewardsDao(handlers ...gdb.ModelHandler) *TaskRewardsDao {
return &TaskRewardsDao{ return &TaskRewardsDao{
group: "default", group: "default",
table: "task_rewards", table: "task_rewards",
columns: taskRewardsColumns, columns: taskRewardsColumns,
handlers: handlers,
} }
} }
@ -61,7 +63,11 @@ func (dao *TaskRewardsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *TaskRewardsDao) Ctx(ctx context.Context) *gdb.Model { func (dao *TaskRewardsDao) 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. // 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. // TasksDao is the data access object for the table tasks.
type TasksDao struct { type TasksDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewTasksDao creates and returns a new DAO object for table data access.
func NewTasksDao() *TasksDao { func NewTasksDao(handlers ...gdb.ModelHandler) *TasksDao {
return &TasksDao{ return &TasksDao{
group: "default", group: "default",
table: "tasks", table: "tasks",
columns: tasksColumns, 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. // 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 { 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. // 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. // UserTasksDao is the data access object for the table user_tasks.
type UserTasksDao struct { type UserTasksDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewUserTasksDao creates and returns a new DAO object for table data access.
func NewUserTasksDao() *UserTasksDao { func NewUserTasksDao(handlers ...gdb.ModelHandler) *UserTasksDao {
return &UserTasksDao{ return &UserTasksDao{
group: "default", group: "default",
table: "user_tasks", table: "user_tasks",
columns: userTasksColumns, 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. // 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 { 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. // 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. // UsersDao is the data access object for the table users.
type UsersDao struct { type UsersDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. 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. // 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. // NewUsersDao creates and returns a new DAO object for table data access.
func NewUsersDao() *UsersDao { func NewUsersDao(handlers ...gdb.ModelHandler) *UsersDao {
return &UsersDao{ return &UsersDao{
group: "default", group: "default",
table: "users", table: "users",
columns: usersColumns, 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. // 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 { 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. // Transaction wraps the transaction logic using function f.

22
internal/dao/notices.go Normal file
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"
)
// noticesDao is the data access object for the table notices.
// You can define custom methods on it to extend its functionality as needed.
type noticesDao struct {
*internal.NoticesDao
}
var (
// Notices is a globally accessible object for table notices operations.
Notices = noticesDao{internal.NewNoticesDao()}
)
// Add your custom methods and functionality below.

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"
)
// rewardCallbackDao is the data access object for the table reward_callback.
// You can define custom methods on it to extend its functionality as needed.
type rewardCallbackDao struct {
*internal.RewardCallbackDao
}
var (
// RewardCallback is a globally accessible object for table reward_callback operations.
RewardCallback = rewardCallbackDao{internal.NewRewardCallbackDao()}
)
// Add your custom methods and functionality below.

View File

@ -359,16 +359,20 @@ func (s *sReward) List(ctx context.Context, in *model.RewardListIn) (out *model.
// GetLift 领取奖励 // GetLift 领取奖励
func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *model.GetRewardOut, err error) { func (s *sReward) GetLift(ctx context.Context, in *model.GetRewardIn) (out *model.GetRewardOut, err error) {
// 遍历奖励类型列表 // 判断奖励类型
//for _, v := range in.RewradTypeId { if in.Source == 1 {
// if v > 0 { // 系统奖励处理
// // 发背包+兑换 if in.RewradTypeId != 16 {
// // 需要大区角色
// }
// if v > 0 { } else {
// // 直接发背包 // 不需要
// }
//} }
} else {
// 门店奖励处理
}
activity, err := gamelife.GetGamelifeClient(ctx).RequestActivity(ctx, &model.QQNetbarActivityIn{PopenId: in.PopenId, 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, TaskId: in.TaskId,
@ -496,3 +500,18 @@ func (s *sReward) OperateTaskReward(ctx context.Context, in *model.OperateTaskRe
return &model.OperateTaskRewardOut{Success: true}, err return &model.OperateTaskRewardOut{Success: true}, err
} }
} }
// CallBack 奖励回调
func (s *sReward) CallBack(ctx context.Context, in *model.RewardCallbackIn) (out *model.RewardCallbackOut, err error) {
dao.RewardCallback.Ctx(ctx).Insert(do.RewardCallback{
OrderId: in.OrderId,
PrizeId: in.PrizeId,
PrizeType: in.PrizeType,
PrizeSubType: in.PrizeSubType,
Uid: in.Uid,
Num: in.Num,
CustomInfo: in.CustomInfo,
})
return nil, err
}

View File

@ -0,0 +1,26 @@
// =================================================================================
// 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"
)
// Notices is the golang structure of table notices for DAO operations like Where/Data.
type Notices struct {
g.Meta `orm:"table:notices, do:true"`
Id interface{} // 通知ID
Title interface{} // 通知标题
Content interface{} // 通知内容
Type interface{} // 通知类型1=系统公告2=活动通知3=维护通知
Status interface{} // 状态0=关闭1=发布
VisibleTo interface{} // 可见范围1=所有人2=仅门店3=仅用户
MerchantId interface{} // 所属商户ID
StoreId interface{} // 所属门店ID
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -0,0 +1,23 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
)
// RewardCallback is the golang structure of table reward_callback for DAO operations like Where/Data.
type RewardCallback struct {
g.Meta `orm:"table:reward_callback, do:true"`
Id interface{} //
Uid interface{} // 用户账号
OrderId interface{} // 订单号必须保证全局唯一(保证接口幂等)
PrizeChannelId interface{} // 券渠道 ID
PrizeId interface{} // 券 ID
PrizeType interface{} // 奖励类型1 网鱼积分2 网鱼经验值3 网鱼兑换码
PrizeSubType interface{} // 奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等
Num interface{} // 奖励个数,默认 1比如经验值 10
CustomInfo interface{} // 透传字段 (json串)
}

View File

@ -0,0 +1,24 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Notices is the golang structure for table notices.
type Notices struct {
Id int64 `json:"id" orm:"id" description:"通知ID"` // 通知ID
Title string `json:"title" orm:"title" description:"通知标题"` // 通知标题
Content string `json:"content" orm:"content" description:"通知内容"` // 通知内容
Type int `json:"type" orm:"type" description:"通知类型1=系统公告2=活动通知3=维护通知"` // 通知类型1=系统公告2=活动通知3=维护通知
Status int `json:"status" orm:"status" description:"状态0=关闭1=发布"` // 状态0=关闭1=发布
VisibleTo int `json:"visibleTo" orm:"visible_to" description:"可见范围1=所有人2=仅门店3=仅用户"` // 可见范围1=所有人2=仅门店3=仅用户
MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID
StoreId int64 `json:"storeId" orm:"store_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:"软删除时间戳"` // 软删除时间戳
}

View File

@ -0,0 +1,18 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
// RewardCallback is the golang structure for table reward_callback.
type RewardCallback struct {
Id int64 `json:"id" orm:"id" description:""` //
Uid string `json:"uid" orm:"uid" description:"用户账号"` // 用户账号
OrderId string `json:"orderId" orm:"order_id" description:"订单号必须保证全局唯一(保证接口幂等)"` // 订单号必须保证全局唯一(保证接口幂等)
PrizeChannelId string `json:"prizeChannelId" orm:"prize_channel_id" description:"券渠道 ID"` // 券渠道 ID
PrizeId string `json:"prizeId" orm:"prize_id" description:"券 ID"` // 券 ID
PrizeType int `json:"prizeType" orm:"prize_type" description:"奖励类型1 网鱼积分2 网鱼经验值3 网鱼兑换码"` // 奖励类型1 网鱼积分2 网鱼经验值3 网鱼兑换码
PrizeSubType int `json:"prizeSubType" orm:"prize_sub_type" description:"奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等"` // 奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等
Num int `json:"num" orm:"num" description:"奖励个数,默认 1比如经验值 10"` // 奖励个数,默认 1比如经验值 10
CustomInfo string `json:"customInfo" orm:"custom_info" description:"透传字段 (json串)"` // 透传字段 (json串)
}

View File

@ -123,26 +123,37 @@ type RewardListOut struct {
// RewardCallbackIn 任务奖励领取回调入参 // RewardCallbackIn 任务奖励领取回调入参
type RewardCallbackIn struct { type RewardCallbackIn struct {
AreaId int Uid string `json:"uid" ` // 用户账号
GameId int OrderId string `json:"orderId"` // 订单号必须保证全局唯一(保证接口幂等)
RewradTypeId []int PrizeChannelId string `json:"prizeChannelId"` // 券渠道 ID
RoleIdx string PrizeId string `json:"prizeId"` // 券 ID
TaskId string PrizeType int `json:"prizeType"` // 奖励类型1 网鱼积分2 网鱼经验值3 网鱼兑换码
PrizeSubType int `json:"prizeSubType"` // 奖励子类型,默认为 0有多种子类型时可用如 1,5 元网费充值券2、满 30-5 满减券等
Num int `json:"num"` // 奖励个数,默认 1比如经验值 10
CustomInfo string `json:"customInfo"` // 透传字段 (json串)
} }
type RewardCallbackOut struct { type RewardCallbackOut struct {
List interface{} `json:"list"` Errcode int32 `json:"errcode"`
Result int64 `json:"result"` Errmsg string `json:"errmsg"`
Water Water `json:"water"` AppId string `json:"appid"`
OrderId string `json:"order_id"`
Datas []CallbackData `json:"data"`
}
type CallbackData struct {
PrizeCode string `json:"prize_code"`
Comment string `json:"comment"`
} }
type GetRewardIn struct { type GetRewardIn struct {
AreaId int AreaId int
GameId int GameId int
RewradTypeId []int RewradTypeId int
RoleIdx string RoleIdx string
TaskId string TaskId string
PopenId string PopenId string
Source int
} }
type GetRewardOut struct { type GetRewardOut struct {
List interface{} `json:"list"` List interface{} `json:"list"`

View File

@ -4,7 +4,7 @@ import (
_ "github.com/gogf/gf/contrib/drivers/mysql/v2" _ "github.com/gogf/gf/contrib/drivers/mysql/v2"
_ "github.com/gogf/gf/contrib/nosql/redis/v2" _ "github.com/gogf/gf/contrib/nosql/redis/v2"
_ "server/utility/gamelife" _ "server/utility/gamelife"
_ "server/utility/mqtt/emqx" //_ "server/utility/mqtt/emqx"
_ "server/utility/myCasbin" _ "server/utility/myCasbin"
_ "server/utility/oss/aliyun" _ "server/utility/oss/aliyun"
_ "server/utility/rsa" _ "server/utility/rsa"

View File

@ -29,6 +29,7 @@ type (
// GetGoodsDetails 物品详情 // GetGoodsDetails 物品详情
GetGoodsDetails(ctx context.Context, in *model.GetGoodsDetailsIn) (out *model.QueryUserGoodsDetailResponse, err error) GetGoodsDetails(ctx context.Context, in *model.GetGoodsDetailsIn) (out *model.QueryUserGoodsDetailResponse, err error)
OperateTaskReward(ctx context.Context, in *model.OperateTaskRewardIn) (out *model.OperateTaskRewardOut, err error) OperateTaskReward(ctx context.Context, in *model.OperateTaskRewardIn) (out *model.OperateTaskRewardOut, err error)
CallBack(ctx context.Context, in *model.RewardCallbackIn) (out *model.RewardCallbackOut, err error)
} }
) )