Compare commits
No commits in common. "17733f2477a431019e75f1933a33f7517acc4965" and "a5374022566fb5624be3fea5201e423d60170683" have entirely different histories.
17733f2477
...
a537402256
|
@ -1,277 +0,0 @@
|
||||||
// --------------------------------------------------------------------------------------------
|
|
||||||
// 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 PushCoinPoolFilterFunc func(cols *PushCoinPoolColumns) interface{}
|
|
||||||
type PushCoinPoolUpdateFunc func(cols *PushCoinPoolColumns) interface{}
|
|
||||||
type PushCoinPoolPipelineFunc func(cols *PushCoinPoolColumns) interface{}
|
|
||||||
type PushCoinPoolCountOptionsFunc func(cols *PushCoinPoolColumns) *options.CountOptions
|
|
||||||
type PushCoinPoolAggregateOptionsFunc func(cols *PushCoinPoolColumns) *options.AggregateOptions
|
|
||||||
type PushCoinPoolFindOneOptionsFunc func(cols *PushCoinPoolColumns) *options.FindOneOptions
|
|
||||||
type PushCoinPoolFindManyOptionsFunc func(cols *PushCoinPoolColumns) *options.FindOptions
|
|
||||||
type PushCoinPoolUpdateOptionsFunc func(cols *PushCoinPoolColumns) *options.UpdateOptions
|
|
||||||
type PushCoinPoolDeleteOptionsFunc func(cols *PushCoinPoolColumns) *options.DeleteOptions
|
|
||||||
type PushCoinPoolInsertOneOptionsFunc func(cols *PushCoinPoolColumns) *options.InsertOneOptions
|
|
||||||
type PushCoinPoolInsertManyOptionsFunc func(cols *PushCoinPoolColumns) *options.InsertManyOptions
|
|
||||||
|
|
||||||
type PushCoinPool struct {
|
|
||||||
Columns *PushCoinPoolColumns
|
|
||||||
Database *mongo.Database
|
|
||||||
Collection *mongo.Collection
|
|
||||||
}
|
|
||||||
|
|
||||||
type PushCoinPoolColumns struct {
|
|
||||||
ID string
|
|
||||||
Pool1 string
|
|
||||||
Pool2 string
|
|
||||||
Pool3 string
|
|
||||||
}
|
|
||||||
|
|
||||||
var pushCoinPoolColumns = &PushCoinPoolColumns{
|
|
||||||
ID: "_id",
|
|
||||||
Pool1: "pool1",
|
|
||||||
Pool2: "pool2",
|
|
||||||
Pool3: "pool3",
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewPushCoinPool() *PushCoinPool {
|
|
||||||
return &PushCoinPool{
|
|
||||||
Columns: pushCoinPoolColumns,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Count returns the number of documents in the collection.
|
|
||||||
func (dao *PushCoinPool) Count(ctx context.Context, filterFunc PushCoinPoolFilterFunc, optionsFunc ...PushCoinPoolCountOptionsFunc) (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 *PushCoinPool) Aggregate(ctx context.Context, pipelineFunc PushCoinPoolPipelineFunc, optionsFunc ...PushCoinPoolAggregateOptionsFunc) (*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 *PushCoinPool) InsertOne(ctx context.Context, model *modelpkg.PushCoinPool, optionsFunc ...PushCoinPoolInsertOneOptionsFunc) (*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 *PushCoinPool) InsertMany(ctx context.Context, models []*modelpkg.PushCoinPool, optionsFunc ...PushCoinPoolInsertManyOptionsFunc) (*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 *PushCoinPool) UpdateOne(ctx context.Context, filterFunc PushCoinPoolFilterFunc, updateFunc PushCoinPoolUpdateFunc, optionsFunc ...PushCoinPoolUpdateOptionsFunc) (*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 *PushCoinPool) UpdateOneByID(ctx context.Context, id string, updateFunc PushCoinPoolUpdateFunc, optionsFunc ...PushCoinPoolUpdateOptionsFunc) (*mongo.UpdateResult, error) {
|
|
||||||
objectID, err := primitive.ObjectIDFromHex(id)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return dao.UpdateOne(ctx, func(cols *PushCoinPoolColumns) interface{} {
|
|
||||||
return bson.M{"_id": objectID}
|
|
||||||
}, updateFunc, optionsFunc...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateMany executes an update command to update documents in the collection.
|
|
||||||
func (dao *PushCoinPool) UpdateMany(ctx context.Context, filterFunc PushCoinPoolFilterFunc, updateFunc PushCoinPoolUpdateFunc, optionsFunc ...PushCoinPoolUpdateOptionsFunc) (*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 *PushCoinPool) FindOne(ctx context.Context, filterFunc PushCoinPoolFilterFunc, optionsFunc ...PushCoinPoolFindOneOptionsFunc) (*modelpkg.PushCoinPool, error) {
|
|
||||||
var (
|
|
||||||
opts *options.FindOneOptions
|
|
||||||
model = &modelpkg.PushCoinPool{}
|
|
||||||
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 *PushCoinPool) FindOneByID(ctx context.Context, id string, optionsFunc ...PushCoinPoolFindOneOptionsFunc) (*modelpkg.PushCoinPool, error) {
|
|
||||||
objectID, err := primitive.ObjectIDFromHex(id)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return dao.FindOne(ctx, func(cols *PushCoinPoolColumns) interface{} {
|
|
||||||
return bson.M{"_id": objectID}
|
|
||||||
}, optionsFunc...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FindMany executes a find command and returns many models the matching documents in the collection.
|
|
||||||
func (dao *PushCoinPool) FindMany(ctx context.Context, filterFunc PushCoinPoolFilterFunc, optionsFunc ...PushCoinPoolFindManyOptionsFunc) ([]*modelpkg.PushCoinPool, 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.PushCoinPool, 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 *PushCoinPool) DeleteOne(ctx context.Context, filterFunc PushCoinPoolFilterFunc, optionsFunc ...PushCoinPoolDeleteOptionsFunc) (*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 *PushCoinPool) DeleteOneByID(ctx context.Context, id string, optionsFunc ...PushCoinPoolDeleteOptionsFunc) (*mongo.DeleteResult, error) {
|
|
||||||
objectID, err := primitive.ObjectIDFromHex(id)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return dao.DeleteOne(ctx, func(cols *PushCoinPoolColumns) interface{} {
|
|
||||||
return bson.M{"_id": objectID}
|
|
||||||
}, optionsFunc...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteMany executes a delete command to delete documents from the collection.
|
|
||||||
func (dao *PushCoinPool) DeleteMany(ctx context.Context, filterFunc PushCoinPoolFilterFunc, optionsFunc ...PushCoinPoolDeleteOptionsFunc) (*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 *PushCoinPool) autofill(ctx context.Context, model *modelpkg.PushCoinPool) error {
|
|
||||||
if model.ID.IsZero() {
|
|
||||||
model.ID = primitive.NewObjectID()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -1,67 +0,0 @@
|
||||||
package dao
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"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 PushCoinPoolColumns = internal.PushCoinPoolColumns
|
|
||||||
|
|
||||||
type PushCoinPool struct {
|
|
||||||
*internal.PushCoinPool
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetPushCoinPool(key string) (*PushCoinPool, error) {
|
|
||||||
return mongox.GetDao(key, NewPushCoinPool)
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewPushCoinPool(db *mongo.Database, c *mongo.Collection) (*PushCoinPool, any) {
|
|
||||||
if db == nil || c == nil {
|
|
||||||
return &PushCoinPool{}, &modelpkg.PushCoinPool{}
|
|
||||||
}
|
|
||||||
|
|
||||||
v := internal.NewPushCoinPool()
|
|
||||||
v.Database = db
|
|
||||||
v.Collection = c
|
|
||||||
|
|
||||||
return &PushCoinPool{PushCoinPool: v}, &modelpkg.PushCoinPool{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PushCoinPool) Load() (*modelpkg.PushCoinPool, error) {
|
|
||||||
ret, err := p.FindOne(context.Background(), func(cols *internal.PushCoinPoolColumns) interface{} {
|
|
||||||
return bson.M{}
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("PushCoinPool FindOne error: %v", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PushCoinPool) Save(data *modelpkg.PushCoinPool) error {
|
|
||||||
_, err := p.UpdateOneByID(context.Background(), data.ID.Hex(), func(cols *internal.PushCoinPoolColumns) interface{} {
|
|
||||||
return bson.M{"$set": data}
|
|
||||||
}, func(cols *internal.PushCoinPoolColumns) *options.UpdateOptions {
|
|
||||||
return options.Update().SetUpsert(true)
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Error("PushCoinPool.Save ", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
package svc
|
|
||||||
|
|
||||||
import (
|
|
||||||
"mongo.games.com/game/dao"
|
|
||||||
"mongo.games.com/game/model"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"net/rpc"
|
|
||||||
)
|
|
||||||
|
|
||||||
var PushCoinSvc = new(PushCoinService)
|
|
||||||
|
|
||||||
type PushCoinService struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PushCoinService) Load(plt *string, ret *model.PushCoinPool) error {
|
|
||||||
m, err := dao.GetPushCoinPool(*plt)
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("PushCoinPool dao error: %v", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
r, err := m.Load()
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("PushCoinPool Load error: %v", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if r != nil {
|
|
||||||
*ret = *r
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PushCoinService) Save(d *model.PushCoinPool, ret *bool) error {
|
|
||||||
m, err := dao.GetPushCoinPool(d.Platform)
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("PushCoinPool dao error: %v", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = m.Save(d); err != nil {
|
|
||||||
logger.Logger.Errorf("PushCoinPool Save error: %v", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
*ret = true
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
rpc.Register(PushCoinSvc)
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
//go:generate mongoctl -model-dir=. -model-names=PushCoinPool -dao-dir=../dao/
|
|
||||||
type PushCoinPool struct {
|
|
||||||
Platform string `bson:"-"`
|
|
||||||
ID primitive.ObjectID `bson:"_id" gen:"autoFill"`
|
|
||||||
Pool1 *PushCoinPoolInfo `bson:"pool1"`
|
|
||||||
Pool2 *PushCoinPoolInfo `bson:"pool2"`
|
|
||||||
Pool3 *PushCoinPoolInfo `bson:"pool3"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PushCoinPoolInfo struct {
|
|
||||||
CurCoin int64 `bson:"curcoin"` // 当前金币
|
|
||||||
Remain int64 `bson:"remain"` // 剩余金币
|
|
||||||
Version int64 `bson:"version"` // 版本号, 达到上限后更新
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewPushCoinPool(plt string) *PushCoinPool {
|
|
||||||
return &PushCoinPool{
|
|
||||||
Platform: plt,
|
|
||||||
ID: primitive.NewObjectID(),
|
|
||||||
Pool1: &PushCoinPoolInfo{},
|
|
||||||
Pool2: &PushCoinPoolInfo{},
|
|
||||||
Pool3: &PushCoinPoolInfo{},
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PushCoinPool) TableName() string {
|
|
||||||
return "pushcoin_pool"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PushCoinPool) DatabaseName() string {
|
|
||||||
return "log"
|
|
||||||
}
|
|
||||||
|
|
||||||
func PushCoinLoad(plt string) (*PushCoinPool, error) {
|
|
||||||
if rpcCli == nil {
|
|
||||||
logger.Logger.Error("model.PushCoinLoad rpcCli == nil")
|
|
||||||
return nil, errors.New("rpc client is nil")
|
|
||||||
}
|
|
||||||
|
|
||||||
res := &PushCoinPool{}
|
|
||||||
err := rpcCli.CallWithTimeout("PushCoinService.Load", &plt, res, time.Second*30)
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("PushCoinLoad error: %v", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if res.ID.IsZero() {
|
|
||||||
res = NewPushCoinPool(plt)
|
|
||||||
}
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func PushCoinSave(data *PushCoinPool) error {
|
|
||||||
if rpcCli == nil {
|
|
||||||
logger.Logger.Error("model.PushCoinSave rpcCli == nil")
|
|
||||||
return errors.New("rpc client is nil")
|
|
||||||
}
|
|
||||||
|
|
||||||
ret := false
|
|
||||||
err := rpcCli.CallWithTimeout("PushCoinService.Save", data, &ret, time.Second*30)
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("PushCoinSave error: %v", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -30,7 +30,6 @@ const (
|
||||||
PushCoinPacketID_PACKET_SCPushCoinPlayerOp PushCoinPacketID = 2683 // 玩家操作返回
|
PushCoinPacketID_PACKET_SCPushCoinPlayerOp PushCoinPacketID = 2683 // 玩家操作返回
|
||||||
PushCoinPacketID_PACKET_NotifyPowerLine PushCoinPacketID = 2684 // 通知能量值
|
PushCoinPacketID_PACKET_NotifyPowerLine PushCoinPacketID = 2684 // 通知能量值
|
||||||
PushCoinPacketID_PACKET_NotifyDrawInfo PushCoinPacketID = 2685 // 抽奖信息
|
PushCoinPacketID_PACKET_NotifyDrawInfo PushCoinPacketID = 2685 // 抽奖信息
|
||||||
PushCoinPacketID_PACKET_NotifyAward PushCoinPacketID = 2686 // 广播中奖信息
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enum value maps for PushCoinPacketID.
|
// Enum value maps for PushCoinPacketID.
|
||||||
|
@ -43,7 +42,6 @@ var (
|
||||||
2683: "PACKET_SCPushCoinPlayerOp",
|
2683: "PACKET_SCPushCoinPlayerOp",
|
||||||
2684: "PACKET_NotifyPowerLine",
|
2684: "PACKET_NotifyPowerLine",
|
||||||
2685: "PACKET_NotifyDrawInfo",
|
2685: "PACKET_NotifyDrawInfo",
|
||||||
2686: "PACKET_NotifyAward",
|
|
||||||
}
|
}
|
||||||
PushCoinPacketID_value = map[string]int32{
|
PushCoinPacketID_value = map[string]int32{
|
||||||
"PACKET_PushCoin_ZERO": 0,
|
"PACKET_PushCoin_ZERO": 0,
|
||||||
|
@ -53,7 +51,6 @@ var (
|
||||||
"PACKET_SCPushCoinPlayerOp": 2683,
|
"PACKET_SCPushCoinPlayerOp": 2683,
|
||||||
"PACKET_NotifyPowerLine": 2684,
|
"PACKET_NotifyPowerLine": 2684,
|
||||||
"PACKET_NotifyDrawInfo": 2685,
|
"PACKET_NotifyDrawInfo": 2685,
|
||||||
"PACKET_NotifyAward": 2686,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -784,63 +781,6 @@ func (x *NotifyPowerLine) GetPowerLineMax() int64 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
//广播中奖信息
|
|
||||||
//PACKET_NotifyAward
|
|
||||||
type NotifyAward struct {
|
|
||||||
state protoimpl.MessageState
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Draw *DrawInfo `protobuf:"bytes,1,opt,name=Draw,proto3" json:"Draw,omitempty"` // 中奖信息
|
|
||||||
Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` // 玩家名字
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *NotifyAward) Reset() {
|
|
||||||
*x = NotifyAward{}
|
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_protocol_activity_pushcoin_proto_msgTypes[9]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *NotifyAward) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*NotifyAward) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *NotifyAward) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_protocol_activity_pushcoin_proto_msgTypes[9]
|
|
||||||
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 NotifyAward.ProtoReflect.Descriptor instead.
|
|
||||||
func (*NotifyAward) Descriptor() ([]byte, []int) {
|
|
||||||
return file_protocol_activity_pushcoin_proto_rawDescGZIP(), []int{9}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *NotifyAward) GetDraw() *DrawInfo {
|
|
||||||
if x != nil {
|
|
||||||
return x.Draw
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *NotifyAward) GetName() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Name
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
var File_protocol_activity_pushcoin_proto protoreflect.FileDescriptor
|
var File_protocol_activity_pushcoin_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_protocol_activity_pushcoin_proto_rawDesc = []byte{
|
var file_protocol_activity_pushcoin_proto_rawDesc = []byte{
|
||||||
|
@ -918,50 +858,43 @@ var file_protocol_activity_pushcoin_proto_rawDesc = []byte{
|
||||||
0x4c, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x50, 0x6f, 0x77, 0x65,
|
0x4c, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x50, 0x6f, 0x77, 0x65,
|
||||||
0x72, 0x4c, 0x69, 0x6e, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69,
|
0x72, 0x4c, 0x69, 0x6e, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69,
|
||||||
0x6e, 0x65, 0x4d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x50, 0x6f, 0x77,
|
0x6e, 0x65, 0x4d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x50, 0x6f, 0x77,
|
||||||
0x65, 0x72, 0x4c, 0x69, 0x6e, 0x65, 0x4d, 0x61, 0x78, 0x22, 0x49, 0x0a, 0x0b, 0x4e, 0x6f, 0x74,
|
0x65, 0x72, 0x4c, 0x69, 0x6e, 0x65, 0x4d, 0x61, 0x78, 0x2a, 0xdd, 0x01, 0x0a, 0x10, 0x50, 0x75,
|
||||||
0x69, 0x66, 0x79, 0x41, 0x77, 0x61, 0x72, 0x64, 0x12, 0x26, 0x0a, 0x04, 0x44, 0x72, 0x61, 0x77,
|
0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x18,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74,
|
0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69,
|
||||||
0x79, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x44, 0x72, 0x61, 0x77,
|
0x6e, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b,
|
||||||
0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
0x45, 0x54, 0x5f, 0x43, 0x53, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x66,
|
||||||
0x4e, 0x61, 0x6d, 0x65, 0x2a, 0xf6, 0x01, 0x0a, 0x10, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69,
|
0x6f, 0x10, 0xf8, 0x14, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
|
||||||
0x6e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x41, 0x43,
|
0x43, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0xf9, 0x14,
|
||||||
0x4b, 0x45, 0x54, 0x5f, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x5f, 0x5a, 0x45, 0x52,
|
0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x50, 0x75, 0x73,
|
||||||
0x4f, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53,
|
0x68, 0x43, 0x6f, 0x69, 0x6e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4f, 0x70, 0x10, 0xfa, 0x14,
|
||||||
0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0xf8, 0x14, 0x12,
|
0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x50, 0x75, 0x73,
|
||||||
0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x50, 0x75, 0x73, 0x68,
|
0x68, 0x43, 0x6f, 0x69, 0x6e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4f, 0x70, 0x10, 0xfb, 0x14,
|
||||||
0x43, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0xf9, 0x14, 0x12, 0x1e, 0x0a, 0x19, 0x50,
|
0x12, 0x1b, 0x0a, 0x16, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4e, 0x6f, 0x74, 0x69, 0x66,
|
||||||
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e,
|
0x79, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x6e, 0x65, 0x10, 0xfc, 0x14, 0x12, 0x1a, 0x0a,
|
||||||
0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4f, 0x70, 0x10, 0xfa, 0x14, 0x12, 0x1e, 0x0a, 0x19, 0x50,
|
0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x44, 0x72,
|
||||||
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e,
|
0x61, 0x77, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0xfd, 0x14, 0x2a, 0x5e, 0x0a, 0x07, 0x4f, 0x70, 0x43,
|
||||||
0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4f, 0x70, 0x10, 0xfb, 0x14, 0x12, 0x1b, 0x0a, 0x16, 0x50,
|
0x6f, 0x64, 0x65, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x50, 0x5f, 0x5a, 0x65, 0x72, 0x6f, 0x10,
|
||||||
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x50, 0x6f, 0x77, 0x65,
|
0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x50, 0x5f, 0x42, 0x65, 0x74, 0x10, 0x01, 0x12, 0x0b, 0x0a,
|
||||||
0x72, 0x4c, 0x69, 0x6e, 0x65, 0x10, 0xfc, 0x14, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b,
|
0x07, 0x4f, 0x50, 0x5f, 0x47, 0x61, 0x69, 0x6e, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x4f, 0x50,
|
||||||
0x45, 0x54, 0x5f, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x44, 0x72, 0x61, 0x77, 0x49, 0x6e, 0x66,
|
0x5f, 0x53, 0x68, 0x61, 0x6b, 0x65, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x5f, 0x52,
|
||||||
0x6f, 0x10, 0xfd, 0x14, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4e,
|
0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x50, 0x5f, 0x45,
|
||||||
0x6f, 0x74, 0x69, 0x66, 0x79, 0x41, 0x77, 0x61, 0x72, 0x64, 0x10, 0xfe, 0x14, 0x2a, 0x5e, 0x0a,
|
0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x10, 0x05, 0x2a, 0xd2, 0x01, 0x0a, 0x14, 0x4f, 0x70,
|
||||||
0x07, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x50, 0x5f, 0x5a,
|
0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x43, 0x6f,
|
||||||
0x65, 0x72, 0x6f, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x50, 0x5f, 0x42, 0x65, 0x74, 0x10,
|
0x64, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x75, 0x73, 0x68, 0x43,
|
||||||
0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x50, 0x5f, 0x47, 0x61, 0x69, 0x6e, 0x10, 0x02, 0x12, 0x0c,
|
0x6f, 0x69, 0x6e, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x17, 0x0a,
|
||||||
0x0a, 0x08, 0x4f, 0x50, 0x5f, 0x53, 0x68, 0x61, 0x6b, 0x65, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a,
|
0x13, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x5f, 0x45,
|
||||||
0x4f, 0x50, 0x5f, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b,
|
0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50,
|
||||||
0x4f, 0x50, 0x5f, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x10, 0x05, 0x2a, 0xd2, 0x01,
|
0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x5f, 0x42, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x45, 0x6e,
|
||||||
0x0a, 0x14, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f,
|
0x6f, 0x75, 0x67, 0x68, 0x10, 0x02, 0x12, 0x23, 0x0a, 0x1f, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50,
|
||||||
0x69, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50,
|
0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x5f, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65,
|
||||||
0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10,
|
0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x03, 0x12, 0x20, 0x0a, 0x1c, 0x4f,
|
||||||
0x00, 0x12, 0x17, 0x0a, 0x13, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f,
|
0x50, 0x52, 0x43, 0x5f, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x5f, 0x53, 0x68, 0x61,
|
||||||
0x69, 0x6e, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x4f, 0x50,
|
0x6b, 0x65, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x04, 0x12, 0x1f, 0x0a,
|
||||||
0x52, 0x43, 0x5f, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x5f, 0x42, 0x65, 0x74, 0x4e,
|
0x1b, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x5f, 0x49,
|
||||||
0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x02, 0x12, 0x23, 0x0a, 0x1f, 0x4f, 0x50,
|
0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x05, 0x42, 0x28,
|
||||||
0x52, 0x43, 0x5f, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e, 0x5f, 0x45, 0x78, 0x63, 0x68,
|
0x5a, 0x26, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f,
|
||||||
0x61, 0x6e, 0x67, 0x65, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x03, 0x12,
|
0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f,
|
||||||
0x20, 0x0a, 0x1c, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f, 0x69, 0x6e,
|
0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
0x5f, 0x53, 0x68, 0x61, 0x6b, 0x65, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10,
|
|
||||||
0x04, 0x12, 0x1f, 0x0a, 0x1b, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x75, 0x73, 0x68, 0x43, 0x6f,
|
|
||||||
0x69, 0x6e, 0x5f, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68,
|
|
||||||
0x10, 0x05, 0x42, 0x28, 0x5a, 0x26, 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, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72,
|
|
||||||
0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -977,7 +910,7 @@ func file_protocol_activity_pushcoin_proto_rawDescGZIP() []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_protocol_activity_pushcoin_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
|
var file_protocol_activity_pushcoin_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
|
||||||
var file_protocol_activity_pushcoin_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
var file_protocol_activity_pushcoin_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||||
var file_protocol_activity_pushcoin_proto_goTypes = []interface{}{
|
var file_protocol_activity_pushcoin_proto_goTypes = []interface{}{
|
||||||
(PushCoinPacketID)(0), // 0: activity.PushCoinPacketID
|
(PushCoinPacketID)(0), // 0: activity.PushCoinPacketID
|
||||||
(OpCodes)(0), // 1: activity.OpCodes
|
(OpCodes)(0), // 1: activity.OpCodes
|
||||||
|
@ -991,7 +924,6 @@ var file_protocol_activity_pushcoin_proto_goTypes = []interface{}{
|
||||||
(*CSPushCoinPlayerOp)(nil), // 9: activity.CSPushCoinPlayerOp
|
(*CSPushCoinPlayerOp)(nil), // 9: activity.CSPushCoinPlayerOp
|
||||||
(*SCPushCoinPlayerOp)(nil), // 10: activity.SCPushCoinPlayerOp
|
(*SCPushCoinPlayerOp)(nil), // 10: activity.SCPushCoinPlayerOp
|
||||||
(*NotifyPowerLine)(nil), // 11: activity.NotifyPowerLine
|
(*NotifyPowerLine)(nil), // 11: activity.NotifyPowerLine
|
||||||
(*NotifyAward)(nil), // 12: activity.NotifyAward
|
|
||||||
}
|
}
|
||||||
var file_protocol_activity_pushcoin_proto_depIdxs = []int32{
|
var file_protocol_activity_pushcoin_proto_depIdxs = []int32{
|
||||||
6, // 0: activity.SCPushCoinInfo.ExchangeList:type_name -> activity.ExchangeInfo
|
6, // 0: activity.SCPushCoinInfo.ExchangeList:type_name -> activity.ExchangeInfo
|
||||||
|
@ -1006,12 +938,11 @@ var file_protocol_activity_pushcoin_proto_depIdxs = []int32{
|
||||||
2, // 9: activity.SCPushCoinPlayerOp.OpRetCode:type_name -> activity.OpResultPushCoinCode
|
2, // 9: activity.SCPushCoinPlayerOp.OpRetCode:type_name -> activity.OpResultPushCoinCode
|
||||||
1, // 10: activity.SCPushCoinPlayerOp.OpCode:type_name -> activity.OpCodes
|
1, // 10: activity.SCPushCoinPlayerOp.OpCode:type_name -> activity.OpCodes
|
||||||
6, // 11: activity.SCPushCoinPlayerOp.Exchange:type_name -> activity.ExchangeInfo
|
6, // 11: activity.SCPushCoinPlayerOp.Exchange:type_name -> activity.ExchangeInfo
|
||||||
7, // 12: activity.NotifyAward.Draw:type_name -> activity.DrawInfo
|
12, // [12:12] is the sub-list for method output_type
|
||||||
13, // [13:13] is the sub-list for method output_type
|
12, // [12:12] is the sub-list for method input_type
|
||||||
13, // [13:13] is the sub-list for method input_type
|
12, // [12:12] is the sub-list for extension type_name
|
||||||
13, // [13:13] is the sub-list for extension type_name
|
12, // [12:12] is the sub-list for extension extendee
|
||||||
13, // [13:13] is the sub-list for extension extendee
|
0, // [0:12] is the sub-list for field type_name
|
||||||
0, // [0:13] is the sub-list for field type_name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_protocol_activity_pushcoin_proto_init() }
|
func init() { file_protocol_activity_pushcoin_proto_init() }
|
||||||
|
@ -1128,18 +1059,6 @@ func file_protocol_activity_pushcoin_proto_init() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_protocol_activity_pushcoin_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
|
||||||
switch v := v.(*NotifyAward); 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{
|
||||||
|
@ -1147,7 +1066,7 @@ func file_protocol_activity_pushcoin_proto_init() {
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_protocol_activity_pushcoin_proto_rawDesc,
|
RawDescriptor: file_protocol_activity_pushcoin_proto_rawDesc,
|
||||||
NumEnums: 3,
|
NumEnums: 3,
|
||||||
NumMessages: 10,
|
NumMessages: 9,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,7 +10,6 @@ enum PushCoinPacketID {
|
||||||
PACKET_SCPushCoinPlayerOp = 2683; // 玩家操作返回
|
PACKET_SCPushCoinPlayerOp = 2683; // 玩家操作返回
|
||||||
PACKET_NotifyPowerLine = 2684; // 通知能量值
|
PACKET_NotifyPowerLine = 2684; // 通知能量值
|
||||||
PACKET_NotifyDrawInfo = 2685; // 抽奖信息
|
PACKET_NotifyDrawInfo = 2685; // 抽奖信息
|
||||||
PACKET_NotifyAward = 2686; // 广播中奖信息
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//信息
|
//信息
|
||||||
|
@ -93,11 +92,4 @@ message SCPushCoinPlayerOp {
|
||||||
message NotifyPowerLine {
|
message NotifyPowerLine {
|
||||||
int64 PowerLine = 1; // 当前能量值
|
int64 PowerLine = 1; // 当前能量值
|
||||||
int64 PowerLineMax = 2; // 能量值上限
|
int64 PowerLineMax = 2; // 能量值上限
|
||||||
}
|
|
||||||
|
|
||||||
//广播中奖信息
|
|
||||||
//PACKET_NotifyAward
|
|
||||||
message NotifyAward {
|
|
||||||
DrawInfo Draw = 1; // 中奖信息
|
|
||||||
string Name = 2; // 玩家名字
|
|
||||||
}
|
}
|
|
@ -57,9 +57,6 @@ func CSPushCoinInfo(s *netlib.Session, packetid int, data interface{}, sid int64
|
||||||
if p.WelfData.PushCoin == nil || len(p.WelfData.PushCoin.Turn) == 0 {
|
if p.WelfData.PushCoin == nil || len(p.WelfData.PushCoin.Turn) == 0 {
|
||||||
InitPlayerPushCoin(p)
|
InitPlayerPushCoin(p)
|
||||||
}
|
}
|
||||||
if p.WelfData.PushCoin.Turn[2] > 3 || p.WelfData.PushCoin.Turn[4] > 3 || p.WelfData.PushCoin.Turn[6] > 6 {
|
|
||||||
InitPlayerPushCoin(p)
|
|
||||||
}
|
|
||||||
|
|
||||||
pack := &activity.SCPushCoinInfo{
|
pack := &activity.SCPushCoinInfo{
|
||||||
ShakeTimes: p.WelfData.PushCoin.Shake,
|
ShakeTimes: p.WelfData.PushCoin.Shake,
|
||||||
|
@ -478,7 +475,7 @@ func PushCoinDraw(p *Player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// fp 奖池返奖,返回是否成功
|
// fp 奖池返奖,返回是否成功
|
||||||
fp := func(i int, poolInfo *model.PushCoinPoolInfo) bool {
|
fp := func(i int, poolInfo *PushCoinPoolInfo) bool {
|
||||||
// 是否返奖
|
// 是否返奖
|
||||||
if poolInfo == nil || poolInfo.Remain <= 0 {
|
if poolInfo == nil || poolInfo.Remain <= 0 {
|
||||||
return false
|
return false
|
||||||
|
@ -513,7 +510,7 @@ func PushCoinDraw(p *Player) {
|
||||||
p.WelfData.PushCoin.PoolV[i] = poolInfo.Version
|
p.WelfData.PushCoin.PoolV[i] = poolInfo.Version
|
||||||
// 下次中奖位置
|
// 下次中奖位置
|
||||||
p.WelfData.PushCoin.Next = int32(PoolIndex[i])
|
p.WelfData.PushCoin.Next = int32(PoolIndex[i])
|
||||||
logger.Logger.Tracef("下次中奖池:%+v", p.WelfData.PushCoin)
|
logger.Logger.Tracef("下次中奖池:%v", p.WelfData.PushCoin)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -565,7 +562,7 @@ func PushCoinDraw(p *Player) {
|
||||||
if i < len(list) {
|
if i < len(list) {
|
||||||
for _, v := range list[i].GetAward() {
|
for _, v := range list[i].GetAward() {
|
||||||
draw = &activity.DrawInfo{
|
draw = &activity.DrawInfo{
|
||||||
Id: k,
|
Id: p.WelfData.PushCoin.Next,
|
||||||
ItemId: v.GetItemId(),
|
ItemId: v.GetItemId(),
|
||||||
ItemNum: v.GetItemNum(),
|
ItemNum: v.GetItemNum(),
|
||||||
}
|
}
|
||||||
|
@ -585,7 +582,7 @@ func PushCoinDraw(p *Player) {
|
||||||
ItemId: v.GetItemId(),
|
ItemId: v.GetItemId(),
|
||||||
ItemNum: v.GetItemNum(),
|
ItemNum: v.GetItemNum(),
|
||||||
})
|
})
|
||||||
logger.Logger.Tracef("刷新奖池奖品:%v", draw1)
|
logger.Logger.Tracef("刷新奖池奖品:%v", draw)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -623,11 +620,6 @@ func PushCoinDraw(p *Player) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if has && index == int(curIndex) {
|
|
||||||
// 重复
|
|
||||||
has = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if !has {
|
if !has {
|
||||||
// 替换
|
// 替换
|
||||||
if slices.Contains(PoolIndex, index) {
|
if slices.Contains(PoolIndex, index) {
|
||||||
|
@ -641,14 +633,12 @@ func PushCoinDraw(p *Player) {
|
||||||
})
|
})
|
||||||
p.WelfData.PushCoin.Turn[index] = e.GetId()
|
p.WelfData.PushCoin.Turn[index] = e.GetId()
|
||||||
} else {
|
} else {
|
||||||
if !slices.Contains(PoolIndex, int(curIndex)) {
|
p.WelfData.PushCoin.Turn[curIndex] = e1.GetId()
|
||||||
p.WelfData.PushCoin.Turn[curIndex] = e1.GetId()
|
draw1 = append(draw1, &activity.DrawInfo{
|
||||||
draw1 = append(draw1, &activity.DrawInfo{
|
Id: curIndex,
|
||||||
Id: curIndex,
|
ItemId: e1.GetItemId(),
|
||||||
ItemId: e1.GetItemId(),
|
ItemNum: e1.GetItemNum(),
|
||||||
ItemNum: e1.GetItemNum(),
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
p.WelfData.PushCoin.Next = int32(index)
|
p.WelfData.PushCoin.Next = int32(index)
|
||||||
logger.Logger.Tracef("下次中普通奖品:index:%v ItemId:%v Num:%v", index, e.GetItemId(), e.GetItemNum())
|
logger.Logger.Tracef("下次中普通奖品:index:%v ItemId:%v Num:%v", index, e.GetItemId(), e.GetItemNum())
|
||||||
|
@ -671,16 +661,6 @@ func PushCoinDraw(p *Player) {
|
||||||
p.SendToClient(int(activity.PushCoinPacketID_PACKET_NotifyDrawInfo), pack)
|
p.SendToClient(int(activity.PushCoinPacketID_PACKET_NotifyDrawInfo), pack)
|
||||||
logger.Logger.Trace("NotifyDrawInfo: ", pack)
|
logger.Logger.Trace("NotifyDrawInfo: ", pack)
|
||||||
|
|
||||||
if slices.Contains(PoolIndex, int(draw.GetId())) {
|
|
||||||
pk := &activity.NotifyAward{
|
|
||||||
Draw: draw,
|
|
||||||
Name: p.GetName(),
|
|
||||||
}
|
|
||||||
// 广播抽奖信息
|
|
||||||
PlatformMgrSingleton.Broadcast(int(activity.PushCoinPacketID_PACKET_NotifyAward), pk, nil, 0)
|
|
||||||
logger.Logger.Trace("Broadcast NotifyAward: ", pk)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 刷新能量条
|
// 刷新能量条
|
||||||
PushCoinAddPower(p, 0)
|
PushCoinAddPower(p, 0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/protocol/webapi"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"mongo.games.com/goserver/core/module"
|
"mongo.games.com/goserver/core/module"
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
|
||||||
"mongo.games.com/game/model"
|
|
||||||
"mongo.games.com/game/protocol/webapi"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -17,15 +15,27 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
var PushCoinPoolMangerInstance = &PushCoinPoolManager{
|
var PushCoinPoolMangerInstance = &PushCoinPoolManager{
|
||||||
PlatformConfig: map[string]*model.PushCoinPool{},
|
PlatformConfig: map[string]*PushCoinPool{},
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
module.RegisteModule(PushCoinPoolMangerInstance, time.Hour, 0)
|
module.RegisteModule(PushCoinPoolMangerInstance, time.Hour, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PushCoinPool struct {
|
||||||
|
Pool1 *PushCoinPoolInfo
|
||||||
|
Pool2 *PushCoinPoolInfo
|
||||||
|
Pool3 *PushCoinPoolInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
type PushCoinPoolInfo struct {
|
||||||
|
CurCoin int64 // 当前金币
|
||||||
|
Remain int64 // 剩余金币
|
||||||
|
Version int64 // 版本号, 达到上限后更新
|
||||||
|
}
|
||||||
|
|
||||||
type PushCoinPoolManager struct {
|
type PushCoinPoolManager struct {
|
||||||
PlatformConfig map[string]*model.PushCoinPool
|
PlatformConfig map[string]*PushCoinPool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PushCoinPoolManager) ModuleName() string {
|
func (p *PushCoinPoolManager) ModuleName() string {
|
||||||
|
@ -34,21 +44,6 @@ func (p *PushCoinPoolManager) ModuleName() string {
|
||||||
|
|
||||||
func (p *PushCoinPoolManager) Init() {
|
func (p *PushCoinPoolManager) Init() {
|
||||||
// 加载水池
|
// 加载水池
|
||||||
for _, v := range PlatformMgrSingleton.GetPlatforms() {
|
|
||||||
d, err := model.PushCoinLoad(v.IdStr)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
d.Platform = v.IdStr
|
|
||||||
p.PlatformConfig[v.IdStr] = d
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PushCoinPoolManager) save(d *model.PushCoinPool) {
|
|
||||||
err := model.PushCoinSave(d)
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("save PushCoinPool error: %v", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PushCoinPoolManager) Update() {
|
func (p *PushCoinPoolManager) Update() {
|
||||||
|
@ -57,16 +52,17 @@ func (p *PushCoinPoolManager) Update() {
|
||||||
|
|
||||||
func (p *PushCoinPoolManager) Shutdown() {
|
func (p *PushCoinPoolManager) Shutdown() {
|
||||||
// 保存水池
|
// 保存水池
|
||||||
for _, v := range p.PlatformConfig {
|
|
||||||
p.save(v)
|
|
||||||
}
|
|
||||||
module.UnregisteModule(p)
|
module.UnregisteModule(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PushCoinPoolManager) Add(platform string, val int64) {
|
func (p *PushCoinPoolManager) Add(platform string, val int64) {
|
||||||
cfg, ok := p.PlatformConfig[platform]
|
cfg, ok := p.PlatformConfig[platform]
|
||||||
if !ok {
|
if !ok {
|
||||||
cfg = model.NewPushCoinPool(platform)
|
cfg = &PushCoinPool{
|
||||||
|
Pool1: &PushCoinPoolInfo{},
|
||||||
|
Pool2: &PushCoinPoolInfo{},
|
||||||
|
Pool3: &PushCoinPoolInfo{},
|
||||||
|
}
|
||||||
p.PlatformConfig[platform] = cfg
|
p.PlatformConfig[platform] = cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +71,7 @@ func (p *PushCoinPoolManager) Add(platform string, val int64) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
f := func(i int, poolInfo *model.PushCoinPoolInfo, pool *webapi.PushCoinPool, rate float64) {
|
f := func(i int, poolInfo *PushCoinPoolInfo, pool *webapi.PushCoinPool, rate float64) {
|
||||||
if pool != nil && pool.GetOn() == common.On {
|
if pool != nil && pool.GetOn() == common.On {
|
||||||
change := int64(float64(val) * rate)
|
change := int64(float64(val) * rate)
|
||||||
poolInfo.CurCoin += change
|
poolInfo.CurCoin += change
|
||||||
|
|
Loading…
Reference in New Issue