diff --git a/bin/gateway b/bin/gateway new file mode 100755 index 000000000..d77c38ba8 Binary files /dev/null and b/bin/gateway differ diff --git a/bin/mainte b/bin/mainte new file mode 100755 index 000000000..776150e5c Binary files /dev/null and b/bin/mainte differ diff --git a/bin/start.sh b/bin/start.sh old mode 100644 new mode 100755 diff --git a/bin/stop.sh b/bin/stop.sh old mode 100644 new mode 100755 index bc190b35a..d9cd2d95f --- a/bin/stop.sh +++ b/bin/stop.sh @@ -2,4 +2,4 @@ ./stup.sh stop mainte -./stup.sh stop worker_1 \ No newline at end of file +./stup.sh stop worker_1 diff --git a/bin/stup.sh b/bin/stup.sh index 7d9278ebd..26c221631 100755 --- a/bin/stup.sh +++ b/bin/stup.sh @@ -1,10 +1,14 @@ #!/bin/sh SERVICE=$2 - CMD="./$2 -conf $3" + CMD="./$3 -conf $4" start(){ - echo "starting..." - nohup $CMD > /dev/null 2>&1 & + echo "starting $SERVICE..." + + num=`ps -ef | grep $SERVICE | grep -v grep | wc -l` + if [ $num -eq 0 ] + then + nohup $CMD > /dev/null 2>&1 & # nohup $CMD >output.log 2>&1 & if [ $? -ne 0 ] then @@ -14,6 +18,11 @@ echo $! > $SERVICE.pid echo "start success" fi + else + echo "$SERVICE is already running" + fi + + } stop(){ echo "stopping..." diff --git a/bin/vsdebug_gateway b/bin/vsdebug_gateway new file mode 100755 index 000000000..86e64d87c Binary files /dev/null and b/bin/vsdebug_gateway differ diff --git a/bin/vsdebug_mainte b/bin/vsdebug_mainte new file mode 100755 index 000000000..6f1644886 Binary files /dev/null and b/bin/vsdebug_mainte differ diff --git a/bin/vsdebug_worker b/bin/vsdebug_worker new file mode 100755 index 000000000..8a9d40384 Binary files /dev/null and b/bin/vsdebug_worker differ diff --git a/bin/worker b/bin/worker new file mode 100755 index 000000000..52667cfd3 Binary files /dev/null and b/bin/worker differ diff --git a/lego/sys/codec/utils/float.go b/lego/sys/codec/utils/float.go index 58c1a2b8d..012184cdd 100644 --- a/lego/sys/codec/utils/float.go +++ b/lego/sys/codec/utils/float.go @@ -52,6 +52,7 @@ func ReadBigFloatForString(buf []byte) (ret *big.Float, n int, err error) { func ReadFloat32ForString(buf []byte) (ret float32, n int, err error) { if buf[0] == '-' { ret, n, err = readPositiveFloat32(buf[1:]) + n++ ret = -ret return } @@ -60,6 +61,7 @@ func ReadFloat32ForString(buf []byte) (ret float32, n int, err error) { func ReadFloat64ForString(buf []byte) (ret float64, n int, err error) { if buf[0] == '-' { ret, n, err = readPositiveFloat64(buf[1:]) + n++ ret = -ret return } diff --git a/lego/sys/codec/utils/int.go b/lego/sys/codec/utils/int.go index 8eb08960b..01a27bc44 100644 --- a/lego/sys/codec/utils/int.go +++ b/lego/sys/codec/utils/int.go @@ -41,6 +41,7 @@ func ReadInt8ForString(buf []byte) (ret int8, n int, err error) { c := buf[0] if c == '-' { val, n, err = ReadUint32ForString(buf[1:]) + n++ if val > math.MaxInt8+1 { err = errors.New("ReadInt8ForString overflow: " + strconv.FormatInt(int64(val), 10)) return @@ -64,6 +65,7 @@ func ReadInt16ForString(buf []byte) (ret int16, n int, err error) { c := buf[0] if c == '-' { val, n, err = ReadUint32ForString(buf[1:]) + n++ if val > math.MaxInt16+1 { err = errors.New("ReadInt16ForString overflow: " + strconv.FormatInt(int64(val), 10)) return @@ -87,6 +89,7 @@ func ReadInt32ForString(buf []byte) (ret int32, n int, err error) { c := buf[0] if c == '-' { val, n, err = ReadUint32ForString(buf[1:]) + n++ if val > math.MaxInt32+1 { err = errors.New("ReadInt32ForString overflow: " + strconv.FormatInt(int64(val), 10)) return @@ -110,6 +113,7 @@ func ReadInt64ForString(buf []byte) (ret int64, n int, err error) { c := buf[0] if c == '-' { val, n, err = ReadUint64ForString(buf[1:]) + n++ if val > math.MaxInt64+1 { err = errors.New("ReadInt64ForString overflow: " + strconv.FormatInt(int64(val), 10)) return @@ -154,6 +158,7 @@ func ReadUint16ForString(buf []byte) (ret uint16, n int, err error) { func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) { ind := intDigits[buf[0]] + n = 1 if ind == 0 { err = assertInteger(buf[1:]) return @@ -163,7 +168,6 @@ func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) { return } ret = uint32(ind) - n = 1 if len(buf) > 10 { i := 1 ind2 := intDigits[buf[i]] @@ -252,6 +256,7 @@ func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) { func ReadUint64ForString(buf []byte) (ret uint64, n int, err error) { ind := intDigits[buf[0]] + n = 1 if ind == 0 { err = assertInteger(buf[1:]) return @@ -261,7 +266,6 @@ func ReadUint64ForString(buf []byte) (ret uint64, n int, err error) { return } ret = uint64(ind) - n = 1 if len(buf) > 10 { i := 0 ind2 := intDigits[buf[i]] diff --git a/modules/equipment/api_equip.go b/modules/equipment/api_equip.go index d77745832..206e69eff 100644 --- a/modules/equipment/api_equip.go +++ b/modules/equipment/api_equip.go @@ -96,6 +96,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq) } else { subsit = false //辅套装没有 } + hero.EquipID[i] = "" } } @@ -119,6 +120,6 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq) return } } - session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: equipments}) + session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: updatequipment}) return } diff --git a/modules/friend/api_apply.go b/modules/friend/api_apply.go index 87e28a8d2..d611ea676 100644 --- a/modules/friend/api_apply.go +++ b/modules/friend/api_apply.go @@ -18,7 +18,7 @@ func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.FriendApplyRe //好友申请 func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (code pb.ErrorCode, data proto.Message) { - if code = this.ApplyCheck(session, req); code != pb.ErrorCode_Success { + if code = this.ApplyCheck(session, req); code != pb.ErrorCode_Success { return } @@ -30,7 +30,8 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c ) defer func() { - utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), FriendSubTypeApply, req, Resp) + + // utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), FriendSubTypeApply, req, Resp) }() defer func() { diff --git a/modules/hero/api_chouka.go b/modules/hero/api_chouka.go index a310f149b..b96cd75a7 100644 --- a/modules/hero/api_chouka.go +++ b/modules/hero/api_chouka.go @@ -3,7 +3,6 @@ package hero import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -23,7 +22,6 @@ func (this *apiComp) Chouka(session comm.IUserSession, req *pb.HeroChoukaReq) (c code = pb.ErrorCode_SystemError return } - utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), HeroSubTypeChouka, req, rsp) }() heroCfgIds := req.HeroIds diff --git a/modules/hero/api_info.go b/modules/hero/api_info.go index 05b1af607..2d998e893 100644 --- a/modules/hero/api_info.go +++ b/modules/hero/api_info.go @@ -4,7 +4,6 @@ import ( "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -29,7 +28,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.HeroInfoReq) (code code = pb.ErrorCode_SystemError return } - utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), HeroSubTypeInfo, req, rsp) + // utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), HeroSubTypeInfo, req, rsp) }() hero := this.module.modelHero.getOneHero(session.GetUserId(), req.HeroId) diff --git a/modules/hero/api_list.go b/modules/hero/api_list.go index 57b1f5cf8..6f6c99bcd 100644 --- a/modules/hero/api_list.go +++ b/modules/hero/api_list.go @@ -3,7 +3,6 @@ package hero import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -21,7 +20,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.HeroListReq) (code if err != nil { code = pb.ErrorCode_SystemError } - utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), HeroSubTypeList, req, rsp) + // utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), HeroSubTypeList, req, rsp) }() rsp.List = this.module.GetHeroList(session.GetUserId()) diff --git a/modules/shop/model_shop.go b/modules/shop/model_shop.go index 1194f53a8..97eb4b8af 100644 --- a/modules/shop/model_shop.go +++ b/modules/shop/model_shop.go @@ -30,6 +30,8 @@ func (this *modelShopComp) Init(service core.IService, module core.IModule, comp //查询用户装备数据 func (this *modelShopComp) QueryUserShopData(uId string) (data *pb.DBShop, err error) { data = &pb.DBShop{} - err = this.Get(uId, data) + if err = this.Get(uId, data); err != nil { + this.module.Errorf("err:%v", err) + } return } diff --git a/modules/task/api_activelist.go b/modules/task/api_activelist.go index 417253257..322ef4fb2 100644 --- a/modules/task/api_activelist.go +++ b/modules/task/api_activelist.go @@ -3,7 +3,6 @@ package task import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -28,7 +27,7 @@ func (this *apiComp) ActiveList(session comm.IUserSession, req *pb.TaskActiveLis if err != nil { code = pb.ErrorCode_SystemError } - utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveList, req, resp) + // utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveList, req, resp) }() resp.Active = this.moduleTask.modelTask.countActive(session.GetUserId(), comm.TaskTag(req.TaskTag)) diff --git a/modules/task/api_activereceive.go b/modules/task/api_activereceive.go index c3c1c73d9..2efad197e 100644 --- a/modules/task/api_activereceive.go +++ b/modules/task/api_activereceive.go @@ -3,7 +3,6 @@ package task import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -29,7 +28,7 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive if err != nil { code = pb.ErrorCode_SystemError } - utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, req, resp) + // utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, req, resp) }() ua := this.moduleTask.modelTaskActive.getUserActive(session.GetUserId(), req.Id, comm.TaskTag(req.TaskTag)) diff --git a/modules/task/api_list.go b/modules/task/api_list.go index db81c1859..4d272f908 100644 --- a/modules/task/api_list.go +++ b/modules/task/api_list.go @@ -3,7 +3,6 @@ package task import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -26,7 +25,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.TaskListReq) (code if err != nil { code = pb.ErrorCode_SystemError } - utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeList, req, rsp) + // utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeList, req, rsp) }() rsp.List = this.moduleTask.modelTask.getTaskList(session.GetUserId(), comm.TaskTag(req.TaskTag)) diff --git a/modules/task/api_receive.go b/modules/task/api_receive.go index b39c6b01e..9a5047e13 100644 --- a/modules/task/api_receive.go +++ b/modules/task/api_receive.go @@ -4,7 +4,6 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -28,7 +27,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq) if err != nil { code = pb.ErrorCode_SystemError } - utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeReceive, req, resp) + // utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeReceive, req, resp) }() userTask := this.moduleTask.modelTask.getUserTask(session.GetUserId(), req.Id) if userTask != nil { diff --git a/utils/trace.go b/utils/trace.go index 16b54858f..a1f5737fb 100644 --- a/utils/trace.go +++ b/utils/trace.go @@ -18,9 +18,9 @@ const ( ) //打印函数处理信息 -func TraceFunc(uid string, module string, funcName string, funcArgs interface{}, rsp interface{}) { - log.Debugf("traceFunc uid:%s module:%s funcName:%s funcArgs:%v", uid, module, funcName, funcArgs) -} +// func TraceFunc(uid string, module string, funcName string, funcArgs interface{}, rsp interface{}) { +// log.Debugf("traceFunc uid:%s module:%s funcName:%s funcArgs:%v", uid, module, funcName, funcArgs) +// } //打印函数处理时间 func TraceTimeCost(funcName string, invocation time.Time) {