bingo 直接创建赛季塔数据

This commit is contained in:
meixiongfeng 2022-12-13 11:04:49 +08:00
parent f829d113d8
commit 1fd0326701
5 changed files with 22 additions and 36 deletions

View File

@ -13,6 +13,7 @@ import (
"go_dreamfactory/sys/db" "go_dreamfactory/sys/db"
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
"go.mongodb.org/mongo-driver/bson/primitive"
) )
type Pagoda struct { type Pagoda struct {
@ -234,8 +235,19 @@ func (this *Pagoda) ModifySeasonPagodaFloor(session comm.IUserSession, level int
return return
} }
if !expand.CompletePagoda { // 普通塔 if !expand.CompletePagoda { // 普通塔
code = pb.ErrorCode_ReqParameterError expand.CompletePagoda = true
return 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 { } else {
list, _ := this.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId()) list, _ := this.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
if list.Id != "" { if list.Id != "" {

View File

@ -266,6 +266,7 @@ func (r *Robot) Login() int64 {
rsp := &pb.NotifyErrorNotifyPush{} rsp := &pb.NotifyErrorNotifyPush{}
if !comm.ProtoUnmarshal(msg, rsp) { // 记录错误码 if !comm.ProtoUnmarshal(msg, rsp) { // 记录错误码
fmt.Printf("NotifyErrorNotifyPush err:%v", rsp)
byteLen = 0 byteLen = 0
break break
} }
@ -304,7 +305,7 @@ func (r *Robot) Create(i uint64) int64 {
subType := "create" subType := "create"
msg := &pb.UserMessage{MainType: mainType, SubType: subType} msg := &pb.UserMessage{MainType: mainType, SubType: subType}
name := "a100000" + strconv.Itoa(int(i)) name := "e100000" + strconv.Itoa(int(i)) + r.account
rsp := &pb.UserCreateReq{ rsp := &pb.UserCreateReq{
NickName: name, NickName: name,
Figure: 100, Figure: 100,
@ -341,9 +342,11 @@ func (r *Robot) Create(i uint64) int64 {
rsp := &pb.NotifyErrorNotifyPush{} rsp := &pb.NotifyErrorNotifyPush{}
if !comm.ProtoUnmarshal(msg, rsp) { // 记录错误码 if !comm.ProtoUnmarshal(msg, rsp) { // 记录错误码
fmt.Printf("NotifyErrorNotifyPush err:%v", rsp)
byteLen = 0 byteLen = 0
break break
} }
break
} }
} }
return byteLen return byteLen

View File

@ -17,7 +17,7 @@ import (
) )
const ( const (
connectionMode = 2 // 1:顺序建立长链接 2:并发建立长链接 connectionMode = 1 // 1:顺序建立长链接 2:并发建立长链接
) )
// init 注册验证器 // init 注册验证器
@ -51,7 +51,7 @@ func Dispose(ctx context.Context, concurrency, totalNumber uint64, request *mode
case 1: case 1:
// 连接以后再启动协程 // 连接以后再启动协程
r := robot.NewRobot(request.URL) 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"} //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) { go func(i uint64) {
r := robot.NewRobot(request.URL) 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"} //head := &pb.UserMessage{MainType: "user", SubType: "login"}
// 先登录 // 先登录

View File

@ -89,35 +89,6 @@ func webSocketRequest(chanID uint64, ch chan<- *model.RequestResults, i uint64,
isSucceed = false 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)) requestTime := uint64(helper.DiffNano(startTime))
requestResults := &model.RequestResults{ requestResults := &model.RequestResults{
ID: "", ID: "",

View File

@ -73,7 +73,7 @@ func main() {
statistics.InitLog() statistics.InitLog()
concurrency = 100 concurrency = 100
totalNumber = 10 totalNumber = 1
debugStr = "false" debugStr = "false"
requestURL = "ws://106.54.189.74:7891/gateway" requestURL = "ws://106.54.189.74:7891/gateway"
if concurrency == 0 || totalNumber == 0 || (requestURL == "") { if concurrency == 0 || totalNumber == 0 || (requestURL == "") {