Merge branch 'develop' of https://git.pogorockgames.com/mango-games/server/game into develop
# Conflicts: # common/constant.go # etcd/keyconf.go # model/config.go # model/player.go # protocol/webapi/common.proto # worldsrv/etcd.go # worldsrv/welfmgr.go
This commit is contained in:
commit
79e05883db
|
@ -332,6 +332,7 @@ const (
|
||||||
GainWayItem_PigBankTakeDiamond = 121 // 购买钻石存钱罐奖励道具
|
GainWayItem_PigBankTakeDiamond = 121 // 购买钻石存钱罐奖励道具
|
||||||
GainWayNianCost = 122 //年兽活动消耗
|
GainWayNianCost = 122 //年兽活动消耗
|
||||||
GainWayNianGain = 123 //年兽活动获得
|
GainWayNianGain = 123 //年兽活动获得
|
||||||
|
GainWayRedPacket = 124 // 红包奖励
|
||||||
)
|
)
|
||||||
|
|
||||||
// 后台选择 金币变化类型 的充值 类型id号起始
|
// 后台选择 金币变化类型 的充值 类型id号起始
|
||||||
|
|
|
@ -127,3 +127,11 @@ func TestInSameWeek(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStrTimeToTime(t *testing.T) {
|
||||||
|
t1 := StrRFC3339TimeToTime("2016-05-17 15:12:15")
|
||||||
|
if t1.IsZero() {
|
||||||
|
t.Fatal("StrTimeToTime(2016-05-17 15:12:15) expect result is not zero")
|
||||||
|
}
|
||||||
|
t.Log(t1)
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,277 @@
|
||||||
|
// --------------------------------------------------------------------------------------------
|
||||||
|
// The following code is automatically generated by the mongo-dao-generator tool.
|
||||||
|
// Please do not modify this code manually to avoid being overwritten in the next generation.
|
||||||
|
// For more tool details, please click the link to view https://github.com/dobyte/mongo-dao-generator
|
||||||
|
// --------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
package internal
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
|
modelpkg "mongo.games.com/game/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type RedPacketFilterFunc func(cols *RedPacketColumns) interface{}
|
||||||
|
type RedPacketUpdateFunc func(cols *RedPacketColumns) interface{}
|
||||||
|
type RedPacketPipelineFunc func(cols *RedPacketColumns) interface{}
|
||||||
|
type RedPacketCountOptionsFunc func(cols *RedPacketColumns) *options.CountOptions
|
||||||
|
type RedPacketAggregateOptionsFunc func(cols *RedPacketColumns) *options.AggregateOptions
|
||||||
|
type RedPacketFindOneOptionsFunc func(cols *RedPacketColumns) *options.FindOneOptions
|
||||||
|
type RedPacketFindManyOptionsFunc func(cols *RedPacketColumns) *options.FindOptions
|
||||||
|
type RedPacketUpdateOptionsFunc func(cols *RedPacketColumns) *options.UpdateOptions
|
||||||
|
type RedPacketDeleteOptionsFunc func(cols *RedPacketColumns) *options.DeleteOptions
|
||||||
|
type RedPacketInsertOneOptionsFunc func(cols *RedPacketColumns) *options.InsertOneOptions
|
||||||
|
type RedPacketInsertManyOptionsFunc func(cols *RedPacketColumns) *options.InsertManyOptions
|
||||||
|
|
||||||
|
type RedPacket struct {
|
||||||
|
Columns *RedPacketColumns
|
||||||
|
Database *mongo.Database
|
||||||
|
Collection *mongo.Collection
|
||||||
|
}
|
||||||
|
|
||||||
|
type RedPacketColumns struct {
|
||||||
|
ID string
|
||||||
|
Cid string // 红包活动id
|
||||||
|
Use string // 已发红包 红包奖励数量:已发个数
|
||||||
|
Ts string // 更新时间戳
|
||||||
|
}
|
||||||
|
|
||||||
|
var redPacketColumns = &RedPacketColumns{
|
||||||
|
ID: "_id",
|
||||||
|
Cid: "Cid", // 红包活动id
|
||||||
|
Use: "Use", // 已发红包 红包奖励数量:已发个数
|
||||||
|
Ts: "Ts", // 更新时间戳
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRedPacket() *RedPacket {
|
||||||
|
return &RedPacket{
|
||||||
|
Columns: redPacketColumns,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count returns the number of documents in the collection.
|
||||||
|
func (dao *RedPacket) Count(ctx context.Context, filterFunc RedPacketFilterFunc, optionsFunc ...RedPacketCountOptionsFunc) (int64, error) {
|
||||||
|
var (
|
||||||
|
opts *options.CountOptions
|
||||||
|
filter = filterFunc(dao.Columns)
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(optionsFunc) > 0 {
|
||||||
|
opts = optionsFunc[0](dao.Columns)
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.Collection.CountDocuments(ctx, filter, opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate executes an aggregate command against the collection and returns a cursor over the resulting documents.
|
||||||
|
func (dao *RedPacket) Aggregate(ctx context.Context, pipelineFunc RedPacketPipelineFunc, optionsFunc ...RedPacketAggregateOptionsFunc) (*mongo.Cursor, error) {
|
||||||
|
var (
|
||||||
|
opts *options.AggregateOptions
|
||||||
|
pipeline = pipelineFunc(dao.Columns)
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(optionsFunc) > 0 {
|
||||||
|
opts = optionsFunc[0](dao.Columns)
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.Collection.Aggregate(ctx, pipeline, opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
// InsertOne executes an insert command to insert a single document into the collection.
|
||||||
|
func (dao *RedPacket) InsertOne(ctx context.Context, model *modelpkg.RedPacket, optionsFunc ...RedPacketInsertOneOptionsFunc) (*mongo.InsertOneResult, error) {
|
||||||
|
if model == nil {
|
||||||
|
return nil, errors.New("model is nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := dao.autofill(ctx, model); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var opts *options.InsertOneOptions
|
||||||
|
|
||||||
|
if len(optionsFunc) > 0 {
|
||||||
|
opts = optionsFunc[0](dao.Columns)
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.Collection.InsertOne(ctx, model, opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
// InsertMany executes an insert command to insert multiple documents into the collection.
|
||||||
|
func (dao *RedPacket) InsertMany(ctx context.Context, models []*modelpkg.RedPacket, optionsFunc ...RedPacketInsertManyOptionsFunc) (*mongo.InsertManyResult, error) {
|
||||||
|
if len(models) == 0 {
|
||||||
|
return nil, errors.New("models is empty")
|
||||||
|
}
|
||||||
|
|
||||||
|
documents := make([]interface{}, 0, len(models))
|
||||||
|
for i := range models {
|
||||||
|
model := models[i]
|
||||||
|
if err := dao.autofill(ctx, model); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
documents = append(documents, model)
|
||||||
|
}
|
||||||
|
|
||||||
|
var opts *options.InsertManyOptions
|
||||||
|
|
||||||
|
if len(optionsFunc) > 0 {
|
||||||
|
opts = optionsFunc[0](dao.Columns)
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.Collection.InsertMany(ctx, documents, opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateOne executes an update command to update at most one document in the collection.
|
||||||
|
func (dao *RedPacket) UpdateOne(ctx context.Context, filterFunc RedPacketFilterFunc, updateFunc RedPacketUpdateFunc, optionsFunc ...RedPacketUpdateOptionsFunc) (*mongo.UpdateResult, error) {
|
||||||
|
var (
|
||||||
|
opts *options.UpdateOptions
|
||||||
|
filter = filterFunc(dao.Columns)
|
||||||
|
update = updateFunc(dao.Columns)
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(optionsFunc) > 0 {
|
||||||
|
opts = optionsFunc[0](dao.Columns)
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.Collection.UpdateOne(ctx, filter, update, opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateOneByID executes an update command to update at most one document in the collection.
|
||||||
|
func (dao *RedPacket) UpdateOneByID(ctx context.Context, id string, updateFunc RedPacketUpdateFunc, optionsFunc ...RedPacketUpdateOptionsFunc) (*mongo.UpdateResult, error) {
|
||||||
|
objectID, err := primitive.ObjectIDFromHex(id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.UpdateOne(ctx, func(cols *RedPacketColumns) interface{} {
|
||||||
|
return bson.M{"_id": objectID}
|
||||||
|
}, updateFunc, optionsFunc...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateMany executes an update command to update documents in the collection.
|
||||||
|
func (dao *RedPacket) UpdateMany(ctx context.Context, filterFunc RedPacketFilterFunc, updateFunc RedPacketUpdateFunc, optionsFunc ...RedPacketUpdateOptionsFunc) (*mongo.UpdateResult, error) {
|
||||||
|
var (
|
||||||
|
opts *options.UpdateOptions
|
||||||
|
filter = filterFunc(dao.Columns)
|
||||||
|
update = updateFunc(dao.Columns)
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(optionsFunc) > 0 {
|
||||||
|
opts = optionsFunc[0](dao.Columns)
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.Collection.UpdateMany(ctx, filter, update, opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindOne executes a find command and returns a model for one document in the collection.
|
||||||
|
func (dao *RedPacket) FindOne(ctx context.Context, filterFunc RedPacketFilterFunc, optionsFunc ...RedPacketFindOneOptionsFunc) (*modelpkg.RedPacket, error) {
|
||||||
|
var (
|
||||||
|
opts *options.FindOneOptions
|
||||||
|
model = &modelpkg.RedPacket{}
|
||||||
|
filter = filterFunc(dao.Columns)
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(optionsFunc) > 0 {
|
||||||
|
opts = optionsFunc[0](dao.Columns)
|
||||||
|
}
|
||||||
|
|
||||||
|
err := dao.Collection.FindOne(ctx, filter, opts).Decode(model)
|
||||||
|
if err != nil {
|
||||||
|
if err == mongo.ErrNoDocuments {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindOneByID executes a find command and returns a model for one document in the collection.
|
||||||
|
func (dao *RedPacket) FindOneByID(ctx context.Context, id string, optionsFunc ...RedPacketFindOneOptionsFunc) (*modelpkg.RedPacket, error) {
|
||||||
|
objectID, err := primitive.ObjectIDFromHex(id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.FindOne(ctx, func(cols *RedPacketColumns) interface{} {
|
||||||
|
return bson.M{"_id": objectID}
|
||||||
|
}, optionsFunc...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindMany executes a find command and returns many models the matching documents in the collection.
|
||||||
|
func (dao *RedPacket) FindMany(ctx context.Context, filterFunc RedPacketFilterFunc, optionsFunc ...RedPacketFindManyOptionsFunc) ([]*modelpkg.RedPacket, error) {
|
||||||
|
var (
|
||||||
|
opts *options.FindOptions
|
||||||
|
filter = filterFunc(dao.Columns)
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(optionsFunc) > 0 {
|
||||||
|
opts = optionsFunc[0](dao.Columns)
|
||||||
|
}
|
||||||
|
|
||||||
|
cur, err := dao.Collection.Find(ctx, filter, opts)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
models := make([]*modelpkg.RedPacket, 0)
|
||||||
|
|
||||||
|
if err = cur.All(ctx, &models); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return models, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOne executes a delete command to delete at most one document from the collection.
|
||||||
|
func (dao *RedPacket) DeleteOne(ctx context.Context, filterFunc RedPacketFilterFunc, optionsFunc ...RedPacketDeleteOptionsFunc) (*mongo.DeleteResult, error) {
|
||||||
|
var (
|
||||||
|
opts *options.DeleteOptions
|
||||||
|
filter = filterFunc(dao.Columns)
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(optionsFunc) > 0 {
|
||||||
|
opts = optionsFunc[0](dao.Columns)
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.Collection.DeleteOne(ctx, filter, opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOneByID executes a delete command to delete at most one document from the collection.
|
||||||
|
func (dao *RedPacket) DeleteOneByID(ctx context.Context, id string, optionsFunc ...RedPacketDeleteOptionsFunc) (*mongo.DeleteResult, error) {
|
||||||
|
objectID, err := primitive.ObjectIDFromHex(id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.DeleteOne(ctx, func(cols *RedPacketColumns) interface{} {
|
||||||
|
return bson.M{"_id": objectID}
|
||||||
|
}, optionsFunc...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteMany executes a delete command to delete documents from the collection.
|
||||||
|
func (dao *RedPacket) DeleteMany(ctx context.Context, filterFunc RedPacketFilterFunc, optionsFunc ...RedPacketDeleteOptionsFunc) (*mongo.DeleteResult, error) {
|
||||||
|
var (
|
||||||
|
opts *options.DeleteOptions
|
||||||
|
filter = filterFunc(dao.Columns)
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(optionsFunc) > 0 {
|
||||||
|
opts = optionsFunc[0](dao.Columns)
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.Collection.DeleteMany(ctx, filter, opts)
|
||||||
|
}
|
||||||
|
|
||||||
|
// autofill when inserting data
|
||||||
|
func (dao *RedPacket) autofill(ctx context.Context, model *modelpkg.RedPacket) error {
|
||||||
|
if model.ID.IsZero() {
|
||||||
|
model.ID = primitive.NewObjectID()
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/mongox"
|
||||||
|
|
||||||
|
"mongo.games.com/game/dao/internal"
|
||||||
|
modelpkg "mongo.games.com/game/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ = context.Background()
|
||||||
|
_ = logger.Logger
|
||||||
|
_ = bson.M{}
|
||||||
|
_ = mongo.Database{}
|
||||||
|
)
|
||||||
|
|
||||||
|
type RedPacketColumns = internal.RedPacketColumns
|
||||||
|
|
||||||
|
type RedPacket struct {
|
||||||
|
*internal.RedPacket
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetRedPacket(key string) (*RedPacket, error) {
|
||||||
|
return mongox.GetDao(key, NewRedPacket)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRedPacket(db *mongo.Database, c *mongo.Collection) (*RedPacket, any) {
|
||||||
|
if db == nil || c == nil {
|
||||||
|
return &RedPacket{}, &modelpkg.RedPacket{}
|
||||||
|
}
|
||||||
|
|
||||||
|
v := internal.NewRedPacket()
|
||||||
|
v.Database = db
|
||||||
|
v.Collection = c
|
||||||
|
|
||||||
|
// 创建索引
|
||||||
|
c.Indexes().CreateOne(context.Background(), mongo.IndexModel{
|
||||||
|
Keys: bson.D{{"cid", 1}}, // 1 表示升序,-1 表示降序
|
||||||
|
Options: options.Index().SetBackground(true).SetSparse(true), // 后台创建索引,稀疏索引
|
||||||
|
})
|
||||||
|
c.Indexes().CreateOne(context.Background(), mongo.IndexModel{
|
||||||
|
Keys: bson.D{{"ts", 1}}, // 1 表示升序,-1 表示降序
|
||||||
|
Options: options.Index().SetBackground(true).SetSparse(true), // 后台创建索引,稀疏索引
|
||||||
|
})
|
||||||
|
c.Indexes().CreateOne(context.Background(), mongo.IndexModel{
|
||||||
|
Keys: bson.D{{"ts", -1}}, // 1 表示升序,-1 表示降序
|
||||||
|
Options: options.Index().SetBackground(true).SetSparse(true), // 后台创建索引,稀疏索引
|
||||||
|
})
|
||||||
|
|
||||||
|
return &RedPacket{RedPacket: v}, &modelpkg.RedPacket{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RedPacket) GetAll() (res []*modelpkg.RedPacket, err error) {
|
||||||
|
res, err = r.FindMany(context.Background(), func(cols *RedPacketColumns) interface{} {
|
||||||
|
return bson.M{}
|
||||||
|
})
|
||||||
|
if err != nil && !errors.Is(err, mongo.ErrNoDocuments) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RedPacket) UpdateAll(list []*modelpkg.RedPacket) error {
|
||||||
|
var operations []mongo.WriteModel
|
||||||
|
for _, v := range list {
|
||||||
|
updateDataMap := bson.M{
|
||||||
|
"$set": v,
|
||||||
|
}
|
||||||
|
delete(updateDataMap["$set"].(bson.M), "_id") // 删除 _id 字段
|
||||||
|
operations = append(operations, mongo.NewUpdateOneModel().SetFilter(bson.M{"_id": v.ID}).SetUpdate(bson.M{"$set": v}).SetUpsert(true))
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := r.Collection.BulkWrite(context.Background(), operations) // 批量更新
|
||||||
|
if err != nil {
|
||||||
|
logger.Logger.Errorf("RedPacket.UpdateAll error: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package svc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/rpc"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/mongox"
|
||||||
|
|
||||||
|
"mongo.games.com/game/dao"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
var RedPacketSvc = new(RedPacketService)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rpc.Register(RedPacketSvc)
|
||||||
|
}
|
||||||
|
|
||||||
|
type RedPacketService struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RedPacketService) GetAll(plt *string, res *[]*model.RedPacket) error {
|
||||||
|
d, err := dao.GetRedPacket(*plt)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
list, err := d.GetAll()
|
||||||
|
if err != nil {
|
||||||
|
logger.Logger.Errorf("GetAll error: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
*res = list
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RedPacketService) UpdateAll(plt *string, list []*model.RedPacket) error {
|
||||||
|
d, err := mongox.GetDao(*plt, dao.NewRedPacket)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = d.UpdateAll(list)
|
||||||
|
if err != nil {
|
||||||
|
logger.Logger.Errorf("UpdateAll error: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -52,4 +52,6 @@ const (
|
||||||
ETCDKEY_PigBankDiamond = "/game/pigbank_diamond" //存钱罐消耗获得
|
ETCDKEY_PigBankDiamond = "/game/pigbank_diamond" //存钱罐消耗获得
|
||||||
ETCDKEY_PigBankProp = "/game/pigbank_prop" //存钱罐属性
|
ETCDKEY_PigBankProp = "/game/pigbank_prop" //存钱罐属性
|
||||||
ETCDKEY_NianConfig = "/game/activity_nian" //年兽活动配置
|
ETCDKEY_NianConfig = "/game/activity_nian" //年兽活动配置
|
||||||
|
ETCDKEY_REDPACKET = "/game/act_redpacket" //红包配置
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
13
go.sum
13
go.sum
|
@ -386,8 +386,6 @@ github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45
|
||||||
github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37 h1:EWU6Pktpas0n8lLQwDsRyZfmkPeRbdgPtW609es+/9E=
|
github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37 h1:EWU6Pktpas0n8lLQwDsRyZfmkPeRbdgPtW609es+/9E=
|
||||||
github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37/go.mod h1:HpMP7DB2CyokmAh4lp0EQnnWhmycP/TvwBGzvuie+H0=
|
github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37/go.mod h1:HpMP7DB2CyokmAh4lp0EQnnWhmycP/TvwBGzvuie+H0=
|
||||||
github.com/xuri/efp v0.0.0-20200605144744-ba689101faaf/go.mod h1:uBiSUepVYMhGTfDeBKKasV4GpgBlzJ46gXUBAqV8qLk=
|
github.com/xuri/efp v0.0.0-20200605144744-ba689101faaf/go.mod h1:uBiSUepVYMhGTfDeBKKasV4GpgBlzJ46gXUBAqV8qLk=
|
||||||
github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d h1:llb0neMWDQe87IzJLS4Ci7psK/lVsjIS2otl+1WyRyY=
|
|
||||||
github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
|
|
||||||
github.com/xuri/efp v0.0.0-20241211021726-c4e992084aa6 h1:8m6DWBG+dlFNbx5ynvrE7NgI+Y7OlZVMVTpayoW+rCc=
|
github.com/xuri/efp v0.0.0-20241211021726-c4e992084aa6 h1:8m6DWBG+dlFNbx5ynvrE7NgI+Y7OlZVMVTpayoW+rCc=
|
||||||
github.com/xuri/efp v0.0.0-20241211021726-c4e992084aa6/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
|
github.com/xuri/efp v0.0.0-20241211021726-c4e992084aa6/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
|
||||||
github.com/xuri/excelize/v2 v2.9.0 h1:1tgOaEq92IOEumR1/JfYS/eR0KHOCsRv/rYXXh6YJQE=
|
github.com/xuri/excelize/v2 v2.9.0 h1:1tgOaEq92IOEumR1/JfYS/eR0KHOCsRv/rYXXh6YJQE=
|
||||||
|
@ -441,8 +439,6 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
|
||||||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
|
|
||||||
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
|
|
||||||
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
||||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
@ -479,8 +475,6 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
|
||||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
|
||||||
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
|
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
|
||||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
@ -493,8 +487,7 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
|
||||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
|
||||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
@ -523,8 +516,6 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
|
||||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
||||||
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
@ -537,8 +528,6 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
|
||||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
|
||||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
|
|
@ -25,6 +25,7 @@ const (
|
||||||
OpPhoneLottery = 5
|
OpPhoneLottery = 5
|
||||||
OpCollect = 6
|
OpCollect = 6
|
||||||
OpNian = 7
|
OpNian = 7
|
||||||
|
OpRedPacket = 8 // 红包活动
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -169,6 +170,8 @@ type AllConfig struct {
|
||||||
*webapi.GamePigBankPropConfig
|
*webapi.GamePigBankPropConfig
|
||||||
//年兽配置
|
//年兽配置
|
||||||
*webapi.ActivityNianConfig
|
*webapi.ActivityNianConfig
|
||||||
|
// 红包配置
|
||||||
|
*webapi.RedPacketConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
type GlobalConfig struct {
|
type GlobalConfig struct {
|
||||||
|
|
|
@ -565,6 +565,7 @@ type WelfareData struct {
|
||||||
PermitAward map[int32]int64 // 赛季通行证奖励领取时间
|
PermitAward map[int32]int64 // 赛季通行证奖励领取时间
|
||||||
PermitExchange map[int32][]int64 // 赛季通行证兑换次数, 多次的兑换时间
|
PermitExchange map[int32][]int64 // 赛季通行证兑换次数, 多次的兑换时间
|
||||||
NianData *NianData //年兽活动数据
|
NianData *NianData //年兽活动数据
|
||||||
|
RedPacket map[int64]int // 红包活动 活动id:领取次数
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWelfareData() *WelfareData {
|
func NewWelfareData() *WelfareData {
|
||||||
|
@ -584,6 +585,7 @@ func NewWelfareData() *WelfareData {
|
||||||
NianData: &NianData{
|
NianData: &NianData{
|
||||||
OtherAwardNum: make(map[int32]int32),
|
OtherAwardNum: make(map[int32]int32),
|
||||||
},
|
},
|
||||||
|
RedPacket: make(map[int64]int),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:generate mongoctl -model-dir=. -model-names=RedPacket -dao-dir=../dao/
|
||||||
|
type RedPacket struct {
|
||||||
|
ID primitive.ObjectID `bson:"_id" gen:"autoFill"`
|
||||||
|
Cid int64 // 红包活动id
|
||||||
|
Use map[int64]int64 // 已发红包 红包奖励数量:已发个数
|
||||||
|
Ts int64 // 更新时间戳
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RedPacket) DatabaseName() string {
|
||||||
|
return "log"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RedPacket) CollectionName() string {
|
||||||
|
return "log_redpacket"
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetRedPacketAll(plt string) (res []*RedPacket, err error) {
|
||||||
|
if rpcCli == nil {
|
||||||
|
logger.Logger.Error("model.GetRedPacketAll rpcCli == nil")
|
||||||
|
return nil, errors.New("rpc client is nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
err = rpcCli.CallWithTimeout("RedPacketService.GetAll", &plt, &res, time.Second*30)
|
||||||
|
if err != nil {
|
||||||
|
logger.Logger.Errorf("GetRedPacketAll error: %v", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpdateRedPacketAll(plt string, list []*RedPacket) error {
|
||||||
|
if rpcCli == nil {
|
||||||
|
logger.Logger.Error("model.UpdateRedPacketAll rpcCli == nil")
|
||||||
|
return errors.New("rpc client is nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
err := rpcCli.CallWithTimeout("RedPacketService.UpdateAll", &plt, &list, time.Second*30)
|
||||||
|
if err != nil {
|
||||||
|
logger.Logger.Errorf("UpdateRedPacketAll error: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -76,6 +76,7 @@ type RegisterHandlerParam struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterHandler 注册消息处理函数
|
// RegisterHandler 注册消息处理函数
|
||||||
|
// 必须在init()函数中调用
|
||||||
func (c *MessageMgr) RegisterHandler(param *RegisterHandlerParam) {
|
func (c *MessageMgr) RegisterHandler(param *RegisterHandlerParam) {
|
||||||
if param == nil {
|
if param == nil {
|
||||||
return
|
return
|
||||||
|
@ -143,6 +144,7 @@ func WriteWithOptions(data interface{}, name string, opts ...broker.PublishOptio
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterHandler 注册消息处理函数
|
// RegisterHandler 注册消息处理函数
|
||||||
|
// 必须在init()函数中调用
|
||||||
func RegisterHandler(param *RegisterHandlerParam) {
|
func RegisterHandler(param *RegisterHandlerParam) {
|
||||||
MessageMgrSingle.RegisterHandler(param)
|
MessageMgrSingle.RegisterHandler(param)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9860,6 +9860,244 @@ func (x *GamePigBankPropConfig) GetPropInfo() []*PigBankPropInfo {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// etcd /game/act_redpacket
|
||||||
|
type RedPacketConfig struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Platform string `protobuf:"bytes,1,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台
|
||||||
|
List []*RedPacketInfo `protobuf:"bytes,2,rep,name=List,proto3" json:"List,omitempty"` // 活动列表
|
||||||
|
PlayerLimit int32 `protobuf:"varint,3,opt,name=PlayerLimit,proto3" json:"PlayerLimit,omitempty"` // 玩家最大领取红包次数 0无限制
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketConfig) Reset() {
|
||||||
|
*x = RedPacketConfig{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_protocol_webapi_common_proto_msgTypes[104]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketConfig) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*RedPacketConfig) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *RedPacketConfig) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_protocol_webapi_common_proto_msgTypes[104]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use RedPacketConfig.ProtoReflect.Descriptor instead.
|
||||||
|
func (*RedPacketConfig) Descriptor() ([]byte, []int) {
|
||||||
|
return file_protocol_webapi_common_proto_rawDescGZIP(), []int{104}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketConfig) GetPlatform() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Platform
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketConfig) GetList() []*RedPacketInfo {
|
||||||
|
if x != nil {
|
||||||
|
return x.List
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketConfig) GetPlayerLimit() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.PlayerLimit
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type RedPacketInfo struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` // 配置id
|
||||||
|
On int32 `protobuf:"varint,2,opt,name=On,proto3" json:"On,omitempty"` // 开关 1开启 2关闭
|
||||||
|
StartHMS int64 `protobuf:"varint,3,opt,name=StartHMS,proto3" json:"StartHMS,omitempty"` // 开始时间,时*10000 + 分*100 + 秒
|
||||||
|
EndHMS int64 `protobuf:"varint,4,opt,name=EndHMS,proto3" json:"EndHMS,omitempty"` // 结束时间,时*10000 + 分*100 + 秒
|
||||||
|
StayTs int64 `protobuf:"varint,5,opt,name=StayTs,proto3" json:"StayTs,omitempty"` // 持续时长,单位秒
|
||||||
|
MaxCount int64 `protobuf:"varint,6,opt,name=MaxCount,proto3" json:"MaxCount,omitempty"` // 每人最大领取次数 0无限制
|
||||||
|
LessCount int64 `protobuf:"varint,7,opt,name=LessCount,proto3" json:"LessCount,omitempty"` // 保底红包个数
|
||||||
|
ItemId int32 `protobuf:"varint,8,opt,name=ItemId,proto3" json:"ItemId,omitempty"` // 奖励类型(道具id,100001金币 100002钻石)
|
||||||
|
TotalNum int64 `protobuf:"varint,9,opt,name=TotalNum,proto3" json:"TotalNum,omitempty"` // 总奖励数量
|
||||||
|
RedList []*RedInfo `protobuf:"bytes,10,rep,name=RedList,proto3" json:"RedList,omitempty"` // 红包奖励列表
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) Reset() {
|
||||||
|
*x = RedPacketInfo{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_protocol_webapi_common_proto_msgTypes[105]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*RedPacketInfo) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_protocol_webapi_common_proto_msgTypes[105]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use RedPacketInfo.ProtoReflect.Descriptor instead.
|
||||||
|
func (*RedPacketInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return file_protocol_webapi_common_proto_rawDescGZIP(), []int{105}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) GetOn() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.On
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) GetStartHMS() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.StartHMS
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) GetEndHMS() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.EndHMS
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) GetStayTs() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.StayTs
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) GetMaxCount() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.MaxCount
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) GetLessCount() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.LessCount
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) GetItemId() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.ItemId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) GetTotalNum() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.TotalNum
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketInfo) GetRedList() []*RedInfo {
|
||||||
|
if x != nil {
|
||||||
|
return x.RedList
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type RedInfo struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Num int64 `protobuf:"varint,1,opt,name=Num,proto3" json:"Num,omitempty"` // 数量
|
||||||
|
Rate int64 `protobuf:"varint,2,opt,name=Rate,proto3" json:"Rate,omitempty"` // 概率,百分比
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedInfo) Reset() {
|
||||||
|
*x = RedInfo{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_protocol_webapi_common_proto_msgTypes[106]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedInfo) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*RedInfo) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *RedInfo) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_protocol_webapi_common_proto_msgTypes[106]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use RedInfo.ProtoReflect.Descriptor instead.
|
||||||
|
func (*RedInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return file_protocol_webapi_common_proto_rawDescGZIP(), []int{106}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedInfo) GetNum() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Num
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RedInfo) GetRate() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Rate
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
var File_protocol_webapi_common_proto protoreflect.FileDescriptor
|
var File_protocol_webapi_common_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_protocol_webapi_common_proto_rawDesc = []byte{
|
var file_protocol_webapi_common_proto_rawDesc = []byte{
|
||||||
|
@ -11387,10 +11625,38 @@ var file_protocol_webapi_common_proto_rawDesc = []byte{
|
||||||
0x72, 0x6d, 0x12, 0x33, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02,
|
0x72, 0x6d, 0x12, 0x33, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02,
|
||||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x69,
|
0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x69,
|
||||||
0x67, 0x42, 0x61, 0x6e, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x50,
|
0x67, 0x42, 0x61, 0x6e, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x50,
|
||||||
0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x26, 0x5a, 0x24, 0x6d, 0x6f, 0x6e, 0x67, 0x6f,
|
0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x7a, 0x0a, 0x0f, 0x52, 0x65, 0x64, 0x50, 0x61,
|
||||||
0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f,
|
0x63, 0x6b, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x62,
|
0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c,
|
||||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x29, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02,
|
||||||
|
0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65,
|
||||||
|
0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x4c, 0x69, 0x73,
|
||||||
|
0x74, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74,
|
||||||
|
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x69,
|
||||||
|
0x6d, 0x69, 0x74, 0x22, 0x94, 0x02, 0x0a, 0x0d, 0x52, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65,
|
||||||
|
0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
|
0x03, 0x52, 0x02, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
|
0x05, 0x52, 0x02, 0x4f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x4d,
|
||||||
|
0x53, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x4d,
|
||||||
|
0x53, 0x12, 0x16, 0x0a, 0x06, 0x45, 0x6e, 0x64, 0x48, 0x4d, 0x53, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||||
|
0x03, 0x52, 0x06, 0x45, 0x6e, 0x64, 0x48, 0x4d, 0x53, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x74, 0x61,
|
||||||
|
0x79, 0x54, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x53, 0x74, 0x61, 0x79, 0x54,
|
||||||
|
0x73, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20,
|
||||||
|
0x01, 0x28, 0x03, 0x52, 0x08, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a,
|
||||||
|
0x09, 0x4c, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03,
|
||||||
|
0x52, 0x09, 0x4c, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x49,
|
||||||
|
0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65,
|
||||||
|
0x6d, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x18,
|
||||||
|
0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x12,
|
||||||
|
0x29, 0x0a, 0x07, 0x52, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b,
|
||||||
|
0x32, 0x0f, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x64, 0x49, 0x6e, 0x66,
|
||||||
|
0x6f, 0x52, 0x07, 0x52, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x2f, 0x0a, 0x07, 0x52, 0x65,
|
||||||
|
0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01,
|
||||||
|
0x28, 0x03, 0x52, 0x03, 0x4e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x61, 0x74, 0x65, 0x18,
|
||||||
|
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x52, 0x61, 0x74, 0x65, 0x42, 0x26, 0x5a, 0x24, 0x6d,
|
||||||
|
0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67,
|
||||||
|
0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x77, 0x65, 0x62,
|
||||||
|
0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -11405,7 +11671,7 @@ func file_protocol_webapi_common_proto_rawDescGZIP() []byte {
|
||||||
return file_protocol_webapi_common_proto_rawDescData
|
return file_protocol_webapi_common_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_protocol_webapi_common_proto_msgTypes = make([]protoimpl.MessageInfo, 114)
|
var file_protocol_webapi_common_proto_msgTypes = make([]protoimpl.MessageInfo, 117)
|
||||||
var file_protocol_webapi_common_proto_goTypes = []interface{}{
|
var file_protocol_webapi_common_proto_goTypes = []interface{}{
|
||||||
(*MysqlDbSetting)(nil), // 0: webapi.MysqlDbSetting
|
(*MysqlDbSetting)(nil), // 0: webapi.MysqlDbSetting
|
||||||
(*MongoDbSetting)(nil), // 1: webapi.MongoDbSetting
|
(*MongoDbSetting)(nil), // 1: webapi.MongoDbSetting
|
||||||
|
@ -11511,32 +11777,35 @@ var file_protocol_webapi_common_proto_goTypes = []interface{}{
|
||||||
(*GamePigBankDiamondConfig)(nil), // 101: webapi.GamePigBankDiamondConfig
|
(*GamePigBankDiamondConfig)(nil), // 101: webapi.GamePigBankDiamondConfig
|
||||||
(*PigBankPropInfo)(nil), // 102: webapi.PigBankPropInfo
|
(*PigBankPropInfo)(nil), // 102: webapi.PigBankPropInfo
|
||||||
(*GamePigBankPropConfig)(nil), // 103: webapi.GamePigBankPropConfig
|
(*GamePigBankPropConfig)(nil), // 103: webapi.GamePigBankPropConfig
|
||||||
nil, // 104: webapi.Platform.BindTelRewardEntry
|
(*RedPacketConfig)(nil), // 104: webapi.RedPacketConfig
|
||||||
nil, // 105: webapi.PlayerData.RankScoreEntry
|
(*RedPacketInfo)(nil), // 105: webapi.RedPacketInfo
|
||||||
nil, // 106: webapi.ItemShop.AwardEntry
|
(*RedInfo)(nil), // 106: webapi.RedInfo
|
||||||
nil, // 107: webapi.VIPcfg.AwardEntry
|
nil, // 107: webapi.Platform.BindTelRewardEntry
|
||||||
nil, // 108: webapi.VIPcfg.Privilege1Entry
|
nil, // 108: webapi.PlayerData.RankScoreEntry
|
||||||
nil, // 109: webapi.VIPcfg.Privilege7Entry
|
nil, // 109: webapi.ItemShop.AwardEntry
|
||||||
nil, // 110: webapi.VIPcfg.Privilege9Entry
|
nil, // 110: webapi.VIPcfg.AwardEntry
|
||||||
nil, // 111: webapi.ActInviteConfig.PayScoreEntry
|
nil, // 111: webapi.VIPcfg.Privilege1Entry
|
||||||
nil, // 112: webapi.SkinLevel.UpItemEntry
|
nil, // 112: webapi.VIPcfg.Privilege7Entry
|
||||||
nil, // 113: webapi.SkinItem.UnlockParamEntry
|
nil, // 113: webapi.VIPcfg.Privilege9Entry
|
||||||
(*server.DB_GameFree)(nil), // 114: server.DB_GameFree
|
nil, // 114: webapi.ActInviteConfig.PayScoreEntry
|
||||||
(*server.DB_GameItem)(nil), // 115: server.DB_GameItem
|
nil, // 115: webapi.SkinLevel.UpItemEntry
|
||||||
|
nil, // 116: webapi.SkinItem.UnlockParamEntry
|
||||||
|
(*server.DB_GameFree)(nil), // 117: server.DB_GameFree
|
||||||
|
(*server.DB_GameItem)(nil), // 118: server.DB_GameItem
|
||||||
}
|
}
|
||||||
var file_protocol_webapi_common_proto_depIdxs = []int32{
|
var file_protocol_webapi_common_proto_depIdxs = []int32{
|
||||||
2, // 0: webapi.Platform.Leaderboard:type_name -> webapi.RankSwitch
|
2, // 0: webapi.Platform.Leaderboard:type_name -> webapi.RankSwitch
|
||||||
3, // 1: webapi.Platform.ClubConfig:type_name -> webapi.ClubConfig
|
3, // 1: webapi.Platform.ClubConfig:type_name -> webapi.ClubConfig
|
||||||
4, // 2: webapi.Platform.ThirdGameMerchant:type_name -> webapi.ThirdGame
|
4, // 2: webapi.Platform.ThirdGameMerchant:type_name -> webapi.ThirdGame
|
||||||
104, // 3: webapi.Platform.BindTelReward:type_name -> webapi.Platform.BindTelRewardEntry
|
107, // 3: webapi.Platform.BindTelReward:type_name -> webapi.Platform.BindTelRewardEntry
|
||||||
6, // 4: webapi.GameConfigGlobal.GameStatus:type_name -> webapi.GameStatus
|
6, // 4: webapi.GameConfigGlobal.GameStatus:type_name -> webapi.GameStatus
|
||||||
114, // 5: webapi.GameFree.DbGameFree:type_name -> server.DB_GameFree
|
117, // 5: webapi.GameFree.DbGameFree:type_name -> server.DB_GameFree
|
||||||
8, // 6: webapi.PlatformGameConfig.DbGameFrees:type_name -> webapi.GameFree
|
8, // 6: webapi.PlatformGameConfig.DbGameFrees:type_name -> webapi.GameFree
|
||||||
0, // 7: webapi.PlatformDbConfig.Mysql:type_name -> webapi.MysqlDbSetting
|
0, // 7: webapi.PlatformDbConfig.Mysql:type_name -> webapi.MysqlDbSetting
|
||||||
1, // 8: webapi.PlatformDbConfig.MongoDb:type_name -> webapi.MongoDbSetting
|
1, // 8: webapi.PlatformDbConfig.MongoDb:type_name -> webapi.MongoDbSetting
|
||||||
1, // 9: webapi.PlatformDbConfig.MongoDbLog:type_name -> webapi.MongoDbSetting
|
1, // 9: webapi.PlatformDbConfig.MongoDbLog:type_name -> webapi.MongoDbSetting
|
||||||
114, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree
|
117, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree
|
||||||
105, // 11: webapi.PlayerData.RankScore:type_name -> webapi.PlayerData.RankScoreEntry
|
108, // 11: webapi.PlayerData.RankScore:type_name -> webapi.PlayerData.RankScoreEntry
|
||||||
32, // 12: webapi.PlayerData.Items:type_name -> webapi.ItemInfo
|
32, // 12: webapi.PlayerData.Items:type_name -> webapi.ItemInfo
|
||||||
14, // 13: webapi.PlayerData.RoleUnlockList:type_name -> webapi.ModInfo
|
14, // 13: webapi.PlayerData.RoleUnlockList:type_name -> webapi.ModInfo
|
||||||
14, // 14: webapi.PlayerData.PetUnlockList:type_name -> webapi.ModInfo
|
14, // 14: webapi.PlayerData.PetUnlockList:type_name -> webapi.ModInfo
|
||||||
|
@ -11549,7 +11818,7 @@ var file_protocol_webapi_common_proto_depIdxs = []int32{
|
||||||
32, // 21: webapi.ExchangeShop.Items:type_name -> webapi.ItemInfo
|
32, // 21: webapi.ExchangeShop.Items:type_name -> webapi.ItemInfo
|
||||||
25, // 22: webapi.ExchangeShopList.List:type_name -> webapi.ExchangeShop
|
25, // 22: webapi.ExchangeShopList.List:type_name -> webapi.ExchangeShop
|
||||||
29, // 23: webapi.ExchangeShopList.Weight:type_name -> webapi.ShopWeight
|
29, // 23: webapi.ExchangeShopList.Weight:type_name -> webapi.ShopWeight
|
||||||
106, // 24: webapi.ItemShop.Award:type_name -> webapi.ItemShop.AwardEntry
|
109, // 24: webapi.ItemShop.Award:type_name -> webapi.ItemShop.AwardEntry
|
||||||
30, // 25: webapi.ItemShopList.List:type_name -> webapi.ItemShop
|
30, // 25: webapi.ItemShopList.List:type_name -> webapi.ItemShop
|
||||||
32, // 26: webapi.MatchInfoAward.ItemId:type_name -> webapi.ItemInfo
|
32, // 26: webapi.MatchInfoAward.ItemId:type_name -> webapi.ItemInfo
|
||||||
33, // 27: webapi.GameMatchDate.Award:type_name -> webapi.MatchInfoAward
|
33, // 27: webapi.GameMatchDate.Award:type_name -> webapi.MatchInfoAward
|
||||||
|
@ -11570,14 +11839,14 @@ var file_protocol_webapi_common_proto_depIdxs = []int32{
|
||||||
38, // 42: webapi.WelfareSpree.Item:type_name -> webapi.WelfareDate
|
38, // 42: webapi.WelfareSpree.Item:type_name -> webapi.WelfareDate
|
||||||
48, // 43: webapi.WelfareFirstPayDataList.List:type_name -> webapi.WelfareSpree
|
48, // 43: webapi.WelfareFirstPayDataList.List:type_name -> webapi.WelfareSpree
|
||||||
48, // 44: webapi.WelfareContinuousPayDataList.List:type_name -> webapi.WelfareSpree
|
48, // 44: webapi.WelfareContinuousPayDataList.List:type_name -> webapi.WelfareSpree
|
||||||
107, // 45: webapi.VIPcfg.Award:type_name -> webapi.VIPcfg.AwardEntry
|
110, // 45: webapi.VIPcfg.Award:type_name -> webapi.VIPcfg.AwardEntry
|
||||||
108, // 46: webapi.VIPcfg.Privilege1:type_name -> webapi.VIPcfg.Privilege1Entry
|
111, // 46: webapi.VIPcfg.Privilege1:type_name -> webapi.VIPcfg.Privilege1Entry
|
||||||
109, // 47: webapi.VIPcfg.Privilege7:type_name -> webapi.VIPcfg.Privilege7Entry
|
112, // 47: webapi.VIPcfg.Privilege7:type_name -> webapi.VIPcfg.Privilege7Entry
|
||||||
110, // 48: webapi.VIPcfg.Privilege9:type_name -> webapi.VIPcfg.Privilege9Entry
|
113, // 48: webapi.VIPcfg.Privilege9:type_name -> webapi.VIPcfg.Privilege9Entry
|
||||||
51, // 49: webapi.VIPcfgDataList.List:type_name -> webapi.VIPcfg
|
51, // 49: webapi.VIPcfgDataList.List:type_name -> webapi.VIPcfg
|
||||||
38, // 50: webapi.ChessRankConfig.Item:type_name -> webapi.WelfareDate
|
38, // 50: webapi.ChessRankConfig.Item:type_name -> webapi.WelfareDate
|
||||||
55, // 51: webapi.ChessRankcfgData.Datas:type_name -> webapi.ChessRankConfig
|
55, // 51: webapi.ChessRankcfgData.Datas:type_name -> webapi.ChessRankConfig
|
||||||
111, // 52: webapi.ActInviteConfig.PayScore:type_name -> webapi.ActInviteConfig.PayScoreEntry
|
114, // 52: webapi.ActInviteConfig.PayScore:type_name -> webapi.ActInviteConfig.PayScoreEntry
|
||||||
62, // 53: webapi.ActInviteConfig.Awards1:type_name -> webapi.RankAward
|
62, // 53: webapi.ActInviteConfig.Awards1:type_name -> webapi.RankAward
|
||||||
62, // 54: webapi.ActInviteConfig.Awards2:type_name -> webapi.RankAward
|
62, // 54: webapi.ActInviteConfig.Awards2:type_name -> webapi.RankAward
|
||||||
62, // 55: webapi.ActInviteConfig.Awards3:type_name -> webapi.RankAward
|
62, // 55: webapi.ActInviteConfig.Awards3:type_name -> webapi.RankAward
|
||||||
|
@ -11594,12 +11863,12 @@ var file_protocol_webapi_common_proto_depIdxs = []int32{
|
||||||
69, // 66: webapi.DiamondLotteryData.Info:type_name -> webapi.DiamondLotteryInfo
|
69, // 66: webapi.DiamondLotteryData.Info:type_name -> webapi.DiamondLotteryInfo
|
||||||
70, // 67: webapi.DiamondLotteryData.Players:type_name -> webapi.DiamondLotteryPlayers
|
70, // 67: webapi.DiamondLotteryData.Players:type_name -> webapi.DiamondLotteryPlayers
|
||||||
72, // 68: webapi.DiamondLotteryConfig.LotteryData:type_name -> webapi.DiamondLotteryData
|
72, // 68: webapi.DiamondLotteryConfig.LotteryData:type_name -> webapi.DiamondLotteryData
|
||||||
115, // 69: webapi.ItemConfig.Items:type_name -> server.DB_GameItem
|
118, // 69: webapi.ItemConfig.Items:type_name -> server.DB_GameItem
|
||||||
32, // 70: webapi.RankAwardInfo.Item:type_name -> webapi.ItemInfo
|
32, // 70: webapi.RankAwardInfo.Item:type_name -> webapi.ItemInfo
|
||||||
75, // 71: webapi.RankTypeInfo.Award:type_name -> webapi.RankAwardInfo
|
75, // 71: webapi.RankTypeInfo.Award:type_name -> webapi.RankAwardInfo
|
||||||
76, // 72: webapi.RankTypeConfig.Info:type_name -> webapi.RankTypeInfo
|
76, // 72: webapi.RankTypeConfig.Info:type_name -> webapi.RankTypeInfo
|
||||||
112, // 73: webapi.SkinLevel.UpItem:type_name -> webapi.SkinLevel.UpItemEntry
|
115, // 73: webapi.SkinLevel.UpItem:type_name -> webapi.SkinLevel.UpItemEntry
|
||||||
113, // 74: webapi.SkinItem.UnlockParam:type_name -> webapi.SkinItem.UnlockParamEntry
|
116, // 74: webapi.SkinItem.UnlockParam:type_name -> webapi.SkinItem.UnlockParamEntry
|
||||||
78, // 75: webapi.SkinItem.Levels:type_name -> webapi.SkinLevel
|
78, // 75: webapi.SkinItem.Levels:type_name -> webapi.SkinLevel
|
||||||
79, // 76: webapi.SkinConfig.Items:type_name -> webapi.SkinItem
|
79, // 76: webapi.SkinConfig.Items:type_name -> webapi.SkinItem
|
||||||
82, // 77: webapi.AwardLogConfig.AwardLog:type_name -> webapi.AwardLogData
|
82, // 77: webapi.AwardLogConfig.AwardLog:type_name -> webapi.AwardLogData
|
||||||
|
@ -11618,11 +11887,13 @@ var file_protocol_webapi_common_proto_depIdxs = []int32{
|
||||||
32, // 90: webapi.PigBankDiamondInfo.DiamondExc:type_name -> webapi.ItemInfo
|
32, // 90: webapi.PigBankDiamondInfo.DiamondExc:type_name -> webapi.ItemInfo
|
||||||
100, // 91: webapi.GamePigBankDiamondConfig.DiamondInfo:type_name -> webapi.PigBankDiamondInfo
|
100, // 91: webapi.GamePigBankDiamondConfig.DiamondInfo:type_name -> webapi.PigBankDiamondInfo
|
||||||
102, // 92: webapi.GamePigBankPropConfig.PropInfo:type_name -> webapi.PigBankPropInfo
|
102, // 92: webapi.GamePigBankPropConfig.PropInfo:type_name -> webapi.PigBankPropInfo
|
||||||
93, // [93:93] is the sub-list for method output_type
|
105, // 93: webapi.RedPacketConfig.List:type_name -> webapi.RedPacketInfo
|
||||||
93, // [93:93] is the sub-list for method input_type
|
106, // 94: webapi.RedPacketInfo.RedList:type_name -> webapi.RedInfo
|
||||||
93, // [93:93] is the sub-list for extension type_name
|
95, // [95:95] is the sub-list for method output_type
|
||||||
93, // [93:93] is the sub-list for extension extendee
|
95, // [95:95] is the sub-list for method input_type
|
||||||
0, // [0:93] is the sub-list for field type_name
|
95, // [95:95] is the sub-list for extension type_name
|
||||||
|
95, // [95:95] is the sub-list for extension extendee
|
||||||
|
0, // [0:95] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_protocol_webapi_common_proto_init() }
|
func init() { file_protocol_webapi_common_proto_init() }
|
||||||
|
@ -12879,6 +13150,42 @@ func file_protocol_webapi_common_proto_init() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
file_protocol_webapi_common_proto_msgTypes[104].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*RedPacketConfig); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_protocol_webapi_common_proto_msgTypes[105].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*RedPacketInfo); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_protocol_webapi_common_proto_msgTypes[106].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*RedInfo); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
|
@ -12886,7 +13193,7 @@ func file_protocol_webapi_common_proto_init() {
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_protocol_webapi_common_proto_rawDesc,
|
RawDescriptor: file_protocol_webapi_common_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 114,
|
NumMessages: 117,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1120,3 +1120,28 @@ message NianDropInfo{
|
||||||
int32 DropRate = 4;//掉落概率
|
int32 DropRate = 4;//掉落概率
|
||||||
int32 DropUp = 5;//掉落上限
|
int32 DropUp = 5;//掉落上限
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// etcd /game/act_redpacket
|
||||||
|
message RedPacketConfig{
|
||||||
|
string Platform = 1; // 平台
|
||||||
|
repeated RedPacketInfo List = 2; // 活动列表
|
||||||
|
int32 PlayerLimit = 3; // 玩家最大领取红包次数 0无限制
|
||||||
|
}
|
||||||
|
|
||||||
|
message RedPacketInfo{
|
||||||
|
int64 Id = 1; // 配置id
|
||||||
|
int32 On = 2; // 开关 1开启 2关闭
|
||||||
|
int64 StartHMS = 3; // 开始时间,时*10000 + 分*100 + 秒
|
||||||
|
int64 EndHMS = 4; // 结束时间,时*10000 + 分*100 + 秒
|
||||||
|
int64 StayTs = 5; // 持续时长,单位秒
|
||||||
|
int64 MaxCount = 6; // 每人最大领取次数 0无限制
|
||||||
|
int64 LessCount = 7; // 保底红包个数
|
||||||
|
int32 ItemId = 8; // 奖励类型(道具id,100001金币 100002钻石)
|
||||||
|
int64 TotalNum = 9; // 总奖励数量
|
||||||
|
repeated RedInfo RedList = 10; // 红包奖励列表
|
||||||
|
}
|
||||||
|
|
||||||
|
message RedInfo{
|
||||||
|
int64 Num = 1; // 数量
|
||||||
|
int64 Rate = 2; // 概率,百分比
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -84,6 +84,12 @@ enum SPacketID {
|
||||||
PACKET_SCLotteryInfo = 2927; // 抽奖信息
|
PACKET_SCLotteryInfo = 2927; // 抽奖信息
|
||||||
PACKET_NotifyLotteryAward = 2928; // 通知抽奖中奖
|
PACKET_NotifyLotteryAward = 2928; // 通知抽奖中奖
|
||||||
PACKET_NotifyLotteryCode = 2929; // 通知获得抽奖号码
|
PACKET_NotifyLotteryCode = 2929; // 通知获得抽奖号码
|
||||||
|
|
||||||
|
PACKET_CSRedPacketInfo = 2930; // 红包信息
|
||||||
|
PACKET_SCRedPacketInfo = 2931; // 红包信息
|
||||||
|
|
||||||
|
PACKET_CSRedPacketDraw = 2932; // 抽红包
|
||||||
|
PACKET_SCRedPacketDraw = 2933; // 抽红包
|
||||||
}
|
}
|
||||||
|
|
||||||
//救济金领取
|
//救济金领取
|
||||||
|
@ -372,7 +378,7 @@ message SCPigbankTakeCoin{
|
||||||
OpResultCode OpRetCode = 1; // 结果
|
OpResultCode OpRetCode = 1; // 结果
|
||||||
int64 TakeCoinNum = 2; // 领取金币数量
|
int64 TakeCoinNum = 2; // 领取金币数量
|
||||||
int32 TakeTimes = 3; // 领取次数
|
int32 TakeTimes = 3; // 领取次数
|
||||||
//repeated PigBankCoinInfo info = 4;
|
repeated PropInfo RewardItems = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 钻石存钱罐信息
|
// 钻石存钱罐信息
|
||||||
|
@ -405,7 +411,7 @@ message SCDiamondBankTakeDiamond{
|
||||||
OpResultCode OpRetCode = 1; // 结果
|
OpResultCode OpRetCode = 1; // 结果
|
||||||
double TakeDiamondNum = 2; // 领取钻石数量
|
double TakeDiamondNum = 2; // 领取钻石数量
|
||||||
int32 TakeTimes = 3; // 领取次数
|
int32 TakeTimes = 3; // 领取次数
|
||||||
//repeated PigBankDiamondInfo info = 4;
|
//repeated PropInfo RewardItems = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 赛季通行证信息
|
// 赛季通行证信息
|
||||||
|
@ -557,3 +563,33 @@ message NotifyLotteryAward{
|
||||||
message NotifyLotteryCode{
|
message NotifyLotteryCode{
|
||||||
repeated LotteryInfo Info = 1;
|
repeated LotteryInfo Info = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 红包信息
|
||||||
|
//PACKET_CSRedPacketInfo
|
||||||
|
message CSRedPacketInfo{
|
||||||
|
}
|
||||||
|
//PACKET_SCRedPacketInfo
|
||||||
|
message SCRedPacketInfo{
|
||||||
|
repeated RedPacketInfo Info = 1; // 红包信息
|
||||||
|
}
|
||||||
|
message RedPacketInfo{
|
||||||
|
int64 Id = 1; // id
|
||||||
|
int64 StartTs = 2; // 开始时间
|
||||||
|
int64 EndTs = 3; // 结束时间
|
||||||
|
int64 StayTs = 4; // 持续时长,单位秒;0代表不限制
|
||||||
|
int64 MaxCount = 5; // 最大领取次数;-1代表不限制
|
||||||
|
int64 RemainCount = 6; // 剩余次数;-1代表不限制
|
||||||
|
}
|
||||||
|
|
||||||
|
// 抽红包
|
||||||
|
//PACKET_CSRedPacketDraw
|
||||||
|
message CSRedPacketDraw{
|
||||||
|
int64 Id = 1; // id
|
||||||
|
}
|
||||||
|
//PACKET_SCRedPacketDraw
|
||||||
|
message SCRedPacketDraw{
|
||||||
|
OpResultCode OpRetCode = 1; // 错误码
|
||||||
|
int64 Id = 2; // id
|
||||||
|
repeated PropInfo Award = 3; // 奖励
|
||||||
|
int64 RemainCount = 4; // 剩余次数;-1代表不限制
|
||||||
|
}
|
|
@ -16,8 +16,8 @@ data_type 数据类型
|
||||||
3新用户平均局数
|
3新用户平均局数
|
||||||
4平均倍数
|
4平均倍数
|
||||||
5活跃破产率
|
5活跃破产率
|
||||||
start_time 开始时间
|
start_time 开始时间 格式:2024-12-26
|
||||||
end_time 结束时间
|
end_time 结束时间 格式:2024-12-26
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Download 下载
|
// Download 下载
|
||||||
|
|
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"mongo.games.com/goserver/core/utils"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
@ -13,6 +12,7 @@ import (
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
"mongo.games.com/goserver/core/mongox"
|
"mongo.games.com/goserver/core/mongox"
|
||||||
"mongo.games.com/goserver/core/mysqlx"
|
"mongo.games.com/goserver/core/mysqlx"
|
||||||
|
"mongo.games.com/goserver/core/utils"
|
||||||
"mongo.games.com/goserver/core/viperx"
|
"mongo.games.com/goserver/core/viperx"
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
|
|
|
@ -1344,6 +1344,40 @@ func CSClientUpgrades(s *netlib.Session, packetid int, data interface{}, sid int
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CSRedPacketInfo(s *netlib.Session, packetid int, data interface{}, sid int64) error {
|
||||||
|
logger.Logger.Tracef("CSRedPacketInfo Process recv %v", data)
|
||||||
|
_, ok := data.(*welfare.CSRedPacketInfo)
|
||||||
|
if !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
p := PlayerMgrSington.GetOnlinePlayer(sid)
|
||||||
|
if p == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
pack := WelfareMgrSington.SendRedPacketInfo(p)
|
||||||
|
logger.Logger.Tracef("SCRedPacketInfo: %v", pack)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CSRedPacketDraw(s *netlib.Session, packetid int, data interface{}, sid int64) error {
|
||||||
|
logger.Logger.Tracef("CSRedPacketDraw Process recv %v", data)
|
||||||
|
msg, ok := data.(*welfare.CSRedPacketDraw)
|
||||||
|
if !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
p := PlayerMgrSington.GetOnlinePlayer(sid)
|
||||||
|
if p == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
pack := WelfareMgrSington.GetRedPacket(p, msg.GetId())
|
||||||
|
logger.Logger.Tracef("SCRedPacketDraw: %v", pack)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// 领取救济金
|
// 领取救济金
|
||||||
common.RegisterHandler(int(welfare.SPacketID_PACKET_CS_WELF_GETRELIEFFUND), &CSGetReliefFundHandler{})
|
common.RegisterHandler(int(welfare.SPacketID_PACKET_CS_WELF_GETRELIEFFUND), &CSGetReliefFundHandler{})
|
||||||
|
@ -1411,4 +1445,8 @@ func init() {
|
||||||
common.Register(int(welfare.SPacketID_PACKET_CSPermitShop), welfare.CSPermitShop{}, CSPermitShop)
|
common.Register(int(welfare.SPacketID_PACKET_CSPermitShop), welfare.CSPermitShop{}, CSPermitShop)
|
||||||
// 客户端升级奖励信息
|
// 客户端升级奖励信息
|
||||||
common.Register(int(upgrade.PacketID_PACKET_CSClientUpgrades), upgrade.CSClientUpgrades{}, CSClientUpgrades)
|
common.Register(int(upgrade.PacketID_PACKET_CSClientUpgrades), upgrade.CSClientUpgrades{}, CSClientUpgrades)
|
||||||
|
// 红包活动信息
|
||||||
|
common.Register(int(welfare.SPacketID_PACKET_CSRedPacketInfo), welfare.CSRedPacketInfo{}, CSRedPacketInfo)
|
||||||
|
// 红包活动领取
|
||||||
|
common.Register(int(welfare.SPacketID_PACKET_CSRedPacketDraw), welfare.CSRedPacketDraw{}, CSRedPacketDraw)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,186 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"golang.org/x/exp/maps"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/module"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
webapiproto "mongo.games.com/game/protocol/webapi"
|
||||||
|
)
|
||||||
|
|
||||||
|
var RedPacketMgrInst = &RedPacketMgr{
|
||||||
|
RedPacketData: make(map[string]map[int64]*model.RedPacket),
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
module.RegisteModule(RedPacketMgrInst, time.Hour, 0)
|
||||||
|
|
||||||
|
common.RegisterClockFunc(&common.ClockFunc{
|
||||||
|
OnDayTimerFunc: func() {
|
||||||
|
RedPacketMgrInst.RedPacketData = make(map[string]map[int64]*model.RedPacket)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
type RedPacketMgr struct {
|
||||||
|
RedPacketData map[string]map[int64]*model.RedPacket // 红包活动状态 平台:活动id:活动状态
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RedPacketMgr) ModuleName() string {
|
||||||
|
return "RedPacketMgr"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RedPacketMgr) Init() {
|
||||||
|
// 加载红包配置
|
||||||
|
for _, v := range PlatformMgrSingleton.GetPlatforms() {
|
||||||
|
if v == nil || v.IdStr == common.Platform_Sys {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
list, err := model.GetRedPacketAll(v.IdStr)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Sprintf("GetRedPacketAll error: %v", err))
|
||||||
|
}
|
||||||
|
for _, v1 := range list {
|
||||||
|
if m.RedPacketData[v.IdStr] == nil {
|
||||||
|
m.RedPacketData[v.IdStr] = make(map[int64]*model.RedPacket)
|
||||||
|
}
|
||||||
|
m.RedPacketData[v.IdStr][v1.Cid] = &model.RedPacket{
|
||||||
|
Cid: v1.Cid,
|
||||||
|
Use: v1.Use,
|
||||||
|
Ts: v1.Ts,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RedPacketMgr) Update() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RedPacketMgr) Shutdown() {
|
||||||
|
// 保存红包配置
|
||||||
|
for k, v := range m.RedPacketData {
|
||||||
|
if err := model.UpdateRedPacketAll(k, maps.Values(v)); err != nil {
|
||||||
|
logger.Logger.Errorf("UpdateRedPacketAll error: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.UnregisteModule(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRemainReward 获取剩余奖励数量
|
||||||
|
func (m *RedPacketMgr) GetRemainReward(plt string, id int64) int64 {
|
||||||
|
v, ok := m.RedPacketData[plt]
|
||||||
|
if !ok {
|
||||||
|
v = make(map[int64]*model.RedPacket)
|
||||||
|
m.RedPacketData[plt] = v
|
||||||
|
}
|
||||||
|
d, ok := v[id]
|
||||||
|
if !ok {
|
||||||
|
d = &model.RedPacket{
|
||||||
|
Cid: id,
|
||||||
|
Use: make(map[int64]int64),
|
||||||
|
Ts: time.Now().Unix(),
|
||||||
|
}
|
||||||
|
v[id] = d
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := WelfareMgrSington.GetConfig(plt).RedPacketConfig
|
||||||
|
if cfg == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range cfg.GetList() {
|
||||||
|
if v.Id == id {
|
||||||
|
total := 0
|
||||||
|
for k1, v1 := range d.Use {
|
||||||
|
total += int(k1 * v1)
|
||||||
|
}
|
||||||
|
|
||||||
|
ret := v.GetTotalNum() - int64(total)
|
||||||
|
if ret < 0 {
|
||||||
|
ret = 0
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRemainTimes 获取剩余次数
|
||||||
|
// 返回最大次数和剩余次数
|
||||||
|
func (m *RedPacketMgr) GetRemainTimes(p *Player, id int64) (int64, int64) {
|
||||||
|
var cfg *webapiproto.RedPacketInfo
|
||||||
|
for _, v := range WelfareMgrSington.GetConfig(p.Platform).RedPacketConfig.GetList() {
|
||||||
|
if v.GetId() == id {
|
||||||
|
cfg = v
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m.GetRemainTimesByConfig(p, cfg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRemainTimesByConfig 获取剩余次数
|
||||||
|
// 返回最大次数和剩余次数
|
||||||
|
func (m *RedPacketMgr) GetRemainTimesByConfig(p *Player, cfg *webapiproto.RedPacketInfo) (int64, int64) {
|
||||||
|
if cfg == nil {
|
||||||
|
return 0, 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var limit int32
|
||||||
|
playerLimit := WelfareMgrSington.GetConfig(p.Platform).RedPacketConfig.GetPlayerLimit()
|
||||||
|
if playerLimit > 0 && cfg.GetMaxCount() > 0 {
|
||||||
|
if playerLimit < int32(cfg.GetMaxCount()) {
|
||||||
|
limit = playerLimit
|
||||||
|
} else {
|
||||||
|
limit = int32(cfg.GetMaxCount())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if playerLimit > 0 {
|
||||||
|
limit = playerLimit
|
||||||
|
}
|
||||||
|
if cfg.GetMaxCount() > 0 {
|
||||||
|
limit = int32(cfg.GetMaxCount())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if limit <= 0 {
|
||||||
|
return -1, -1
|
||||||
|
}
|
||||||
|
n := 0
|
||||||
|
if p.WelfData != nil && p.WelfData.RedPacket != nil {
|
||||||
|
if _, exist := p.WelfData.RedPacket[cfg.GetId()]; exist {
|
||||||
|
n = p.WelfData.RedPacket[cfg.GetId()]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
remainCount := int64(limit) - int64(n)
|
||||||
|
if remainCount < 0 {
|
||||||
|
remainCount = 0
|
||||||
|
}
|
||||||
|
return int64(limit), remainCount
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddUse 添加使用红包
|
||||||
|
func (m *RedPacketMgr) AddUse(plt string, id int64, n int64) {
|
||||||
|
v, ok := m.RedPacketData[plt]
|
||||||
|
if !ok {
|
||||||
|
v = make(map[int64]*model.RedPacket)
|
||||||
|
m.RedPacketData[plt] = v
|
||||||
|
}
|
||||||
|
d, ok := v[id]
|
||||||
|
if !ok {
|
||||||
|
d = &model.RedPacket{
|
||||||
|
Cid: id,
|
||||||
|
Use: make(map[int64]int64),
|
||||||
|
Ts: time.Now().Unix(),
|
||||||
|
}
|
||||||
|
v[id] = d
|
||||||
|
}
|
||||||
|
d.Use[n]++
|
||||||
|
d.Ts = time.Now().Unix()
|
||||||
|
}
|
|
@ -96,7 +96,7 @@ func (this *AwardLogManager) UpdateAnnouncerLog(data model.AnnouncerLog) {
|
||||||
func (this *AwardLogManager) Init() {
|
func (this *AwardLogManager) Init() {
|
||||||
this.AwardMap = make(map[string]map[int32]map[int32]int64)
|
this.AwardMap = make(map[string]map[int32]map[int32]int64)
|
||||||
for _, v := range PlatformMgrSingleton.platforms {
|
for _, v := range PlatformMgrSingleton.platforms {
|
||||||
if v != nil {
|
if v != nil && v.IdStr != common.Platform_Sys {
|
||||||
// 获取道具获得总数
|
// 获取道具获得总数
|
||||||
res, err := model.FetchAwardLog(v.IdStr)
|
res, err := model.FetchAwardLog(v.IdStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -112,7 +112,8 @@ func init() {
|
||||||
etcd.Register(etcd.ETCDKEY_PigBankProp, webapi.GamePigBankPropConfig{}, platformConfigEvent)
|
etcd.Register(etcd.ETCDKEY_PigBankProp, webapi.GamePigBankPropConfig{}, platformConfigEvent)
|
||||||
//年兽配置
|
//年兽配置
|
||||||
etcd.Register(etcd.ETCDKEY_NianConfig, webapi.ActivityNianConfig{}, platformConfigEvent)
|
etcd.Register(etcd.ETCDKEY_NianConfig, webapi.ActivityNianConfig{}, platformConfigEvent)
|
||||||
|
// 红包配置
|
||||||
|
etcd.Register(etcd.ETCDKEY_REDPACKET, webapi.RedPacketConfig{}, platformConfigEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
|
func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
|
||||||
|
@ -360,6 +361,8 @@ func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, e
|
||||||
PlatformMgrSingleton.GetConfig(config.Platform).GamePigBankPropConfig = config
|
PlatformMgrSingleton.GetConfig(config.Platform).GamePigBankPropConfig = config
|
||||||
case *webapi.ActivityNianConfig:
|
case *webapi.ActivityNianConfig:
|
||||||
WelfareMgrSington.UpdateActivityNianStatus(config)
|
WelfareMgrSington.UpdateActivityNianStatus(config)
|
||||||
|
case *webapi.RedPacketConfig:
|
||||||
|
WelfareMgrSington.UpdateRedPacket(config, isInit)
|
||||||
default:
|
default:
|
||||||
logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey)
|
logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,11 @@ func RegisterPlayerListener[Player, Scene any](l PlayerListener[Player, Scene])
|
||||||
type PlayerListener[Player, Scene any] interface {
|
type PlayerListener[Player, Scene any] interface {
|
||||||
common.ClockSinker
|
common.ClockSinker
|
||||||
// 登出相关
|
// 登出相关
|
||||||
OnPlayerLogined(p Player) // 玩家登录时触发
|
OnPlayerLogined(p Player) // 玩家登录时触发
|
||||||
OnPlayerLogouted(p Player) // 玩家登出时触发
|
OnPlayerLogouted(p Player) // 玩家登出时触发
|
||||||
OnPlayerDropLine(p Player) // 玩家掉线时触发
|
OnPlayerDropLine(p Player) // 玩家掉线时触发
|
||||||
OnPlayerRehold(p Player) // 玩家重新连接时触发
|
OnPlayerRehold(p Player) // 玩家重新连接时触发
|
||||||
|
OnPlayerDayChanged(p Player, isLogin, isContinue bool) // 玩家跨天时触发
|
||||||
// 业务相关
|
// 业务相关
|
||||||
OnPlayerEnterSceneBefore(p Player, s Scene) // 玩家进入场景前触发
|
OnPlayerEnterSceneBefore(p Player, s Scene) // 玩家进入场景前触发
|
||||||
OnPlayerEnterSceneAfter(p Player, s Scene) // 玩家进入场景后触发
|
OnPlayerEnterSceneAfter(p Player, s Scene) // 玩家进入场景后触发
|
||||||
|
@ -61,6 +62,14 @@ func FirePlayerRehold[Player, Scene any](p Player) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FirePlayerDayChanged[Player, Scene any](p Player, isLogin, isContinue bool) {
|
||||||
|
for _, l := range _playerListeners {
|
||||||
|
if l != nil {
|
||||||
|
l.(PlayerListener[Player, Scene]).OnPlayerDayChanged(p, isLogin, isContinue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func FirePlayerEnterSceneBefore[Player, Scene any](p Player, s Scene) {
|
func FirePlayerEnterSceneBefore[Player, Scene any](p Player, s Scene) {
|
||||||
for _, l := range _playerListeners {
|
for _, l := range _playerListeners {
|
||||||
if l != nil {
|
if l != nil {
|
||||||
|
@ -113,16 +122,17 @@ type BasePlayerListener[Player, Scene any] struct {
|
||||||
common.ClockFunc
|
common.ClockFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *BasePlayerListener[Player, Scene]) OnPlayerLogined(p Player) {}
|
func (l *BasePlayerListener[Player, Scene]) OnPlayerLogined(p Player) {}
|
||||||
func (l *BasePlayerListener[Player, Scene]) OnPlayerLogouted(p Player) {}
|
func (l *BasePlayerListener[Player, Scene]) OnPlayerLogouted(p Player) {}
|
||||||
func (l *BasePlayerListener[Player, Scene]) OnPlayerDropLine(p Player) {}
|
func (l *BasePlayerListener[Player, Scene]) OnPlayerDropLine(p Player) {}
|
||||||
func (l *BasePlayerListener[Player, Scene]) OnPlayerRehold(p Player) {}
|
func (l *BasePlayerListener[Player, Scene]) OnPlayerRehold(p Player) {}
|
||||||
func (l *BasePlayerListener[Player, Scene]) OnPlayerEnterSceneBefore(p Player, s Scene) {}
|
func (l *BasePlayerListener[Player, Scene]) OnPlayerDayChanged(p Player, isLogin, isContinue bool) {}
|
||||||
func (l *BasePlayerListener[Player, Scene]) OnPlayerEnterSceneAfter(p Player, s Scene) {}
|
func (l *BasePlayerListener[Player, Scene]) OnPlayerEnterSceneBefore(p Player, s Scene) {}
|
||||||
func (l *BasePlayerListener[Player, Scene]) OnPlayerLeaveSceneBefore(p Player, s Scene) {}
|
func (l *BasePlayerListener[Player, Scene]) OnPlayerEnterSceneAfter(p Player, s Scene) {}
|
||||||
func (l *BasePlayerListener[Player, Scene]) OnPlayerLeaveSceneAfter(p Player, s Scene) {}
|
func (l *BasePlayerListener[Player, Scene]) OnPlayerLeaveSceneBefore(p Player, s Scene) {}
|
||||||
func (l *BasePlayerListener[Player, Scene]) OnPlayerReturnSceneBefore(p Player, s Scene) {}
|
func (l *BasePlayerListener[Player, Scene]) OnPlayerLeaveSceneAfter(p Player, s Scene) {}
|
||||||
func (l *BasePlayerListener[Player, Scene]) OnPlayerReturnSceneAfter(p Player, s Scene) {}
|
func (l *BasePlayerListener[Player, Scene]) OnPlayerReturnSceneBefore(p Player, s Scene) {}
|
||||||
|
func (l *BasePlayerListener[Player, Scene]) OnPlayerReturnSceneAfter(p Player, s Scene) {}
|
||||||
|
|
||||||
type PlayerListenerFunc[Player, Scene any] struct {
|
type PlayerListenerFunc[Player, Scene any] struct {
|
||||||
common.ClockFunc
|
common.ClockFunc
|
||||||
|
@ -130,6 +140,7 @@ type PlayerListenerFunc[Player, Scene any] struct {
|
||||||
OnPlayerLogoutedFunc func(p Player)
|
OnPlayerLogoutedFunc func(p Player)
|
||||||
OnPlayerDropLineFunc func(p Player)
|
OnPlayerDropLineFunc func(p Player)
|
||||||
OnPlayerReholdFunc func(p Player)
|
OnPlayerReholdFunc func(p Player)
|
||||||
|
OnPlayerDayChangedFunc func(p Player, isLogin, isContinue bool)
|
||||||
OnPlayerEnterSceneBeforeFunc func(p Player, s Scene)
|
OnPlayerEnterSceneBeforeFunc func(p Player, s Scene)
|
||||||
OnPlayerEnterSceneAfterFunc func(p Player, s Scene)
|
OnPlayerEnterSceneAfterFunc func(p Player, s Scene)
|
||||||
OnPlayerLeaveSceneBeforeFunc func(p Player, s Scene)
|
OnPlayerLeaveSceneBeforeFunc func(p Player, s Scene)
|
||||||
|
@ -162,6 +173,12 @@ func (l *PlayerListenerFunc[Player, Scene]) OnPlayerRehold(p Player) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *PlayerListenerFunc[Player, Scene]) OnPlayerDayChanged(p Player, isLogin, isContinue bool) {
|
||||||
|
if l.OnPlayerDayChangedFunc != nil {
|
||||||
|
l.OnPlayerDayChangedFunc(p, isLogin, isContinue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (l *PlayerListenerFunc[Player, Scene]) OnPlayerEnterSceneBefore(p Player, s Scene) {
|
func (l *PlayerListenerFunc[Player, Scene]) OnPlayerEnterSceneBefore(p Player, s Scene) {
|
||||||
if l.OnPlayerEnterSceneBeforeFunc != nil {
|
if l.OnPlayerEnterSceneBeforeFunc != nil {
|
||||||
l.OnPlayerEnterSceneBeforeFunc(p, s)
|
l.OnPlayerEnterSceneBeforeFunc(p, s)
|
||||||
|
@ -198,7 +215,7 @@ func (l *PlayerListenerFunc[Player, Scene]) OnPlayerReturnSceneAfter(p Player, s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterPlayerListenerFunc[P, S any](l *PlayerListenerFunc[P, S]) {
|
func RegisterPlayerListenerFunc[Player, Scene any](l *PlayerListenerFunc[Player, Scene]) {
|
||||||
common.RegisterClockFunc(&l.ClockFunc)
|
common.RegisterClockFunc(&l.ClockFunc)
|
||||||
RegisterPlayerListener(l)
|
RegisterPlayerListener(l)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ type PlayerLoadReplay struct {
|
||||||
// 重连不会执行
|
// 重连不会执行
|
||||||
type IPlayerLoad interface {
|
type IPlayerLoad interface {
|
||||||
// Load 查询数据库,在task中执行
|
// Load 查询数据库,在task中执行
|
||||||
Load(platform string, snid int32, data any) *PlayerLoadReplay
|
Load(platform string, snid int32, playerBaseData any) *PlayerLoadReplay
|
||||||
// Callback 数据查询成功的回掉方法
|
// Callback 数据查询成功的回掉方法
|
||||||
Callback(data any, ret *PlayerLoadReplay)
|
Callback(data any, ret *PlayerLoadReplay)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1646,20 +1646,16 @@ func (this *Player) OnDayTimer(login, continuous bool, t int) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.lastOnDayChange = time.Now().Local()
|
this.lastOnDayChange = time.Now().Local()
|
||||||
|
this.dirty = true
|
||||||
|
|
||||||
logger.Logger.Infof("(this *Player) (%v) OnDayTimer(%v,%v) ", this.SnId, login, continuous)
|
logger.Logger.Infof("(this *Player) (%v) OnDayTimer(%v,%v) ", this.SnId, login, continuous)
|
||||||
|
|
||||||
this.dirty = true
|
internal.FirePlayerDayChanged[*Player, *Scene](this, login, continuous)
|
||||||
|
|
||||||
if login || this.scene == nil {
|
if login || this.scene == nil {
|
||||||
//跨天登录 数据给昨天,今天置为空
|
//跨天登录 数据给昨天,今天置为空
|
||||||
this.YesterdayGameData = this.TodayGameData
|
this.YesterdayGameData = this.TodayGameData
|
||||||
this.TodayGameData = model.NewPlayerGameCtrlData()
|
this.TodayGameData = model.NewPlayerGameCtrlData()
|
||||||
/*
|
|
||||||
for k, v := range this.YesterdayGameData.CtrlData {
|
|
||||||
t := &model.PlayerGameStatics{}
|
|
||||||
t.AvgBetCoin = v.AvgBetCoin
|
|
||||||
this.TodayGameData.CtrlData[k] = t
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//this.OnTimeDayTotal(continuous, t)
|
//this.OnTimeDayTotal(continuous, t)
|
||||||
|
@ -1667,8 +1663,6 @@ func (this *Player) OnDayTimer(login, continuous bool, t int) {
|
||||||
//商城数据更新
|
//商城数据更新
|
||||||
this.ShopTotal = make(map[int32]*model.ShopTotal)
|
this.ShopTotal = make(map[int32]*model.ShopTotal)
|
||||||
this.ShopLastLookTime = make(map[int32]int64)
|
this.ShopLastLookTime = make(map[int32]int64)
|
||||||
// 福利活动更新
|
|
||||||
WelfareMgrSington.OnDayChanged(this)
|
|
||||||
this.VipMatchTimes = 0
|
this.VipMatchTimes = 0
|
||||||
//VIP商城数据更新
|
//VIP商城数据更新
|
||||||
this.UpdateVipShopData()
|
this.UpdateVipShopData()
|
||||||
|
|
|
@ -2945,7 +2945,7 @@ func init() {
|
||||||
var msg *webapi.DebugTestReq
|
var msg *webapi.DebugTestReq
|
||||||
err := json.Unmarshal(params, &msg)
|
err := json.Unmarshal(params, &msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Error("Unmarshal webapi.PlatfromUpScoreReq error:", err)
|
logger.Logger.Error("Unmarshal webapi.DebugTestReq error:", err)
|
||||||
return common.ResponseTag_ParamError, pack
|
return common.ResponseTag_ParamError, pack
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2955,7 +2955,7 @@ func init() {
|
||||||
Message: "未知错误",
|
Message: "未知错误",
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Logger.Tracef("/api/platform/debug upScoreReqInfo%v", msg)
|
logger.Logger.Tracef("/api/platform/debug DebugTestReq%v", msg)
|
||||||
|
|
||||||
player := PlayerMgrSington.GetPlayerBySnId(msg.Snid)
|
player := PlayerMgrSington.GetPlayerBySnId(msg.Snid)
|
||||||
//玩家在线
|
//玩家在线
|
||||||
|
@ -2967,7 +2967,7 @@ func init() {
|
||||||
|
|
||||||
if msg.Rpc == 1 {
|
if msg.Rpc == 1 {
|
||||||
addCoin, _ := strconv.ParseInt(msg.Count, 10, 64)
|
addCoin, _ := strconv.ParseInt(msg.Count, 10, 64)
|
||||||
player.AddCoin(addCoin, 0, 5555, "platform", "debug加钻石")
|
player.AddCoin(addCoin, 0, 5555, "platform", "debug加金币")
|
||||||
player.SendDiffData()
|
player.SendDiffData()
|
||||||
jsonRet.Data.Count = player.Coin
|
jsonRet.Data.Count = player.Coin
|
||||||
} else if msg.Rpc == 2 {
|
} else if msg.Rpc == 2 {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
"slices"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
@ -17,6 +18,7 @@ import (
|
||||||
webapi_proto "mongo.games.com/game/protocol/webapi"
|
webapi_proto "mongo.games.com/game/protocol/webapi"
|
||||||
"mongo.games.com/game/protocol/welfare"
|
"mongo.games.com/game/protocol/welfare"
|
||||||
"mongo.games.com/game/srvdata"
|
"mongo.games.com/game/srvdata"
|
||||||
|
"mongo.games.com/game/worldsrv/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1124,7 +1126,7 @@ func (this *WelfareMgr) BlindBoxInfo(p *Player, bid int32) {
|
||||||
pack.MinId = blindBox.MinId
|
pack.MinId = blindBox.MinId
|
||||||
pack.Draw = 1
|
pack.Draw = 1
|
||||||
cyc := info.BlindBoxCycle
|
cyc := info.BlindBoxCycle
|
||||||
if p.WelfData.BlindBoxId == -1 {
|
if p.WelfData.BlindBoxId == -1 { // == 1代表当日循环
|
||||||
if cyc == 1 || blindBox.Cycle == model.WelfareOpen {
|
if cyc == 1 || blindBox.Cycle == model.WelfareOpen {
|
||||||
p.WelfData.BlindBoxId = 0
|
p.WelfData.BlindBoxId = 0
|
||||||
}
|
}
|
||||||
|
@ -1899,6 +1901,11 @@ func (this *WelfareMgr) PigbankTakeCoin(p *Player) {
|
||||||
p.WelfData.PigBank.TakeRecord[infoData.Id] = p.WelfData.PigBank.BankCoin
|
p.WelfData.PigBank.TakeRecord[infoData.Id] = p.WelfData.PigBank.BankCoin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pack.RewardItems = append(pack.RewardItems, &welfare.PropInfo{
|
||||||
|
ItemId: common.ItemIDCoin,
|
||||||
|
ItemNum: p.WelfData.PigBank.BankCoin,
|
||||||
|
})
|
||||||
|
|
||||||
if infoData.GoldExc != nil {
|
if infoData.GoldExc != nil {
|
||||||
// 发放奖励道具
|
// 发放奖励道具
|
||||||
var items []*model.Item
|
var items []*model.Item
|
||||||
|
@ -1907,6 +1914,11 @@ func (this *WelfareMgr) PigbankTakeCoin(p *Player) {
|
||||||
ItemId: int32(v.ItemId),
|
ItemId: int32(v.ItemId),
|
||||||
ItemNum: v.ItemNum,
|
ItemNum: v.ItemNum,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
pack.RewardItems = append(pack.RewardItems, &welfare.PropInfo{
|
||||||
|
ItemId: v.ItemId,
|
||||||
|
ItemNum: v.ItemNum,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
BagMgrSingleton.AddItems(&model.AddItemParam{
|
BagMgrSingleton.AddItems(&model.AddItemParam{
|
||||||
Platform: p.Platform,
|
Platform: p.Platform,
|
||||||
|
@ -1998,7 +2010,7 @@ func (this *WelfareMgr) DiamondBankGetInfo(p *Player) {
|
||||||
bankInfo.Price = int64(data.DiamondPrice)
|
bankInfo.Price = int64(data.DiamondPrice)
|
||||||
bankInfo.NowPrice = int64(data.DiamondNowPrice)
|
bankInfo.NowPrice = int64(data.DiamondNowPrice)
|
||||||
bankInfo.ShopId = data.DiamondId
|
bankInfo.ShopId = data.DiamondId
|
||||||
for _, v := range data.GoldExc {
|
for _, v := range data.DiamondExc {
|
||||||
bankInfo.DiamondExc[int64(v.ItemId)] = v.ItemNum
|
bankInfo.DiamondExc[int64(v.ItemId)] = v.ItemNum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2064,9 +2076,15 @@ func (this *WelfareMgr) DiamondBankTakeCoin(p *Player) (retItemArr []*model.Item
|
||||||
Num: 1,
|
Num: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
retItemArr = append(retItemArr, &model.Item{
|
||||||
|
ItemId: common.ItemIDDiamond,
|
||||||
|
ItemNum: addDiamond,
|
||||||
|
})
|
||||||
|
|
||||||
// 发放奖励道具
|
// 发放奖励道具
|
||||||
if infoData.DiamondExc != nil {
|
if infoData.DiamondExc != nil {
|
||||||
var items []*model.Item
|
var items []*model.Item
|
||||||
|
|
||||||
for _, v := range infoData.DiamondExc {
|
for _, v := range infoData.DiamondExc {
|
||||||
items = append(items, &model.Item{
|
items = append(items, &model.Item{
|
||||||
ItemId: v.ItemId,
|
ItemId: v.ItemId,
|
||||||
|
@ -2210,27 +2228,189 @@ func (this *WelfareMgr) ClearActivityNianData(p *Player) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (this *WelfareMgr) Update() {
|
|
||||||
|
|
||||||
|
// UpdateRedPacket 更新红包配置
|
||||||
|
func (this *WelfareMgr) UpdateRedPacket(cfg *webapi_proto.RedPacketConfig, isInit bool) {
|
||||||
|
this.GetConfig(cfg.Platform).RedPacketConfig = cfg
|
||||||
|
if !isInit {
|
||||||
|
// 广播给客户端
|
||||||
|
for _, p := range PlayerMgrSington.players {
|
||||||
|
this.ReleaseRedPacket(p)
|
||||||
|
this.SendRedPacketInfo(p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReleaseRedPacket 释放玩家红包数据
|
||||||
|
func (this *WelfareMgr) ReleaseRedPacket(p *Player) {
|
||||||
|
if p == nil || p.IsOffline() || p.IsRobot() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ids := make([]int64, 0)
|
||||||
|
for _, v := range this.GetConfig(p.Platform).RedPacketConfig.GetList() {
|
||||||
|
ids = append(ids, v.GetId())
|
||||||
|
}
|
||||||
|
delIds := make([]int64, 0)
|
||||||
|
if p.WelfData != nil && p.WelfData.RedPacket != nil {
|
||||||
|
for k, _ := range p.WelfData.RedPacket {
|
||||||
|
if !slices.Contains(ids, k) {
|
||||||
|
delIds = append(delIds, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, v := range delIds {
|
||||||
|
delete(p.WelfData.RedPacket, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SendRedPacketInfo 发送红包信息
|
||||||
|
func (this *WelfareMgr) SendRedPacketInfo(p *Player) *welfare.SCRedPacketInfo {
|
||||||
|
if p == nil || p.IsOffline() || p.IsRobot() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
pack := &welfare.SCRedPacketInfo{}
|
||||||
|
now := time.Now().Unix()
|
||||||
|
for _, v := range this.GetConfig(p.Platform).RedPacketConfig.GetList() {
|
||||||
|
if v.GetOn() != common.On {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
startTs, endTs := common.IntToTime(int(v.GetStartHMS())).Unix(), common.IntToTime(int(v.GetEndHMS())).Unix()
|
||||||
|
if now < startTs || now >= endTs {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
info := &welfare.RedPacketInfo{
|
||||||
|
Id: v.GetId(),
|
||||||
|
StartTs: startTs,
|
||||||
|
EndTs: endTs,
|
||||||
|
StayTs: v.GetStayTs(),
|
||||||
|
}
|
||||||
|
info.MaxCount, info.RemainCount = RedPacketMgrInst.GetRemainTimesByConfig(p, v)
|
||||||
|
if info.RemainCount > 0 {
|
||||||
|
pack.Info = append(pack.Info, info)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p.SendToClient(int(welfare.SPacketID_PACKET_SCRedPacketInfo), pack)
|
||||||
|
return pack
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRedPacket 抽红包
|
||||||
|
// id 红包活动id
|
||||||
|
func (this *WelfareMgr) GetRedPacket(p *Player, id int64) *welfare.SCRedPacketDraw {
|
||||||
|
if p == nil || p.IsOffline() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
pack := &welfare.SCRedPacketDraw{
|
||||||
|
OpRetCode: welfare.OpResultCode_OPRC_Error,
|
||||||
|
Id: id,
|
||||||
|
}
|
||||||
|
Send := func(code welfare.OpResultCode) {
|
||||||
|
pack.OpRetCode = code
|
||||||
|
p.SendToClient(int(welfare.SPacketID_PACKET_SCRedPacketDraw), pack)
|
||||||
|
}
|
||||||
|
|
||||||
|
playerLimit := this.GetConfig(p.Platform).RedPacketConfig.GetPlayerLimit()
|
||||||
|
var cfg *webapi_proto.RedPacketInfo
|
||||||
|
for _, v := range this.GetConfig(p.Platform).RedPacketConfig.GetList() {
|
||||||
|
if v.GetId() == id {
|
||||||
|
cfg = v
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
now := time.Now().Unix()
|
||||||
|
if cfg == nil || cfg.GetOn() != common.On ||
|
||||||
|
now < common.IntToTime(int(cfg.GetStartHMS())).Unix() || now >= common.IntToTime(int(cfg.GetEndHMS())).Unix() {
|
||||||
|
Send(welfare.OpResultCode_OPRC_Error)
|
||||||
|
return pack
|
||||||
|
}
|
||||||
|
|
||||||
|
// 次数限制
|
||||||
|
n := 0
|
||||||
|
if p.WelfData != nil && p.WelfData.RedPacket != nil {
|
||||||
|
if _, exist := p.WelfData.RedPacket[id]; exist {
|
||||||
|
n = p.WelfData.RedPacket[id]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if playerLimit > 0 && n >= int(playerLimit) {
|
||||||
|
Send(welfare.OpResultCode_OPRC_NoTimes)
|
||||||
|
return pack
|
||||||
|
}
|
||||||
|
if cfg.GetMaxCount() > 0 && cfg.GetMaxCount() <= int64(n) {
|
||||||
|
Send(welfare.OpResultCode_OPRC_NoTimes)
|
||||||
|
return pack
|
||||||
|
}
|
||||||
|
|
||||||
|
// 余额检查
|
||||||
|
var reward int64 // 红包奖金
|
||||||
|
remain := RedPacketMgrInst.GetRemainReward(p.Platform, id)
|
||||||
|
if remain <= 0 {
|
||||||
|
// 空奖
|
||||||
|
} else {
|
||||||
|
// 保底计算
|
||||||
|
|
||||||
|
// 概率抽奖
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.WelfData != nil {
|
||||||
|
p.WelfData.RedPacket[id]++
|
||||||
|
RedPacketMgrInst.AddUse(p.Platform, id, reward)
|
||||||
|
if reward > 0 {
|
||||||
|
BagMgrSingleton.AddItems(&model.AddItemParam{
|
||||||
|
Platform: p.Platform,
|
||||||
|
SnId: p.GetSnId(),
|
||||||
|
Change: []*model.Item{{ItemId: cfg.GetItemId(), ItemNum: reward}},
|
||||||
|
GainWay: common.GainWayRedPacket,
|
||||||
|
Operator: "system",
|
||||||
|
Remark: "红包奖励",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//todo 抽奖记录
|
||||||
|
|
||||||
|
_, pack.RemainCount = RedPacketMgrInst.GetRemainTimesByConfig(p, cfg)
|
||||||
|
p.SendToClient(int(welfare.SPacketID_PACKET_SCRedPacketDraw), pack)
|
||||||
|
return pack
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *WelfareMgr) Update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *WelfareMgr) Shutdown() {
|
func (this *WelfareMgr) Shutdown() {
|
||||||
module.UnregisteModule(this)
|
module.UnregisteModule(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *WelfareMgr) OnDayTimer() {
|
|
||||||
for _, v := range this.GetConfigs() {
|
|
||||||
v.BlindBoxCycle = 0
|
|
||||||
v.FirstPayCycle = 0
|
|
||||||
v.ContinuousPayCycle = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *WelfareMgr) InterestClockEvent() int {
|
|
||||||
return (1 << common.ClockEventMax) - 1
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
module.RegisteModule(WelfareMgrSington, time.Second, 0)
|
module.RegisteModule(WelfareMgrSington, time.Second, 0)
|
||||||
common.ClockMgrSingleton.RegisterSinker(WelfareMgrSington)
|
|
||||||
|
internal.RegisterPlayerListenerFunc(&internal.PlayerListenerFunc[*Player, *Scene]{
|
||||||
|
ClockFunc: common.ClockFunc{
|
||||||
|
OnDayTimerFunc: func() {
|
||||||
|
for _, v := range WelfareMgrSington.GetConfigs() {
|
||||||
|
v.BlindBoxCycle = 0
|
||||||
|
v.FirstPayCycle = 0
|
||||||
|
v.ContinuousPayCycle = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
OnPlayerLoginedFunc: func(p *Player) {
|
||||||
|
WelfareMgrSington.SendRedPacketInfo(p)
|
||||||
|
},
|
||||||
|
|
||||||
|
OnPlayerReholdFunc: func(p *Player) {
|
||||||
|
WelfareMgrSington.SendRedPacketInfo(p)
|
||||||
|
},
|
||||||
|
|
||||||
|
OnPlayerDayChangedFunc: func(p *Player, isLogin, isContinue bool) {
|
||||||
|
if p.WelfData != nil && p.WelfData.RedPacket != nil {
|
||||||
|
p.WelfData.RedPacket = make(map[int64]int)
|
||||||
|
}
|
||||||
|
WelfareMgrSington.OnDayChanged(p)
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue