Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
07b493bfb5
@ -14,7 +14,7 @@ const (
|
|||||||
PagodaGetRewardResp = "getreward"
|
PagodaGetRewardResp = "getreward"
|
||||||
PagodaRankListResp = "ranklist"
|
PagodaRankListResp = "ranklist"
|
||||||
PagodaActivateResp = "activate"
|
PagodaActivateResp = "activate"
|
||||||
PagodaPassCheckResp = "passcheck"
|
PagodaWarOrderResp = "warorder"
|
||||||
)
|
)
|
||||||
|
|
||||||
type apiComp struct {
|
type apiComp struct {
|
||||||
|
@ -9,13 +9,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) PassCheckCheck(session comm.IUserSession, req *pb.PagodaPassCheckReq) (code pb.ErrorCode) {
|
func (this *apiComp) WarOrderCheck(session comm.IUserSession, req *pb.PagodaWarOrderReq) (code pb.ErrorCode) {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 战令领取
|
// 战令领取
|
||||||
func (this *apiComp) PassCheck(session comm.IUserSession, req *pb.PagodaPassCheckReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) WarOrder(session comm.IUserSession, req *pb.PagodaWarOrderReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
var (
|
var (
|
||||||
list *pb.DBPagoda
|
list *pb.DBPagoda
|
||||||
resCfg []*cfg.Gameatn
|
resCfg []*cfg.Gameatn
|
||||||
@ -24,19 +24,16 @@ func (this *apiComp) PassCheck(session comm.IUserSession, req *pb.PagodaPassChec
|
|||||||
resID []int32 // 当前可领取的id
|
resID []int32 // 当前可领取的id
|
||||||
vipID []int32 // 有vip的情况 可领取的id
|
vipID []int32 // 有vip的情况 可领取的id
|
||||||
mapData map[string]interface{}
|
mapData map[string]interface{}
|
||||||
|
bReward bool
|
||||||
)
|
)
|
||||||
mapData = make(map[string]interface{}, 0)
|
mapData = make(map[string]interface{}, 0)
|
||||||
this.PassCheckCheck(session, req)
|
//this.WarOrderCheck(session, req)
|
||||||
|
|
||||||
list, _ = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
list, _ = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
||||||
if list.Id == "" {
|
if list.Id == "" {
|
||||||
code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到
|
code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if list.PagodaId <= list.PassCheckID { // 层数校验
|
|
||||||
code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
payPoint := this.module.configure.GetPassCheckPointByTtype(1)
|
payPoint := this.module.configure.GetPassCheckPointByTtype(1)
|
||||||
if payPoint != "" {
|
if payPoint != "" {
|
||||||
@ -45,25 +42,39 @@ func (this *apiComp) PassCheck(session comm.IUserSession, req *pb.PagodaPassChec
|
|||||||
vip = true
|
vip = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if list.PagodaId < list.PassCheckID { // 层数校验
|
||||||
|
//code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到
|
||||||
|
//return
|
||||||
|
bReward = true
|
||||||
|
}
|
||||||
|
if vip && bReward {
|
||||||
|
if list.PagodaId < list.VipPassCheckID { // 层数校验
|
||||||
|
code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
conf := this.module.configure.GetPassCheckByTtype(1)
|
conf := this.module.configure.GetPassCheckByTtype(1)
|
||||||
|
|
||||||
for pos, v := range conf {
|
for _, v := range conf {
|
||||||
if int32(pos) <= list.PassCheckID {
|
if v.Parameter <= list.PassCheckID {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if v.Parameter >= list.PagodaId {
|
if v.Parameter <= list.PagodaId {
|
||||||
resID = append(resID, v.Id)
|
resID = append(resID, v.Id)
|
||||||
mapData["passCheckID"] = v.Parameter
|
mapData["passCheckID"] = v.Parameter
|
||||||
|
list.PassCheckID = v.Parameter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if vip {
|
if vip {
|
||||||
for pos, v := range conf {
|
for _, v := range conf {
|
||||||
if int32(pos) <= list.VipPassCheckID {
|
if v.Parameter <= list.VipPassCheckID {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if v.Parameter >= list.PagodaId {
|
if v.Parameter <= list.PagodaId {
|
||||||
vipID = append(vipID, v.Id)
|
vipID = append(vipID, v.Id)
|
||||||
mapData["vipPassCheckID"] = v.Parameter
|
mapData["vipPassCheckID"] = v.Parameter
|
||||||
|
list.VipPassCheckID = v.Parameter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,19 +89,38 @@ func (this *apiComp) PassCheck(session comm.IUserSession, req *pb.PagodaPassChec
|
|||||||
resCfg = append(resCfg, confCheck.PayReward)
|
resCfg = append(resCfg, confCheck.PayReward)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if code = this.module.DispenseRes(session, resCfg, true); code != pb.ErrorCode_Success { // 发放奖励
|
// 资源整合
|
||||||
return
|
var totalRes []*cfg.Gameatn
|
||||||
}
|
|
||||||
// 转成协议格式
|
|
||||||
for _, v := range resCfg {
|
for _, v := range resCfg {
|
||||||
|
b := false
|
||||||
|
for _, v1 := range totalRes {
|
||||||
|
if v.A == v1.A && v.T == v1.T {
|
||||||
|
b = true
|
||||||
|
v1.N += v.N
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !b {
|
||||||
|
totalRes = append(totalRes, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(totalRes) > 0 {
|
||||||
|
if code = this.module.DispenseRes(session, totalRes, true); code != pb.ErrorCode_Success { // 发放奖励
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转成协议格式
|
||||||
|
for _, v := range totalRes {
|
||||||
res = append(res, &pb.UserAssets{
|
res = append(res, &pb.UserAssets{
|
||||||
A: v.A,
|
A: v.A,
|
||||||
T: v.T,
|
T: v.T,
|
||||||
N: v.N,
|
N: v.N,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData)
|
code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData)
|
||||||
session.SendMsg(string(this.module.GetType()), PagodaPassCheckResp, &pb.PagodaPassCheckResp{
|
session.SendMsg(string(this.module.GetType()), PagodaWarOrderResp, &pb.PagodaWarOrderResp{
|
||||||
Data: list,
|
Data: list,
|
||||||
Itmes: res,
|
Itmes: res,
|
||||||
})
|
})
|
@ -13,6 +13,8 @@ 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"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Pagoda struct {
|
type Pagoda struct {
|
||||||
@ -93,9 +95,21 @@ func (this *Pagoda) ModifyPagodaFloor(session comm.IUserSession, level int32) (c
|
|||||||
list.PagodaId = level
|
list.PagodaId = level
|
||||||
mapData := make(map[string]interface{}, 0)
|
mapData := make(map[string]interface{}, 0)
|
||||||
mapData["pagodaId"] = level
|
mapData["pagodaId"] = level
|
||||||
|
// 通关校验
|
||||||
|
Nomalcfg := this.configure.GetPagodaConfigData(comm.PagodaType, level+1)
|
||||||
|
if Nomalcfg == nil {
|
||||||
|
// 修改expand 数据
|
||||||
|
update := map[string]interface{}{
|
||||||
|
"completePagoda": true,
|
||||||
|
}
|
||||||
|
this.ModuleUser.ChangeUserExpand(session.GetUserId(), update)
|
||||||
|
list.Complete = true
|
||||||
|
mapData["complete"] = true
|
||||||
|
}
|
||||||
code = this.ModifyPagodaData(session.GetUserId(), mapData)
|
code = this.ModifyPagodaData(session.GetUserId(), mapData)
|
||||||
session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
|
session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,8 +248,26 @@ 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
|
||||||
|
if conn, err := db.Cross(); err == nil {
|
||||||
|
rst := conn.Mgo.FindOne(comm.TableServerData, bson.M{})
|
||||||
|
server := &pb.DBServerData{}
|
||||||
|
rst.Decode(server)
|
||||||
|
list.Type = server.SeasonType
|
||||||
|
|
||||||
|
}
|
||||||
|
this.modelSeasonPagoda.addNewSeasonPagoda(session.GetUserId(), list)
|
||||||
|
session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
list, _ := this.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
list, _ := this.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
||||||
if list.Id != "" {
|
if list.Id != "" {
|
||||||
@ -243,7 +275,7 @@ func (this *Pagoda) ModifySeasonPagodaFloor(session comm.IUserSession, level int
|
|||||||
list.PagodaId = level
|
list.PagodaId = level
|
||||||
mapData := make(map[string]interface{}, 0)
|
mapData := make(map[string]interface{}, 0)
|
||||||
mapData["pagodaId"] = level
|
mapData["pagodaId"] = level
|
||||||
code = this.ModifyPagodaData(session.GetUserId(), mapData)
|
code = this.ModifySeasonPagodaData(session.GetUserId(), mapData)
|
||||||
session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
|
session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,13 +88,3 @@ func (this *ModelExpand) updateLoginDay(uid string, timestamp int64) (err error)
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通关了普通塔
|
|
||||||
func (this *ModelExpand) CompleteNormalPagoda(uid string) (err error) {
|
|
||||||
update := map[string]interface{}{
|
|
||||||
"completePagoda": true,
|
|
||||||
}
|
|
||||||
err = this.ChangeUserExpand(uid, update)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
@ -715,14 +715,14 @@ func (x *PagodaActivateResp) GetData() *DBPagoda {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 领取战令奖励
|
// 领取战令奖励
|
||||||
type PagodaPassCheckReq struct {
|
type PagodaWarOrderReq struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PagodaPassCheckReq) Reset() {
|
func (x *PagodaWarOrderReq) Reset() {
|
||||||
*x = PagodaPassCheckReq{}
|
*x = PagodaWarOrderReq{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_pagoda_pagoda_msg_proto_msgTypes[14]
|
mi := &file_pagoda_pagoda_msg_proto_msgTypes[14]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@ -730,13 +730,13 @@ func (x *PagodaPassCheckReq) Reset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PagodaPassCheckReq) String() string {
|
func (x *PagodaWarOrderReq) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*PagodaPassCheckReq) ProtoMessage() {}
|
func (*PagodaWarOrderReq) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *PagodaPassCheckReq) ProtoReflect() protoreflect.Message {
|
func (x *PagodaWarOrderReq) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_pagoda_pagoda_msg_proto_msgTypes[14]
|
mi := &file_pagoda_pagoda_msg_proto_msgTypes[14]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@ -748,12 +748,12 @@ func (x *PagodaPassCheckReq) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use PagodaPassCheckReq.ProtoReflect.Descriptor instead.
|
// Deprecated: Use PagodaWarOrderReq.ProtoReflect.Descriptor instead.
|
||||||
func (*PagodaPassCheckReq) Descriptor() ([]byte, []int) {
|
func (*PagodaWarOrderReq) Descriptor() ([]byte, []int) {
|
||||||
return file_pagoda_pagoda_msg_proto_rawDescGZIP(), []int{14}
|
return file_pagoda_pagoda_msg_proto_rawDescGZIP(), []int{14}
|
||||||
}
|
}
|
||||||
|
|
||||||
type PagodaPassCheckResp struct {
|
type PagodaWarOrderResp struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
@ -762,8 +762,8 @@ type PagodaPassCheckResp struct {
|
|||||||
Itmes []*UserAssets `protobuf:"bytes,2,rep,name=itmes,proto3" json:"itmes"` // 获得的奖励
|
Itmes []*UserAssets `protobuf:"bytes,2,rep,name=itmes,proto3" json:"itmes"` // 获得的奖励
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PagodaPassCheckResp) Reset() {
|
func (x *PagodaWarOrderResp) Reset() {
|
||||||
*x = PagodaPassCheckResp{}
|
*x = PagodaWarOrderResp{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_pagoda_pagoda_msg_proto_msgTypes[15]
|
mi := &file_pagoda_pagoda_msg_proto_msgTypes[15]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@ -771,13 +771,13 @@ func (x *PagodaPassCheckResp) Reset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PagodaPassCheckResp) String() string {
|
func (x *PagodaWarOrderResp) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*PagodaPassCheckResp) ProtoMessage() {}
|
func (*PagodaWarOrderResp) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *PagodaPassCheckResp) ProtoReflect() protoreflect.Message {
|
func (x *PagodaWarOrderResp) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_pagoda_pagoda_msg_proto_msgTypes[15]
|
mi := &file_pagoda_pagoda_msg_proto_msgTypes[15]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@ -789,19 +789,19 @@ func (x *PagodaPassCheckResp) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use PagodaPassCheckResp.ProtoReflect.Descriptor instead.
|
// Deprecated: Use PagodaWarOrderResp.ProtoReflect.Descriptor instead.
|
||||||
func (*PagodaPassCheckResp) Descriptor() ([]byte, []int) {
|
func (*PagodaWarOrderResp) Descriptor() ([]byte, []int) {
|
||||||
return file_pagoda_pagoda_msg_proto_rawDescGZIP(), []int{15}
|
return file_pagoda_pagoda_msg_proto_rawDescGZIP(), []int{15}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PagodaPassCheckResp) GetData() *DBPagoda {
|
func (x *PagodaWarOrderResp) GetData() *DBPagoda {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Data
|
return x.Data
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PagodaPassCheckResp) GetItmes() []*UserAssets {
|
func (x *PagodaWarOrderResp) GetItmes() []*UserAssets {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Itmes
|
return x.Itmes
|
||||||
}
|
}
|
||||||
@ -871,14 +871,14 @@ var file_pagoda_pagoda_msg_proto_rawDesc = []byte{
|
|||||||
0x67, 0x6f, 0x64, 0x61, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
|
0x67, 0x6f, 0x64, 0x61, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
|
||||||
0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09,
|
0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09,
|
||||||
0x2e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22,
|
0x2e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22,
|
||||||
0x14, 0x0a, 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x50, 0x61, 0x73, 0x73, 0x43, 0x68, 0x65,
|
0x13, 0x0a, 0x11, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x57, 0x61, 0x72, 0x4f, 0x72, 0x64, 0x65,
|
||||||
0x63, 0x6b, 0x52, 0x65, 0x71, 0x22, 0x57, 0x0a, 0x13, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x50,
|
0x72, 0x52, 0x65, 0x71, 0x22, 0x56, 0x0a, 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x57, 0x61,
|
||||||
0x61, 0x73, 0x73, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04,
|
0x72, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61,
|
||||||
0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x50,
|
0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x67,
|
||||||
0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x21, 0x0a, 0x05, 0x69,
|
0x6f, 0x64, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x21, 0x0a, 0x05, 0x69, 0x74, 0x6d,
|
||||||
0x74, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65,
|
0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41,
|
||||||
0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x05, 0x69, 0x74, 0x6d, 0x65, 0x73, 0x42, 0x06,
|
0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x05, 0x69, 0x74, 0x6d, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04,
|
||||||
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -909,8 +909,8 @@ var file_pagoda_pagoda_msg_proto_goTypes = []interface{}{
|
|||||||
(*PagodaQueryRecordResp)(nil), // 11: PagodaQueryRecordResp
|
(*PagodaQueryRecordResp)(nil), // 11: PagodaQueryRecordResp
|
||||||
(*PagodaActivateReq)(nil), // 12: PagodaActivateReq
|
(*PagodaActivateReq)(nil), // 12: PagodaActivateReq
|
||||||
(*PagodaActivateResp)(nil), // 13: PagodaActivateResp
|
(*PagodaActivateResp)(nil), // 13: PagodaActivateResp
|
||||||
(*PagodaPassCheckReq)(nil), // 14: PagodaPassCheckReq
|
(*PagodaWarOrderReq)(nil), // 14: PagodaWarOrderReq
|
||||||
(*PagodaPassCheckResp)(nil), // 15: PagodaPassCheckResp
|
(*PagodaWarOrderResp)(nil), // 15: PagodaWarOrderResp
|
||||||
(*DBPagoda)(nil), // 16: DBPagoda
|
(*DBPagoda)(nil), // 16: DBPagoda
|
||||||
(*BattleFormation)(nil), // 17: BattleFormation
|
(*BattleFormation)(nil), // 17: BattleFormation
|
||||||
(*BattleInfo)(nil), // 18: BattleInfo
|
(*BattleInfo)(nil), // 18: BattleInfo
|
||||||
@ -928,8 +928,8 @@ var file_pagoda_pagoda_msg_proto_depIdxs = []int32{
|
|||||||
20, // 6: PagodaRankListResp.ranks:type_name -> DBPagodaRecord
|
20, // 6: PagodaRankListResp.ranks:type_name -> DBPagodaRecord
|
||||||
20, // 7: PagodaQueryRecordResp.data:type_name -> DBPagodaRecord
|
20, // 7: PagodaQueryRecordResp.data:type_name -> DBPagodaRecord
|
||||||
16, // 8: PagodaActivateResp.data:type_name -> DBPagoda
|
16, // 8: PagodaActivateResp.data:type_name -> DBPagoda
|
||||||
16, // 9: PagodaPassCheckResp.data:type_name -> DBPagoda
|
16, // 9: PagodaWarOrderResp.data:type_name -> DBPagoda
|
||||||
21, // 10: PagodaPassCheckResp.itmes:type_name -> UserAssets
|
21, // 10: PagodaWarOrderResp.itmes:type_name -> UserAssets
|
||||||
11, // [11:11] is the sub-list for method output_type
|
11, // [11:11] is the sub-list for method output_type
|
||||||
11, // [11:11] is the sub-list for method input_type
|
11, // [11:11] is the sub-list for method input_type
|
||||||
11, // [11:11] is the sub-list for extension type_name
|
11, // [11:11] is the sub-list for extension type_name
|
||||||
@ -1115,7 +1115,7 @@ func file_pagoda_pagoda_msg_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_pagoda_pagoda_msg_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
|
file_pagoda_pagoda_msg_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*PagodaPassCheckReq); i {
|
switch v := v.(*PagodaWarOrderReq); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@ -1127,7 +1127,7 @@ func file_pagoda_pagoda_msg_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_pagoda_pagoda_msg_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
|
file_pagoda_pagoda_msg_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*PagodaPassCheckResp); i {
|
switch v := v.(*PagodaWarOrderResp); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -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
|
||||||
|
@ -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"}
|
||||||
|
|
||||||
// 先登录
|
// 先登录
|
||||||
|
@ -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: "",
|
||||||
|
@ -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 == "") {
|
||||||
|
Loading…
Reference in New Issue
Block a user