新增奖励回调接口,调整奖励领取接口
This commit is contained in:
@ -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.
|
||||
|
||||
Reference in New Issue
Block a user