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

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

@ -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.