Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
71bac26e10
@ -2,7 +2,6 @@ package hero
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"strconv"
|
||||
@ -77,7 +76,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c
|
||||
err1 = this.module.modelHero.modifyHeroData(session.GetUserId(), _hero.Id, _heroMap)
|
||||
if err1 != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
log.Errorf("update hero skill failed:%v", err1)
|
||||
this.module.Errorf("update hero skill failed:%v", err1)
|
||||
return
|
||||
}
|
||||
} else { // 加属性
|
||||
@ -91,7 +90,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c
|
||||
|
||||
err1 = this.module.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化
|
||||
if err1 != nil {
|
||||
log.Errorf("PushHeroProperty err!")
|
||||
this.module.Errorf("PushHeroProperty err!")
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.HeroAwakenResp{Hero: _hero})
|
||||
return
|
||||
|
@ -2,7 +2,6 @@ package hero
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
"strconv"
|
||||
|
||||
@ -105,7 +104,7 @@ func (this *apiComp) Resonance(session comm.IUserSession, req *pb.HeroResonanceR
|
||||
}
|
||||
err1 = this.module.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||
if err1 != nil {
|
||||
log.Errorf("update hero skill failed:%v", err1)
|
||||
this.module.Errorf("update hero skill failed:%v", err1)
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
@ -124,7 +123,7 @@ func (this *apiComp) Resonance(session comm.IUserSession, req *pb.HeroResonanceR
|
||||
}
|
||||
err1 = this.module.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化
|
||||
if err1 != nil {
|
||||
log.Errorf("PushHeroProperty err!")
|
||||
this.module.Errorf("PushHeroProperty err!")
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), Resonance, &pb.HeroResonanceResp{Hero: _hero})
|
||||
return
|
||||
|
@ -2,7 +2,6 @@ package hero
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
@ -76,13 +75,13 @@ func (this *apiComp) ResonanceReset(session comm.IUserSession, req *pb.HeroReson
|
||||
|
||||
err1 = this.module.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||
if err1 != nil {
|
||||
log.Errorf("update hero skill failed:%v", err1)
|
||||
this.module.Errorf("update hero skill failed:%v", err1)
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
err1 = this.module.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化
|
||||
if err1 != nil {
|
||||
log.Errorf("PushHeroProperty err!")
|
||||
this.module.Errorf("PushHeroProperty err!")
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), ResonanceReset, &pb.HeroResonanceResetResp{Hero: _hero, Energy: _hero.ResonateNum})
|
||||
return
|
||||
|
@ -2,7 +2,6 @@ package hero
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
"math"
|
||||
|
||||
@ -46,7 +45,7 @@ func (this *apiComp) ResonanceUseEnergy(session comm.IUserSession, req *pb.HeroR
|
||||
err1 := this.module.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||
if err1 != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
log.Errorf("update hero skill failed:%v", err1)
|
||||
this.module.Errorf("update hero skill failed:%v", err1)
|
||||
return
|
||||
}
|
||||
// 计算属性
|
||||
@ -69,7 +68,7 @@ func (this *apiComp) ResonanceUseEnergy(session comm.IUserSession, req *pb.HeroR
|
||||
|
||||
err1 = this.module.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化
|
||||
if err1 != nil {
|
||||
log.Errorf("PushHeroProperty err!")
|
||||
this.module.Errorf("PushHeroProperty err!")
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), ResonanceUseEnergy, &pb.HeroResonanceUseEnergyResp{Hero: _hero})
|
||||
return
|
||||
|
@ -3,7 +3,6 @@ package hero
|
||||
import (
|
||||
"crypto/rand"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
"math/big"
|
||||
|
||||
@ -120,7 +119,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
||||
}
|
||||
err1 = this.module.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
|
||||
if err1 != nil {
|
||||
log.Errorf("update hero skill failed:%v", err1)
|
||||
this.module.Errorf("update hero skill failed:%v", err1)
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
@ -132,7 +131,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
||||
}
|
||||
err1 = this.module.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化
|
||||
if err1 != nil {
|
||||
log.Errorf("PushHeroProperty err!")
|
||||
this.module.Errorf("PushHeroProperty err!")
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), StrengthenUpSkill, &pb.HeroStrengthenUpSkillResp{Hero: _hero})
|
||||
|
@ -2,7 +2,6 @@ package hero
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
@ -116,7 +115,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
|
||||
// 消耗道具
|
||||
code = this.module.ModuleUser.AddAttributeValue(session.GetUserId(), "gold", -target.Gold) // 减少金币
|
||||
if code != pb.ErrorCode_Success {
|
||||
log.Errorf("cost gold failed ,count = %d", target.Gold)
|
||||
this.module.Errorf("cost gold failed ,count = %d", target.Gold)
|
||||
code = pb.ErrorCode_GoldNoEnough
|
||||
return
|
||||
}
|
||||
@ -125,7 +124,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
|
||||
code = this.module.DelCard(session.GetUserId(), v.CostCardObj, v.Amount)
|
||||
if code != pb.ErrorCode_Success {
|
||||
code = pb.ErrorCode_DBError
|
||||
log.Errorf("del hero err card:%s,count = %d", v.CostCardObj, v.Amount)
|
||||
this.module.Errorf("del hero err card:%s,count = %d", v.CostCardObj, v.Amount)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package hero
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
@ -122,7 +121,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
||||
return
|
||||
}
|
||||
|
||||
log.Debugf("升级后当前等级: %d,经验: %d,需要消耗的金币: %d,增加的经验: %d", curLv, curExp, costRes["gold"], addExp)
|
||||
this.module.Debugf("升级后当前等级: %d,经验: %d,需要消耗的金币: %d,增加的经验: %d", curLv, curExp, costRes["gold"], addExp)
|
||||
// 执行升级逻辑
|
||||
code = this.module.AddCardExp(session.GetUserId(), req.HeroObjID, addExp) // 加经验
|
||||
if code != pb.ErrorCode_Success {
|
||||
@ -140,13 +139,13 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
||||
err1 := this.module.modelHero.consumeOneHeroCard(session.GetUserId(), req.ExpCardID, req.Amount)
|
||||
if err1 != nil {
|
||||
code = pb.ErrorCode_HeroNoEnough
|
||||
log.Errorf("delete err failed err:%T!", err1)
|
||||
this.module.Errorf("delete err failed err:%T!", err1)
|
||||
return
|
||||
}
|
||||
|
||||
err1 = this.module.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化
|
||||
if err1 != nil {
|
||||
log.Errorf("PushHeroProperty err!")
|
||||
this.module.Errorf("PushHeroProperty err!")
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.HeroStrengthenUplvResp{Hero: _hero})
|
||||
|
@ -87,7 +87,7 @@ func TestPropertyCompute(t *testing.T) {
|
||||
|
||||
func TestHeroList(t *testing.T) {
|
||||
heroes := module.modelHero.getHeroList("u1")
|
||||
fmt.Printf("%v", heroes,)
|
||||
fmt.Printf("%v", heroes)
|
||||
}
|
||||
|
||||
func TestModify(t *testing.T) {
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"math"
|
||||
@ -35,7 +34,7 @@ func (this *ModelHero) Init(service core.IService, module core.IModule, comp cor
|
||||
func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DBHero {
|
||||
heroCfg := this.moduleHero.configure.GetHero(heroCfgId)
|
||||
if heroCfg == nil {
|
||||
log.Errorf("%v hero not found from config %v", heroCfgId)
|
||||
this.moduleHero.Errorf("%v hero not found from config %v", heroCfgId)
|
||||
return nil
|
||||
}
|
||||
objId := primitive.NewObjectID().Hex()
|
||||
@ -90,7 +89,7 @@ func (this *ModelHero) createOneHero(uid string, heroCfgId int32) (err error) {
|
||||
hero := this.initHero(uid, heroCfgId)
|
||||
if hero != nil {
|
||||
if err = this.moduleHero.modelHero.AddList(uid, hero.Id, hero); err != nil {
|
||||
log.Errorf("%v", err)
|
||||
this.moduleHero.Errorf("%v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -151,7 +150,7 @@ func (this *ModelHero) getOneHero(uid, heroId string) *pb.DBHero {
|
||||
func (this *ModelHero) consumeOneHeroCard(uid, heroId string, count int32) (err error) {
|
||||
for i := 0; i < int(count); i++ {
|
||||
if err := this.moduleHero.modelHero.DelListlds(uid, heroId); err != nil {
|
||||
log.Errorf("%v", err)
|
||||
this.moduleHero.Errorf("%v", err)
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -200,7 +199,7 @@ func (this *ModelHero) mergeMainProperty(uid, heroId string, data map[string]int
|
||||
comm.Def: hero.Property[comm.Def],
|
||||
}
|
||||
if err := this.modifyHeroData(uid, heroId, update); err != nil {
|
||||
log.Errorf("mergeMainProperty err %v", err)
|
||||
this.moduleHero.Errorf("mergeMainProperty err %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,7 +218,7 @@ func (this *ModelHero) mergeAddProperty(uid, heroId string, data map[string]int3
|
||||
comm.DefPro: hero.AddProperty[comm.DefPro],
|
||||
}
|
||||
if err := this.modifyHeroData(uid, heroId, update); err != nil {
|
||||
log.Errorf("mergeAddProperty err %v", err)
|
||||
this.moduleHero.Errorf("mergeAddProperty err %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,7 +290,7 @@ func (this *ModelHero) PushHeroProperty(session comm.IUserSession, heroId string
|
||||
}
|
||||
|
||||
if err = this.ChangeList(session.GetUserId(), heroId, update); err != nil {
|
||||
log.Errorf("PushHeroProperty err:%v", err)
|
||||
this.moduleHero.Errorf("PushHeroProperty err:%v", err)
|
||||
return
|
||||
}
|
||||
return session.SendMsg("push", "property", &pb.HeroProperty{Property: m})
|
||||
@ -307,7 +306,7 @@ func (this *ModelHero) HeroStarUp(session comm.IUserSession, hero *pb.DBHero) (c
|
||||
err1 := this.modifyHeroData(session.GetUserId(), hero.Id, _heroMap)
|
||||
if err1 != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
log.Errorf("update hero skill failed:%v", err1)
|
||||
this.moduleHero.Errorf("update hero skill failed:%v", err1)
|
||||
}
|
||||
// 计算属性
|
||||
data := make(map[string]int32, 0)
|
||||
@ -327,7 +326,7 @@ func (this *ModelHero) HeroStarUp(session comm.IUserSession, hero *pb.DBHero) (c
|
||||
err1 = this.PushHeroProperty(session, hero.Id) // 推送属性变化
|
||||
if err1 != nil {
|
||||
code = pb.ErrorCode_Unknown
|
||||
log.Errorf("PushHeroProperty err!")
|
||||
this.moduleHero.Errorf("PushHeroProperty err!")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package mail
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
@ -36,7 +35,7 @@ func (this *apiComp) DelMail(session comm.IUserSession, req *pb.MailDelMailReq)
|
||||
}
|
||||
|
||||
if mailinfo, err = this.module.modelMail.Mail_QueryUserMail(session.GetUserId()); err != nil {
|
||||
log.Errorf("QueryUserMailResp err:%v", err)
|
||||
this.module.Errorf("QueryUserMailResp err:%v", err)
|
||||
code = pb.ErrorCode_CacheReadError
|
||||
return
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package mail
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
@ -25,7 +24,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.MailGetListReq)
|
||||
return
|
||||
}
|
||||
if mailinfo, err = this.module.modelMail.Mail_QueryUserMail(session.GetUserId()); err != nil {
|
||||
log.Errorf("Mail_GetList_Resp err:%v", err)
|
||||
this.module.Errorf("Mail_GetList_Resp err:%v", err)
|
||||
code = pb.ErrorCode_CacheReadError
|
||||
return
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
)
|
||||
|
||||
/*
|
||||
@ -53,7 +52,7 @@ func (this *Mail) CreateNewMail(uId string, mail *pb.DBMailData) bool {
|
||||
}
|
||||
err := this.modelMail.Mail_InsertUserMail(mail)
|
||||
if err != nil {
|
||||
log.Error("create mail failed")
|
||||
this.ModuleBase.Errorf("create mail failed")
|
||||
}
|
||||
// 通知玩家
|
||||
var _cache = &pb.CacheUser{}
|
||||
|
@ -2,7 +2,6 @@ package story
|
||||
|
||||
import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
@ -13,12 +12,12 @@ const ( //Redis
|
||||
|
||||
type ModelStory struct {
|
||||
modules.MCompModel
|
||||
moduleStory *Story
|
||||
module *Story
|
||||
}
|
||||
|
||||
func (this *ModelStory) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.moduleStory = module.(*Story)
|
||||
this.module = module.(*Story)
|
||||
this.TableName = string(TableStory)
|
||||
return
|
||||
}
|
||||
@ -32,14 +31,14 @@ func (this *ModelStory) getStoryList(uid string) (storys []*pb.DBStory, err erro
|
||||
|
||||
// 修改章节信息
|
||||
func (this *ModelStory) modifyStoryData(uid string, objid string, data map[string]interface{}) error {
|
||||
return this.moduleStory.modelStory.ChangeList(uid, objid, data)
|
||||
return this.module.modelStory.ChangeList(uid, objid, data)
|
||||
}
|
||||
|
||||
// 增加新的章节数据
|
||||
func (this *ModelStory) addNewChapter(uId string, data map[string]interface{}) (err error) {
|
||||
|
||||
if err = this.AddLists(uId, data); err != nil {
|
||||
log.Errorf("err:%v", err)
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user