From 1fd03267010ed4f0e102877b5ed2b12d982afb55 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 13 Dec 2022 11:04:49 +0800 Subject: [PATCH] =?UTF-8?q?bingo=20=E7=9B=B4=E6=8E=A5=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E8=B5=9B=E5=AD=A3=E5=A1=94=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pagoda/module.go | 16 ++++++++++++-- stress/robot/robot.go | 5 ++++- stress/server/dispose.go | 6 +++--- stress/server/golink/websocket_link.go | 29 -------------------------- stress/stress.go | 2 +- 5 files changed, 22 insertions(+), 36 deletions(-) diff --git a/modules/pagoda/module.go b/modules/pagoda/module.go index ff73e9dab..3312812ed 100644 --- a/modules/pagoda/module.go +++ b/modules/pagoda/module.go @@ -13,6 +13,7 @@ import ( "go_dreamfactory/sys/db" "github.com/go-redis/redis/v8" + "go.mongodb.org/mongo-driver/bson/primitive" ) type Pagoda struct { @@ -234,8 +235,19 @@ func (this *Pagoda) ModifySeasonPagodaFloor(session comm.IUserSession, level int return } if !expand.CompletePagoda { // 普通塔 - code = pb.ErrorCode_ReqParameterError - return + expand.CompletePagoda = true + update := map[string]interface{}{ + "completePagoda": true, + } + this.ModuleUser.ChangeUserExpand(session.GetUserId(), update) + list, _ := this.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId()) + if list.Id == "" { + list.Id = primitive.NewObjectID().Hex() + list.Uid = session.GetUserId() + list.PagodaId = level + + this.modelSeasonPagoda.addNewSeasonPagoda(session.GetUserId(), list) + } } else { list, _ := this.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId()) if list.Id != "" { diff --git a/stress/robot/robot.go b/stress/robot/robot.go index 7aae07d54..c0244c335 100644 --- a/stress/robot/robot.go +++ b/stress/robot/robot.go @@ -266,6 +266,7 @@ func (r *Robot) Login() int64 { rsp := &pb.NotifyErrorNotifyPush{} if !comm.ProtoUnmarshal(msg, rsp) { // 记录错误码 + fmt.Printf("NotifyErrorNotifyPush err:%v", rsp) byteLen = 0 break } @@ -304,7 +305,7 @@ func (r *Robot) Create(i uint64) int64 { subType := "create" msg := &pb.UserMessage{MainType: mainType, SubType: subType} - name := "a100000" + strconv.Itoa(int(i)) + name := "e100000" + strconv.Itoa(int(i)) + r.account rsp := &pb.UserCreateReq{ NickName: name, Figure: 100, @@ -341,9 +342,11 @@ func (r *Robot) Create(i uint64) int64 { rsp := &pb.NotifyErrorNotifyPush{} if !comm.ProtoUnmarshal(msg, rsp) { // 记录错误码 + fmt.Printf("NotifyErrorNotifyPush err:%v", rsp) byteLen = 0 break } + break } } return byteLen diff --git a/stress/server/dispose.go b/stress/server/dispose.go index 348cb5890..93424d9a2 100644 --- a/stress/server/dispose.go +++ b/stress/server/dispose.go @@ -17,7 +17,7 @@ import ( ) const ( - connectionMode = 2 // 1:顺序建立长链接 2:并发建立长链接 + connectionMode = 1 // 1:顺序建立长链接 2:并发建立长链接 ) // init 注册验证器 @@ -51,7 +51,7 @@ func Dispose(ctx context.Context, concurrency, totalNumber uint64, request *mode case 1: // 连接以后再启动协程 r := robot.NewRobot(request.URL) - r.SetAccount("41112" + strconv.Itoa(int(i))) + r.SetAccount("f51112" + strconv.Itoa(int(i))) //head := &pb.UserMessage{MainType: "user", SubType: "login"} // 先登录 @@ -63,7 +63,7 @@ func Dispose(ctx context.Context, concurrency, totalNumber uint64, request *mode // 并发建立长链接 go func(i uint64) { r := robot.NewRobot(request.URL) - r.SetAccount("71112" + strconv.Itoa(int(i))) + r.SetAccount("b71112" + strconv.Itoa(int(i))) //head := &pb.UserMessage{MainType: "user", SubType: "login"} // 先登录 diff --git a/stress/server/golink/websocket_link.go b/stress/server/golink/websocket_link.go index f677743c5..f44a5a376 100644 --- a/stress/server/golink/websocket_link.go +++ b/stress/server/golink/websocket_link.go @@ -89,35 +89,6 @@ func webSocketRequest(chanID uint64, ch chan<- *model.RequestResults, i uint64, isSucceed = false } - //startTime := time.Now() - // r.GetRandUser() // 获取随机在线玩家数据 - //r.GetGourmetList() - //byteLen = r.GourmetOrder() - // if byteLen > 0 { - // isSucceed = true - // } - // for { - // var msg *pb.UserMessage = &pb.UserMessage{} - // data, err := r.GetMessagedata() - // if err != nil { - // fmt.Printf("readMessage err:%v", err) - // isSucceed = false - // break - // } - // if err = proto.Unmarshal(data, msg); err != nil { - // fmt.Printf("unmarshal err:%v", err) - // } - // if msg.MainType == "gourmet" && msg.SubType == "getlist" { - // byteLen += int64(len(data)) - // isSucceed = true - // resp := &pb.GourmetGetListResp{} - // if !comm.ProtoUnmarshal(msg, resp) { //反序列化失败 - // break - // } - // break - // } - // } - requestTime := uint64(helper.DiffNano(startTime)) requestResults := &model.RequestResults{ ID: "", diff --git a/stress/stress.go b/stress/stress.go index 113fa6e0a..66b19d569 100644 --- a/stress/stress.go +++ b/stress/stress.go @@ -73,7 +73,7 @@ func main() { statistics.InitLog() concurrency = 100 - totalNumber = 10 + totalNumber = 1 debugStr = "false" requestURL = "ws://106.54.189.74:7891/gateway" if concurrency == 0 || totalNumber == 0 || (requestURL == "") {