diff --git a/bin/build_linux.sh b/bin/build_linux.sh index 19e825379..0ece25ba6 100755 --- a/bin/build_linux.sh +++ b/bin/build_linux.sh @@ -2,6 +2,7 @@ CGO_ENABLED=0 GO111MODULE=on GOOS=linux cd ../ +go build -o ./bin/cmd ./services/cmd/main.go go build -o ./bin/mainte ./services/mainte/main.go go build -o ./bin/gateway ./services/gateway/main.go go build -o ./bin/worker ./services/worker/main.go diff --git a/bin/gm.json b/bin/gm.json index 5c8ef9ed1..d768ccf95 100644 --- a/bin/gm.json +++ b/bin/gm.json @@ -1,47 +1,47 @@ { - "AreaId": "dfli01", + "AreaId": "df03", "ConsulAddr": [ "10.0.0.9:10012" ], "IsCross": false, - "BelongCrossServerId": "dflicross01", + "BelongCrossServerId": "dfcross_2", "LoaclDB": { "RedisIsCluster": false, - "RedisAddr": "10.0.0.9:10011", + "RedisAddr": ["10.0.0.9:10011"], "RedisPassword": "li13451234", - "RedisDB": 5, + "RedisDB": 3, "MongodbUrl": "mongodb://10.0.0.9:10013", - "MongodbDatabase": "dreamfactory5" + "MongodbDatabase": "dreamfactory3" }, "CrossDB": { "RedisIsCluster": false, - "RedisAddr": "10.0.0.9:10011", + "RedisAddr": ["10.0.0.9:10011"], "RedisPassword": "li13451234", - "RedisDB": 6, + "RedisDB": 12, "MongodbUrl": "mongodb://10.0.0.9:10013", - "MongodbDatabase": "dreamfactory6" + "MongodbDatabase": "dreamfactory12" }, "Services": [ { "ServiceType": "gateway", "Host": "127.0.0.1", - "Port": 9567, + "Port": 9571, "Loglevel": 5, "MaxAgeTime": 7, - "ListenPort": 7891 + "ListenPort": 7895 }, { "ServiceType": "mainte", "Host": "127.0.0.1", - "Port": 9568, + "Port": 9572, "Loglevel": 5, "MaxAgeTime": 7, - "ListenPort": 8000 + "ListenPort": 7896 }, { "ServiceType": "worker", "Host": "127.0.0.1", - "Port": 9569, + "Port": 9573, "Loglevel": 5, "MaxAgeTime": 7 } diff --git a/bin/stup.sh b/bin/stup.sh index b24bc4c4e..ceed5aff4 100755 --- a/bin/stup.sh +++ b/bin/stup.sh @@ -4,12 +4,11 @@ start(){ echo "starting $SERVICE..." - - num=`ps -ef | grep $SERVICE | grep -v grep | wc -l` + num=`ps -ef | grep conf | grep $SERVICE | grep -v grep | grep -v /bin/bash | wc -l` if [ $num -eq 0 ] then - nohup $CMD > /dev/null 2>&1 & - #nohup $CMD > $SERVICE.log 2>&1 & + # nohup $CMD > /dev/null 2>&1 & + nohup $CMD > $SERVICE.log 2>&1 & if [ $? -ne 0 ] then echo "start failed, please check the log!" diff --git a/comm/imodule.go b/comm/imodule.go index 5d588d99f..c504444e8 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -97,7 +97,7 @@ type ( } IMainline interface { // 修改章节信息 - ModifyMainlineData(uid string, objId string, data interface{}) (code pb.ErrorCode) + ModifyMainlineData(uid string, id int32) (code pb.ErrorCode) /// 查询章节ID GetUsermainLineData(uid string) (mainlineId int32) } @@ -160,4 +160,8 @@ type ( IGm interface { CreateCmd(session IUserSession, cmd string) (code pb.ErrorCode) } + // 修改爬塔 + IPagoda interface { + ModifyPagodaFloor(session IUserSession, level int32) (code pb.ErrorCode) + } ) diff --git a/modules/gm/api_cmd.go b/modules/gm/api_cmd.go index a46c761ee..b81f0befe 100644 --- a/modules/gm/api_cmd.go +++ b/modules/gm/api_cmd.go @@ -13,6 +13,11 @@ import ( /* GM 在控制台输入的字符串类型 //bingo:item,10001,1 //bingo:attr,gold,1000000 +2、修改主线关卡进度:bingo:mapid,102(102代表关卡位置) + +3、修改心魔塔进度:bingo:pataid,10(10代表层数) + +4、修改玩家经验值:bingo:exp,1000(1000代表新增的经验值 // */ //参数校验 func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (code pb.ErrorCode) { @@ -31,7 +36,8 @@ func (this *apiComp) Cmd(session comm.IUserSession, req *pb.GMCmdReq) (code pb.E if len(keys) == 2 { if keys[0] == "bingo" { datas := strings.Split(keys[1], ",") - if len(datas) == 3 { + if len(datas) == 3 && (datas[0] == comm.AttrType || datas[0] == comm.ItemType || + datas[0] == comm.HeroType || datas[0] == comm.EquipmentType) { num, err := strconv.Atoi(datas[2]) if err != nil { code = pb.ErrorCode_ReqParameterError @@ -48,6 +54,28 @@ func (this *apiComp) Cmd(session comm.IUserSession, req *pb.GMCmdReq) (code pb.E session.SendMsg(string(this.module.GetType()), "cmd", &pb.GMCmdResp{IsSucc: true}) return } + } else if len(datas) == 2 && (datas[0] == "mapid") { + module1, err := this.service.GetModule(comm.ModuleMainline) + if err != nil { + return + } + num, err := strconv.Atoi(datas[1]) + if err != nil { + code = pb.ErrorCode_ReqParameterError + return + } + code = module1.(comm.IMainline).ModifyMainlineData(session.GetUserId(), int32(num)) + } else if len(datas) == 2 && (datas[0] == "pataid") { + module1, err := this.service.GetModule(comm.ModulePagoda) + if err != nil { + return + } + num, err := strconv.Atoi(datas[1]) + if err != nil { + code = pb.ErrorCode_ReqParameterError + return + } + code = module1.(comm.IPagoda).ModifyPagodaFloor(session, int32(num)) } } } diff --git a/modules/hero/api_strengthenUplv.go b/modules/hero/api_strengthenUplv.go index b77fd61e2..e01c8e81e 100644 --- a/modules/hero/api_strengthenUplv.go +++ b/modules/hero/api_strengthenUplv.go @@ -114,7 +114,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren _data := this.module.configure.GetHeroLv(curLv) if _data != nil { - if maxLv == _hero.Lv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级 + if maxLv == curLv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级 code = pb.ErrorCode_HeroMaxLv return } @@ -123,7 +123,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren if len(_data.Heroexp) == 0 { break } - if maxLv <= _hero.Lv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级 + if maxLv <= curLv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级 // 超过的经验值 leftExp := curExp - _data.Heroexp[0].N this.module.Debugf("经验溢出%d", leftExp) diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index dd915b201..43fd6c4cf 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -490,7 +490,7 @@ func (this *ModelHero) AddCardExp(uid string, hero *pb.DBHero, exp int32) (newhe maxLv = hero.Star * comm.HeroStarLvRatio _data := this.moduleHero.configure.GetHeroLv(curLv) if _data != nil { - if maxLv <= hero.Lv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级 + if maxLv <= curLv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级 code = pb.ErrorCode_HeroMaxLv return } @@ -499,7 +499,7 @@ func (this *ModelHero) AddCardExp(uid string, hero *pb.DBHero, exp int32) (newhe if len(_data.Heroexp) == 0 { break } - if maxLv <= hero.Lv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级 + if maxLv <= curLv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级 curLv = maxLv curExp = _data.Heroexp[0].N break diff --git a/modules/mainline/module.go b/modules/mainline/module.go index fed06c09f..13bb24e42 100644 --- a/modules/mainline/module.go +++ b/modules/mainline/module.go @@ -6,6 +6,8 @@ import ( "go_dreamfactory/modules" "go_dreamfactory/pb" "sort" + + "go.mongodb.org/mongo-driver/bson/primitive" ) type Mainline struct { @@ -39,11 +41,38 @@ func (this *Mainline) OnInstallComp() { } // 接口信息 给其他模块调用 用来修改主线关卡信息 -func (this *Mainline) ModifyMainlineData(uid string, objId string, data map[string]interface{}) (code pb.ErrorCode) { - err := this.modelMainline.modifyMainlineData(uid, objId, data) +func (this *Mainline) ModifyMainlineData(uid string, id int32) (code pb.ErrorCode) { + + conf := this.configure.GetMainlineConfigData(id, 1) + list, err := this.modelMainline.getMainlineList(uid) if err != nil { code = pb.ErrorCode_DBError + return } + for _, v := range list { + if v.ChapterId == conf.Chapter { + data := make(map[string]interface{}, 0) + data["mainlineId"] = id + data["chapterId"] = v.ChapterId + this.modelMainline.modifyMainlineData(uid, v.Id, data) + if err != nil { + code = pb.ErrorCode_DBError + } + + return + } + } + //add + _data := &pb.DBMainline{} + _data.Id = primitive.NewObjectID().Hex() + _data.ChapterId = conf.Chapter + _data.MainlineId = conf.Id + _mData := make(map[string]interface{}, 0) + _data.Uid = uid + _data.Intensity = 1 // 难度1 + _mData[_data.Id] = _data + + this.modelMainline.addNewChapter(uid, _mData) return } diff --git a/modules/pagoda/module.go b/modules/pagoda/module.go index e7f83e4db..e653cd524 100644 --- a/modules/pagoda/module.go +++ b/modules/pagoda/module.go @@ -68,3 +68,17 @@ func (this *Pagoda) Start() (err error) { this.battle = module.(comm.IBattle) return } + +// 给gm 调用修改爬塔层数 +func (this *Pagoda) ModifyPagodaFloor(session comm.IUserSession, level int32) (code pb.ErrorCode) { + list, _ := this.modelPagoda.getPagodaList(session.GetUserId()) + if list != nil { + + list.PagodaId = level + mapData := make(map[string]interface{}, 0) + mapData["pagodaId"] = level + code = this.ModifyPagodaData(session.GetUserId(), mapData) + session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list}) + } + return +} diff --git a/modules/user/api_login.go b/modules/user/api_login.go index 8df29b6d9..bb95d0b7b 100644 --- a/modules/user/api_login.go +++ b/modules/user/api_login.go @@ -139,8 +139,8 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod mail := &pb.DBMailData{ ObjId: primitive.NewObjectID().Hex(), Uid: user.Uid, - Title: "系统邮件", - Contex: "恭喜获得登录专属礼包一份", + Title: "system mail", + Contex: "Congratulations on getting a login exclusive gift pack", CreateTime: uint64(time.Now().Unix()), DueTime: uint64(time.Now().Unix()) + 30*24*3600, // 30天需要走配置文件 Check: false,