Files
arenax-server/internal/dao/internal/reward_waters.go

98 lines
3.4 KiB
Go

// ==========================================================================
// 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 // 订单号
Recvuid string // 用户账号
TaskId string // 任务 id
Water string // 兑换流水
Status string // 兑换状态 1:奖励发放成功 2:奖励兑换失败(礼包发放背包环节成功,需重新引导领奖) 3:针对只需要发背包,然后引导用户到人生应用背包领奖的奖励类型,发奖成功了 4:water错误(一般是 orderid),不做兑换操作
CreatedAt string //
UpdatedAt string //
DeletedAt string //
GameId string // 游戏唯一 id
}
// rewardWatersColumns holds the columns for the table reward_waters.
var rewardWatersColumns = RewardWatersColumns{
Id: "id",
OrderId: "order_id",
Recvuid: "recvuid",
TaskId: "task_id",
Water: "water",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
GameId: "game_id",
}
// 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)
}