实现任务绑定奖励的接口

This commit is contained in:
2025-06-24 21:36:58 +08:00
parent 4c367bd9ca
commit 8cd9477f3d
9 changed files with 156 additions and 2 deletions

View File

@ -0,0 +1,13 @@
package reward
import (
"context"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
"server/api/reward/v1"
)
func (c *ControllerV1) OperateTaskReward(ctx context.Context, req *v1.OperateTaskRewardReq) (res *v1.OperateTaskRewardRes, err error) {
return nil, gerror.NewCode(gcode.CodeNotImplemented)
}

View File

@ -0,0 +1,75 @@
// ==========================================================================
// 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"
)
// TaskRewardsDao is the data access object for the table task_rewards.
type TaskRewardsDao 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 TaskRewardsColumns // columns contains all the column names of Table for convenient usage.
}
// TaskRewardsColumns defines and stores column names for the table task_rewards.
type TaskRewardsColumns struct {
TaskId string // 任务ID
RewardId string // 奖励ID
}
// taskRewardsColumns holds the columns for the table task_rewards.
var taskRewardsColumns = TaskRewardsColumns{
TaskId: "task_id",
RewardId: "reward_id",
}
// NewTaskRewardsDao creates and returns a new DAO object for table data access.
func NewTaskRewardsDao() *TaskRewardsDao {
return &TaskRewardsDao{
group: "default",
table: "task_rewards",
columns: taskRewardsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *TaskRewardsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *TaskRewardsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *TaskRewardsDao) Columns() TaskRewardsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *TaskRewardsDao) 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 *TaskRewardsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).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 *TaskRewardsDao) 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,27 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalTaskRewardsDao is an internal type for wrapping the internal DAO implementation.
type internalTaskRewardsDao = *internal.TaskRewardsDao
// taskRewardsDao is the data access object for the table task_rewards.
// You can define custom methods on it to extend its functionality as needed.
type taskRewardsDao struct {
internalTaskRewardsDao
}
var (
// TaskRewards is a globally accessible object for table task_rewards operations.
TaskRewards = taskRewardsDao{
internal.NewTaskRewardsDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -0,0 +1,16 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
)
// TaskRewards is the golang structure of table task_rewards for DAO operations like Where/Data.
type TaskRewards struct {
g.Meta `orm:"table:task_rewards, do:true"`
TaskId interface{} // 任务ID
RewardId interface{} // 奖励ID
}

View File

@ -0,0 +1,11 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
// TaskRewards is the golang structure for table task_rewards.
type TaskRewards struct {
TaskId int64 `json:"taskId" orm:"task_id" description:"任务ID"` // 任务ID
RewardId int64 `json:"rewardId" orm:"reward_id" description:"奖励ID"` // 奖励ID
}

View File

@ -27,6 +27,7 @@ type (
GetGoods(ctx context.Context, in *model.GetGoodsGetIn) (out *model.GoodsGetOut, err error)
// GetGoodsDetails 物品详情
GetGoodsDetails(ctx context.Context, in *model.GetGoodsDetailsIn) (out *model.QueryUserGoodsDetailResponse, err error)
OperateTaskReward(ctx context.Context, in *model.OperateTaskRewardIn) (out *model.OperateTaskRewardOut, err error)
}
)

View File

@ -16,9 +16,9 @@ type (
Create(ctx context.Context, in *model.RewardTypeCreateIn) (out *model.RewardTypeCreateOut, err error)
// Update 更新奖励类型
Update(ctx context.Context, in *model.RewardTypeUpdateIn) (out *model.RewardTypeUpdateOut, err error)
// Delete 删除奖励类型
// Delete 删除奖励类型(逻辑删除)
Delete(ctx context.Context, in *model.RewardTypeDeleteIn) (out *model.RewardTypeDeleteOut, err error)
// List 获取奖励类型列表
// List 获取奖励类型列表(支持分页、过滤)
List(ctx context.Context, in *model.RewardTypeListIn) (out *model.RewardTypeListOut, err error)
}
)