Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
31184ce365
@ -2,6 +2,7 @@ CGO_ENABLED=0
|
|||||||
GO111MODULE=on
|
GO111MODULE=on
|
||||||
GOOS=linux
|
GOOS=linux
|
||||||
cd ../
|
cd ../
|
||||||
|
go build -o ./bin/cmd ./services/cmd/main.go
|
||||||
go build -o ./bin/mainte ./services/mainte/main.go
|
go build -o ./bin/mainte ./services/mainte/main.go
|
||||||
go build -o ./bin/gateway ./services/gateway/main.go
|
go build -o ./bin/gateway ./services/gateway/main.go
|
||||||
go build -o ./bin/worker ./services/worker/main.go
|
go build -o ./bin/worker ./services/worker/main.go
|
||||||
|
26
bin/gm.json
26
bin/gm.json
@ -1,47 +1,47 @@
|
|||||||
{
|
{
|
||||||
"AreaId": "dfli01",
|
"AreaId": "df03",
|
||||||
"ConsulAddr": [
|
"ConsulAddr": [
|
||||||
"10.0.0.9:10012"
|
"10.0.0.9:10012"
|
||||||
],
|
],
|
||||||
"IsCross": false,
|
"IsCross": false,
|
||||||
"BelongCrossServerId": "dflicross01",
|
"BelongCrossServerId": "dfcross_2",
|
||||||
"LoaclDB": {
|
"LoaclDB": {
|
||||||
"RedisIsCluster": false,
|
"RedisIsCluster": false,
|
||||||
"RedisAddr": "10.0.0.9:10011",
|
"RedisAddr": ["10.0.0.9:10011"],
|
||||||
"RedisPassword": "li13451234",
|
"RedisPassword": "li13451234",
|
||||||
"RedisDB": 5,
|
"RedisDB": 3,
|
||||||
"MongodbUrl": "mongodb://10.0.0.9:10013",
|
"MongodbUrl": "mongodb://10.0.0.9:10013",
|
||||||
"MongodbDatabase": "dreamfactory5"
|
"MongodbDatabase": "dreamfactory3"
|
||||||
},
|
},
|
||||||
"CrossDB": {
|
"CrossDB": {
|
||||||
"RedisIsCluster": false,
|
"RedisIsCluster": false,
|
||||||
"RedisAddr": "10.0.0.9:10011",
|
"RedisAddr": ["10.0.0.9:10011"],
|
||||||
"RedisPassword": "li13451234",
|
"RedisPassword": "li13451234",
|
||||||
"RedisDB": 6,
|
"RedisDB": 12,
|
||||||
"MongodbUrl": "mongodb://10.0.0.9:10013",
|
"MongodbUrl": "mongodb://10.0.0.9:10013",
|
||||||
"MongodbDatabase": "dreamfactory6"
|
"MongodbDatabase": "dreamfactory12"
|
||||||
},
|
},
|
||||||
"Services": [
|
"Services": [
|
||||||
{
|
{
|
||||||
"ServiceType": "gateway",
|
"ServiceType": "gateway",
|
||||||
"Host": "127.0.0.1",
|
"Host": "127.0.0.1",
|
||||||
"Port": 9567,
|
"Port": 9571,
|
||||||
"Loglevel": 5,
|
"Loglevel": 5,
|
||||||
"MaxAgeTime": 7,
|
"MaxAgeTime": 7,
|
||||||
"ListenPort": 7891
|
"ListenPort": 7895
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ServiceType": "mainte",
|
"ServiceType": "mainte",
|
||||||
"Host": "127.0.0.1",
|
"Host": "127.0.0.1",
|
||||||
"Port": 9568,
|
"Port": 9572,
|
||||||
"Loglevel": 5,
|
"Loglevel": 5,
|
||||||
"MaxAgeTime": 7,
|
"MaxAgeTime": 7,
|
||||||
"ListenPort": 8000
|
"ListenPort": 7896
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ServiceType": "worker",
|
"ServiceType": "worker",
|
||||||
"Host": "127.0.0.1",
|
"Host": "127.0.0.1",
|
||||||
"Port": 9569,
|
"Port": 9573,
|
||||||
"Loglevel": 5,
|
"Loglevel": 5,
|
||||||
"MaxAgeTime": 7
|
"MaxAgeTime": 7
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,11 @@
|
|||||||
|
|
||||||
start(){
|
start(){
|
||||||
echo "starting $SERVICE..."
|
echo "starting $SERVICE..."
|
||||||
|
num=`ps -ef | grep conf | grep $SERVICE | grep -v grep | grep -v /bin/bash | wc -l`
|
||||||
num=`ps -ef | grep $SERVICE | grep -v grep | wc -l`
|
|
||||||
if [ $num -eq 0 ]
|
if [ $num -eq 0 ]
|
||||||
then
|
then
|
||||||
nohup $CMD > /dev/null 2>&1 &
|
# nohup $CMD > /dev/null 2>&1 &
|
||||||
#nohup $CMD > $SERVICE.log 2>&1 &
|
nohup $CMD > $SERVICE.log 2>&1 &
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "start failed, please check the log!"
|
echo "start failed, please check the log!"
|
||||||
|
@ -97,7 +97,7 @@ type (
|
|||||||
}
|
}
|
||||||
IMainline interface {
|
IMainline interface {
|
||||||
// 修改章节信息
|
// 修改章节信息
|
||||||
ModifyMainlineData(uid string, objId string, data interface{}) (code pb.ErrorCode)
|
ModifyMainlineData(uid string, id int32) (code pb.ErrorCode)
|
||||||
/// 查询章节ID
|
/// 查询章节ID
|
||||||
GetUsermainLineData(uid string) (mainlineId int32)
|
GetUsermainLineData(uid string) (mainlineId int32)
|
||||||
}
|
}
|
||||||
@ -160,4 +160,8 @@ type (
|
|||||||
IGm interface {
|
IGm interface {
|
||||||
CreateCmd(session IUserSession, cmd string) (code pb.ErrorCode)
|
CreateCmd(session IUserSession, cmd string) (code pb.ErrorCode)
|
||||||
}
|
}
|
||||||
|
// 修改爬塔
|
||||||
|
IPagoda interface {
|
||||||
|
ModifyPagodaFloor(session IUserSession, level int32) (code pb.ErrorCode)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,11 @@ import (
|
|||||||
/* GM 在控制台输入的字符串类型
|
/* GM 在控制台输入的字符串类型
|
||||||
//bingo:item,10001,1
|
//bingo:item,10001,1
|
||||||
//bingo:attr,gold,1000000
|
//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) {
|
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 len(keys) == 2 {
|
||||||
if keys[0] == "bingo" {
|
if keys[0] == "bingo" {
|
||||||
datas := strings.Split(keys[1], ",")
|
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])
|
num, err := strconv.Atoi(datas[2])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
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})
|
session.SendMsg(string(this.module.GetType()), "cmd", &pb.GMCmdResp{IsSucc: true})
|
||||||
return
|
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
|||||||
|
|
||||||
_data := this.module.configure.GetHeroLv(curLv)
|
_data := this.module.configure.GetHeroLv(curLv)
|
||||||
if _data != nil {
|
if _data != nil {
|
||||||
if maxLv == _hero.Lv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级
|
if maxLv == curLv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级
|
||||||
code = pb.ErrorCode_HeroMaxLv
|
code = pb.ErrorCode_HeroMaxLv
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
|||||||
if len(_data.Heroexp) == 0 {
|
if len(_data.Heroexp) == 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if maxLv <= _hero.Lv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级
|
if maxLv <= curLv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级
|
||||||
// 超过的经验值
|
// 超过的经验值
|
||||||
leftExp := curExp - _data.Heroexp[0].N
|
leftExp := curExp - _data.Heroexp[0].N
|
||||||
this.module.Debugf("经验溢出%d", leftExp)
|
this.module.Debugf("经验溢出%d", leftExp)
|
||||||
|
@ -490,7 +490,7 @@ func (this *ModelHero) AddCardExp(uid string, hero *pb.DBHero, exp int32) (newhe
|
|||||||
maxLv = hero.Star * comm.HeroStarLvRatio
|
maxLv = hero.Star * comm.HeroStarLvRatio
|
||||||
_data := this.moduleHero.configure.GetHeroLv(curLv)
|
_data := this.moduleHero.configure.GetHeroLv(curLv)
|
||||||
if _data != nil {
|
if _data != nil {
|
||||||
if maxLv <= hero.Lv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级
|
if maxLv <= curLv && curExp >= _data.Heroexp[0].N { // 加经验之前校验是否达到最大等级
|
||||||
code = pb.ErrorCode_HeroMaxLv
|
code = pb.ErrorCode_HeroMaxLv
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -499,7 +499,7 @@ func (this *ModelHero) AddCardExp(uid string, hero *pb.DBHero, exp int32) (newhe
|
|||||||
if len(_data.Heroexp) == 0 {
|
if len(_data.Heroexp) == 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if maxLv <= hero.Lv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级
|
if maxLv <= curLv && curExp >= _data.Heroexp[0].N { // 设置最大经验和等级
|
||||||
curLv = maxLv
|
curLv = maxLv
|
||||||
curExp = _data.Heroexp[0].N
|
curExp = _data.Heroexp[0].N
|
||||||
break
|
break
|
||||||
|
@ -6,6 +6,8 @@ import (
|
|||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Mainline struct {
|
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) {
|
func (this *Mainline) ModifyMainlineData(uid string, id int32) (code pb.ErrorCode) {
|
||||||
err := this.modelMainline.modifyMainlineData(uid, objId, data)
|
|
||||||
|
conf := this.configure.GetMainlineConfigData(id, 1)
|
||||||
|
list, err := this.modelMainline.getMainlineList(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,3 +68,17 @@ func (this *Pagoda) Start() (err error) {
|
|||||||
this.battle = module.(comm.IBattle)
|
this.battle = module.(comm.IBattle)
|
||||||
return
|
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
|
||||||
|
}
|
||||||
|
@ -139,8 +139,8 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
|||||||
mail := &pb.DBMailData{
|
mail := &pb.DBMailData{
|
||||||
ObjId: primitive.NewObjectID().Hex(),
|
ObjId: primitive.NewObjectID().Hex(),
|
||||||
Uid: user.Uid,
|
Uid: user.Uid,
|
||||||
Title: "系统邮件",
|
Title: "system mail",
|
||||||
Contex: "恭喜获得登录专属礼包一份",
|
Contex: "Congratulations on getting a login exclusive gift pack",
|
||||||
CreateTime: uint64(time.Now().Unix()),
|
CreateTime: uint64(time.Now().Unix()),
|
||||||
DueTime: uint64(time.Now().Unix()) + 30*24*3600, // 30天需要走配置文件
|
DueTime: uint64(time.Now().Unix()) + 30*24*3600, // 30天需要走配置文件
|
||||||
Check: false,
|
Check: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user