改checklist手动调用

This commit is contained in:
zhaocy 2022-07-04 14:55:32 +08:00
parent 76dc1a3574
commit b5680788f4
19 changed files with 110 additions and 59 deletions

View File

@ -23,46 +23,56 @@ var (
subType: friend.FriendSubTypeBlacklist,
req: &pb.FriendBlackListReq{},
rsp: &pb.FriendBlackListResp{},
// enabled: true,
}, {
//search
mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeSearch,
req: &pb.FriendSearchReq{
NickName: "", //设置测试参数
NickName: "乐谷745", //设置测试参数
},
rsp: &pb.FriendSearchResp{},
rsp: &pb.FriendSearchResp{},
// enabled: true,
}, {
//apply
mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeApply,
req: &pb.FriendApplyReq{},
rsp: &pb.FriendApplyResp{},
// enabled: true,
req: &pb.FriendApplyReq{
FriendId: "0_62c28ab569b7d416cf9eb8c7",
},
rsp: &pb.FriendApplyResp{},
// enabled: true,
}, {
//applylist
mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeApplyList,
req: &pb.FriendApplyListReq{},
rsp: &pb.FriendApplyListResp{},
enabled: true,
}, {
//agree
mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeAgree,
req: &pb.FriendAgreeReq{},
rsp: &pb.FriendAgreeResp{},
req: &pb.FriendAgreeReq{
FriendIds: []string{"0_62c28ab569b7d416cf9eb8c7"},
},
rsp: &pb.FriendAgreeResp{},
// enabled: true,
}, {
//refuse
mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeRefuse,
req: &pb.FriendAgreeReq{},
rsp: &pb.FriendAgreeResp{},
req: &pb.FriendRefuseReq{
FriendIds: []string{"0_62c28bcb69b7d416cf9eb8c9"},
},
rsp: &pb.FriendRefuseResp{},
enabled: true,
}, {
//addblack
mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeAddBlack,
req: &pb.FriendBlackAddReq{
FriendId: "0_62be9f40f67327fb53039b70",
FriendId: "0_62c26323e5cc5577d41bf591",
},
rsp: &pb.FriendBlackAddResp{},
// enabled: true,
@ -72,6 +82,7 @@ var (
subType: friend.FriendSubTypeDelBlack,
req: &pb.FriendDelBlackReq{},
rsp: &pb.FriendDelBlackResp{},
// enabled: true,
},
}
)

View File

@ -24,7 +24,7 @@ var (
fmt.Printf("%d- %v\n", (i + 1), v)
}
},
enabled: true,
// enabled: true,
}, {
mainType: string(comm.ModuleHero),
subType: hero.HeroSubTypeInfo,

View File

@ -14,9 +14,9 @@ var user_builders = []*TestCase{
mainType: string(comm.ModuleUser),
subType: user.UserSubTypeCreate,
req: &pb.UserCreateReq{ //设置请求参数
NickName: "乐谷6301",
NickName: "乐谷748",
},
rsp: &pb.UserCreateResp{},
rsp: &pb.UserCreateResp{},
// enabled: true,
}, {
Desc: "添加资源",

View File

@ -17,11 +17,15 @@ func (this *apiComp) AddblackCheck(session comm.IUserSession, req *pb.FriendBlac
//加入黑名单
func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendBlackAddReq) (code pb.ErrorCode, data proto.Message) {
if code = this.AddblackCheck(session, req); code != pb.ErrorCode_Success {
return
}
var (
err error
self *pb.DBFriend
target *pb.DBFriend
Resp *pb.FriendBlackAddResp
Resp *pb.FriendBlackAddResp
)
defer func() {

View File

@ -18,11 +18,14 @@ func (this *apiComp) AgreeCheck(session comm.IUserSession, req *pb.FriendAgreeRe
//单个/批量同意
func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (code pb.ErrorCode, data proto.Message) {
if code = this.AgreeCheck(session, req); code != pb.ErrorCode_Success {
return
}
var (
err error
self *pb.DBFriend
target *pb.DBFriend
Resp *pb.FriendAgreeResp
Resp *pb.FriendAgreeResp
optNum int32
)

View File

@ -18,11 +18,15 @@ 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 {
return
}
var (
err error
self *pb.DBFriend
target *pb.DBFriend
Resp *pb.FriendApplyResp
Resp *pb.FriendApplyResp
)
defer func() {
@ -45,14 +49,14 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c
//获取玩家自己好友数据
self = this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil || err != nil {
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
}
//获取好友数据
target = this.module.modelFriend.GetFriend(req.FriendId)
if target == nil || err != nil {
if target == nil {
code = pb.ErrorCode_FriendTargetNoData
return
}

View File

@ -3,19 +3,19 @@ package friend
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
func (this *apiComp) ApplyListCheck(session comm.IUserSession, req *pb.FriendApplyListReq) (code pb.ErrorCode) {
return
}
//申请列表
func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyListReq) (code pb.ErrorCode) {
func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyListReq) (code pb.ErrorCode, data proto.Message) {
var (
err error
self *pb.DBFriend
Resp *pb.FriendApplyListResp
Resp *pb.FriendApplyListResp
list []*pb.FriendBase
)
@ -31,7 +31,7 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyLis
}()
self = this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil || err != nil {
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
}

View File

@ -13,8 +13,7 @@ func (this *apiComp) BlacklistCheck(session comm.IUserSession, req *pb.FriendBla
//黑名单
func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackListReq) (code pb.ErrorCode, data proto.Message) {
var (
err error
var (
self *pb.DBFriend
Resp *pb.FriendBlackListResp
list []*pb.FriendBase
@ -33,7 +32,7 @@ func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackLis
}()
self = this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil || err != nil {
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
}

View File

@ -17,10 +17,13 @@ func (this *apiComp) DelblackCheck(session comm.IUserSession, req *pb.FriendDelB
//删除黑名单
func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackReq) (code pb.ErrorCode, data proto.Message) {
if code = this.DelblackCheck(session, req); code != pb.ErrorCode_Success {
return
}
var (
err error
self *pb.DBFriend
Resp *pb.FriendDelBlackResp
Resp *pb.FriendDelBlackResp
)
defer func() {
if code == pb.ErrorCode_Success {
@ -37,7 +40,7 @@ func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackR
}()
self = this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil || err != nil {
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
}

View File

@ -18,11 +18,13 @@ func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.FriendRefuse
//单个/批量拒绝
func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq) (code pb.ErrorCode, data proto.Message) {
if code = this.RefuseCheck(session, req); code != pb.ErrorCode_Success {
return
}
//将申请人从申请列表中删除
var (
err error
self *pb.DBFriend
Resp *pb.FriendRefuseResp
Resp *pb.FriendRefuseResp
optNum int32
)
defer func() {
@ -39,7 +41,7 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq)
//获取玩家自己好友数据
self = this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil || err != nil {
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
}

View File

@ -17,8 +17,12 @@ func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.FriendSearch
//搜索
func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq) (code pb.ErrorCode, data proto.Message) {
if code = this.SearchCheck(session, req); code != pb.ErrorCode_Success {
return
}
var (
Resp *pb.FriendSearchResp
Resp *pb.FriendSearchResp
friend *pb.FriendBase
)
defer func() {

View File

@ -10,10 +10,17 @@ import (
//参数校验
func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.HeroInfoReq) (code pb.ErrorCode) {
if req.HeroId != "" {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Info(session comm.IUserSession, req *pb.HeroInfoReq) (code pb.ErrorCode, data proto.Message) {
if code = this.InfoCheck(session, req); code != pb.ErrorCode_Success {
return
}
rsp := &pb.HeroInfoResp{}
defer func() {
err := session.SendMsg(string(this.module.GetType()), HeroSubTypeInfo, rsp)

View File

@ -166,14 +166,11 @@ func (this *ModelHero) getHeroList(uid string) ([]*pb.DBHero, error) {
}
//更新装备
func (this *ModelHero) setEquipment(uid, heroId string, equipIds []string) pb.ErrorCode {
hero := this.getOneHero(uid, heroId)
if hero == nil {
return pb.ErrorCode_HeroNoExist
func (this *ModelHero) setEquipment(uid, heroId string, equipIds []string) error {
update := map[string]interface{}{
"equipID": equipIds,
}
hero.EquipID = equipIds
return pb.ErrorCode_Success
return this.moduleHero.modelHero.modifyHeroData(uid, heroId, update)
}
//合并属性即属性值累加

View File

@ -96,7 +96,11 @@ func (this *Hero) UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (co
this.modelHero.mergeMainProperty(hero.Uid, hero.Id, property)
this.modelHero.mergeAddProperty(hero.Uid, hero.Id, addProperty)
return this.modelHero.setEquipment(hero.Uid, hero.Id, equipIds)
if err := this.modelHero.setEquipment(hero.Uid, hero.Id, equipIds); err != nil {
code = pb.ErrorCode_HeroEquipUpdate
return
}
return
}
//英雄列表

View File

@ -19,6 +19,9 @@ func (this *apiComp) CreateCheck(session comm.IUserSession, req *pb.UserCreateRe
//创角
func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (code pb.ErrorCode, data proto.Message) {
if code = this.CreateCheck(session, req); code != pb.ErrorCode_Success {
return
}
var err error
defer utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), UserSubTypeCreate, req, nil)

View File

@ -22,6 +22,9 @@ func (this *apiComp) LoginCheck(session comm.IUserSession, req *pb.UserLoginReq)
//登录
func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (code pb.ErrorCode, data proto.Message) {
if code = this.LoginCheck(session, req); code != pb.ErrorCode_Success {
return
}
var (
err error
user *pb.DBUser
@ -40,7 +43,6 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
}
}()
//从mgo查询user
user, err = this.module.modelUser.User_FindByAccount(req.Sid, req.Account)
if err != nil {

View File

@ -15,6 +15,10 @@ func (this *apiComp) AddResCheck(session comm.IUserSession, req *pb.UserAddResRe
}
func (this *apiComp) AddRes(session comm.IUserSession, req *pb.UserAddResReq) (code pb.ErrorCode, data proto.Message) {
if code = this.AddResCheck(session, req); code != pb.ErrorCode_Success {
return
}
rsp := &pb.UserAddResResp{}
defer func() {

View File

@ -79,6 +79,7 @@ const (
ErrorCode_HeroNotNeedResonate ErrorCode = 1308 // 不需要重置共鸣
ErrorCode_HeroNoEnergy ErrorCode = 1309 // 没有能量点数
ErrorCode_HeroCreate ErrorCode = 1310 // 创建卡失败
ErrorCode_HeroEquipUpdate ErrorCode = 1311 //更新装备失败
// equipment
ErrorCode_EquipmentOnFoundEquipment ErrorCode = 1400 // 未找到武器
ErrorCode_EquipmentLvlimitReached ErrorCode = 1401 // 武器等级已达上限
@ -139,6 +140,7 @@ var (
1308: "HeroNotNeedResonate",
1309: "HeroNoEnergy",
1310: "HeroCreate",
1311: "HeroEquipUpdate",
1400: "EquipmentOnFoundEquipment",
1401: "EquipmentLvlimitReached",
}
@ -195,6 +197,7 @@ var (
"HeroNotNeedResonate": 1308,
"HeroNoEnergy": 1309,
"HeroCreate": 1310,
"HeroEquipUpdate": 1311,
"EquipmentOnFoundEquipment": 1400,
"EquipmentLvlimitReached": 1401,
}
@ -231,7 +234,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
var file_errorcode_proto_rawDesc = []byte{
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2a, 0xf2, 0x08, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x6f, 0x2a, 0x88, 0x09, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
@ -298,12 +301,13 @@ var file_errorcode_proto_rawDesc = []byte{
0x72, 0x6f, 0x4e, 0x6f, 0x74, 0x4e, 0x65, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74,
0x65, 0x10, 0x9c, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x6e,
0x65, 0x72, 0x67, 0x79, 0x10, 0x9d, 0x0a, 0x12, 0x0f, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x43,
0x72, 0x65, 0x61, 0x74, 0x65, 0x10, 0x9e, 0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4f, 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63,
0x68, 0x65, 0x64, 0x10, 0xf9, 0x0a, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x72, 0x65, 0x61, 0x74, 0x65, 0x10, 0x9e, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f,
0x45, 0x71, 0x75, 0x69, 0x70, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x10, 0x9f, 0x0a, 0x12, 0x1e,
0x0a, 0x19, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4f, 0x6e, 0x46, 0x6f, 0x75,
0x6e, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0xf8, 0x0a, 0x12, 0x1c,
0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x76, 0x6c, 0x69, 0x6d,
0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x10, 0xf9, 0x0a, 0x42, 0x06, 0x5a, 0x04,
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -51,18 +51,18 @@ enum ErrorCode {
ItemsGirdAmountUpper = 1203; //
// hero
HeroNoExist = 1300; //
HeroNoEnough = 1301; //
HeroMaxLv = 1302; //
HeroInitCreat = 1303; //
HeroColorErr = 1304; //
HeroSkillUpErr = 1305;//
HeroMaxResonate = 1306; //
HeroNoResonate = 1307; //
HeroNoExist = 1300; //
HeroNoEnough = 1301; //
HeroMaxLv = 1302; //
HeroInitCreat = 1303; //
HeroColorErr = 1304; //
HeroSkillUpErr = 1305; //
HeroMaxResonate = 1306; //
HeroNoResonate = 1307; //
HeroNotNeedResonate = 1308; //
HeroNoEnergy = 1309; //
HeroCreate = 1310; //
HeroNoEnergy = 1309; //
HeroCreate = 1310; //
HeroEquipUpdate = 1311; //
// equipment
EquipmentOnFoundEquipment = 1400; //