调整奖励类型和奖励

This commit is contained in:
2025-06-26 14:52:33 +08:00
parent 9bfdaf5fa2
commit 8107b9a719
38 changed files with 313 additions and 403 deletions

View File

@ -17,4 +17,5 @@ type ITaskV1 interface {
List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error)
Selector(ctx context.Context, req *v1.SelectorReq) (res *v1.SelectorRes, err error)
GetTask(ctx context.Context, req *v1.GetTaskReq) (res *v1.GetTaskRes, err error)
GetUserTaskRecordsList(ctx context.Context, req *v1.GetUserTaskRecordsListReq) (res *v1.GetUserTaskRecordsListRes, err error)
}

View File

@ -85,3 +85,18 @@ type GetTaskReq struct {
type GetTaskRes struct {
Success bool `json:"success"`
}
type GetUserTaskRecordsListReq struct {
g.Meta `path:"/task/records" method:"get" tags:"Task" summary:"(PC)用户任务记录列表"`
TaskId string `json:"taskId" dc:"任务 id"`
StoreId int `json:"storeId" dc:"门店 id"`
NetbarAccount string `json:"netbarAccount" dc:"网关账号"`
Page int `json:"page" dc:"页数"`
Size int `json:"size" dc:"条数"`
StartTime int32 `json:"startTime" dc:"开始时间"`
EndTime int32 `json:"endTime" dc:"结束时间"`
}
type GetUserTaskRecordsListRes struct {
List interface{} `json:"list"`
Total int `json:"total"`
}

View File

@ -0,0 +1,23 @@
package task
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"server/internal/model"
"server/internal/service"
"server/api/task/v1"
)
func (c *ControllerV1) GetUserTaskRecordsList(ctx context.Context, req *v1.GetUserTaskRecordsListReq) (res *v1.GetUserTaskRecordsListRes, err error) {
fromCtx := g.RequestFromCtx(ctx)
userId := fromCtx.GetCtxVar("id").Int()
out, err := service.Task().GetUserTaskRecordsList(ctx, &model.UserTaskRecordsListIn{UserId: userId})
if err != nil {
return nil, err
}
return &v1.GetUserTaskRecordsListRes{
List: out.List,
Total: out.Total,
}, nil
}

View File

@ -16,7 +16,6 @@ type AdminsDao 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 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.
@ -50,12 +49,11 @@ var adminsColumns = AdminsColumns{
}
// NewAdminsDao creates and returns a new DAO object for table data access.
func NewAdminsDao(handlers ...gdb.ModelHandler) *AdminsDao {
func NewAdminsDao() *AdminsDao {
return &AdminsDao{
group: "default",
table: "admins",
columns: adminsColumns,
handlers: handlers,
}
}
@ -81,11 +79,7 @@ func (dao *AdminsDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type FeedbacksDao 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 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.
@ -52,12 +51,11 @@ var feedbacksColumns = FeedbacksColumns{
}
// NewFeedbacksDao creates and returns a new DAO object for table data access.
func NewFeedbacksDao(handlers ...gdb.ModelHandler) *FeedbacksDao {
func NewFeedbacksDao() *FeedbacksDao {
return &FeedbacksDao{
group: "default",
table: "feedbacks",
columns: feedbacksColumns,
handlers: handlers,
}
}
@ -83,11 +81,7 @@ func (dao *FeedbacksDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type GamesDao 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 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.
@ -46,12 +45,11 @@ var gamesColumns = GamesColumns{
}
// NewGamesDao creates and returns a new DAO object for table data access.
func NewGamesDao(handlers ...gdb.ModelHandler) *GamesDao {
func NewGamesDao() *GamesDao {
return &GamesDao{
group: "default",
table: "games",
columns: gamesColumns,
handlers: handlers,
}
}
@ -77,11 +75,7 @@ func (dao *GamesDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type MerchantAdminsDao 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 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.
@ -58,12 +57,11 @@ var merchantAdminsColumns = MerchantAdminsColumns{
}
// NewMerchantAdminsDao creates and returns a new DAO object for table data access.
func NewMerchantAdminsDao(handlers ...gdb.ModelHandler) *MerchantAdminsDao {
func NewMerchantAdminsDao() *MerchantAdminsDao {
return &MerchantAdminsDao{
group: "default",
table: "merchant_admins",
columns: merchantAdminsColumns,
handlers: handlers,
}
}
@ -89,11 +87,7 @@ func (dao *MerchantAdminsDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type MerchantsDao 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 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.
@ -72,12 +71,11 @@ var merchantsColumns = MerchantsColumns{
}
// NewMerchantsDao creates and returns a new DAO object for table data access.
func NewMerchantsDao(handlers ...gdb.ModelHandler) *MerchantsDao {
func NewMerchantsDao() *MerchantsDao {
return &MerchantsDao{
group: "default",
table: "merchants",
columns: merchantsColumns,
handlers: handlers,
}
}
@ -103,11 +101,7 @@ func (dao *MerchantsDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ 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.
@ -50,12 +49,11 @@ var noticesColumns = NoticesColumns{
}
// NewNoticesDao creates and returns a new DAO object for table data access.
func NewNoticesDao(handlers ...gdb.ModelHandler) *NoticesDao {
func NewNoticesDao() *NoticesDao {
return &NoticesDao{
group: "default",
table: "notices",
columns: noticesColumns,
handlers: handlers,
}
}
@ -81,11 +79,7 @@ func (dao *NoticesDao) Group() string {
// 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)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ 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.
@ -48,12 +47,11 @@ var rewardCallbackColumns = RewardCallbackColumns{
}
// NewRewardCallbackDao creates and returns a new DAO object for table data access.
func NewRewardCallbackDao(handlers ...gdb.ModelHandler) *RewardCallbackDao {
func NewRewardCallbackDao() *RewardCallbackDao {
return &RewardCallbackDao{
group: "default",
table: "reward_callback",
columns: rewardCallbackColumns,
handlers: handlers,
}
}
@ -79,11 +77,7 @@ func (dao *RewardCallbackDao) Group() string {
// 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)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,40 +16,36 @@ type RewardTypesDao 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 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.
type RewardTypesColumns struct {
Id string // 奖励类型ID
Name string // 类型名称
TencentTypeId string // 腾讯奖励类型ID仅系统奖励有效
Source string // 奖励来源1=腾讯系统2=本系统3=其他
Code string // 唯一编码
IconUrl string // 图标链接地址
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间
StoreId string // 门店 id
}
// rewardTypesColumns holds the columns for the table reward_types.
var rewardTypesColumns = RewardTypesColumns{
Id: "id",
Name: "name",
TencentTypeId: "tencent_type_id",
Source: "source",
Code: "code",
IconUrl: "icon_url",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
StoreId: "store_id",
}
// NewRewardTypesDao creates and returns a new DAO object for table data access.
func NewRewardTypesDao(handlers ...gdb.ModelHandler) *RewardTypesDao {
func NewRewardTypesDao() *RewardTypesDao {
return &RewardTypesDao{
group: "default",
table: "reward_types",
columns: rewardTypesColumns,
handlers: handlers,
}
}
@ -75,11 +71,7 @@ func (dao *RewardTypesDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ 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.
@ -46,12 +45,11 @@ var rewardWatersColumns = RewardWatersColumns{
}
// NewRewardWatersDao creates and returns a new DAO object for table data access.
func NewRewardWatersDao(handlers ...gdb.ModelHandler) *RewardWatersDao {
func NewRewardWatersDao() *RewardWatersDao {
return &RewardWatersDao{
group: "default",
table: "reward_waters",
columns: rewardWatersColumns,
handlers: handlers,
}
}
@ -77,11 +75,7 @@ func (dao *RewardWatersDao) Group() string {
// 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)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type RewardsDao 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 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.
@ -43,6 +42,8 @@ type RewardsColumns struct {
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 删除时间(软删除)
PrizeId string // 券 id
Source string // 奖励来源1 为系统奖励对接腾讯2 是门店
}
// rewardsColumns holds the columns for the table rewards.
@ -69,15 +70,16 @@ var rewardsColumns = RewardsColumns{
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
PrizeId: "prize_id",
Source: "source",
}
// NewRewardsDao creates and returns a new DAO object for table data access.
func NewRewardsDao(handlers ...gdb.ModelHandler) *RewardsDao {
func NewRewardsDao() *RewardsDao {
return &RewardsDao{
group: "default",
table: "rewards",
columns: rewardsColumns,
handlers: handlers,
}
}
@ -103,11 +105,7 @@ func (dao *RewardsDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type RolesDao 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 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.
@ -48,12 +47,11 @@ var rolesColumns = RolesColumns{
}
// NewRolesDao creates and returns a new DAO object for table data access.
func NewRolesDao(handlers ...gdb.ModelHandler) *RolesDao {
func NewRolesDao() *RolesDao {
return &RolesDao{
group: "default",
table: "roles",
columns: rolesColumns,
handlers: handlers,
}
}
@ -79,11 +77,7 @@ func (dao *RolesDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type StoreAdminsDao 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 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.
@ -58,12 +57,11 @@ var storeAdminsColumns = StoreAdminsColumns{
}
// NewStoreAdminsDao creates and returns a new DAO object for table data access.
func NewStoreAdminsDao(handlers ...gdb.ModelHandler) *StoreAdminsDao {
func NewStoreAdminsDao() *StoreAdminsDao {
return &StoreAdminsDao{
group: "default",
table: "store_admins",
columns: storeAdminsColumns,
handlers: handlers,
}
}
@ -89,11 +87,7 @@ func (dao *StoreAdminsDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type StoreDesktopSettingsDao 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 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.
@ -34,12 +33,11 @@ var storeDesktopSettingsColumns = StoreDesktopSettingsColumns{
}
// NewStoreDesktopSettingsDao creates and returns a new DAO object for table data access.
func NewStoreDesktopSettingsDao(handlers ...gdb.ModelHandler) *StoreDesktopSettingsDao {
func NewStoreDesktopSettingsDao() *StoreDesktopSettingsDao {
return &StoreDesktopSettingsDao{
group: "default",
table: "store_desktop_settings",
columns: storeDesktopSettingsColumns,
handlers: handlers,
}
}
@ -65,11 +63,7 @@ func (dao *StoreDesktopSettingsDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type StoreIpsDao 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 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.
@ -42,12 +41,11 @@ var storeIpsColumns = StoreIpsColumns{
}
// NewStoreIpsDao creates and returns a new DAO object for table data access.
func NewStoreIpsDao(handlers ...gdb.ModelHandler) *StoreIpsDao {
func NewStoreIpsDao() *StoreIpsDao {
return &StoreIpsDao{
group: "default",
table: "store_ips",
columns: storeIpsColumns,
handlers: handlers,
}
}
@ -73,11 +71,7 @@ func (dao *StoreIpsDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type StoreNetfeeAreaLevelDao 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 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.
@ -50,12 +49,11 @@ var storeNetfeeAreaLevelColumns = StoreNetfeeAreaLevelColumns{
}
// NewStoreNetfeeAreaLevelDao creates and returns a new DAO object for table data access.
func NewStoreNetfeeAreaLevelDao(handlers ...gdb.ModelHandler) *StoreNetfeeAreaLevelDao {
func NewStoreNetfeeAreaLevelDao() *StoreNetfeeAreaLevelDao {
return &StoreNetfeeAreaLevelDao{
group: "default",
table: "store_netfee_area_level",
columns: storeNetfeeAreaLevelColumns,
handlers: handlers,
}
}
@ -81,11 +79,7 @@ func (dao *StoreNetfeeAreaLevelDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type StoreRolesDao 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 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.
@ -40,12 +39,11 @@ var storeRolesColumns = StoreRolesColumns{
}
// NewStoreRolesDao creates and returns a new DAO object for table data access.
func NewStoreRolesDao(handlers ...gdb.ModelHandler) *StoreRolesDao {
func NewStoreRolesDao() *StoreRolesDao {
return &StoreRolesDao{
group: "default",
table: "store_roles",
columns: storeRolesColumns,
handlers: handlers,
}
}
@ -71,11 +69,7 @@ func (dao *StoreRolesDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type StoresDao 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 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.
@ -52,12 +51,11 @@ var storesColumns = StoresColumns{
}
// NewStoresDao creates and returns a new DAO object for table data access.
func NewStoresDao(handlers ...gdb.ModelHandler) *StoresDao {
func NewStoresDao() *StoresDao {
return &StoresDao{
group: "default",
table: "stores",
columns: storesColumns,
handlers: handlers,
}
}
@ -83,11 +81,7 @@ func (dao *StoresDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ 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.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// TaskRewardsColumns defines and stores column names for the table task_rewards.
@ -32,12 +31,11 @@ var taskRewardsColumns = TaskRewardsColumns{
}
// NewTaskRewardsDao creates and returns a new DAO object for table data access.
func NewTaskRewardsDao(handlers ...gdb.ModelHandler) *TaskRewardsDao {
func NewTaskRewardsDao() *TaskRewardsDao {
return &TaskRewardsDao{
group: "default",
table: "task_rewards",
columns: taskRewardsColumns,
handlers: handlers,
}
}
@ -63,11 +61,7 @@ func (dao *TaskRewardsDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type TasksDao 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 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.
@ -58,12 +57,11 @@ var tasksColumns = TasksColumns{
}
// NewTasksDao creates and returns a new DAO object for table data access.
func NewTasksDao(handlers ...gdb.ModelHandler) *TasksDao {
func NewTasksDao() *TasksDao {
return &TasksDao{
group: "default",
table: "tasks",
columns: tasksColumns,
handlers: handlers,
}
}
@ -89,11 +87,7 @@ func (dao *TasksDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type UserTaskRewardsDao 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 UserTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// UserTaskRewardsColumns defines and stores column names for the table user_task_rewards.
@ -32,6 +31,7 @@ type UserTaskRewardsColumns struct {
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间
ExpiredAt string // 奖励过期时间
}
// userTaskRewardsColumns holds the columns for the table user_task_rewards.
@ -47,15 +47,15 @@ var userTaskRewardsColumns = UserTaskRewardsColumns{
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
ExpiredAt: "expired_at",
}
// NewUserTaskRewardsDao creates and returns a new DAO object for table data access.
func NewUserTaskRewardsDao(handlers ...gdb.ModelHandler) *UserTaskRewardsDao {
func NewUserTaskRewardsDao() *UserTaskRewardsDao {
return &UserTaskRewardsDao{
group: "default",
table: "user_task_rewards",
columns: userTaskRewardsColumns,
handlers: handlers,
}
}
@ -81,11 +81,7 @@ func (dao *UserTaskRewardsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *UserTaskRewardsDao) 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)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ 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.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// UserTasksColumns defines and stores column names for the table user_tasks.
@ -52,12 +51,11 @@ var userTasksColumns = UserTasksColumns{
}
// NewUserTasksDao creates and returns a new DAO object for table data access.
func NewUserTasksDao(handlers ...gdb.ModelHandler) *UserTasksDao {
func NewUserTasksDao() *UserTasksDao {
return &UserTasksDao{
group: "default",
table: "user_tasks",
columns: userTasksColumns,
handlers: handlers,
}
}
@ -83,11 +81,7 @@ 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -16,7 +16,6 @@ type UsersDao 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 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.
@ -60,12 +59,11 @@ var usersColumns = UsersColumns{
}
// NewUsersDao creates and returns a new DAO object for table data access.
func NewUsersDao(handlers ...gdb.ModelHandler) *UsersDao {
func NewUsersDao() *UsersDao {
return &UsersDao{
group: "default",
table: "users",
columns: usersColumns,
handlers: handlers,
}
}
@ -91,11 +89,7 @@ func (dao *UsersDao) Group() string {
// 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 {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.

View File

@ -260,20 +260,18 @@ func (s *sReward) Delete(ctx context.Context, in *model.RewardDeleteIn) (out *mo
func (s *sReward) List(ctx context.Context, in *model.RewardListIn) (out *model.RewardListOut, err error) {
rewardCols := dao.Rewards.Columns()
rewardTypeCols := dao.RewardTypes.Columns()
rewardTypeIds := make([]int64, 0)
// ==== 权限校验 ====
orm := dao.Rewards.Ctx(ctx).LeftJoin(
dao.RewardTypes.Table(),
fmt.Sprintf(
"%s.%s = %s.%s",
dao.Rewards.Table(), dao.Rewards.Columns().RewardTypeId,
dao.RewardTypes.Table(), dao.RewardTypes.Columns().Id,
),
).Fields(fmt.Sprintf("%s.*,%s.name as reward_type_name", dao.Rewards.Table(), dao.RewardTypes.Table()))
switch in.OperatorRole {
case consts.AdminRoleCode:
// 系统管理员只能查询 source = 1 的奖励
array, err := dao.RewardTypes.Ctx(ctx).Where(do.RewardTypes{Source: 1}).Fields(rewardTypeCols.Id).Array()
if err != nil {
return nil, ecode.Fail.Sub("获取奖励类型列表失败")
}
for _, value := range array {
rewardTypeIds = append(rewardTypeIds, value.Int64())
}
orm = orm.Where(rewardCols.Source, 1)
case consts.MerchantRoleCode, consts.StoreRoleCode:
// 合并商户和门店角色权限校验
var exist bool
@ -308,28 +306,11 @@ func (s *sReward) List(ctx context.Context, in *model.RewardListIn) (out *model.
if !exist {
return nil, ecode.Params.Sub("无门店权限")
}
//
array, err := dao.RewardTypes.Ctx(ctx).Where(do.RewardTypes{Source: 2, StoreId: in.StoreId}).Fields(rewardTypeCols.Id).Array()
if err != nil {
return nil, ecode.Fail.Sub("获取奖励类型列表失败")
}
for _, value := range array {
rewardTypeIds = append(rewardTypeIds, value.Int64())
}
orm = orm.Where(rewardCols.Source, 2)
default:
return nil, ecode.Params.Sub("无效的角色")
}
orm := dao.Rewards.Ctx(ctx).LeftJoin(
dao.RewardTypes.Table(),
fmt.Sprintf(
"%s.%s = %s.%s",
dao.Rewards.Table(), dao.Rewards.Columns().RewardTypeId,
dao.RewardTypes.Table(), dao.RewardTypes.Columns().Id,
),
).Fields(fmt.Sprintf("%s.*,%s.name as reward_type_name", dao.Rewards.Table(), dao.RewardTypes.Table())).
WhereIn(dao.Rewards.Columns().RewardTypeId, rewardTypeIds)
// ==== 其他查询条件 ====
if in.Status != 0 {
orm = orm.Where(fmt.Sprintf("%s.%s = ?", dao.Rewards.Table(), rewardCols.Status), in.Status)

View File

@ -33,9 +33,6 @@ func (s *sRewardType) Create(ctx context.Context, in *model.RewardTypeCreateIn)
data := do.RewardTypes{
Name: in.Name,
Source: in.Source,
StoreId: in.StoreId,
TencentTypeId: in.TencentTypeId,
}
id, err := dao.RewardTypes.Ctx(ctx).OmitEmptyData().Data(data).InsertAndGetId()

View File

@ -190,12 +190,10 @@ func (s *sTask) GetNonLoginTaskList(ctx context.Context, in *model.GetTaskListIn
dao.RewardTypes.Table(), dao.RewardTypes.Columns().Id,
dao.Rewards.Table(), dao.Rewards.Columns().RewardTypeId)).
Fields(
fmt.Sprintf("%s.*, `%s`.`%s` AS %s, `%s`.`%s` AS %s",
fmt.Sprintf(
"%s.*, `%s`.`%s` AS %s",
dao.Rewards.Table(),
dao.RewardTypes.Table(), dao.RewardTypes.Columns().Name,
"reward_type_name",
dao.RewardTypes.Table(), dao.RewardTypes.Columns().Source,
"reward_type_source",
dao.RewardTypes.Table(), dao.RewardTypes.Columns().Name, "reward_type_name",
),
).Where(dao.TaskRewards.Columns().TaskId, task.TaskID).Scan(&data.Rewards)
if err != nil {
@ -385,3 +383,7 @@ func (s *sTask) GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.Ge
Success: true,
}, nil
}
func (s *sTask) GetUserTaskRecordsList(ctx context.Context, in *model.UserTaskRecordsListIn) (out *model.UserTaskRecordsListOut, err error) {
return
}

View File

@ -14,10 +14,9 @@ type RewardTypes struct {
g.Meta `orm:"table:reward_types, do:true"`
Id interface{} // 奖励类型ID
Name interface{} // 类型名称
TencentTypeId interface{} // 腾讯奖励类型ID仅系统奖励有效
Source interface{} // 奖励来源1=腾讯系统2=本系统3=其他
Code interface{} // 唯一编码
IconUrl interface{} // 图标链接地址
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间
StoreId interface{} // 门店 id
}

View File

@ -34,4 +34,6 @@ type Rewards struct {
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 删除时间(软删除)
PrizeId interface{} // 券 id
Source interface{} // 奖励来源1 为系统奖励对接腾讯2 是门店
}

View File

@ -23,4 +23,5 @@ type UserTaskRewards struct {
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间
ExpiredAt *gtime.Time // 奖励过期时间
}

View File

@ -12,10 +12,9 @@ import (
type RewardTypes struct {
Id int64 `json:"id" orm:"id" description:"奖励类型ID"` // 奖励类型ID
Name string `json:"name" orm:"name" description:"类型名称"` // 类型名称
TencentTypeId int `json:"tencentTypeId" orm:"tencent_type_id" description:"腾讯奖励类型ID仅系统奖励有效"` // 腾讯奖励类型ID仅系统奖励有效
Source int `json:"source" orm:"source" description:"奖励来源1=腾讯系统2=本系统3=其他"` // 奖励来源1=腾讯系统2=本系统3=其他
Code string `json:"code" orm:"code" description:"唯一编码"` // 唯一编码
IconUrl string `json:"iconUrl" orm:"icon_url" description:"图标链接地址"` // 图标链接地址
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:"软删除时间"` // 软删除时间
StoreId int64 `json:"storeId" orm:"store_id" description:"门店 id"` // 门店 id
}

View File

@ -32,4 +32,6 @@ type Rewards struct {
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:"删除时间(软删除)"` // 删除时间(软删除)
PrizeId string `json:"prizeId" orm:"prize_id" description:"券 id"` // 券 id
Source int `json:"source" orm:"source" description:"奖励来源1 为系统奖励对接腾讯2 是门店"` // 奖励来源1 为系统奖励对接腾讯2 是门店
}

View File

@ -21,4 +21,5 @@ type UserTaskRewards struct {
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:"软删除时间"` // 软删除时间
ExpiredAt *gtime.Time `json:"expiredAt" orm:"expired_at" description:"奖励过期时间"` // 奖励过期时间
}

View File

@ -11,7 +11,7 @@ type Reward struct {
Name string `json:"name" orm:"name" description:"奖励名称"` // 奖励名称
RewardTypeId int64 `json:"rewardTypeId" orm:"reward_type_id" description:"奖励类型ID关联 reward_types 表"` // 奖励类型ID关联 reward_types 表
RewardTypeName string `json:"rewardTypeName" orm:"reward_type_name" description:"奖励类型名称"` // 奖励类型名称
RewardTypeSource int `json:"rewardTypeSource" orm:"reward_type_source" description:"奖励类型来源"` // 奖励类型来源
Source int `json:"source" orm:"source" description:"奖励来源,1=系统奖励对接腾讯2=门店追加"` // 奖励来源,1=系统奖励对接腾讯2=门店追加
GameId int64 `json:"gameId" orm:"game_id" description:"游戏ID"` // 游戏ID
ImageUrl string `json:"imageUrl" orm:"image_url" description:"奖励图片链接"` // 奖励图片链接
QqGoodsId string `json:"qqGoodsId" orm:"qq_goods_id" description:"QQ网吧物品ID"` // QQ网吧物品ID

View File

@ -70,3 +70,16 @@ type GetTaskIn struct {
type GetTaskOut struct {
Success bool `json:"success"`
}
type UserTaskRecordsListIn struct {
UserId int
Page int
Size int
StoreId int
NetBarAccount string
}
type UserTaskRecordsListOut struct {
List []UserTask
Total int
}

View File

@ -29,6 +29,7 @@ type (
// 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)
// CallBack 奖励回调
CallBack(ctx context.Context, in *model.RewardCallbackIn) (out *model.RewardCallbackOut, err error)
}
)

View File

@ -21,6 +21,7 @@ type (
GetSelectorList(ctx context.Context, in *model.SelectorIn) (out *[]model.SelectorOut, err error)
// GetTask 完成任务
GetTask(ctx context.Context, in *model.GetTaskIn) (out *model.GetTaskOut, err error)
GetUserTaskRecordsList(ctx context.Context, in *model.UserTaskRecordsListIn) (out *model.UserTaskRecordsListOut, err error)
}
)