生成奖励相关代码,实现新增门店奖励

This commit is contained in:
2025-06-06 15:49:46 +08:00
parent e40f9987db
commit 2054256a8c
33 changed files with 972 additions and 98 deletions

View File

@ -1,7 +1,10 @@
package model
import "github.com/gogf/gf/v2/frame/g"
// Admin 管理员信息
type Admin struct {
g.Meta `orm:"table:admins"`
Id int64 `json:"id" orm:"id,primary"` // 管理员ID
RoleId int64 `json:"roleId" orm:"role_id,not null"` // 角色ID
Username string `json:"username" orm:"username,not null"` // 管理员用户名

View File

@ -0,0 +1,28 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// Rewards is the golang structure of table rewards for DAO operations like Where/Data.
type Rewards struct {
g.Meta `orm:"table:rewards, do:true"`
Id interface{} // 奖励唯一标识符
RewardTypeId interface{} // 奖励类型ID
RewardScope interface{} // 奖励范围1=系统奖励2=门店奖励
Name interface{} // 奖励名称
Code interface{} // 奖励编号
Description interface{} // 奖励描述
Status interface{} // 状态1=启用2=禁用
Stock interface{} // 奖励库存0表示无限制
StartAt *gtime.Time // 奖励有效开始时间
ExpireAt *gtime.Time // 奖励有效结束时间
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -0,0 +1,18 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// StoreRewards is the golang structure of table store_rewards for DAO operations like Where/Data.
type StoreRewards struct {
g.Meta `orm:"table:store_rewards, do:true"`
StoreId interface{} // 门店ID
RewardId interface{} // 奖励ID
CreatedAt *gtime.Time // 创建时间
}

View File

@ -0,0 +1,26 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Rewards is the golang structure for table rewards.
type Rewards struct {
Id int64 `json:"id" orm:"id" description:"奖励唯一标识符"` // 奖励唯一标识符
RewardTypeId int64 `json:"rewardTypeId" orm:"reward_type_id" description:"奖励类型ID"` // 奖励类型ID
RewardScope int `json:"rewardScope" orm:"reward_scope" description:"奖励范围1=系统奖励2=门店奖励"` // 奖励范围1=系统奖励2=门店奖励
Name string `json:"name" orm:"name" description:"奖励名称"` // 奖励名称
Code string `json:"code" orm:"code" description:"奖励编号"` // 奖励编号
Description string `json:"description" orm:"description" description:"奖励描述"` // 奖励描述
Status int `json:"status" orm:"status" description:"状态1=启用2=禁用"` // 状态1=启用2=禁用
Stock int `json:"stock" orm:"stock" description:"奖励库存0表示无限制"` // 奖励库存0表示无限制
StartAt *gtime.Time `json:"startAt" orm:"start_at" description:"奖励有效开始时间"` // 奖励有效开始时间
ExpireAt *gtime.Time `json:"expireAt" orm:"expire_at" 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:"软删除时间戳"` // 软删除时间戳
}

View File

@ -0,0 +1,16 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// StoreRewards is the golang structure for table store_rewards.
type StoreRewards struct {
StoreId int64 `json:"storeId" orm:"store_id" description:"门店ID"` // 门店ID
RewardId int64 `json:"rewardId" orm:"reward_id" description:"奖励ID"` // 奖励ID
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
}

74
internal/model/reward.go Normal file
View File

@ -0,0 +1,74 @@
package model
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Reward 奖励信息
type Reward struct {
ID int64 `json:"id" orm:"id,primary"` // 奖励ID
RewardTypeID int64 `json:"rewardTypeId" orm:"reward_type_id,not null"` // 奖励类型ID
RewardScope int `json:"rewardScope" orm:"reward_scope,not null,default:2"` // 奖励范围1=系统奖励2=门店奖励
Name string `json:"name" orm:"name,not null"` // 奖励名称
Code string `json:"code" orm:"code,unique"` // 奖励编号
Description string `json:"description" orm:"description"` // 奖励描述
Status int `json:"status" orm:"status,default:1"` // 状态1=启用2=禁用
Stock int `json:"stock" orm:"stock,default:0"` // 奖励库存0表示无限制
StartAt *gtime.Time `json:"startAt" orm:"start_at"` // 奖励有效开始时间
ExpireAt *gtime.Time `json:"expireAt" orm:"expire_at"` // 奖励有效结束时间
}
type RewardCreateIn struct {
OperatorId int64 // 操作人ID
OperatorRole string // 操作人角色
RewardTypeID int64 // 奖励类型ID
RewardScope int // 奖励范围1=系统奖励2=门店奖励
Name string // 奖励名称
Description string // 奖励描述
Status int // 状态1=启用2=禁用
Stock int // 奖励库存0表示无限制
StartAt *gtime.Time // 奖励有效开始时间
ExpireAt *gtime.Time // 奖励有效结束时间
StoreIDs []int64 // 关联门店ID列表仅门店奖励需要
}
type RewardUpdateIn struct {
ID int64 // 奖励ID
RewardTypeID int64 // 奖励类型ID
RewardScope int // 奖励范围1=系统奖励2=门店奖励
Name string // 奖励名称
Description string // 奖励描述
Status int // 状态1=启用2=禁用
Stock int // 奖励库存0表示无限制
StartAt *gtime.Time // 奖励有效开始时间
ExpireAt *gtime.Time // 奖励有效结束时间
StoreIDs []int64 // 关联门店ID列表仅门店奖励需要
}
type RewardListIn struct {
Page int // 页码
Size int // 每页数量
StoreID *int64 // 门店ID用于过滤门店可见的奖励
RewardTypeID int64 // 奖励类型ID
Name string // 奖励名称(模糊查询)
Status int // 状态1=启用2=禁用
RewardScope int // 奖励范围1=系统奖励2=门店奖励
}
type RewardListOut struct {
List []Reward // 奖励列表
Total int // 总记录数
}
type RewardDeleteIn struct {
ID int64 // 奖励ID
}
type RewardDetailIn struct {
ID int64 // 奖励ID
}
type RewardDetailOut struct {
*Reward
StoreIDs []int64 // 关联门店ID列表仅门店奖励有值
}