This commit is contained in:
meixiongfeng 2022-07-22 11:56:42 +08:00
commit 8050f7a77d
22 changed files with 38 additions and 27 deletions

BIN
bin/gateway Executable file

Binary file not shown.

BIN
bin/mainte Executable file

Binary file not shown.

0
bin/start.sh Normal file → Executable file
View File

2
bin/stop.sh Normal file → Executable file
View File

@ -2,4 +2,4 @@
./stup.sh stop mainte
./stup.sh stop worker_1
./stup.sh stop worker_1

View File

@ -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..."

BIN
bin/vsdebug_gateway Executable file

Binary file not shown.

BIN
bin/vsdebug_mainte Executable file

Binary file not shown.

BIN
bin/vsdebug_worker Executable file

Binary file not shown.

BIN
bin/worker Executable file

Binary file not shown.

View File

@ -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
}

View File

@ -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]]

View File

@ -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
}

View File

@ -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() {

View File

@ -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

View File

@ -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)

View File

@ -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())

View File

@ -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
}

View File

@ -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))

View File

@ -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))

View File

@ -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))

View File

@ -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 {

View File

@ -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) {