跨服发英雄,通知区服修改羁绊信息
This commit is contained in:
parent
349aef1c94
commit
520d613b7f
@ -230,6 +230,8 @@ const ( //Rpc
|
|||||||
// 充值发货
|
// 充值发货
|
||||||
Rpc_ModulePayDelivery core.Rpc_Key = "Rpc_ModuleArenaRaceSettlement" //充值发货
|
Rpc_ModulePayDelivery core.Rpc_Key = "Rpc_ModuleArenaRaceSettlement" //充值发货
|
||||||
|
|
||||||
|
// 羁绊信息
|
||||||
|
Rpc_ModuleFetter core.Rpc_Key = "Rpc_ModuleFetter"
|
||||||
)
|
)
|
||||||
|
|
||||||
//事件类型定义处
|
//事件类型定义处
|
||||||
|
@ -206,8 +206,8 @@ type (
|
|||||||
IHeroFetter interface {
|
IHeroFetter interface {
|
||||||
ModifyHeroFetterData(uid string, obj string, data map[string]interface{}) (code pb.ErrorCode) // 修改羁绊信息
|
ModifyHeroFetterData(uid string, obj string, data map[string]interface{}) (code pb.ErrorCode) // 修改羁绊信息
|
||||||
QueryHeroFetter(uid string) (data []*pb.DBHeroFetter) // 查询所有的羁绊信息
|
QueryHeroFetter(uid string) (data []*pb.DBHeroFetter) // 查询所有的羁绊信息
|
||||||
//QueryOneHeroFetter(uid string, cid string) *pb.DBHeroFetter // 通过英雄配置id 查询羁绊信息
|
|
||||||
AddHeroFetterData(uid string, heroConfId string) (code pb.ErrorCode) // 创建一条羁绊信息
|
AddHeroFetterData(uid string, heroConfId string) (code pb.ErrorCode) // 创建一条羁绊信息
|
||||||
|
SendRpcAddHero(session IUserSession, heroConfId string) (err error)
|
||||||
}
|
}
|
||||||
//月子秘境
|
//月子秘境
|
||||||
IMoonFantasy interface {
|
IMoonFantasy interface {
|
||||||
|
@ -70,8 +70,6 @@ func GetMonthStartEnd() (int64, int64) {
|
|||||||
return _d1, _d2
|
return _d1, _d2
|
||||||
}
|
}
|
||||||
func Test_Main(t *testing.T) {
|
func Test_Main(t *testing.T) {
|
||||||
GetMonthStartEnd()
|
|
||||||
fmt.Printf("%d", 9/10)
|
|
||||||
ids := utils.RandomNumbers(0, 10, 5)
|
ids := utils.RandomNumbers(0, 10, 5)
|
||||||
for _, v := range ids {
|
for _, v := range ids {
|
||||||
fmt.Printf("%d", v)
|
fmt.Printf("%d", v)
|
||||||
|
@ -278,11 +278,11 @@ func (this *ModelHero) setEnergyProperty(hero *pb.DBHero, star int32) {
|
|||||||
EnergyProperty := make(map[string]int32) //副属性
|
EnergyProperty := make(map[string]int32) //副属性
|
||||||
for k, v := range hero.Energy {
|
for k, v := range hero.Energy {
|
||||||
if k == comm.ResonanceHpPro {
|
if k == comm.ResonanceHpPro {
|
||||||
EnergyProperty[comm.Hp] += int32(math.Floor((1.0 + float64(resonConfig.Hppro*v)/1000) * float64(hero.Property[comm.Hp])))
|
EnergyProperty[comm.Hp] += int32(math.Floor(float64(resonConfig.Hppro*v) / 1000 * float64(hero.Property[comm.Hp])))
|
||||||
} else if k == comm.ResonanceAtkPro {
|
} else if k == comm.ResonanceAtkPro {
|
||||||
EnergyProperty[comm.Atk] += int32(math.Floor((1.0 + float64(resonConfig.Atkpro*v)/1000) * float64(hero.Property[comm.Atk])))
|
EnergyProperty[comm.Atk] += int32(math.Floor(float64(resonConfig.Atkpro*v) / 1000 * float64(hero.Property[comm.Atk])))
|
||||||
} else if k == comm.ResonanceDefPro {
|
} else if k == comm.ResonanceDefPro {
|
||||||
EnergyProperty[comm.Def] += int32(math.Floor((1.0 + float64(resonConfig.Defpro*v)/1000) * float64(hero.Property[comm.Def])))
|
EnergyProperty[comm.Def] += int32(math.Floor(float64(resonConfig.Defpro*v) / 1000 * float64(hero.Property[comm.Def])))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_heroMap := make(map[string]interface{}, 0)
|
_heroMap := make(map[string]interface{}, 0)
|
||||||
|
@ -67,7 +67,11 @@ func (this *Hero) CreateRepeatHero(session comm.IUserSession, heroCfgId string,
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
||||||
go func(uid string, heroCfgId string) { // 携程处理 图鉴数据
|
go func(uid string, heroCfgId string) { // 携程处理 图鉴数据
|
||||||
|
if db.IsCross() {
|
||||||
|
this.moduleFetter.SendRpcAddHero(session, heroCfgId)
|
||||||
|
} else {
|
||||||
this.moduleFetter.AddHeroFetterData(uid, heroCfgId)
|
this.moduleFetter.AddHeroFetterData(uid, heroCfgId)
|
||||||
|
}
|
||||||
if result, err1 := this.ModuleUser.GetUserExpand(uid); err1 == nil {
|
if result, err1 := this.ModuleUser.GetUserExpand(uid); err1 == nil {
|
||||||
initUpdate := map[string]interface{}{}
|
initUpdate := map[string]interface{}{}
|
||||||
sz := result.GetTujian()
|
sz := result.GetTujian()
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
package library
|
package library
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
@ -11,6 +16,7 @@ import (
|
|||||||
|
|
||||||
type Library struct {
|
type Library struct {
|
||||||
modules.ModuleBase
|
modules.ModuleBase
|
||||||
|
service base.IRPCXService
|
||||||
modelLibrary *modelLibrary
|
modelLibrary *modelLibrary
|
||||||
modelFetter *modelFetter
|
modelFetter *modelFetter
|
||||||
api *apiComp
|
api *apiComp
|
||||||
@ -27,7 +33,7 @@ func (this *Library) GetType() core.M_Modules {
|
|||||||
|
|
||||||
func (this *Library) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
func (this *Library) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||||
err = this.ModuleBase.Init(service, module, options)
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
|
this.service = service.(base.IRPCXService)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,6 +46,12 @@ func (this *Library) OnInstallComp() {
|
|||||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Library) Start() (err error) {
|
||||||
|
err = this.ModuleBase.Start()
|
||||||
|
this.service.RegisterFunctionName(string(comm.Rpc_ModuleFetter), this.Rpc_ModuleFetter)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 接口信息 更新藏书馆数据
|
// 接口信息 更新藏书馆数据
|
||||||
func (this *Library) ModifyLibraryData(uid string, obj string, data map[string]interface{}) (code pb.ErrorCode) {
|
func (this *Library) ModifyLibraryData(uid string, obj string, data map[string]interface{}) (code pb.ErrorCode) {
|
||||||
err := this.modelLibrary.modifyLibraryDataByObjId(uid, obj, data)
|
err := this.modelLibrary.modifyLibraryDataByObjId(uid, obj, data)
|
||||||
@ -135,8 +147,26 @@ func (this *Library) QueryOneHeroFetter(uid string, cid string) *pb.DBHeroFetter
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 发送prc消息到区服处理
|
||||||
|
func (this *Library) SendRpcAddHero(session comm.IUserSession, heroConfId string) (err error) {
|
||||||
|
if this.IsCross() {
|
||||||
|
if _, err = this.service.AcrossClusterRpcGo( // 给区服发送rpc消息
|
||||||
|
context.Background(),
|
||||||
|
session.GetServiecTag(),
|
||||||
|
comm.Service_Worker,
|
||||||
|
string(comm.Rpc_ModuleFetter),
|
||||||
|
pb.RPCGeneralReqA2{Param1: session.GetUserId(), Param2: heroConfId},
|
||||||
|
nil); err != nil {
|
||||||
|
this.Errorln(err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 创建一条羁绊信息
|
// 创建一条羁绊信息
|
||||||
func (this *Library) AddHeroFetterData(uid string, heroConfId string) (code pb.ErrorCode) {
|
func (this *Library) AddHeroFetterData(uid, heroConfId string) (code pb.ErrorCode) {
|
||||||
|
|
||||||
_conf := this.configure.GetLibraryHero(heroConfId) // 配置表中没有这个英雄数据 直接返回
|
_conf := this.configure.GetLibraryHero(heroConfId) // 配置表中没有这个英雄数据 直接返回
|
||||||
if _conf == nil {
|
if _conf == nil {
|
||||||
return
|
return
|
||||||
@ -195,3 +225,18 @@ func (this *Library) AddHeroFetterData(uid string, heroConfId string) (code pb.E
|
|||||||
func (this *Library) getLibraryByObjID(uid, oid string) *pb.DBLibrary {
|
func (this *Library) getLibraryByObjID(uid, oid string) *pb.DBLibrary {
|
||||||
return this.modelLibrary.getOneLibrary(uid, oid)
|
return this.modelLibrary.getOneLibrary(uid, oid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Library) Rpc_ModuleFetter(ctx context.Context, args *pb.RPCGeneralReqA2, reply *pb.EmptyResp) (err error) {
|
||||||
|
this.Debug("Rpc_ModuleFetter", log.Field{Key: "args", Value: args.String()})
|
||||||
|
if args.Param1 == "" || args.Param2 == "" {
|
||||||
|
err = errors.New("请求参数错误")
|
||||||
|
}
|
||||||
|
if session, ok := this.GetUserSession(args.Param1); !ok {
|
||||||
|
err = fmt.Errorf("目标用户:%s 不在线", args.Param1)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
this.AddHeroFetterData(session.GetUserId(), args.Param2)
|
||||||
|
session.Push()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -46,7 +46,7 @@ func (this *configureComp) GetMainline() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Errorf("get game_pagoda conf err:%v", err)
|
log.Errorf("get game_mainline conf err:%v", err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,10 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq)
|
|||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount) // 8
|
// 自动交易
|
||||||
aiCount := this.configure.GetTrollRule(comm.TrollAIBuyCount) // 10
|
//if trolltrain.AiCount+trolltrain.SellCount < this.configure.GetTrollRule(comm.TrollAIBuyCount) {
|
||||||
if trolltrain.AiCount+trolltrain.SellCount < aiCount {
|
|
||||||
this.module.TrollAI(session, trolltrain)
|
this.module.TrollAI(session, trolltrain)
|
||||||
}
|
//}
|
||||||
|
|
||||||
maxCoefficient = this.configure.GetTrollMaxCoefficientNux() // 增长幅度的最大值
|
maxCoefficient = this.configure.GetTrollMaxCoefficientNux() // 增长幅度的最大值
|
||||||
if maxCoefficient == 0 {
|
if maxCoefficient == 0 {
|
||||||
|
@ -3,6 +3,8 @@ package user
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/utils"
|
||||||
|
"time"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
@ -16,6 +18,61 @@ func (this *apiComp) SignCheck(session comm.IUserSession, req *pb.UserSignReq) (
|
|||||||
//登录
|
//登录
|
||||||
func (this *apiComp) Sign(session comm.IUserSession, req *pb.UserSignReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) Sign(session comm.IUserSession, req *pb.UserSignReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
|
|
||||||
code = this.module.modelSign.checkResetSignData(session)
|
var (
|
||||||
|
update map[string]interface{}
|
||||||
|
bReward bool
|
||||||
|
)
|
||||||
|
|
||||||
|
update = make(map[string]interface{}, 0)
|
||||||
|
if sign, err := this.module.modelSign.GetUserSign(session.GetUserId()); err == nil {
|
||||||
|
start, _ := utils.GetMonthStartEnd()
|
||||||
|
if sign.RTime < start { // 重置
|
||||||
|
sign.RTime = time.Now().Unix()
|
||||||
|
sign.SignTime = sign.RTime
|
||||||
|
sign.SignCount = 1
|
||||||
|
if newGroup := this.module.configure.GetSignResetConf(sign.Cid + 1); newGroup != -1 { // 获取当前的组id
|
||||||
|
sign.Cid += 1
|
||||||
|
sign.Group = newGroup
|
||||||
|
update["cid"] = sign.Cid
|
||||||
|
update["group"] = sign.Group
|
||||||
|
}
|
||||||
|
update["rTime"] = sign.RTime
|
||||||
|
update["signTime"] = sign.SignTime
|
||||||
|
update["signCount"] = sign.SignCount
|
||||||
|
this.module.modelSign.Change(session.GetUserId(), update)
|
||||||
|
bReward = true
|
||||||
|
} else {
|
||||||
|
if !utils.IsToday(sign.SignTime) {
|
||||||
|
sign.SignCount += 1
|
||||||
|
update["signCount"] = sign.SignCount
|
||||||
|
sign.SignTime = time.Now().Unix()
|
||||||
|
update["signTime"] = sign.SignTime
|
||||||
|
sign.RTime = sign.SignTime
|
||||||
|
update["rTime"] = sign.RTime
|
||||||
|
this.module.modelSign.Change(session.GetUserId(), update)
|
||||||
|
bReward = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_data := this.module.configure.GetSignConf(sign.Cid, sign.Group)
|
||||||
|
if _data != nil { // 发奖
|
||||||
|
if bReward {
|
||||||
|
this.module.DispenseRes(session, _data.Loopgift, true)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
globalCnf := this.module.configure.GetGlobalAtnConf("unified_reward") // 获取重置消耗
|
||||||
|
if globalCnf == nil {
|
||||||
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if bReward {
|
||||||
|
this.module.DispenseRes(session, globalCnf.Var, true) // 发放通用奖励
|
||||||
|
}
|
||||||
|
}
|
||||||
|
session.SendMsg(string(this.module.GetType()), "sign", &pb.UserSignResp{
|
||||||
|
Data: sign,
|
||||||
|
Reward: bReward,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/db"
|
||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
@ -26,8 +27,18 @@ func (this *ModelExpand) Init(service core.IService, module core.IModule, comp c
|
|||||||
//获取用户通过扩展表
|
//获取用户通过扩展表
|
||||||
func (this *ModelExpand) GetUserExpand(uid string) (result *pb.DBUserExpand, err error) {
|
func (this *ModelExpand) GetUserExpand(uid string) (result *pb.DBUserExpand, err error) {
|
||||||
result = &pb.DBUserExpand{}
|
result = &pb.DBUserExpand{}
|
||||||
if err = this.module.modelExpand.Get(uid, result); err != nil && mongo.ErrNoDocuments != err {
|
if this.module.IsCross() {
|
||||||
return
|
if model, err := this.module.GetDBNoduleByUid(uid, this.TableName, this.Expired); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
} else {
|
||||||
|
if err = model.Get(uid, &result); err != nil && mongo.ErrNoDocuments != err {
|
||||||
|
this.module.Errorf("err:%v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err = this.Get(uid, result); err != nil && mongo.ErrNoDocuments != err {
|
||||||
|
this.module.Errorf("err:%v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
err = nil
|
err = nil
|
||||||
return result, err
|
return result, err
|
||||||
@ -38,7 +49,19 @@ func (this *ModelExpand) ChangeUserExpand(uid string, value map[string]interface
|
|||||||
if len(value) == 0 {
|
if len(value) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return this.module.modelExpand.Change(uid, value)
|
var (
|
||||||
|
model *db.DBModel
|
||||||
|
)
|
||||||
|
if this.module.IsCross() {
|
||||||
|
if model, err = this.module.GetDBNoduleByUid(uid, this.TableName, this.Expired); err == nil {
|
||||||
|
return model.Change(uid, value)
|
||||||
|
} else {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.Change(uid, value)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ func (this *ModelSetting) InitSetting(uid string) {
|
|||||||
// 用户设置获取
|
// 用户设置获取
|
||||||
func (this *ModelSetting) GetSetting(uid string) *pb.DBUserSetting {
|
func (this *ModelSetting) GetSetting(uid string) *pb.DBUserSetting {
|
||||||
setting := &pb.DBUserSetting{}
|
setting := &pb.DBUserSetting{}
|
||||||
if err := this.module.modelSetting.Get(uid, setting); err != nil {
|
if err := this.Get(uid, setting); err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return setting
|
return setting
|
||||||
@ -59,7 +59,7 @@ func (this *ModelSetting) UpdateSetting(uid string, data map[string]interface{})
|
|||||||
if len(data) == 0 {
|
if len(data) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return this.module.modelSetting.Change(uid, data)
|
return this.Change(uid, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
//校验时间和初始次数
|
//校验时间和初始次数
|
||||||
@ -91,7 +91,7 @@ func (this *ModelSetting) checkInitCount(uid string) bool {
|
|||||||
func (this *ModelSetting) checkVeriCode(uid string) (int32, bool) {
|
func (this *ModelSetting) checkVeriCode(uid string) (int32, bool) {
|
||||||
key := fmt.Sprintf("code:%s", uid)
|
key := fmt.Sprintf("code:%s", uid)
|
||||||
var code int32
|
var code int32
|
||||||
err := this.module.modelSetting.Redis.Get(key, &code)
|
err := this.Redis.Get(key, &code)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == redis.RedisNil {
|
if err == redis.RedisNil {
|
||||||
return 0, false
|
return 0, false
|
||||||
@ -112,7 +112,7 @@ func (this *ModelSetting) refresh(uid string) (code int32) {
|
|||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
code = cast.ToInt32(utils.GenValidateCode(6))
|
code = cast.ToInt32(utils.GenValidateCode(6))
|
||||||
if err := this.module.modelSetting.Redis.Set(key, code, time.Second*60); err != nil {
|
if err := this.Redis.Set(key, code, time.Second*60); err != nil {
|
||||||
this.module.Errorf("%v", err)
|
this.module.Errorf("%v", err)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ func (this *ModelSetting) refresh(uid string) (code int32) {
|
|||||||
|
|
||||||
// 清空设置
|
// 清空设置
|
||||||
func (this *ModelSetting) cleanData(uid string) {
|
func (this *ModelSetting) cleanData(uid string) {
|
||||||
if err := this.module.modelSetting.DelByUId(uid); err != nil {
|
if err := this.DelByUId(uid); err != nil {
|
||||||
this.module.Errorf("cleanData err:%v", err)
|
this.module.Errorf("cleanData err:%v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,21 +35,14 @@ func (this *ModelSign) GetUserSign(uid string) (result *pb.DBSign, err error) {
|
|||||||
result = &pb.DBSign{
|
result = &pb.DBSign{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
SignTime: 0,
|
|
||||||
SignCount: 0,
|
|
||||||
Group: _data.Group,
|
Group: _data.Group,
|
||||||
Cid: 0,
|
|
||||||
RTime: 0,
|
|
||||||
}
|
}
|
||||||
this.Add(uid, result)
|
this.Add(uid, result)
|
||||||
} else {
|
} else {
|
||||||
err = errors.New("conf err")
|
err = errors.New("conf err")
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
err = nil
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
err = nil
|
err = nil
|
||||||
return result, err
|
return result, err
|
||||||
@ -79,61 +72,6 @@ func (this *ModelSign) updateSignData(uid string, sign *pb.DBSign) (err error) {
|
|||||||
|
|
||||||
// 检测是否达到重置日期
|
// 检测是否达到重置日期
|
||||||
func (this *ModelSign) checkResetSignData(session comm.IUserSession) (code pb.ErrorCode) {
|
func (this *ModelSign) checkResetSignData(session comm.IUserSession) (code pb.ErrorCode) {
|
||||||
var (
|
|
||||||
update map[string]interface{}
|
|
||||||
bReward bool
|
|
||||||
)
|
|
||||||
|
|
||||||
update = make(map[string]interface{}, 0)
|
|
||||||
if sign, err := this.module.modelSign.GetUserSign(session.GetUserId()); err == nil {
|
|
||||||
start, _ := utils.GetMonthStartEnd()
|
|
||||||
if sign.RTime < start { // 重置
|
|
||||||
sign.RTime = time.Now().Unix()
|
|
||||||
sign.SignTime = sign.RTime
|
|
||||||
sign.SignCount = 1
|
|
||||||
if newGroup := this.module.configure.GetSignResetConf(sign.Cid + 1); newGroup != -1 { // 获取当前的组id
|
|
||||||
sign.Cid += 1
|
|
||||||
sign.Group = newGroup
|
|
||||||
update["cid"] = sign.Cid
|
|
||||||
update["group"] = sign.Group
|
|
||||||
}
|
|
||||||
update["rTime"] = sign.RTime
|
|
||||||
update["signTime"] = sign.SignTime
|
|
||||||
update["signCount"] = sign.SignCount
|
|
||||||
this.Change(session.GetUserId(), update)
|
|
||||||
bReward = true
|
|
||||||
} else {
|
|
||||||
if !utils.IsToday(sign.SignTime) {
|
|
||||||
sign.SignCount += 1
|
|
||||||
update["signCount"] = sign.SignCount
|
|
||||||
sign.SignTime = time.Now().Unix()
|
|
||||||
update["signTime"] = sign.SignTime
|
|
||||||
sign.RTime = sign.SignTime
|
|
||||||
update["rTime"] = sign.RTime
|
|
||||||
this.Change(session.GetUserId(), update)
|
|
||||||
bReward = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_data := this.module.configure.GetSignConf(sign.Cid, sign.Group)
|
|
||||||
if _data != nil { // 发奖
|
|
||||||
if bReward {
|
|
||||||
this.module.DispenseRes(session, _data.Loopgift, true)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
globalCnf := this.module.configure.GetGlobalAtnConf("unified_reward") // 获取重置消耗
|
|
||||||
if globalCnf == nil {
|
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if bReward {
|
|
||||||
this.module.DispenseRes(session, globalCnf.Var, true) // 发放通用奖励
|
|
||||||
}
|
|
||||||
}
|
|
||||||
session.SendMsg(string(this.module.GetType()), "sign", &pb.UserSignResp{
|
|
||||||
Data: sign,
|
|
||||||
Reward: bReward,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -425,6 +425,7 @@ func (this *User) EventUserChanged(session comm.IUserSession) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *User) GetUserExpand(uid string) (result *pb.DBUserExpand, err error) {
|
func (this *User) GetUserExpand(uid string) (result *pb.DBUserExpand, err error) {
|
||||||
|
|
||||||
return this.modelExpand.GetUserExpand(uid)
|
return this.modelExpand.GetUserExpand(uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,6 +232,7 @@ const (
|
|||||||
ErrorCode_SociatyAcitvityReceive ErrorCode = 30030 //活跃度领取失败
|
ErrorCode_SociatyAcitvityReceive ErrorCode = 30030 //活跃度领取失败
|
||||||
ErrorCode_SociatyDismissed ErrorCode = 30031 //公会已解散
|
ErrorCode_SociatyDismissed ErrorCode = 30031 //公会已解散
|
||||||
ErrorCode_SociatyNameExist ErrorCode = 30032 //公会名存在
|
ErrorCode_SociatyNameExist ErrorCode = 30032 //公会名存在
|
||||||
|
ErrorCode_SociatyQuitNoAllowed ErrorCode = 30033 //会长不允许退公会
|
||||||
// arena
|
// arena
|
||||||
ErrorCode_ArenaTicketBuyUp ErrorCode = 3101 //票据上限
|
ErrorCode_ArenaTicketBuyUp ErrorCode = 3101 //票据上限
|
||||||
ErrorCode_ArenaTicketNotEnough ErrorCode = 3102 //票据不足
|
ErrorCode_ArenaTicketNotEnough ErrorCode = 3102 //票据不足
|
||||||
@ -453,6 +454,7 @@ var (
|
|||||||
30030: "SociatyAcitvityReceive",
|
30030: "SociatyAcitvityReceive",
|
||||||
30031: "SociatyDismissed",
|
30031: "SociatyDismissed",
|
||||||
30032: "SociatyNameExist",
|
30032: "SociatyNameExist",
|
||||||
|
30033: "SociatyQuitNoAllowed",
|
||||||
3101: "ArenaTicketBuyUp",
|
3101: "ArenaTicketBuyUp",
|
||||||
3102: "ArenaTicketNotEnough",
|
3102: "ArenaTicketNotEnough",
|
||||||
3103: "ArenaTicketNpcInCd",
|
3103: "ArenaTicketNpcInCd",
|
||||||
@ -664,6 +666,7 @@ var (
|
|||||||
"SociatyAcitvityReceive": 30030,
|
"SociatyAcitvityReceive": 30030,
|
||||||
"SociatyDismissed": 30031,
|
"SociatyDismissed": 30031,
|
||||||
"SociatyNameExist": 30032,
|
"SociatyNameExist": 30032,
|
||||||
|
"SociatyQuitNoAllowed": 30033,
|
||||||
"ArenaTicketBuyUp": 3101,
|
"ArenaTicketBuyUp": 3101,
|
||||||
"ArenaTicketNotEnough": 3102,
|
"ArenaTicketNotEnough": 3102,
|
||||||
"ArenaTicketNpcInCd": 3103,
|
"ArenaTicketNpcInCd": 3103,
|
||||||
@ -717,7 +720,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_errorcode_proto_rawDesc = []byte{
|
var file_errorcode_proto_rawDesc = []byte{
|
||||||
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x2a, 0x87, 0x25, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
0x6f, 0x2a, 0xa3, 0x25, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||||
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
||||||
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
|
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
|
||||||
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||||
@ -985,36 +988,38 @@ var file_errorcode_proto_rawDesc = []byte{
|
|||||||
0x10, 0xce, 0xea, 0x01, 0x12, 0x16, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x44,
|
0x10, 0xce, 0xea, 0x01, 0x12, 0x16, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x44,
|
||||||
0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x65, 0x64, 0x10, 0xcf, 0xea, 0x01, 0x12, 0x16, 0x0a, 0x10,
|
0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x65, 0x64, 0x10, 0xcf, 0xea, 0x01, 0x12, 0x16, 0x0a, 0x10,
|
||||||
0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74,
|
0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74,
|
||||||
0x10, 0xd0, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x10, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63,
|
0x10, 0xd0, 0xea, 0x01, 0x12, 0x1a, 0x0a, 0x14, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x51,
|
||||||
0x6b, 0x65, 0x74, 0x42, 0x75, 0x79, 0x55, 0x70, 0x10, 0x9d, 0x18, 0x12, 0x19, 0x0a, 0x14, 0x41,
|
0x75, 0x69, 0x74, 0x4e, 0x6f, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x10, 0xd1, 0xea, 0x01,
|
||||||
0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f,
|
0x12, 0x15, 0x0a, 0x10, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x42,
|
||||||
0x75, 0x67, 0x68, 0x10, 0x9e, 0x18, 0x12, 0x17, 0x0a, 0x12, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54,
|
0x75, 0x79, 0x55, 0x70, 0x10, 0x9d, 0x18, 0x12, 0x19, 0x0a, 0x14, 0x41, 0x72, 0x65, 0x6e, 0x61,
|
||||||
0x69, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x70, 0x63, 0x49, 0x6e, 0x43, 0x64, 0x10, 0x9f, 0x18, 0x12,
|
0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10,
|
||||||
0x16, 0x0a, 0x11, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x4c,
|
0x9e, 0x18, 0x12, 0x17, 0x0a, 0x12, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65,
|
||||||
0x65, 0x61, 0x72, 0x6e, 0x10, 0x81, 0x19, 0x12, 0x12, 0x0a, 0x0d, 0x54, 0x61, 0x6c, 0x65, 0x6e,
|
0x74, 0x4e, 0x70, 0x63, 0x49, 0x6e, 0x43, 0x64, 0x10, 0x9f, 0x18, 0x12, 0x16, 0x0a, 0x11, 0x54,
|
||||||
0x74, 0x45, 0x72, 0x72, 0x44, 0x61, 0x74, 0x61, 0x10, 0x82, 0x19, 0x12, 0x19, 0x0a, 0x14, 0x54,
|
0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x4c, 0x65, 0x61, 0x72, 0x6e,
|
||||||
0x61, 0x6c, 0x65, 0x6e, 0x74, 0x55, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x42, 0x65, 0x66,
|
0x10, 0x81, 0x19, 0x12, 0x12, 0x0a, 0x0d, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x45, 0x72, 0x72,
|
||||||
0x6f, 0x72, 0x65, 0x10, 0x83, 0x19, 0x12, 0x15, 0x0a, 0x10, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74,
|
0x44, 0x61, 0x74, 0x61, 0x10, 0x82, 0x19, 0x12, 0x19, 0x0a, 0x14, 0x54, 0x61, 0x6c, 0x65, 0x6e,
|
||||||
0x52, 0x65, 0x73, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x10, 0x84, 0x19, 0x12, 0x10, 0x0a,
|
0x74, 0x55, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x10,
|
||||||
0x0b, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x42, 0x75, 0x79, 0x4d, 0x61, 0x78, 0x10, 0xe5, 0x19, 0x12,
|
0x83, 0x19, 0x12, 0x15, 0x0a, 0x10, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x65,
|
||||||
0x11, 0x0a, 0x0c, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x53, 0x65, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x10,
|
0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x10, 0x84, 0x19, 0x12, 0x10, 0x0a, 0x0b, 0x54, 0x72, 0x6f,
|
||||||
0xe6, 0x19, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x53, 0x65,
|
0x6c, 0x6c, 0x42, 0x75, 0x79, 0x4d, 0x61, 0x78, 0x10, 0xe5, 0x19, 0x12, 0x11, 0x0a, 0x0c, 0x54,
|
||||||
0x6c, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xe7, 0x19, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x72,
|
0x72, 0x6f, 0x6c, 0x6c, 0x53, 0x65, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x10, 0xe6, 0x19, 0x12, 0x16,
|
||||||
0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10,
|
0x0a, 0x11, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x6c, 0x6c, 0x43, 0x6f,
|
||||||
0xe8, 0x19, 0x12, 0x18, 0x0a, 0x13, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61,
|
0x75, 0x6e, 0x74, 0x10, 0xe7, 0x19, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x4d,
|
||||||
0x74, 0x65, 0x64, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xe9, 0x19, 0x12, 0x19, 0x0a, 0x14,
|
0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xe8, 0x19, 0x12, 0x18,
|
||||||
0x48, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x4e, 0x6f, 0x74, 0x54, 0x75, 0x72, 0x6e,
|
0x0a, 0x13, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52,
|
||||||
0x65, 0x64, 0x4f, 0x6e, 0x10, 0xc9, 0x1a, 0x12, 0x19, 0x0a, 0x14, 0x48, 0x6f, 0x72, 0x6f, 0x73,
|
0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xe9, 0x19, 0x12, 0x19, 0x0a, 0x14, 0x48, 0x6f, 0x72, 0x6f,
|
||||||
0x63, 0x6f, 0x70, 0x65, 0x52, 0x65, 0x73, 0x74, 0x43, 0x44, 0x4e, 0x6f, 0x45, 0x6e, 0x64, 0x10,
|
0x73, 0x63, 0x6f, 0x70, 0x65, 0x4e, 0x6f, 0x74, 0x54, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x4f, 0x6e,
|
||||||
0xca, 0x1a, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x4e,
|
0x10, 0xc9, 0x1a, 0x12, 0x19, 0x0a, 0x14, 0x48, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65,
|
||||||
0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xad, 0x1b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x72,
|
0x52, 0x65, 0x73, 0x74, 0x43, 0x44, 0x4e, 0x6f, 0x45, 0x6e, 0x64, 0x10, 0xca, 0x1a, 0x12, 0x16,
|
||||||
0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x52, 0x65, 0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65,
|
0x0a, 0x11, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f,
|
||||||
0x10, 0xae, 0x1b, 0x12, 0x14, 0x0a, 0x0f, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52,
|
0x75, 0x6e, 0x64, 0x10, 0xad, 0x1b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c,
|
||||||
0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x91, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x47, 0x72, 0x6f,
|
0x65, 0x67, 0x65, 0x52, 0x65, 0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x10, 0xae, 0x1b, 0x12,
|
||||||
0x77, 0x74, 0x61, 0x73, 0x6b, 0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10,
|
0x14, 0x0a, 0x0f, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69,
|
||||||
0x92, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x61, 0x79, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x4e,
|
0x76, 0x65, 0x10, 0x91, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73,
|
||||||
0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xf5, 0x1c, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
0x6b, 0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x92, 0x1c, 0x12, 0x17,
|
||||||
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x0a, 0x12, 0x50, 0x61, 0x79, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x4e, 0x6f, 0x74, 0x45, 0x6e,
|
||||||
|
0x6f, 0x75, 0x67, 0x68, 0x10, 0xf5, 0x1c, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
|
||||||
|
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Loading…
Reference in New Issue
Block a user