Initial commit

This commit is contained in:
2026-05-20 16:13:58 +08:00
commit ceffbe382e
500 changed files with 157469 additions and 0 deletions
+462
View File
@@ -0,0 +1,462 @@
package activitymod
import (
"context"
"fmt"
"stat/common/log"
"stat/common/mongos"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
var dbAct *mongos.MongoTool
var dbLotCodeInfo *mongos.MongoTool
var dbLotGift *mongos.MongoTool
var dbLotGetGift *mongos.MongoTool
func Init() {
ctx := context.Background()
InitAct(ctx)
InitLotCodeInfo(ctx)
InitLotGift(ctx)
InitLotGiftCode(ctx)
}
func InitAct(ctx context.Context) {
// 获取数据库表
dbAct = mongos.New(mongos.MgoManager, TN.ActivityInfo)
// 初始化
indexes := []mongo.IndexModel{
{
Keys: bson.D{{Key: FN.ActivityInfo.Name, Value: 1}},
},
{
Keys: bson.D{{Key: FN.ActivityInfo.Enable, Value: 1}},
},
{
Keys: bson.D{{Key: FN.ActivityInfo.SortCode, Value: -1}},
},
{
Keys: bson.D{
{Key: FN.ActivityInfo.StartTime, Value: -1},
{Key: FN.ActivityInfo.EndTime, Value: -1},
},
},
}
if _, err := dbAct.CreateIndex(context.Background(), indexes); err != nil {
panic(fmt.Sprintf("%s model set index err ==>[%+v]", TN.ActivityInfo, err))
}
}
func InitLotCodeInfo(ctx context.Context) {
// 获取数据库表
dbLotCodeInfo = mongos.New(mongos.MgoManager, TN.LottertyCodeInfo)
// 初始化
indexes := []mongo.IndexModel{
{
Keys: bson.D{{Key: FN.LottertyCodeInfo.LotteryCode, Value: 1}},
},
{
Keys: bson.D{{Key: FN.LottertyCodeInfo.ActId, Value: 1}},
},
{
Keys: bson.D{{Key: FN.LottertyCodeInfo.UserIp, Value: 1}},
},
{
Keys: bson.D{{Key: FN.LottertyCodeInfo.IsUsed, Value: 1}},
},
}
if _, err := dbLotCodeInfo.CreateIndex(context.Background(), indexes); err != nil {
panic(fmt.Sprintf("%s model set index err ==>[%+v]", TN.LottertyCodeInfo, err))
}
}
func InitLotGift(ctx context.Context) {
// 获取数据库表
dbLotGift = mongos.New(mongos.MgoManager, TN.LotteryGift)
// 初始化
indexes := []mongo.IndexModel{
{
Keys: bson.D{{Key: FN.LotteryGift.ActId, Value: 1}},
},
{
Keys: bson.D{{Key: FN.LotteryGift.GiftName, Value: 1}},
},
}
if _, err := dbLotGift.CreateIndex(context.Background(), indexes); err != nil {
panic(fmt.Sprintf("%s model set index err ==>[%+v]", TN.LotteryGift, err))
}
}
func InitLotGiftCode(ctx context.Context) {
// 获取数据库表
dbLotGetGift = mongos.New(mongos.MgoManager, TN.LotteryGetGift)
// 初始化
indexes := []mongo.IndexModel{
{
Keys: bson.D{{Key: FN.LotteryGetGift.GiftCode, Value: 1}},
},
{
Keys: bson.D{{Key: FN.LotteryGetGift.AppName, Value: 1}},
},
{
Keys: bson.D{{Key: FN.LotteryGetGift.ActId, Value: 1}},
},
{
Keys: bson.D{{Key: FN.LotteryGetGift.GiftId, Value: 1}},
},
}
if _, err := dbLotGetGift.CreateIndex(context.Background(), indexes); err != nil {
panic(fmt.Sprintf("%s model set index err ==>[%+v]", TN.LotteryGetGift, err))
}
}
//InsertOneActivityInfo 插入一个活动信息
func InsertOneActivityInfo(ctx context.Context, data *ActivityInfo) error {
if _, err := dbAct.InsertOne(ctx, data); err != nil {
log.Warn("activitymod:InsertOneActivityInfo db.InsertOne failed", log.E(err))
return err
}
return nil
}
//FindOneActivityInfo 查找一个活动信息
func FindOneActivityInfo(ctx context.Context, filter bson.M) (*ActivityInfo, error) {
var data ActivityInfo
if err := dbAct.FindOneEx(ctx, &data, filter); err != nil {
log.Warn("activitymod:FindOneActivityInfo db.FindOne failed",
log.E(err), log.Any("filter", filter))
return nil, err
}
return &data, nil
}
//DelOneActivityInfo 删除一个活动信息
func DelOneActivityInfo(ctx context.Context, filter bson.M) (int64, error) {
count, err := dbAct.DeleteOne(ctx, filter)
if err != nil {
log.Warn("activitymod:DelOneActivityInfo db.DeleteOne failed",
log.E(err), log.Any("filter", filter))
return 0, err
}
return count, nil
}
//UpdateOneActivityInfo 更新一个活动信息
func UpdateOneActivityInfo(ctx context.Context, filter bson.M, update bson.M) error {
result, err := dbAct.UpdateOne(ctx, filter, update)
if err != nil {
log.Warn("activitymod:UpdateOneActivityInfo activitymod:UpdateOne failed",
log.E(err), log.Any("filter", filter))
return err
}
if result.MatchedCount == 0 {
return mongo.ErrNoDocuments
}
return nil
}
//CountActivityInfos 统计活动信息数量
func CountActivityInfos(ctx context.Context, filter bson.M) (int64, error) {
count, err := dbAct.Count(ctx, filter)
if err != nil {
log.Warn("activitymod:CountActivityInfos db.Count failed",
log.E(err), log.Any("filter", filter))
return 0, err
}
return count, nil
}
//UpdateManyActivityInfo 更新满足条件的活动信息
func UpdateManyActivityInfo(ctx context.Context, filter bson.M, update bson.M) error {
_, err := dbAct.UpdateMany(ctx, filter, update)
if err != nil {
log.Warn("user:UpdateManyActivityInfo db.UpdateMany failed",
log.E(err), log.Any("filter", filter))
return err
}
return nil
}
//FindManyActivityInfo 查找一批活动信息数据
func FindManyActivityInfo(ctx context.Context, filter bson.M, opts ...*options.FindOptions) (ActivityInfoList, error) {
data := make(ActivityInfoList, 0)
if err := dbAct.Find(ctx, &data, filter, opts...); err != nil {
log.Warn("activitymod:FindManyActivityInfo db.Find failed", log.E(err), log.Any("filter", filter))
return nil, err
}
return data, nil
}
//FindManyActivityInfoWithBind 用自己定义结构查找一批活动信息数据
func FindManyActivityInfoWithBind(ctx context.Context, bind interface{}, filter bson.M, opts ...*options.FindOptions) error {
if err := dbAct.Find(ctx, bind, filter, opts...); err != nil {
log.Warn("activitymod:FindManyActivityInfoWithBind db.Find failed", log.E(err), log.Any("filter", filter))
return err
}
return nil
}
//InsertOneLottertyCodeInfo 插入一个抽奖码信息
func InsertOneLottertyCodeInfo(ctx context.Context, data *LottertyCodeInfo) error {
if _, err := dbLotCodeInfo.InsertOne(ctx, data); err != nil {
log.Warn("activitymod:InsertOneLottertyCodeInfo db.InsertOne failed", log.E(err))
return err
}
return nil
}
//FindOneLottertyCodeInfo 查找一个抽奖码信息
func FindOneLottertyCodeInfo(ctx context.Context, filter bson.M) (*LottertyCodeInfo, error) {
var data LottertyCodeInfo
if err := dbLotCodeInfo.FindOneEx(ctx, &data, filter); err != nil {
log.Warn("LottertyCodeInfo:FindOneLottertyCodeInfo activitymod:FindOne failed",
log.E(err), log.Any("filter", filter))
return nil, err
}
return &data, nil
}
//DelOneLottertyCodeInfo 删除一个抽奖码信息
func DelOneLottertyCodeInfo(ctx context.Context, filter bson.M) (int64, error) {
count, err := dbLotCodeInfo.DeleteOne(ctx, filter)
if err != nil {
log.Warn("LottertyCodeInfo:DelOneLottertyCodeInfo activitymod:DeleteOne failed",
log.E(err), log.Any("filter", filter))
return 0, err
}
return count, nil
}
//UpdateOneLottertyCodeInfo 更新一个抽奖码信息
func UpdateOneLottertyCodeInfo(ctx context.Context, filter bson.M, update bson.M) error {
result, err := dbLotCodeInfo.UpdateOne(ctx, filter, update)
if err != nil {
log.Warn("UpdateOneLottertyCodeInfo activitymod:UpdateOne failed",
log.E(err), log.Any("filter", filter))
return err
}
if result.MatchedCount == 0 {
return mongo.ErrNoDocuments
}
return nil
}
//CountLottertyCodeInfos 统计抽奖码信息数量
func CountLottertyCodeInfos(ctx context.Context, filter bson.M) (int64, error) {
count, err := dbLotCodeInfo.Count(ctx, filter)
if err != nil {
log.Warn("LottertyCodeInfo:CountLottertyCodeInfos activitymod:Count failed",
log.E(err), log.Any("filter", filter))
return 0, err
}
return count, nil
}
//UpdateManyLottertyCodeInfo 更新满足条件的抽奖码信息
func UpdateManyLottertyCodeInfo(ctx context.Context, filter bson.M, update bson.M) error {
_, err := dbLotCodeInfo.UpdateMany(ctx, filter, update)
if err != nil {
log.Warn("user:UpdateManyLottertyCodeInfo activitymod:UpdateMany failed",
log.E(err), log.Any("filter", filter))
return err
}
return nil
}
//FindManyLottertyCodeInfo 查找一批抽奖码信息数据
func FindManyLottertyCodeInfo(ctx context.Context, filter bson.M, opts ...*options.FindOptions) (LottertyCodeInfoList, error) {
data := make(LottertyCodeInfoList, 0)
if err := dbLotCodeInfo.Find(ctx, &data, filter, opts...); err != nil {
log.Warn("LottertyCodeInfo:FindManyLottertyCodeInfo activitymod:Find failed", log.E(err), log.Any("filter", filter))
return nil, err
}
return data, nil
}
//FindManyLottertyCodeInfoWithBind 用自己定义结构查找一批抽奖码信息数据
func FindManyLottertyCodeInfoWithBind(ctx context.Context, bind interface{}, filter bson.M, opts ...*options.FindOptions) error {
if err := dbLotCodeInfo.Find(ctx, bind, filter, opts...); err != nil {
log.Warn("LottertyCodeInfo:FindManyLottertyCodeInfoWithBind activitymod:Find failed", log.E(err), log.Any("filter", filter))
return err
}
return nil
}
//InsertOneLotteryGift 插入一个奖品信息
func InsertOneLotteryGift(ctx context.Context, data *LotteryGift) error {
if _, err := dbLotGift.InsertOne(ctx, data); err != nil {
log.Warn("activitymod:InsertOneLotteryGift db.InsertOne failed", log.E(err))
return err
}
return nil
}
//FindOneLotteryGift 查找一个奖品信息
func FindOneLotteryGift(ctx context.Context, filter bson.M) (*LotteryGift, error) {
var data LotteryGift
if err := dbLotGift.FindOneEx(ctx, &data, filter); err != nil {
log.Warn("LotteryGift:FindOneLotteryGift dbLotGift.FindOne failed",
log.E(err), log.Any("filter", filter))
return nil, err
}
return &data, nil
}
//DelOneLotteryGift 删除一个奖品信息
func DelOneLotteryGift(ctx context.Context, filter bson.M) (int64, error) {
count, err := dbLotGift.DeleteOne(ctx, filter)
if err != nil {
log.Warn("LotteryGift:DelOneLotteryGift dbLotGift.DeleteOne failed",
log.E(err), log.Any("filter", filter))
return 0, err
}
return count, nil
}
//UpdateOneLotteryGift 更新一个奖品信息
func UpdateOneLotteryGift(ctx context.Context, filter bson.M, update bson.M) error {
result, err := dbLotGift.UpdateOne(ctx, filter, update)
if err != nil {
log.Warn("UpdateOneLotteryGift dbLotGift.UpdateOne failed",
log.E(err), log.Any("filter", filter))
return err
}
if result.MatchedCount == 0 {
return mongo.ErrNoDocuments
}
return nil
}
//CountLotteryGifts 统计奖品信息数量
func CountLotteryGifts(ctx context.Context, filter bson.M) (int64, error) {
count, err := dbLotGift.Count(ctx, filter)
if err != nil {
log.Warn("LotteryGift:CountLotteryGifts dbLotGift.Count failed",
log.E(err), log.Any("filter", filter))
return 0, err
}
return count, nil
}
//UpdateManyLotteryGift 更新满足条件的奖品信息
func UpdateManyLotteryGift(ctx context.Context, filter bson.M, update bson.M) error {
_, err := dbLotGift.UpdateMany(ctx, filter, update)
if err != nil {
log.Warn("user:UpdateManyLotteryGift dbLotGift.UpdateMany failed",
log.E(err), log.Any("filter", filter))
return err
}
return nil
}
//FindManyLotteryGift 查找一批奖品信息数据
func FindManyLotteryGift(ctx context.Context, filter bson.M, opts ...*options.FindOptions) (LotteryGiftList, error) {
data := make(LotteryGiftList, 0)
if err := dbLotGift.Find(ctx, &data, filter, opts...); err != nil {
log.Warn("LotteryGift:FindManyLotteryGift dbLotGift.Find failed", log.E(err), log.Any("filter", filter))
return nil, err
}
return data, nil
}
//FindManyLotteryGiftWithBind 用自己定义结构查找一批奖品信息数据
func FindManyLotteryGiftWithBind(ctx context.Context, bind interface{}, filter bson.M, opts ...*options.FindOptions) error {
if err := dbLotGift.Find(ctx, bind, filter, opts...); err != nil {
log.Warn("LotteryGift:FindManyLotteryGiftWithBind dbLotGift.Find failed", log.E(err), log.Any("filter", filter))
return err
}
return nil
}
//InsertOneLotteryGetGift 插入一个中奖兑换相关信息
func InsertOneLotteryGetGift(ctx context.Context, media *LotteryGetGift) error {
if _, err := dbLotGetGift.InsertOne(ctx, media); err != nil {
log.Warn("activitymod:InsertOneLotteryGetGift dbLotGetGift.InsertOne failed", log.E(err))
return err
}
return nil
}
//FindOneLotteryGetGift 查找一个中奖兑换相关信息
func FindOneLotteryGetGift(ctx context.Context, filter bson.M) (*LotteryGetGift, error) {
var data LotteryGetGift
if err := dbLotGetGift.FindOneEx(ctx, &data, filter); err != nil {
log.Warn("LotteryGetGift:FindOneLotteryGetGift dbLotGetGift.FindOne failed",
log.E(err), log.Any("filter", filter))
return nil, err
}
return &data, nil
}
//DelOneLotteryGetGift 删除一个中奖兑换相关信息
func DelOneLotteryGetGift(ctx context.Context, filter bson.M) (int64, error) {
count, err := dbLotGetGift.DeleteOne(ctx, filter)
if err != nil {
log.Warn("LotteryGetGift:DelOneLotteryGetGift dbLotGetGift.DeleteOne failed",
log.E(err), log.Any("filter", filter))
return 0, err
}
return count, nil
}
//UpdateOneLotteryGetGift 更新一个中奖兑换相关信息
func UpdateOneLotteryGetGift(ctx context.Context, filter bson.M, update bson.M) error {
result, err := dbLotGetGift.UpdateOne(ctx, filter, update)
if err != nil {
log.Warn("UpdateOneLotteryGetGift dbLotGetGift.UpdateOne failed",
log.E(err), log.Any("filter", filter))
return err
}
if result.MatchedCount == 0 {
return mongo.ErrNoDocuments
}
return nil
}
//CountLotteryGetGifts 统计中奖兑换相关信息数量
func CountLotteryGetGifts(ctx context.Context, filter bson.M) (int64, error) {
count, err := dbLotGetGift.Count(ctx, filter)
if err != nil {
log.Warn("LotteryGetGift:CountLotteryGetGifts dbLotGetGift.Count failed",
log.E(err), log.Any("filter", filter))
return 0, err
}
return count, nil
}
//UpdateManyLotteryGetGift 更新满足条件的中奖兑换相关信息
func UpdateManyLotteryGetGift(ctx context.Context, filter bson.M, update bson.M) error {
_, err := dbLotGetGift.UpdateMany(ctx, filter, update)
if err != nil {
log.Warn("user:UpdateManyLotteryGetGift dbLotGetGift.UpdateMany failed",
log.E(err), log.Any("filter", filter))
return err
}
return nil
}
//FindManyLotteryGetGift 查找一批渠道中奖兑换相关信息
func FindManyLotteryGetGift(ctx context.Context, filter bson.M, opts ...*options.FindOptions) (LotteryGetGiftList, error) {
data := make(LotteryGetGiftList, 0)
if err := dbLotGetGift.Find(ctx, &data, filter, opts...); err != nil {
log.Warn("LotteryGetGift:FindManyLotteryGetGift dbLotGetGift.Find failed", log.E(err), log.Any("filter", filter))
return nil, err
}
return data, nil
}
//FindManyLotteryGetGiftWithBind 用自己定义结构查找一批渠道中奖兑换相关信息
func FindManyLotteryGetGiftWithBind(ctx context.Context, bind interface{}, filter bson.M, opts ...*options.FindOptions) error {
if err := dbLotGetGift.Find(ctx, bind, filter, opts...); err != nil {
log.Warn("LotteryGetGift:FindManyLotteryGetGiftWithBind dbLotGetGift.Find failed", log.E(err), log.Any("filter", filter))
return err
}
return nil
}
+127
View File
@@ -0,0 +1,127 @@
package activitymod
type TagLotteryGift struct {
ActId string
ActName string
CreatedAt string
GiftDesc string
GiftName string
Id string
Rate string
Sort string
UpdatedAt string
}
type TagLotteryGetGift struct {
ActId string
ActName string
AppName string
CreatedAt string
GetGiftAt string
GiftCode string
GiftId string
GiftName string
Id string
IsGaveOut string
IsUsed string
LotteryCode string
Remark string
UpdatedAt string
UserId string
}
type TagActivityInfo struct {
Background string
Banner string
CreatedAt string
Desc string
Enable string
EndTime string
GiftDesc string
H5Domain string
Id string
Name string
SortCode string
StartTime string
UpdatedAt string
}
type TagLottertyCodeInfo struct {
ActId string
ActName string
CreatedAt string
GiftCode string
Id string
IsUsed string
LotteryAt string
LotteryCode string
Remark string
UpdatedAt string
UserIp string
}
var FN struct {
LotteryGift TagLotteryGift
LotteryGetGift TagLotteryGetGift
ActivityInfo TagActivityInfo
LottertyCodeInfo TagLottertyCodeInfo
}
var TN struct {
LotteryGift string
LotteryGetGift string
ActivityInfo string
LottertyCodeInfo string
}
func init() {
FN.LotteryGift.ActId = "actId"
FN.LotteryGift.ActName = "actName"
FN.LotteryGift.CreatedAt = "createdAt"
FN.LotteryGift.GiftDesc = "giftDesc"
FN.LotteryGift.GiftName = "giftName"
FN.LotteryGift.Id = "_id"
FN.LotteryGift.Rate = "rate"
FN.LotteryGift.Sort = "sort"
FN.LotteryGift.UpdatedAt = "updatedAt"
FN.LotteryGetGift.ActId = "actId"
FN.LotteryGetGift.ActName = "actName"
FN.LotteryGetGift.AppName = "appName"
FN.LotteryGetGift.CreatedAt = "createdAt"
FN.LotteryGetGift.GetGiftAt = "getGiftAt"
FN.LotteryGetGift.GiftCode = "giftCode"
FN.LotteryGetGift.GiftId = "giftId"
FN.LotteryGetGift.GiftName = "giftName"
FN.LotteryGetGift.Id = "_id"
FN.LotteryGetGift.IsGaveOut = "isGaveOut"
FN.LotteryGetGift.IsUsed = "isUsed"
FN.LotteryGetGift.LotteryCode = "lotteryCode"
FN.LotteryGetGift.Remark = "remark"
FN.LotteryGetGift.UpdatedAt = "updatedAt"
FN.LotteryGetGift.UserId = "userId"
FN.ActivityInfo.Background = "background"
FN.ActivityInfo.Banner = "banner"
FN.ActivityInfo.CreatedAt = "createdAt"
FN.ActivityInfo.Desc = "desc"
FN.ActivityInfo.Enable = "enable"
FN.ActivityInfo.EndTime = "endTime"
FN.ActivityInfo.GiftDesc = "giftDesc"
FN.ActivityInfo.H5Domain = "h5Domain"
FN.ActivityInfo.Id = "_id"
FN.ActivityInfo.Name = "name"
FN.ActivityInfo.SortCode = "sortCode"
FN.ActivityInfo.StartTime = "startTime"
FN.ActivityInfo.UpdatedAt = "updatedAt"
FN.LottertyCodeInfo.ActId = "actId"
FN.LottertyCodeInfo.ActName = "actName"
FN.LottertyCodeInfo.CreatedAt = "createdAt"
FN.LottertyCodeInfo.GiftCode = "giftCode"
FN.LottertyCodeInfo.Id = "_id"
FN.LottertyCodeInfo.IsUsed = "isUsed"
FN.LottertyCodeInfo.LotteryAt = "lotteryAt"
FN.LottertyCodeInfo.LotteryCode = "lotteryCode"
FN.LottertyCodeInfo.Remark = "remark"
FN.LottertyCodeInfo.UpdatedAt = "updatedAt"
FN.LottertyCodeInfo.UserIp = "userIp"
TN.LotteryGetGift = "lottery_get_gift"
TN.ActivityInfo = "activity_info"
TN.LottertyCodeInfo = "lotterty_code_info"
TN.LotteryGift = "lottery_gift"
}
+88
View File
@@ -0,0 +1,88 @@
package activitymod
import (
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
)
// 活动信息
// @table:activity_info
type ActivityInfo struct {
Id primitive.ObjectID `json:"id" bson:"_id"` // 唯一ID
Name string `json:"name" bson:"name"` // 活动名称
Desc string `json:"desc" bson:"desc"` // 活动说明
SortCode int32 `json:"sortCode" bson:"sortCode"` // 排序号
H5Domain string `json:"h5Domain" bson:"h5Domain"` // 活动H5地址
GiftDesc string `json:"giftDesc" bson:"giftDesc"` // 奖励说明
Enable bool `json:"enable" bson:"enable"` // 活动开关
Background string `json:"background" bson:"background"` // 背景图
StartTime time.Time `json:"startTime" bson:"startTime"` // 活动开始时间
EndTime time.Time `json:"endTime" bson:"endTime"` // 活动结束时间
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
Banner []BannerInfo `json:"banner" bson:"banner"` // banner列表
}
type BannerInfo struct {
Img string `json:"bannerImg" bson:"bannerImg"` // banner图片
Url string `json:"bannerUrl" bson:"bannerUrl"` // banner跳转地址
}
type ActivityInfoList []*ActivityInfo
// 抽奖码相关信息
// @table:lotterty_code_info
type LottertyCodeInfo struct {
Id primitive.ObjectID `json:"id" bson:"_id"` // 唯一ID
LotteryCode string `json:"lotteryCode" bson:"lotteryCode"` // 抽奖码
ActId string `json:"actId" bson:"actId"` // 所属活动的ID
ActName string `json:"actName" bson:"actName"` // 活动名称
UserIp string `json:"userIp" bson:"userIp"` // 抽奖者IP
Remark string `json:"remark" bson:"remark"` // 备注
IsUsed bool `json:"isUsed" bson:"isUsed"` // 抽奖码是否已使用
GiftCode string `json:"giftCode" bson:"giftCode"` // 奖品兑换码
LotteryAt time.Time `json:"lotteryAt" bson:"lotteryAt"` // 抽奖时间
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
}
type LottertyCodeInfoList []*LottertyCodeInfo
// 奖品信息
// @table:lottery_gift
type LotteryGift struct {
Id primitive.ObjectID `json:"id" bson:"_id"` // 唯一ID
ActId string `json:"actId" bson:"actId"` // 所属活动的ID
ActName string `json:"actName" bson:"actName"` // 所属活动的名称
GiftName string `json:"giftName" bson:"giftName"` // 奖品名称
GiftDesc string `json:"giftDesc" bson:"giftDesc"` // 奖品描述
Rate int32 `json:"rate" bson:"rate"` // 备注
Sort int32 `json:"sort" bson:"sort"` // 排序
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
}
type LotteryGiftList []*LotteryGift
// 中奖兑换相关信息
// @table:lottery_get_gift
type LotteryGetGift struct {
Id primitive.ObjectID `json:"id" bson:"_id"` // 唯一ID
LotteryCode string `json:"lotteryCode" bson:"lotteryCode"` // 抽奖码
ActId string `json:"actId" bson:"actId"` // 所属活动的ID
ActName string `json:"actName" bson:"actName"` // 所属活动的名称
GiftId string `json:"giftId" bson:"giftId"` // 所属活动奖品的ID
GiftName string `json:"giftName" bson:"giftName"` // 奖品名称
UserId string `json:"userId" bson:"userId"` // 兑换者Id
AppName string `json:"appName" bson:"appName"` // 所属app的名字
Remark string `json:"remark" bson:"remark"` // 备注
IsGaveOut bool `json:"isGaveOut" bson:"isGaveOut"` // 兑换码是否已发放
IsUsed bool `json:"isUsed" bson:"isUsed"` // 奖品兑换码是否已使用
GiftCode string `json:"giftCode" bson:"giftCode"` // 奖品兑换码
GetGiftAt time.Time `json:"getGiftAt" bson:"getGiftAt"` // 兑换奖品的时间
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
}
type LotteryGetGiftList []*LotteryGetGift