上传配置
This commit is contained in:
parent
28c7975613
commit
175c3391f3
@ -500,6 +500,11 @@ type (
|
|||||||
GetPriceGroupLen(pricegroupId int32) (count int32, err error)
|
GetPriceGroupLen(pricegroupId int32) (count int32, err error)
|
||||||
GetGrormetLlame(id string) (data int32, err error)
|
GetGrormetLlame(id string) (data int32, err error)
|
||||||
GetGroupDataByLotteryId(id int32) (data *cfg.GameLotteryData, err error)
|
GetGroupDataByLotteryId(id int32) (data *cfg.GameLotteryData, err error)
|
||||||
|
|
||||||
|
//读取全局表 db层
|
||||||
|
GetGlobalData(key string, v interface{}) (err error)
|
||||||
|
//更新全局表 db层
|
||||||
|
UpdateGlobalData(key string, v interface{}) (err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
IReputation interface {
|
IReputation interface {
|
||||||
|
@ -3,7 +3,11 @@ package tools
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
)
|
)
|
||||||
|
|
||||||
type modelGlobal struct {
|
type modelGlobal struct {
|
||||||
@ -17,3 +21,19 @@ func (this *modelGlobal) Init(service core.IService, module core.IModule, comp c
|
|||||||
this.module = module.(*Tools)
|
this.module = module.(*Tools)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询全局配置
|
||||||
|
func (this *modelGlobal) GetGlobalData(key string, v interface{}) (err error) {
|
||||||
|
if err = this.DBModel.DB.FindOne(core.SqlTable(this.TableName), bson.M{"_id": key}).Decode(v); err != nil {
|
||||||
|
this.module.Error("GetGlobalData err", log.Field{Key: "key", Value: key}, log.Field{Key: "err", Value: err.Error()})
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新全局配置
|
||||||
|
func (this *modelGlobal) UpdateGlobalData(key string, v interface{}) (err error) {
|
||||||
|
if _, err = this.DBModel.DB.UpdateOne(core.SqlTable(this.TableName), bson.M{"_id": key}, v, options.Update().SetUpsert(true)); err != nil {
|
||||||
|
this.module.Error("GetGlobalData err", log.Field{Key: "key", Value: key}, log.Field{Key: "err", Value: err.Error()})
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -14,7 +14,8 @@ func NewModule() core.IModule {
|
|||||||
|
|
||||||
type Tools struct {
|
type Tools struct {
|
||||||
modules.ModuleBase
|
modules.ModuleBase
|
||||||
configure *MCompConfigure
|
configure *MCompConfigure
|
||||||
|
modelGlobal *modelGlobal
|
||||||
}
|
}
|
||||||
|
|
||||||
// 模块名
|
// 模块名
|
||||||
@ -38,6 +39,7 @@ func (this *Tools) Start() (err error) {
|
|||||||
func (this *Tools) OnInstallComp() {
|
func (this *Tools) OnInstallComp() {
|
||||||
this.ModuleBase.OnInstallComp()
|
this.ModuleBase.OnInstallComp()
|
||||||
this.configure = this.RegisterComp(new(MCompConfigure)).(*MCompConfigure)
|
this.configure = this.RegisterComp(new(MCompConfigure)).(*MCompConfigure)
|
||||||
|
this.modelGlobal = this.RegisterComp(new(modelGlobal)).(*modelGlobal)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 随机机器人
|
// 随机机器人
|
||||||
@ -77,3 +79,11 @@ func (this *Tools) GetPriceGroupLen(pricegroupId int32) (count int32, err error)
|
|||||||
func (this *Tools) GetGrormetLlame(id string) (data int32, err error) {
|
func (this *Tools) GetGrormetLlame(id string) (data int32, err error) {
|
||||||
return this.configure.GetGrormetLlame(id)
|
return this.configure.GetGrormetLlame(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Tools) GetGlobalData(key string, v interface{}) (err error) {
|
||||||
|
return this.modelGlobal.GetGlobalData(key, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Tools) UpdateGlobalData(key string, v interface{}) (err error) {
|
||||||
|
return this.modelGlobal.UpdateGlobalData(key, v)
|
||||||
|
}
|
||||||
|
@ -22,6 +22,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.WarorderReceiveR
|
|||||||
info *pb.Warorder
|
info *pb.Warorder
|
||||||
confs []*cfg.GamePassCheckData
|
confs []*cfg.GamePassCheckData
|
||||||
awards []*cfg.Gameatn
|
awards []*cfg.Gameatn
|
||||||
|
ads []*pb.UserAssets = make([]*pb.UserAssets, 0)
|
||||||
days int32
|
days int32
|
||||||
err error
|
err error
|
||||||
ok bool
|
ok bool
|
||||||
@ -60,10 +61,20 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.WarorderReceiveR
|
|||||||
if v.Parameter <= days {
|
if v.Parameter <= days {
|
||||||
if info.Freeprogress < v.Parameter {
|
if info.Freeprogress < v.Parameter {
|
||||||
awards = append(awards, v.FreeReward)
|
awards = append(awards, v.FreeReward)
|
||||||
|
ads = append(ads, &pb.UserAssets{
|
||||||
|
A: v.FreeReward.A,
|
||||||
|
T: v.FreeReward.T,
|
||||||
|
N: v.FreeReward.N,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
if info.Vip {
|
if info.Vip {
|
||||||
if info.Payprogress < v.Parameter {
|
if info.Payprogress < v.Parameter {
|
||||||
awards = append(awards, v.PayReward)
|
awards = append(awards, v.PayReward)
|
||||||
|
ads = append(ads, &pb.UserAssets{
|
||||||
|
A: v.PayReward.A,
|
||||||
|
T: v.PayReward.T,
|
||||||
|
N: v.PayReward.N,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,6 +86,6 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.WarorderReceiveR
|
|||||||
if errdata = this.module.DispenseRes(session, awards, true); errdata != nil {
|
if errdata = this.module.DispenseRes(session, awards, true); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), "receive", &pb.WarorderReceiveResp{Info: info})
|
session.SendMsg(string(this.module.GetType()), "receive", &pb.WarorderReceiveResp{Rtype: req.Rtype, Info: info, Award: ads})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user