friend errdata
This commit is contained in:
parent
3d00711bd5
commit
a275e970cf
@ -28,12 +28,18 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq)
|
|||||||
if qr := this.module.ModelFriendQiecuo.getQiecuo(req.Uid); qr != nil {
|
if qr := this.module.ModelFriendQiecuo.getQiecuo(req.Uid); qr != nil {
|
||||||
now := configure.Now().Unix()
|
now := configure.Now().Unix()
|
||||||
if now-qr.Timestamp > 10 { //大于10s 切磋超时
|
if now-qr.Timestamp > 10 { //大于10s 切磋超时
|
||||||
code = pb.ErrorCode_FriendQiecuoTimeout
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendQiecuoTimeout,
|
||||||
|
Title: pb.ErrorCode_FriendQiecuoTimeout.ToString(),
|
||||||
|
}
|
||||||
this.module.Debug("切磋接受超时", log.Field{Key: "uid", Value: session.GetUserId()})
|
this.module.Debug("切磋接受超时", log.Field{Key: "uid", Value: session.GetUserId()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
code = pb.ErrorCode_FriendQiecuoNoRequest
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendQiecuoNoRequest,
|
||||||
|
Title: pb.ErrorCode_FriendQiecuoNoRequest.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,13 +48,20 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq)
|
|||||||
//发起者 red
|
//发起者 red
|
||||||
red := this.module.ModuleUser.GetUser(req.Uid)
|
red := this.module.ModuleUser.GetUser(req.Uid)
|
||||||
if red == nil {
|
if red == nil {
|
||||||
code = pb.ErrorCode_UserNofound
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_UserNofound,
|
||||||
|
Title: pb.ErrorCode_UserNofound.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("未找到红方信息", log.Field{Key: "uid", Value: req.Uid})
|
this.module.Error("未找到红方信息", log.Field{Key: "uid", Value: req.Uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
blue := this.module.ModuleUser.GetUser(session.GetUserId())
|
blue := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
if blue == nil {
|
if blue == nil {
|
||||||
code = pb.ErrorCode_UserNofound
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_UserNofound,
|
||||||
|
Title: pb.ErrorCode_UserNofound.ToString(),
|
||||||
|
}
|
||||||
|
|
||||||
this.module.Error("未找到蓝方信息", log.Field{Key: "uid", Value: session.GetUserId()})
|
this.module.Error("未找到蓝方信息", log.Field{Key: "uid", Value: session.GetUserId()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -57,7 +70,7 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq)
|
|||||||
&pb.PvpUserInfo{Uid: blue.Uid, Name: blue.Name, Avatar: blue.Avatar, Lv: blue.Lv},
|
&pb.PvpUserInfo{Uid: blue.Uid, Name: blue.Name, Avatar: blue.Avatar, Lv: blue.Lv},
|
||||||
pb.PvpType_friends,
|
pb.PvpType_friends,
|
||||||
)
|
)
|
||||||
if c != pb.ErrorCode_Success {
|
if c != nil {
|
||||||
this.module.Debug("createPvp code:", log.Field{Key: "code", Value: c})
|
this.module.Debug("createPvp code:", log.Field{Key: "code", Value: c})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -71,10 +84,8 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq)
|
|||||||
resp := &pb.FriendAcceptResp{
|
resp := &pb.FriendAcceptResp{
|
||||||
IsSucc: true,
|
IsSucc: true,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAccept, resp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeAccept, resp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
|
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
|
||||||
&pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 2}, req.Uid)
|
&pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 2}, req.Uid)
|
||||||
|
@ -35,13 +35,19 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
|
|||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
self = this.module.modelFriend.GetFriend(uid)
|
self = this.module.modelFriend.GetFriend(uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
target = this.module.modelFriend.GetFriend(req.FriendId)
|
target = this.module.modelFriend.GetFriend(req.FriendId)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
code = pb.ErrorCode_FriendTargetNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendTargetNoData,
|
||||||
|
Title: pb.ErrorCode_FriendTargetNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,19 +59,28 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
|
|||||||
|
|
||||||
//判断目标是否已经在黑名单中
|
//判断目标是否已经在黑名单中
|
||||||
if _, ok := utils.Findx(self.BlackIds, req.FriendId); ok {
|
if _, ok := utils.Findx(self.BlackIds, req.FriendId); ok {
|
||||||
code = pb.ErrorCode_FriendSelfBlackYet
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfBlackYet,
|
||||||
|
Title: pb.ErrorCode_FriendSelfBlackYet.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断自己是否在对方的黑名单中
|
// 判断自己是否在对方的黑名单中
|
||||||
if _, ok := utils.Findx(target.BlackIds, self.Uid); ok {
|
if _, ok := utils.Findx(target.BlackIds, self.Uid); ok {
|
||||||
code = pb.ErrorCode_FriendTargetBlackYet
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendTargetBlackYet,
|
||||||
|
Title: pb.ErrorCode_FriendTargetBlackYet.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否黑名单人数已满
|
// 判断是否黑名单人数已满
|
||||||
if len(self.BlackIds) >= int(this.module.globalConf.FriendBlack) {
|
if len(self.BlackIds) >= int(this.module.globalConf.FriendBlack) {
|
||||||
code = pb.ErrorCode_FriendBlackMax
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendBlackMax,
|
||||||
|
Title: pb.ErrorCode_FriendBlackMax.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,10 +113,7 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
|
|||||||
FriendId: req.FriendId,
|
FriendId: req.FriendId,
|
||||||
UserId: session.GetUserId(),
|
UserId: session.GetUserId(),
|
||||||
}
|
}
|
||||||
if err = session.SendMsg(string(this.module.GetType()), FriendSubTypeAddBlack, Resp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeAddBlack, Resp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,11 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (e
|
|||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
self = this.module.modelFriend.GetFriend(uid)
|
self = this.module.modelFriend.GetFriend(uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +93,11 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (e
|
|||||||
//双向添加:将自己加入到申请人的好友列表中
|
//双向添加:将自己加入到申请人的好友列表中
|
||||||
target = this.module.modelFriend.GetFriend(userId)
|
target = this.module.modelFriend.GetFriend(userId)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
code = pb.ErrorCode_FriendTargetNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendTargetNoData,
|
||||||
|
Title: pb.ErrorCode_FriendTargetNoData.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
target.ApplyIds = utils.DeleteString(target.ApplyIds, self.Uid)
|
target.ApplyIds = utils.DeleteString(target.ApplyIds, self.Uid)
|
||||||
@ -155,9 +163,6 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (e
|
|||||||
resp := &pb.FriendAgreeResp{
|
resp := &pb.FriendAgreeResp{
|
||||||
Num: optNum,
|
Num: optNum,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAgree, resp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeAgree, resp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -35,58 +35,85 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (e
|
|||||||
|
|
||||||
//判断是否是自己
|
//判断是否是自己
|
||||||
if req.FriendId == uid {
|
if req.FriendId == uid {
|
||||||
code = pb.ErrorCode_FriendNotSelf
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendNotSelf,
|
||||||
|
Title: pb.ErrorCode_FriendNotSelf.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
self = this.module.modelFriend.GetFriend(uid)
|
self = this.module.modelFriend.GetFriend(uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
globalConf := this.module.globalConf
|
globalConf := this.module.globalConf
|
||||||
//判断是否超过最大好友数量
|
//判断是否超过最大好友数量
|
||||||
if len(self.FriendIds) >= int(globalConf.FriendMaxnum) {
|
if len(self.FriendIds) >= int(globalConf.FriendMaxnum) {
|
||||||
code = pb.ErrorCode_FriendSelfMax
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfMax,
|
||||||
|
Title: pb.ErrorCode_FriendSelfMax.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断是否是好友
|
//判断是否是好友
|
||||||
if _, ok := utils.Find(self.FriendIds, req.FriendId); ok {
|
if _, ok := utils.Find(self.FriendIds, req.FriendId); ok {
|
||||||
code = pb.ErrorCode_FriendYet
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendYet,
|
||||||
|
Title: pb.ErrorCode_FriendYet.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取好友数据
|
//获取好友数据
|
||||||
target = this.module.modelFriend.GetFriend(req.FriendId)
|
target = this.module.modelFriend.GetFriend(req.FriendId)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
code = pb.ErrorCode_FriendTargetNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendTargetNoData,
|
||||||
|
Title: pb.ErrorCode_FriendTargetNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断自己是否在目标用户的申请列表中
|
//判断自己是否在目标用户的申请列表中
|
||||||
if _, ok := utils.Find(target.ApplyIds, self.Uid); ok {
|
if _, ok := utils.Find(target.ApplyIds, self.Uid); ok {
|
||||||
code = pb.ErrorCode_FriendApplyYet
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendApplyYet,
|
||||||
|
Title: pb.ErrorCode_FriendApplyYet.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断对方是否也超过最大好友数量
|
//判断对方是否也超过最大好友数量
|
||||||
if len(target.FriendIds) >= int(globalConf.FriendMaxnum) {
|
if len(target.FriendIds) >= int(globalConf.FriendMaxnum) {
|
||||||
code = pb.ErrorCode_FriendTargetMax
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendTargetMax,
|
||||||
|
Title: pb.ErrorCode_FriendTargetMax.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断目标用户是否在黑名单中
|
//判断目标用户是否在黑名单中
|
||||||
if _, ok := utils.Find(self.BlackIds, req.FriendId); ok {
|
if _, ok := utils.Find(self.BlackIds, req.FriendId); ok {
|
||||||
code = pb.ErrorCode_FriendSelfBlackYet
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfBlackYet,
|
||||||
|
Title: pb.ErrorCode_FriendSelfBlackYet.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断是否在对方的黑名单中
|
//判断是否在对方的黑名单中
|
||||||
if _, ok := utils.Find(target.BlackIds, self.Uid); ok {
|
if _, ok := utils.Find(target.BlackIds, self.Uid); ok {
|
||||||
code = pb.ErrorCode_FriendTargetBlackYet
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendTargetBlackYet,
|
||||||
|
Title: pb.ErrorCode_FriendTargetBlackYet.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +126,10 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (e
|
|||||||
if err = this.module.modelFriend.Change(req.FriendId, map[string]interface{}{
|
if err = this.module.modelFriend.Change(req.FriendId, map[string]interface{}{
|
||||||
"applyIds": target.ApplyIds,
|
"applyIds": target.ApplyIds,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
code = pb.ErrorCode_FriendApplyError
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendApplyError,
|
||||||
|
Title: pb.ErrorCode_FriendApplyError.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("好友申请",
|
this.module.Error("好友申请",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "params", Value: req.FriendId},
|
log.Field{Key: "params", Value: req.FriendId},
|
||||||
@ -113,9 +143,6 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (e
|
|||||||
FriendId: req.FriendId,
|
FriendId: req.FriendId,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeApply, resp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeApply, resp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,10 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyLis
|
|||||||
|
|
||||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,9 +37,7 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyLis
|
|||||||
List: list,
|
List: list,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeApplyList, resp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeApplyList, resp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -42,14 +42,20 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
|
|||||||
}
|
}
|
||||||
|
|
||||||
if hero == nil {
|
if hero == nil {
|
||||||
code = pb.ErrorCode_HeroNoExist
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroNoExist,
|
||||||
|
Title: pb.ErrorCode_HeroNoExist.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
self := this.module.modelFriend.GetFriend(uid)
|
self := this.module.modelFriend.GetFriend(uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +70,10 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := this.module.modelFriend.Change(self.Uid, update); err != nil {
|
if err := this.module.modelFriend.Change(self.Uid, update); err != nil {
|
||||||
code = pb.ErrorCode_FriendApplyError
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendApplyError,
|
||||||
|
Title: pb.ErrorCode_FriendApplyError.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("设置助战英雄",
|
this.module.Error("设置助战英雄",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "params", Value: req.HeroObjId},
|
log.Field{Key: "params", Value: req.HeroObjId},
|
||||||
@ -75,7 +84,6 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
|
|||||||
|
|
||||||
rsp := &pb.FriendAssistheroResp{HeroObjId: req.HeroObjId, Received: received}
|
rsp := &pb.FriendAssistheroResp{HeroObjId: req.HeroObjId, Received: received}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAssistHero, rsp); err != nil {
|
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAssistHero, rsp); err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,10 @@ func (this *apiComp) AssistHeroList(session comm.IUserSession, req *pb.FriendAss
|
|||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
self := this.module.modelFriend.GetFriend(session.GetUserId())
|
self := this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,9 +33,7 @@ func (this *apiComp) AssistHeroList(session comm.IUserSession, req *pb.FriendAss
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAssistHeroList, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeAssistHeroList, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,10 @@ func (this *apiComp) Assistlist(session comm.IUserSession, req *pb.FriendAssistl
|
|||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
self := this.module.modelFriend.GetFriend(session.GetUserId())
|
self := this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,8 +67,6 @@ func (this *apiComp) Assistlist(session comm.IUserSession, req *pb.FriendAssistl
|
|||||||
HeroObjId: self.AssistHeroId,
|
HeroObjId: self.AssistHeroId,
|
||||||
Record: self.Record,
|
Record: self.Record,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAssistlist, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeAssistlist, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,10 @@ func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackLis
|
|||||||
|
|
||||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,10 +36,7 @@ func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackLis
|
|||||||
Friends: list,
|
Friends: list,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := session.SendMsg(string(this.module.GetType()), FriendSubTypeBlacklist, resp)
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeBlacklist, resp)
|
||||||
if err != nil {
|
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,10 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (errda
|
|||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
self := this.module.modelFriend.GetFriend(uid)
|
self := this.module.modelFriend.GetFriend(uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,13 +45,19 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (errda
|
|||||||
log.Field{Key: "params", Value: req.String()},
|
log.Field{Key: "params", Value: req.String()},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
log.Field{Key: "err", Value: err.Error()},
|
||||||
)
|
)
|
||||||
code = pb.ErrorCode_FriendApplyError
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendApplyError,
|
||||||
|
Title: pb.ErrorCode_FriendApplyError.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
target := this.module.modelFriend.GetFriend(req.FriendId)
|
target := this.module.modelFriend.GetFriend(req.FriendId)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
code = pb.ErrorCode_FriendNotSelf
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendNotSelf,
|
||||||
|
Title: pb.ErrorCode_FriendNotSelf.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +67,10 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (errda
|
|||||||
if err := this.module.modelFriend.Change(req.FriendId, map[string]interface{}{
|
if err := this.module.modelFriend.Change(req.FriendId, map[string]interface{}{
|
||||||
"friendIds": targetFriendIds,
|
"friendIds": targetFriendIds,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
code = pb.ErrorCode_FriendApplyError
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendApplyError,
|
||||||
|
Title: pb.ErrorCode_FriendApplyError.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("删除好友",
|
this.module.Error("删除好友",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "params", Value: req.FriendId},
|
log.Field{Key: "params", Value: req.FriendId},
|
||||||
@ -67,9 +79,7 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (errda
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeDel, &pb.FriendDelResp{FriendId: req.FriendId, UserId: self.Uid}); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeDel, &pb.FriendDelResp{FriendId: req.FriendId, UserId: self.Uid})
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,10 @@ func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackR
|
|||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,9 +60,6 @@ func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackR
|
|||||||
UserId: session.GetUserId(),
|
UserId: session.GetUserId(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeDelBlack, resp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeDelBlack, resp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -26,13 +26,19 @@ func (this *apiComp) GetRelation(session comm.IUserSession, req *pb.FriendGetRel
|
|||||||
|
|
||||||
self := this.module.modelFriend.GetFriend(session.GetUserId())
|
self := this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
target := this.module.modelFriend.GetFriend(req.TargetUid)
|
target := this.module.modelFriend.GetFriend(req.TargetUid)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
code = pb.ErrorCode_FriendTargetNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendTargetNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var status bool
|
var status bool
|
||||||
@ -51,9 +57,6 @@ func (this *apiComp) GetRelation(session comm.IUserSession, req *pb.FriendGetRel
|
|||||||
TargetUid: req.TargetUid,
|
TargetUid: req.TargetUid,
|
||||||
Status: status,
|
Status: status,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeRelation, resp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeRelation, resp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,18 @@ func (this *apiComp) Getreward(session comm.IUserSession, req *pb.FriendGetrewar
|
|||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
self := this.module.modelFriend.GetFriend(uid)
|
self := this.module.modelFriend.GetFriend(uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.Received != 1 {
|
if self.Received != 1 {
|
||||||
code = pb.ErrorCode_FriendNoreceived
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendNoreceived,
|
||||||
|
Title: pb.ErrorCode_FriendNoreceived.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +36,10 @@ func (this *apiComp) Getreward(session comm.IUserSession, req *pb.FriendGetrewar
|
|||||||
"received": received,
|
"received": received,
|
||||||
}
|
}
|
||||||
if err := this.module.modelFriend.Change(self.Uid, update); err != nil {
|
if err := this.module.modelFriend.Change(self.Uid, update); err != nil {
|
||||||
code = pb.ErrorCode_FriendApplyError
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendApplyError,
|
||||||
|
Title: pb.ErrorCode_FriendApplyError.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("领奖",
|
this.module.Error("领奖",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
log.Field{Key: "err", Value: err.Error()},
|
||||||
@ -43,16 +52,13 @@ func (this *apiComp) Getreward(session comm.IUserSession, req *pb.FriendGetrewar
|
|||||||
this.module.Error("好友领奖励",
|
this.module.Error("好友领奖励",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "reward", Value: globalConf.FriendPeize},
|
log.Field{Key: "reward", Value: globalConf.FriendPeize},
|
||||||
log.Field{Key: "code", Value: code},
|
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
rsp := &pb.FriendGetrewardResp{Received: int32(received)}
|
rsp := &pb.FriendGetrewardResp{Received: int32(received)}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), "getreward", rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), "getreward", rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,10 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.FriendListReq) (err
|
|||||||
|
|
||||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,10 +61,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.FriendListReq) (err
|
|||||||
resp := &pb.FriendListResp{
|
resp := &pb.FriendListResp{
|
||||||
List: list,
|
List: list,
|
||||||
}
|
}
|
||||||
err := session.SendMsg(string(this.module.GetType()), FriendSubTypeList, resp)
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeList, resp)
|
||||||
if err != nil {
|
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,10 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.FriendQiecuoReq)
|
|||||||
|
|
||||||
//目标是否在线
|
//目标是否在线
|
||||||
if !this.module.ModuleUser.IsOnline(req.TargetUid) {
|
if !this.module.ModuleUser.IsOnline(req.TargetUid) {
|
||||||
code = pb.ErrorCode_UserOffline
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_UserOffline,
|
||||||
|
Title: pb.ErrorCode_UserOffline.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +35,12 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.FriendQiecuoReq)
|
|||||||
if err := this.module.ModelFriendQiecuo.qiecuoReq(session.GetUserId(), req.TargetUid); err != nil {
|
if err := this.module.ModelFriendQiecuo.qiecuoReq(session.GetUserId(), req.TargetUid); err != nil {
|
||||||
var customErr = new(comm.CustomError)
|
var customErr = new(comm.CustomError)
|
||||||
if errors.As(err, &customErr) {
|
if errors.As(err, &customErr) {
|
||||||
code = customErr.Code
|
code := customErr.Code
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: code,
|
||||||
|
Title: code.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
@ -47,10 +55,8 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.FriendQiecuoReq)
|
|||||||
TargetUid: req.TargetUid,
|
TargetUid: req.TargetUid,
|
||||||
Uid: session.GetUserId(),
|
Uid: session.GetUserId(),
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeQiecuo, resp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeQiecuo, resp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
|
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
|
||||||
&pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 1}, req.TargetUid)
|
&pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 1}, req.TargetUid)
|
||||||
|
|
||||||
|
@ -18,7 +18,10 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
|
|||||||
// 当前玩家好友数据
|
// 当前玩家好友数据
|
||||||
self := this.module.modelFriend.GetFriend(session.GetUserId())
|
self := this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +52,10 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
|
|||||||
//检查目标v中的申请列表中是否有自己,
|
//检查目标v中的申请列表中是否有自己,
|
||||||
target := this.module.modelFriend.GetFriend(v.Uid)
|
target := this.module.modelFriend.GetFriend(v.Uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _, ok := utils.Findx(target.ApplyIds, self.Uid); ok {
|
if _, ok := utils.Findx(target.ApplyIds, self.Uid); ok {
|
||||||
@ -106,10 +112,7 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
|
|||||||
rsp := &pb.FriendRandlistResp{
|
rsp := &pb.FriendRandlistResp{
|
||||||
List: userList,
|
List: userList,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeRandList, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeRandList, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,10 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq)
|
|||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
self = this.module.modelFriend.GetFriend(uid)
|
self = this.module.modelFriend.GetFriend(uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,11 +78,8 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq)
|
|||||||
Num: optNum,
|
Num: optNum,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := session.SendMsg(string(this.module.GetType()), FriendSubTypeRefuse, resp)
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeRefuse, resp)
|
||||||
if err != nil {
|
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,10 @@ import (
|
|||||||
// 搜索
|
// 搜索
|
||||||
func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.FriendSearchReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.FriendSearchReq) (errdata *pb.ErrorData) {
|
||||||
if req.NickName == "" {
|
if req.NickName == "" {
|
||||||
code = pb.ErrorCode_FriendSearchNameEmpty
|
errdata = &pb.ErrorData{
|
||||||
this.module.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
|
Code: pb.ErrorCode_FriendSearchNameEmpty,
|
||||||
|
Title: pb.ErrorCode_FriendSearchNameEmpty.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@ -64,9 +66,7 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq)
|
|||||||
resp.Friends = append(resp.Friends, base)
|
resp.Friends = append(resp.Friends, base)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeSearch, resp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeSearch, resp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,7 @@ func (this *apiComp) Stop(session comm.IUserSession, req *pb.FriendStopReq) (err
|
|||||||
resp := &pb.FriendStopResp{
|
resp := &pb.FriendStopResp{
|
||||||
IsSucc: true,
|
IsSucc: true,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), "stop", resp); err != nil {
|
session.SendMsg(string(this.module.GetType()), "stop", resp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
|
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
|
||||||
&pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 3}, req.Uid)
|
&pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 3}, req.Uid)
|
||||||
return
|
return
|
||||||
|
@ -36,7 +36,10 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (errda
|
|||||||
// 不能给自己点赞
|
// 不能给自己点赞
|
||||||
for _, v := range req.FriendIds {
|
for _, v := range req.FriendIds {
|
||||||
if v == selfId {
|
if v == selfId {
|
||||||
code = pb.ErrorCode_FriendZanSelf
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendZanSelf,
|
||||||
|
Title: pb.ErrorCode_FriendZanSelf.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,7 +51,10 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (errda
|
|||||||
for _, v := range req.FriendIds {
|
for _, v := range req.FriendIds {
|
||||||
target = this.module.modelFriend.GetFriend(v)
|
target = this.module.modelFriend.GetFriend(v)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +94,11 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (errda
|
|||||||
|
|
||||||
// 今日送出的友情点是否达到上限
|
// 今日送出的友情点是否达到上限
|
||||||
if ue.FriendPointOD >= this.module.globalConf.FriendMaxsendnum {
|
if ue.FriendPointOD >= this.module.globalConf.FriendMaxsendnum {
|
||||||
code = pb.ErrorCode_FriendPointLimit
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendPointLimit,
|
||||||
|
Title: pb.ErrorCode_FriendPointLimit.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,10 +118,7 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (errda
|
|||||||
Flag: true,
|
Flag: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeZan, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeZan, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 赠送X次友情点
|
// 赠送X次友情点
|
||||||
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype11, 1)
|
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype11, 1)
|
||||||
|
@ -23,7 +23,10 @@ func (this *apiComp) Zanlist(session comm.IUserSession, req *pb.FriendZanlistReq
|
|||||||
|
|
||||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,10 +40,7 @@ func (this *apiComp) Zanlist(session comm.IUserSession, req *pb.FriendZanlistReq
|
|||||||
rsp := &pb.FriendZanlistResp{
|
rsp := &pb.FriendZanlistResp{
|
||||||
List: list,
|
List: list,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeZanList, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeZanList, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,10 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece
|
|||||||
|
|
||||||
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendSelfNoData,
|
||||||
|
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +76,10 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece
|
|||||||
|
|
||||||
// 今日获赠的友情点是否达到上限
|
// 今日获赠的友情点是否达到上限
|
||||||
if ue.FriendPointID >= int32(this.module.globalConf.FriendMaxgetnum) {
|
if ue.FriendPointID >= int32(this.module.globalConf.FriendMaxgetnum) {
|
||||||
code = pb.ErrorCode_FriendPointLimit
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_FriendPointLimit,
|
||||||
|
Title: pb.ErrorCode_FriendPointLimit.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,11 +96,8 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeZanreceive,
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeZanreceive,
|
||||||
&pb.FriendZanreceiveResp{Flag: true}); err != nil {
|
&pb.FriendZanreceiveResp{Flag: true})
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user