公会errordata
This commit is contained in:
parent
6eb2a1b45e
commit
355c63a42e
@ -15,14 +15,13 @@ func (this *apiComp) Formation(session comm.IUserSession, req *pb.SociatyBFormat
|
|||||||
if errdata = this.FormationCheck(session, req); errdata != nil {
|
if errdata = this.FormationCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
user := this.module.ModuleUser.GetUser(uid)
|
user := this.module.ModuleUser.GetUser(uid)
|
||||||
if user == nil {
|
if user == nil {
|
||||||
this.module.Error("GetRemoteUser",
|
this.module.Error("GetRemoteUser",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
)
|
)
|
||||||
code = pb.ErrorCode_UserSessionNobeing
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,30 +30,37 @@ func (this *apiComp) Formation(session comm.IUserSession, req *pb.SociatyBFormat
|
|||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
|
||||||
}
|
}
|
||||||
data.Title = code.ToString()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//检验第二队或第三队是否达到解锁条件
|
//检验第二队或第三队是否达到解锁条件
|
||||||
if _, ok := req.Teams[2]; ok {
|
if _, ok := req.Teams[2]; ok {
|
||||||
if user.Lv < ggd.GuildBossTroop2 {
|
if user.Lv < ggd.GuildBossTroop2 {
|
||||||
code = pb.ErrorCode_SociatyTeamUnlock
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyTeamUnlock,
|
||||||
|
Title: pb.ErrorCode_SociatyTeamUnlock.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if _, ok := req.Teams[3]; ok {
|
if _, ok := req.Teams[3]; ok {
|
||||||
if user.Lv < ggd.GuildBossTroop3 {
|
if user.Lv < ggd.GuildBossTroop3 {
|
||||||
code = pb.ErrorCode_SociatyTeamUnlock
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyTeamUnlock,
|
||||||
|
Title: pb.ErrorCode_SociatyTeamUnlock.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -73,8 +79,6 @@ func (this *apiComp) Formation(session comm.IUserSession, req *pb.SociatyBFormat
|
|||||||
SociatyId: sociaty.Id,
|
SociatyId: sociaty.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeFormation, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeFormation, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,15 @@ func (this *apiComp) Accuse(session comm.IUserSession, req *pb.SociatyAccuseReq)
|
|||||||
if errdata = this.AccuseCheck(session, req); errdata != nil {
|
if errdata = this.AccuseCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
data.Datastring = uid
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
data.Message = SociatyNoFound
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,14 +34,17 @@ func (this *apiComp) Accuse(session comm.IUserSession, req *pb.SociatyAccuseReq)
|
|||||||
pb.SociatyJob_VICEPRESIDENT,
|
pb.SociatyJob_VICEPRESIDENT,
|
||||||
pb.SociatyJob_ADMIN,
|
pb.SociatyJob_ADMIN,
|
||||||
pb.SociatyJob_MEMBER) {
|
pb.SociatyJob_MEMBER) {
|
||||||
code = pb.ErrorCode_SociatyNoRight
|
errdata = &pb.ErrorData{
|
||||||
data.Message = SociatyNoRight
|
Code: pb.ErrorCode_SociatyNoRight,
|
||||||
|
Title: pb.ErrorCode_SociatyNoRight.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 弹劾
|
// 弹劾
|
||||||
if err := this.module.modelSociaty.accuse(sociaty); err != nil {
|
if err := this.module.modelSociaty.accuse(sociaty); err != nil {
|
||||||
var customErr = new(comm.CustomError)
|
var customErr = new(comm.CustomError)
|
||||||
|
var code pb.ErrorCode
|
||||||
if errors.As(err, &customErr) {
|
if errors.As(err, &customErr) {
|
||||||
code = customErr.Code
|
code = customErr.Code
|
||||||
} else {
|
} else {
|
||||||
@ -49,7 +54,12 @@ func (this *apiComp) Accuse(session comm.IUserSession, req *pb.SociatyAccuseReq)
|
|||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.Datastring = sociaty.Id
|
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: code,
|
||||||
|
Title: code.ToString(),
|
||||||
|
Datastring: sociaty.Id,
|
||||||
|
}
|
||||||
this.module.Error("弹劾",
|
this.module.Error("弹劾",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
||||||
@ -62,8 +72,6 @@ func (this *apiComp) Accuse(session comm.IUserSession, req *pb.SociatyAccuseReq)
|
|||||||
SociatyId: sociaty.Id,
|
SociatyId: sociaty.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeAccuse, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeAccuse, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,14 @@ func (this *apiComp) ActivitylistCheck(session comm.IUserSession, req *pb.Sociat
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *apiComp) Activitylist(session comm.IUserSession, req *pb.SociatyActivityListReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) Activitylist(session comm.IUserSession, req *pb.SociatyActivityListReq) (errdata *pb.ErrorData) {
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
data.Datastring = uid
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
data.Message = SociatyNoFound
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,9 +38,7 @@ func (this *apiComp) Activitylist(session comm.IUserSession, req *pb.SociatyActi
|
|||||||
rsp.List = activityList
|
rsp.List = activityList
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeActivityList, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeActivityList, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -23,12 +23,15 @@ func (this *apiComp) Activityreceive(session comm.IUserSession, req *pb.SociatyA
|
|||||||
if errdata = this.ActivityreceiveCheck(session, req); errdata != nil {
|
if errdata = this.ActivityreceiveCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +40,10 @@ func (this *apiComp) Activityreceive(session comm.IUserSession, req *pb.SociatyA
|
|||||||
for _, v := range sociatyTask.ActivityList {
|
for _, v := range sociatyTask.ActivityList {
|
||||||
if v.Id == req.Id {
|
if v.Id == req.Id {
|
||||||
if v.Status == 1 {
|
if v.Status == 1 {
|
||||||
code = pb.ErrorCode_SociatyRewardReceived
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyRewardReceived,
|
||||||
|
Title: pb.ErrorCode_SociatyRewardReceived.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -49,16 +55,17 @@ func (this *apiComp) Activityreceive(session comm.IUserSession, req *pb.SociatyA
|
|||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//是否满足领取条件
|
//是否满足领取条件
|
||||||
if sociaty.Activity < conf.Activity {
|
if sociaty.Activity < conf.Activity {
|
||||||
code = pb.ErrorCode_SociatyActivityNoEnough
|
errdata = &pb.ErrorData{
|
||||||
data.Datastring = uid
|
Code: pb.ErrorCode_SociatyActivityNoEnough,
|
||||||
data.Message = fmt.Sprintf("活跃度不足 实际:%d 期望:%d", sociaty.Activity, conf.Activity)
|
Title: pb.ErrorCode_SociatyActivityNoEnough.ToString(),
|
||||||
|
Message: fmt.Sprintf("活跃度不足 实际:%d 期望:%d", sociaty.Activity, conf.Activity),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,8 +85,6 @@ func (this *apiComp) Activityreceive(session comm.IUserSession, req *pb.SociatyA
|
|||||||
SociatyId: sociaty.Id,
|
SociatyId: sociaty.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeActivityReceive, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeActivityReceive, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -24,14 +24,14 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (
|
|||||||
if errdata = this.AgreeCheck(session, req); errdata != nil {
|
if errdata = this.AgreeCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
data.Datastring = uid
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
data.Message = SociatyNoFound
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,14 +40,16 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (
|
|||||||
pb.SociatyJob_PRESIDENT,
|
pb.SociatyJob_PRESIDENT,
|
||||||
pb.SociatyJob_VICEPRESIDENT,
|
pb.SociatyJob_VICEPRESIDENT,
|
||||||
pb.SociatyJob_ADMIN) {
|
pb.SociatyJob_ADMIN) {
|
||||||
code = pb.ErrorCode_SociatyNoRight
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyNoRight,
|
||||||
data.Message = SociatyNoRight
|
Title: pb.ErrorCode_SociatyNoRight.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := this.module.modelSociaty.agree(req.Uid, sociaty); err != nil {
|
if err := this.module.modelSociaty.agree(req.Uid, sociaty); err != nil {
|
||||||
var customError = new(comm.CustomError)
|
var customError = new(comm.CustomError)
|
||||||
|
var code pb.ErrorCode
|
||||||
if errors.As(err, &customError) {
|
if errors.As(err, &customError) {
|
||||||
code = customError.Code
|
code = customError.Code
|
||||||
} else {
|
} else {
|
||||||
@ -57,8 +59,11 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (
|
|||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.Title = code.ToString()
|
errdata = &pb.ErrorData{
|
||||||
data.Message = err.Error()
|
Code: code,
|
||||||
|
Title: code.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
this.module.Error("公会审核-同意",
|
this.module.Error("公会审核-同意",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "申请人", Value: req.Uid},
|
log.Field{Key: "申请人", Value: req.Uid},
|
||||||
@ -84,10 +89,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (
|
|||||||
SociatyId: sociaty.Id,
|
SociatyId: sociaty.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeAgree, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeAgree, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//审核通过推送给申请人
|
//审核通过推送给申请人
|
||||||
if err := this.module.SendMsgToUser(string(this.module.GetType()), "pagree", &pb.SociatyPAgreePush{
|
if err := this.module.SendMsgToUser(string(this.module.GetType()), "pagree", &pb.SociatyPAgreePush{
|
||||||
|
@ -27,15 +27,14 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
|
|
||||||
sociaty := this.module.modelSociaty.getSociaty(req.SociatyId)
|
sociaty := this.module.modelSociaty.getSociaty(req.SociatyId)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
data.Datastring = req.SociatyId
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
this.module.Error("公会未找到", log.Field{Key: "uid", Value: uid}, log.Field{Key: "sociatyId", Value: req.SociatyId})
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,58 +42,69 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
|
|||||||
userEx, err := this.module.ModuleUser.GetUserExpand(uid)
|
userEx, err := this.module.ModuleUser.GetUserExpand(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.module.Error("GetRemoteUserExpand", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
|
this.module.Error("GetRemoteUserExpand", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
|
||||||
code = pb.ErrorCode_UserNofound
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_UserNofound,
|
||||||
data.Datastring = uid
|
Title: pb.ErrorCode_UserNofound.ToString(),
|
||||||
data.Message = err.Error()
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if utils.IsInCDHour(userEx.SociatyCd) {
|
if utils.IsInCDHour(userEx.SociatyCd) {
|
||||||
code = pb.ErrorCode_SociatyCDLimit
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyCDLimit,
|
||||||
data.Message = fmt.Sprintf("CD内[%v]不允许申请", userEx.SociatyCd)
|
Title: pb.ErrorCode_SociatyCDLimit.ToString(),
|
||||||
|
Message: fmt.Sprintf("CD内[%v]不允许申请", userEx.SociatyCd),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 是否公会成员
|
// 是否公会成员
|
||||||
if this.module.modelSociaty.isMember(uid, sociaty) {
|
if this.module.modelSociaty.isMember(uid, sociaty) {
|
||||||
code = pb.ErrorCode_SociatyBelongTo
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyBelongTo,
|
||||||
data.Datastring = sociaty.Id
|
Title: pb.ErrorCode_SociatyBelongTo.ToString(),
|
||||||
data.Message = fmt.Sprintf("[%v]已经是公会[%v]成员", uid, sociaty.Name)
|
Message: fmt.Sprintf("[%v]已经是公会[%v]成员", uid, sociaty.Name),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user := this.module.ModuleUser.GetUser(uid)
|
user := this.module.ModuleUser.GetUser(uid)
|
||||||
if user == nil {
|
if user == nil {
|
||||||
code = pb.ErrorCode_UserNofound
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_UserNofound,
|
||||||
data.Datastring = uid
|
Title: pb.ErrorCode_UserNofound.ToString(),
|
||||||
|
Datastring: uid,
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 是否达到入会等级
|
// 是否达到入会等级
|
||||||
if user.Lv < sociaty.ApplyLv {
|
if user.Lv < sociaty.ApplyLv {
|
||||||
code = pb.ErrorCode_SociatyAppyLvNoEnough
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyAppyLvNoEnough,
|
||||||
data.Message = fmt.Sprintf("实际等级:%v 期望等级:%v", user.Lv, sociaty.ApplyLv)
|
Title: pb.ErrorCode_SociatyAppyLvNoEnough.ToString(),
|
||||||
|
Message: fmt.Sprintf("实际等级:%v 期望等级:%v", user.Lv, sociaty.ApplyLv),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 是否已申请
|
// 是否已申请
|
||||||
if this.module.modelSociaty.isApplied(uid, sociaty) {
|
if this.module.modelSociaty.isApplied(uid, sociaty) {
|
||||||
code = pb.ErrorCode_SociatyApplied
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyApplied,
|
||||||
data.Message = fmt.Sprintf("[%v]已申请", sociaty.Name)
|
Title: pb.ErrorCode_SociatyApplied.ToString(),
|
||||||
|
Message: fmt.Sprintf("[%v]已申请", sociaty.Name),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断申请人数是否超出最大允许申请数
|
//判断申请人数是否超出最大允许申请数
|
||||||
if len(sociaty.ApplyRecord) >= int(this.module.globalConf.GuildAcceptApplyMax) {
|
if len(sociaty.ApplyRecord) >= int(this.module.globalConf.GuildAcceptApplyMax) {
|
||||||
code = pb.ErrorCode_SociatyApplyMax
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyApplyMax,
|
||||||
data.Message = fmt.Sprintf("实际人数:%d 期望人数:%d", len(sociaty.ApplyRecord), int(this.module.globalConf.GuildAcceptApplyMax))
|
Title: pb.ErrorCode_SociatyApplyMax.ToString(),
|
||||||
|
Message: fmt.Sprintf("实际人数:%d 期望人数:%d", len(sociaty.ApplyRecord), int(this.module.globalConf.GuildAcceptApplyMax)),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +112,7 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
|
|||||||
isCheck, err := this.module.modelSociaty.apply(uid, sociaty)
|
isCheck, err := this.module.modelSociaty.apply(uid, sociaty)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var customError = new(comm.CustomError)
|
var customError = new(comm.CustomError)
|
||||||
|
var code pb.ErrorCode
|
||||||
if errors.As(err, &customError) {
|
if errors.As(err, &customError) {
|
||||||
code = customError.Code
|
code = customError.Code
|
||||||
} else {
|
} else {
|
||||||
@ -111,8 +122,11 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
|
|||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.Title = code.ToString()
|
errdata = &pb.ErrorData{
|
||||||
data.Message = err.Error()
|
Code: code,
|
||||||
|
Title: code.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
this.module.Error("公会申请",
|
this.module.Error("公会申请",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "sociatyId", Value: req.SociatyId},
|
log.Field{Key: "sociatyId", Value: req.SociatyId},
|
||||||
@ -130,8 +144,6 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
|
|||||||
Uid: uid,
|
Uid: uid,
|
||||||
ScoiatyId: req.SociatyId,
|
ScoiatyId: req.SociatyId,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeApply, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeApply, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -23,14 +23,15 @@ func (this *apiComp) ApplyCancel(session comm.IUserSession, req *pb.SociatyApply
|
|||||||
if errdata = this.ApplyCancelCheck(session, req); errdata != nil {
|
if errdata = this.ApplyCancelCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
|
|
||||||
sociaty := this.module.modelSociaty.getSociaty(req.SociatyId)
|
sociaty := this.module.modelSociaty.getSociaty(req.SociatyId)
|
||||||
if sociaty != nil && sociaty.Id == "" {
|
if sociaty != nil && sociaty.Id == "" {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
this.module.Error("公会未找到", log.Field{Key: "uid", Value: uid}, log.Field{Key: "sociatyId", Value: req.SociatyId})
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,8 +53,6 @@ func (this *apiComp) ApplyCancel(session comm.IUserSession, req *pb.SociatyApply
|
|||||||
Uid: uid,
|
Uid: uid,
|
||||||
ScoiatyId: req.SociatyId,
|
ScoiatyId: req.SociatyId,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeApplyCanel, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeApplyCanel, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -23,15 +23,14 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.SociatyApplyLi
|
|||||||
if errdata = this.ApplyListCheck(session, req); errdata != nil {
|
if errdata = this.ApplyListCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getSociaty(req.SociatyId)
|
sociaty := this.module.modelSociaty.getSociaty(req.SociatyId)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
this.module.Error("公会未找到",
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
log.Field{Key: "uid", Value: uid},
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
log.Field{Key: "sociatyId", Value: req.SociatyId},
|
}
|
||||||
)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +39,10 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.SociatyApplyLi
|
|||||||
pb.SociatyJob_PRESIDENT,
|
pb.SociatyJob_PRESIDENT,
|
||||||
pb.SociatyJob_VICEPRESIDENT,
|
pb.SociatyJob_VICEPRESIDENT,
|
||||||
pb.SociatyJob_ADMIN) {
|
pb.SociatyJob_ADMIN) {
|
||||||
code = pb.ErrorCode_SociatyNoRight
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoRight,
|
||||||
|
Title: pb.ErrorCode_SociatyNoRight.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,8 +50,6 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.SociatyApplyLi
|
|||||||
rsp := &pb.SociatyApplyListResp{
|
rsp := &pb.SociatyApplyListResp{
|
||||||
List: list,
|
List: list,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeApplyList, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeApplyList, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ func (this *apiComp) Assign(session comm.IUserSession, req *pb.SociatyAssignReq)
|
|||||||
if errdata = this.AssignCheck(session, req); errdata != nil {
|
if errdata = this.AssignCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
if uid == req.TargetId {
|
if uid == req.TargetId {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
@ -36,20 +36,28 @@ func (this *apiComp) Assign(session comm.IUserSession, req *pb.SociatyAssignReq)
|
|||||||
|
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验权限
|
// 校验权限
|
||||||
if !this.module.modelSociaty.isRight(uid, sociaty, pb.SociatyJob_PRESIDENT) {
|
if !this.module.modelSociaty.isRight(uid, sociaty, pb.SociatyJob_PRESIDENT) {
|
||||||
code = pb.ErrorCode_SociatyNoRight
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoRight,
|
||||||
|
Title: pb.ErrorCode_SociatyNoRight.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验目标是否公会成员
|
// 校验目标是否公会成员
|
||||||
if !this.module.modelSociaty.isMember(req.TargetId, sociaty) {
|
if !this.module.modelSociaty.isMember(req.TargetId, sociaty) {
|
||||||
code = pb.ErrorCode_SociatyNoMember
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoMember,
|
||||||
|
Title: pb.ErrorCode_SociatyNoMember.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,6 +81,7 @@ func (this *apiComp) Assign(session comm.IUserSession, req *pb.SociatyAssignReq)
|
|||||||
if err := this.module.modelSociatyLog.addLog(Log_Job, sociaty.Id,
|
if err := this.module.modelSociatyLog.addLog(Log_Job, sociaty.Id,
|
||||||
uid, req.TargetId, pb.SociatyJob_PRESIDENT.String()); err != nil {
|
uid, req.TargetId, pb.SociatyJob_PRESIDENT.String()); err != nil {
|
||||||
var customErr = new(comm.CustomError)
|
var customErr = new(comm.CustomError)
|
||||||
|
var code pb.ErrorCode
|
||||||
if errors.As(err, &customErr) {
|
if errors.As(err, &customErr) {
|
||||||
code = customErr.Code
|
code = customErr.Code
|
||||||
} else {
|
} else {
|
||||||
@ -82,6 +91,11 @@ func (this *apiComp) Assign(session comm.IUserSession, req *pb.SociatyAssignReq)
|
|||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: code,
|
||||||
|
Title: code.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
this.module.Error("公会转让日志",
|
this.module.Error("公会转让日志",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
||||||
@ -96,8 +110,6 @@ func (this *apiComp) Assign(session comm.IUserSession, req *pb.SociatyAssignReq)
|
|||||||
SociatyId: sociaty.Id,
|
SociatyId: sociaty.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeAssign, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeAssign, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,12 @@ func (this *apiComp) BossmainCheck(session comm.IUserSession, req *pb.SociatyBMa
|
|||||||
|
|
||||||
func (this *apiComp) Bossmain(session comm.IUserSession, req *pb.SociatyBMainReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) Bossmain(session comm.IUserSession, req *pb.SociatyBMainReq) (errdata *pb.ErrorData) {
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
data = &pb.ErrorData{}
|
|
||||||
ggd := this.module.ModuleTools.GetGlobalConf()
|
ggd := this.module.ModuleTools.GetGlobalConf()
|
||||||
if ggd == nil {
|
if ggd == nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -31,7 +30,10 @@ func (this *apiComp) Bossmain(session comm.IUserSession, req *pb.SociatyBMainReq
|
|||||||
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()},
|
||||||
)
|
)
|
||||||
code = pb.ErrorCode_UserSessionNobeing
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_UserSessionNobeing,
|
||||||
|
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,8 +60,11 @@ func (this *apiComp) Bossmain(session comm.IUserSession, req *pb.SociatyBMainReq
|
|||||||
|
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -67,7 +72,10 @@ func (this *apiComp) Bossmain(session comm.IUserSession, req *pb.SociatyBMainReq
|
|||||||
// 赛季信息
|
// 赛季信息
|
||||||
dbs := this.module.modelSociatyBoss.getSociatyBossSports()
|
dbs := this.module.modelSociatyBoss.getSociatyBossSports()
|
||||||
if dbs == nil {
|
if dbs == nil {
|
||||||
code = pb.ErrorCode_SociatySportsNoinit
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatySportsNoinit,
|
||||||
|
Title: pb.ErrorCode_SociatySportsNoinit.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
rsp.EndTime = dbs.EndTime
|
rsp.EndTime = dbs.EndTime
|
||||||
@ -92,8 +100,6 @@ func (this *apiComp) Bossmain(session comm.IUserSession, req *pb.SociatyBMainReq
|
|||||||
rsp.Teams = sm.Teams
|
rsp.Teams = sm.Teams
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeBossmain, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeBossmain, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -22,12 +22,15 @@ func (this *apiComp) Brank(session comm.IUserSession, req *pb.SociatyBRankReq) (
|
|||||||
if errdata = this.BrankCheck(session, req); errdata != nil {
|
if errdata = this.BrankCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -38,8 +41,6 @@ func (this *apiComp) Brank(session comm.IUserSession, req *pb.SociatyBRankReq) (
|
|||||||
Rank: sri,
|
Rank: sri,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeBrank, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeBrank, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -22,12 +22,14 @@ func (this *apiComp) Breceive(session comm.IUserSession, req *pb.SociatyBReceive
|
|||||||
if errdata = this.BreceiveCheck(session, req); errdata != nil {
|
if errdata = this.BreceiveCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -37,7 +39,6 @@ func (this *apiComp) Breceive(session comm.IUserSession, req *pb.SociatyBReceive
|
|||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -48,10 +49,16 @@ func (this *apiComp) Breceive(session comm.IUserSession, req *pb.SociatyBReceive
|
|||||||
if task.TaskId == req.TaskId {
|
if task.TaskId == req.TaskId {
|
||||||
taskId = task.TaskId
|
taskId = task.TaskId
|
||||||
if task.Status == 2 { //已领取
|
if task.Status == 2 { //已领取
|
||||||
code = pb.ErrorCode_SociatyTaskReceived
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyTaskReceived,
|
||||||
|
Title: pb.ErrorCode_SociatyTaskReceived.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
} else if taskId == 0 { //未完成
|
} else if taskId == 0 { //未完成
|
||||||
code = pb.ErrorCode_SociatyTaskNoFinished
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyTaskNoFinished,
|
||||||
|
Title: pb.ErrorCode_SociatyTaskNoFinished.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
} else if taskId == 1 { //可领取
|
} else if taskId == 1 { //可领取
|
||||||
task.Status = 2
|
task.Status = 2
|
||||||
@ -74,7 +81,7 @@ func (this *apiComp) Breceive(session comm.IUserSession, req *pb.SociatyBReceive
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 奖励
|
// 奖励
|
||||||
if code := this.module.DispenseRes(session, taskConf.Reward, true); errdata != nil {
|
if errdata := this.module.DispenseRes(session, taskConf.Reward, true); errdata != nil {
|
||||||
this.module.Error("积分任务奖励领取",
|
this.module.Error("积分任务奖励领取",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "taskId", Value: taskId},
|
log.Field{Key: "taskId", Value: taskId},
|
||||||
@ -85,8 +92,6 @@ func (this *apiComp) Breceive(session comm.IUserSession, req *pb.SociatyBReceive
|
|||||||
SociatyId: sociaty.Id,
|
SociatyId: sociaty.Id,
|
||||||
TaskId: req.TaskId,
|
TaskId: req.TaskId,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeBreceive, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeBreceive, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -21,21 +21,22 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.SociatyBuyReq) (errd
|
|||||||
if errdata = this.BuyCheck(session, req); errdata != nil {
|
if errdata = this.BuyCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
ggd := this.module.ModuleTools.GetGlobalConf()
|
ggd := this.module.ModuleTools.GetGlobalConf()
|
||||||
if ggd == nil {
|
if ggd == nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -43,13 +44,16 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.SociatyBuyReq) (errd
|
|||||||
//校验钻石
|
//校验钻石
|
||||||
imodule, err := this.module.service.GetModule(comm.ModuleUser)
|
imodule, err := this.module.service.GetModule(comm.ModuleUser)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ExternalModule,
|
||||||
|
Title: pb.ErrorCode_ExternalModule.ToString(),
|
||||||
|
Message: comm.NewExternalModuleErr("user", "").Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
iuser, ok := imodule.(comm.IUser)
|
iuser, ok := imodule.(comm.IUser)
|
||||||
if !ok {
|
if !ok {
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,9 +68,11 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.SociatyBuyReq) (errd
|
|||||||
|
|
||||||
ex, err := iuser.GetUserExpand(uid)
|
ex, err := iuser.GetUserExpand(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_UserSessionNobeing
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_UserSessionNobeing,
|
||||||
data.Message = err.Error()
|
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +90,6 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.SociatyBuyReq) (errd
|
|||||||
|
|
||||||
//扣除资源
|
//扣除资源
|
||||||
if errdata = this.module.DispenseRes(session, atn, true); errdata != nil {
|
if errdata = this.module.DispenseRes(session, atn, true); errdata != nil {
|
||||||
data.Title = code.ToString()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,8 +97,6 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.SociatyBuyReq) (errd
|
|||||||
Uid: uid,
|
Uid: uid,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeBuy, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeBuy, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,14 @@ func (this *apiComp) Challengefinish(session comm.IUserSession, req *pb.SociatyB
|
|||||||
if errdata = this.ChallengefinishCheck(session, req); errdata != nil {
|
if errdata = this.ChallengefinishCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -30,7 +33,7 @@ func (this *apiComp) Challengefinish(session comm.IUserSession, req *pb.SociatyB
|
|||||||
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()},
|
||||||
)
|
)
|
||||||
code = pb.ErrorCode_UserSessionNobeing
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,8 +54,6 @@ func (this *apiComp) Challengefinish(session comm.IUserSession, req *pb.SociatyB
|
|||||||
Integral: this.module.modelSociatyBoss.transIntegral(req.Report.Harm),
|
Integral: this.module.modelSociatyBoss.transIntegral(req.Report.Harm),
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeChallengefinish, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeChallengefinish, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,15 @@ func (this *apiComp) Challengestart(session comm.IUserSession, req *pb.SociatyBC
|
|||||||
if errdata = this.ChallengestartCheck(session, req); errdata != nil {
|
if errdata = this.ChallengestartCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -31,19 +35,22 @@ func (this *apiComp) Challengestart(session comm.IUserSession, req *pb.SociatyBC
|
|||||||
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()},
|
||||||
)
|
)
|
||||||
code = pb.ErrorCode_UserSessionNobeing
|
|
||||||
data.Title = code.ToString()
|
|
||||||
data.Message = err.Error()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if userEx.SociatyTicket <= 0 {
|
if userEx.SociatyTicket <= 0 {
|
||||||
code = pb.ErrorCode_SociatyTicketsNoEnough
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyTicketsNoEnough,
|
||||||
|
Title: pb.ErrorCode_SociatyTicketsNoEnough.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//校验赛季时间
|
//校验赛季时间
|
||||||
if this.module.modelSociatyBoss.sportsIsFinished() {
|
if this.module.modelSociatyBoss.sportsIsFinished() {
|
||||||
code = pb.ErrorCode_SociatySportsEnd
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatySportsEnd,
|
||||||
|
Title: pb.ErrorCode_SociatySportsEnd.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,10 +58,11 @@ func (this *apiComp) Challengestart(session comm.IUserSession, req *pb.SociatyBC
|
|||||||
if err := this.module.modelSociatyBoss.challengestart(session, sociaty); err != nil {
|
if err := this.module.modelSociatyBoss.challengestart(session, sociaty); 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
|
||||||
// if code == pb.ErrorCode_SociatyNoFormation {
|
errdata = &pb.ErrorData{
|
||||||
// return
|
Code: code,
|
||||||
// }
|
Title: code.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,8 +72,6 @@ func (this *apiComp) Challengestart(session comm.IUserSession, req *pb.SociatyBC
|
|||||||
Uid: uid,
|
Uid: uid,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeChallengestart, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeChallengestart, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,11 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
|
|||||||
if errdata = this.CreateCheck(session, req); errdata != nil {
|
if errdata = this.CreateCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
user := this.module.ModuleUser.GetUser(uid)
|
user := this.module.ModuleUser.GetUser(uid)
|
||||||
if user == nil {
|
if user == nil {
|
||||||
this.module.Error("GetRmoteUser not found", log.Field{Key: "uid", Value: uid})
|
this.module.Error("GetRmoteUser not found", log.Field{Key: "uid", Value: uid})
|
||||||
code = pb.ErrorCode_UserSessionNobeing
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,20 +44,25 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
|
|||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data.Title = code.ToString()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// CD校验
|
// CD校验
|
||||||
if utils.IsInCDHour(userExpand.SociatyCd) {
|
if utils.IsInCDHour(userExpand.SociatyCd) {
|
||||||
code = pb.ErrorCode_SociatyCDLimit
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyCDLimit,
|
||||||
|
Title: pb.ErrorCode_SociatyCDLimit.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查是否已加入公会
|
//检查是否已加入公会
|
||||||
if userExpand.SociatyId != "" {
|
if userExpand.SociatyId != "" {
|
||||||
code = pb.ErrorCode_SociatyAdded
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyAdded,
|
||||||
|
Title: pb.ErrorCode_SociatyAdded.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +70,12 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
|
|||||||
if err := this.module.modelSociaty.isNameExist(req.Name); err != nil {
|
if err := this.module.modelSociaty.isNameExist(req.Name); 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(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
@ -97,7 +106,11 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if req.ApplyLv > maxLv {
|
if req.ApplyLv > maxLv {
|
||||||
code = pb.ErrorCode_SociatyApplyLvLimit
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyApplyLvLimit,
|
||||||
|
Title: pb.ErrorCode_SociatyApplyLvLimit.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,9 +132,9 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
|
|||||||
})
|
})
|
||||||
if err := this.module.modelSociaty.create(sociaty); err != nil {
|
if err := this.module.modelSociaty.create(sociaty); err != nil {
|
||||||
var customError = new(comm.CustomError)
|
var customError = new(comm.CustomError)
|
||||||
|
var code pb.ErrorCode
|
||||||
if errors.As(err, &customError) {
|
if errors.As(err, &customError) {
|
||||||
if customError.Code == pb.ErrorCode_SociatyNoFound {
|
code = customError.Code
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
|
||||||
} else {
|
} else {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
@ -129,6 +142,10 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
|
|||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: code,
|
||||||
|
Title: code.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
this.module.Error("创建公会",
|
this.module.Error("创建公会",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
@ -168,12 +185,9 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeCreate, &pb.SociatyCreateResp{
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeCreate, &pb.SociatyCreateResp{
|
||||||
Id: sociaty.Id,
|
Id: sociaty.Id,
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
}); err != nil {
|
})
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,14 @@ func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischar
|
|||||||
if errdata = this.DischargeCheck(session, req); errdata != nil {
|
if errdata = this.DischargeCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -37,13 +40,17 @@ func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischar
|
|||||||
if !this.module.modelSociaty.isRight(uid, sociaty,
|
if !this.module.modelSociaty.isRight(uid, sociaty,
|
||||||
pb.SociatyJob_PRESIDENT,
|
pb.SociatyJob_PRESIDENT,
|
||||||
pb.SociatyJob_VICEPRESIDENT) {
|
pb.SociatyJob_VICEPRESIDENT) {
|
||||||
code = pb.ErrorCode_SociatyNoRight
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoRight,
|
||||||
|
Title: pb.ErrorCode_SociatyNoRight.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 踢人
|
// 踢人
|
||||||
if err := this.module.modelSociaty.discharge(req.TargetId, sociaty); err != nil {
|
if err := this.module.modelSociaty.discharge(req.TargetId, sociaty); err != nil {
|
||||||
var customError = new(comm.CustomError)
|
var customError = new(comm.CustomError)
|
||||||
|
var code pb.ErrorCode
|
||||||
if errors.As(err, &customError) {
|
if errors.As(err, &customError) {
|
||||||
code = customError.Code
|
code = customError.Code
|
||||||
} else {
|
} else {
|
||||||
@ -53,8 +60,10 @@ func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischar
|
|||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.Title = code.ToString()
|
errdata = &pb.ErrorData{
|
||||||
data.Message = err.Error()
|
Code: code,
|
||||||
|
Title: code.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("踢出公会",
|
this.module.Error("踢出公会",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
||||||
@ -109,8 +118,6 @@ func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischar
|
|||||||
SociatyId: sociaty.Id,
|
SociatyId: sociaty.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeDischarge, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeDischarge, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -25,11 +25,14 @@ func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissRe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoFound,
|
||||||
|
Title: pb.ErrorCode_SociatyNoFound.ToString(),
|
||||||
|
}
|
||||||
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -42,7 +45,10 @@ func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissRe
|
|||||||
// 校验权限
|
// 校验权限
|
||||||
if !this.module.modelSociaty.isRight(uid, sociaty,
|
if !this.module.modelSociaty.isRight(uid, sociaty,
|
||||||
pb.SociatyJob_PRESIDENT) {
|
pb.SociatyJob_PRESIDENT) {
|
||||||
code = pb.ErrorCode_SociatyNoRight
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoRight,
|
||||||
|
Title: pb.ErrorCode_SociatyNoRight.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +59,10 @@ func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissRe
|
|||||||
if sociaty.DismissTime == 0 {
|
if sociaty.DismissTime == 0 {
|
||||||
if sociaty.DismissCD != 0 {
|
if sociaty.DismissCD != 0 {
|
||||||
if utils.IsInCDHour(int64(sociaty.DismissCD)) {
|
if utils.IsInCDHour(int64(sociaty.DismissCD)) {
|
||||||
code = pb.ErrorCode_SociatyCDLimit
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyCDLimit,
|
||||||
|
Title: pb.ErrorCode_SociatyCDLimit.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
update["dismissCD"] = 0
|
update["dismissCD"] = 0
|
||||||
@ -68,7 +77,10 @@ func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissRe
|
|||||||
update["dismissCD"] = utils.AddHour(int(globalCnf.GuildDissolutionCd)).Unix()
|
update["dismissCD"] = utils.AddHour(int(globalCnf.GuildDissolutionCd)).Unix()
|
||||||
} else {
|
} else {
|
||||||
if utils.IsInCDHour(int64(sociaty.DismissCD)) {
|
if utils.IsInCDHour(int64(sociaty.DismissCD)) {
|
||||||
code = pb.ErrorCode_SociatyCDLimit
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyCDLimit,
|
||||||
|
Title: pb.ErrorCode_SociatyCDLimit.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,8 +101,6 @@ func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeDismiss, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeDismiss, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,6 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.SociatyListReq) (er
|
|||||||
rsp.List = append(rsp.List, info)
|
rsp.List = append(rsp.List, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeList, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeList, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ func (this *apiComp) Log(session comm.IUserSession, req *pb.SociatyLogReq) (errd
|
|||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -31,8 +30,6 @@ func (this *apiComp) Log(session comm.IUserSession, req *pb.SociatyLogReq) (errd
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeLog, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeLog, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ func (this *apiComp) Members(session comm.IUserSession, req *pb.SociatyMembersRe
|
|||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -27,8 +26,6 @@ func (this *apiComp) Members(session comm.IUserSession, req *pb.SociatyMembersRe
|
|||||||
List: members,
|
List: members,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeMembers, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeMembers, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ func (this *apiComp) MineCheck(session comm.IUserSession, req *pb.SociatyMineReq
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (errdata *pb.ErrorData) {
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
userEx, err := this.module.ModuleUser.GetUserExpand(uid)
|
userEx, err := this.module.ModuleUser.GetUserExpand(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -22,7 +22,6 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (er
|
|||||||
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()},
|
||||||
)
|
)
|
||||||
code = pb.ErrorCode_UserSessionNobeing
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,22 +29,28 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (er
|
|||||||
|
|
||||||
// 未加入公会
|
// 未加入公会
|
||||||
if userEx.SociatyId == "" {
|
if userEx.SociatyId == "" {
|
||||||
code = pb.ErrorCode_SociatyNoAdded
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoAdded,
|
||||||
|
Title: pb.ErrorCode_SociatyNoAdded.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取公会
|
// 获取公会
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断公会是否解散(公会解散非立即执行)
|
//判断公会是否解散(公会解散非立即执行)
|
||||||
if this.module.modelSociaty.isDismiss(sociaty) {
|
if this.module.modelSociaty.isDismiss(sociaty) {
|
||||||
code = pb.ErrorCode_SociatyDismissed
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyDismissed,
|
||||||
|
Title: pb.ErrorCode_SociatyDismissed.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +88,7 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (er
|
|||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data.Title = code.ToString()
|
|
||||||
data.Message = err.Error()
|
|
||||||
this.module.Error("会长弹劾",
|
this.module.Error("会长弹劾",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
||||||
@ -97,8 +101,6 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (er
|
|||||||
rsp.Sociaty = sociaty
|
rsp.Sociaty = sociaty
|
||||||
rsp.Master = master
|
rsp.Master = master
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeMine, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeMine, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,10 @@ func (this *apiComp) QuitCheck(session comm.IUserSession, req *pb.SociatyQuitReq
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (errdata *pb.ErrorData) {
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -26,13 +25,19 @@ func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (er
|
|||||||
// 会长不允许退公会
|
// 会长不允许退公会
|
||||||
if this.module.modelSociaty.isRight(uid, sociaty,
|
if this.module.modelSociaty.isRight(uid, sociaty,
|
||||||
pb.SociatyJob_PRESIDENT) {
|
pb.SociatyJob_PRESIDENT) {
|
||||||
code = pb.ErrorCode_SociatyQuitNoAllowed
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyQuitNoAllowed,
|
||||||
|
Title: pb.ErrorCode_SociatyQuitNoAllowed.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 退出公会
|
// 退出公会
|
||||||
if err := this.module.modelSociaty.quit(uid, sociaty); err != nil {
|
if err := this.module.modelSociaty.quit(uid, sociaty); err != nil {
|
||||||
code = pb.ErrorCode_SociatyQuit
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyQuit,
|
||||||
|
Title: pb.ErrorCode_SociatyQuit.ToString(),
|
||||||
|
}
|
||||||
this.module.Errorf("退出公会", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "err": err.Error()})
|
this.module.Errorf("退出公会", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "err": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -49,8 +54,7 @@ func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (er
|
|||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data.Title = code.ToString()
|
|
||||||
data.Message = err.Error()
|
|
||||||
this.module.Error("退出公会,更新玩家公会ID",
|
this.module.Error("退出公会,更新玩家公会ID",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
||||||
@ -73,8 +77,6 @@ func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (er
|
|||||||
Uid: uid,
|
Uid: uid,
|
||||||
SociatyId: sociaty.Id,
|
SociatyId: sociaty.Id,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeQuit, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeQuit, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,6 @@ func (this *apiComp) Rank(session comm.IUserSession, req *pb.SociatyRankReq) (er
|
|||||||
Rank: list,
|
Rank: list,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeRank, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeRank, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.SociatyReceiveRe
|
|||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -35,11 +34,17 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.SociatyReceiveRe
|
|||||||
for _, v := range sociatyTask.TaskList {
|
for _, v := range sociatyTask.TaskList {
|
||||||
if v.TaskId == req.TaskId {
|
if v.TaskId == req.TaskId {
|
||||||
if v.Status != 1 {
|
if v.Status != 1 {
|
||||||
code = pb.ErrorCode_SociatyTaskValidation
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyTaskValidation,
|
||||||
|
Title: pb.ErrorCode_SociatyTaskValidation.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if v.Received == 1 { //已领取
|
if v.Received == 1 { //已领取
|
||||||
code = pb.ErrorCode_SociatyRewardReceived
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyRewardReceived,
|
||||||
|
Title: pb.ErrorCode_SociatyRewardReceived.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -48,7 +53,11 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.SociatyReceiveRe
|
|||||||
|
|
||||||
// 奖励领取
|
// 奖励领取
|
||||||
if err := this.module.modelSociatyTask.receive(req.TaskId, sociaty.Id, uid); err != nil {
|
if err := this.module.modelSociatyTask.receive(req.TaskId, sociaty.Id, uid); err != nil {
|
||||||
code = pb.ErrorCode_SociatyRewardReceive
|
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyRewardReceived,
|
||||||
|
Title: pb.ErrorCode_SociatyRewardReceived.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("领取公会任务奖励",
|
this.module.Error("领取公会任务奖励",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
||||||
@ -67,7 +76,6 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.SociatyReceiveRe
|
|||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
||||||
log.Field{Key: "taskId", Value: req.TaskId},
|
log.Field{Key: "taskId", Value: req.TaskId},
|
||||||
log.Field{Key: "code", Value: code},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,8 +107,6 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.SociatyReceiveRe
|
|||||||
TaskId: req.TaskId,
|
TaskId: req.TaskId,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeReceive, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeReceive, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,6 @@ func (this *apiComp) Recommend(session comm.IUserSession, req *pb.SociatyRecomme
|
|||||||
|
|
||||||
rsp := &pb.SociatyRecommendResp{}
|
rsp := &pb.SociatyRecommendResp{}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeRecommend, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeRecommend, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,10 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.SociatyRefuseReq)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -38,22 +37,28 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.SociatyRefuseReq)
|
|||||||
pb.SociatyJob_PRESIDENT,
|
pb.SociatyJob_PRESIDENT,
|
||||||
pb.SociatyJob_VICEPRESIDENT,
|
pb.SociatyJob_VICEPRESIDENT,
|
||||||
pb.SociatyJob_ADMIN) {
|
pb.SociatyJob_ADMIN) {
|
||||||
code = pb.ErrorCode_SociatyNoRight
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoRight,
|
||||||
|
Title: pb.ErrorCode_SociatyNoRight.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 已是公会成员
|
// 已是公会成员
|
||||||
if this.module.modelSociaty.isMember(uid, sociaty) {
|
if this.module.modelSociaty.isMember(uid, sociaty) {
|
||||||
code = pb.ErrorCode_SociatyAdded
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyAdded,
|
||||||
|
Title: pb.ErrorCode_SociatyAdded.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拒绝公会申请
|
// 拒绝公会申请
|
||||||
if err := this.module.modelSociaty.refuse(req.Uid, sociaty); err != nil {
|
if err := this.module.modelSociaty.refuse(req.Uid, sociaty); err != nil {
|
||||||
code = pb.ErrorCode_SociatyRefuse
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatyRefuse,
|
||||||
data.Message = err.Error()
|
Title: pb.ErrorCode_SociatyRefuse.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("申请拒绝",
|
this.module.Error("申请拒绝",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "拒绝目标人", Value: req.Uid},
|
log.Field{Key: "拒绝目标人", Value: req.Uid},
|
||||||
@ -66,8 +71,6 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.SociatyRefuseReq)
|
|||||||
Uid: req.Uid,
|
Uid: req.Uid,
|
||||||
SociatyId: sociaty.Id,
|
SociatyId: sociaty.Id,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeRefuse, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeRefuse, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -22,15 +22,13 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.SociatySearchReq)
|
|||||||
if errdata = this.SearchCheck(session, req); errdata != nil {
|
if errdata = this.SearchCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
rsp := &pb.SociatySearchResp{}
|
rsp := &pb.SociatySearchResp{}
|
||||||
sociaty := this.module.modelSociaty.findByName(req.Name)
|
sociaty := this.module.modelSociaty.findByName(req.Name)
|
||||||
if sociaty != nil && sociaty.Id != "" {
|
if sociaty != nil && sociaty.Id != "" {
|
||||||
rsp.List = append(rsp.List, sociaty)
|
rsp.List = append(rsp.List, sociaty)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeSearch, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeSearch, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,10 @@ func (this *apiComp) Setting(session comm.IUserSession, req *pb.SociatySettingRe
|
|||||||
if errdata = this.SettingCheck(session, req); errdata != nil {
|
if errdata = this.SettingCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -35,7 +34,10 @@ func (this *apiComp) Setting(session comm.IUserSession, req *pb.SociatySettingRe
|
|||||||
// 校验权限
|
// 校验权限
|
||||||
if !this.module.modelSociaty.isRight(uid, sociaty,
|
if !this.module.modelSociaty.isRight(uid, sociaty,
|
||||||
pb.SociatyJob_PRESIDENT, pb.SociatyJob_VICEPRESIDENT) {
|
pb.SociatyJob_PRESIDENT, pb.SociatyJob_VICEPRESIDENT) {
|
||||||
code = pb.ErrorCode_SociatyNoRight
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoRight,
|
||||||
|
Title: pb.ErrorCode_SociatyNoRight.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,9 +48,10 @@ func (this *apiComp) Setting(session comm.IUserSession, req *pb.SociatySettingRe
|
|||||||
|
|
||||||
// 更新设置
|
// 更新设置
|
||||||
if err := this.module.modelSociaty.setting(sociaty); err != nil {
|
if err := this.module.modelSociaty.setting(sociaty); err != nil {
|
||||||
code = pb.ErrorCode_SociatySetting
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatySetting,
|
||||||
data.Message = err.Error()
|
Title: pb.ErrorCode_SociatySetting.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("公会修改",
|
this.module.Error("公会修改",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
||||||
@ -62,8 +65,6 @@ func (this *apiComp) Setting(session comm.IUserSession, req *pb.SociatySettingRe
|
|||||||
SociatyId: sociaty.Id,
|
SociatyId: sociaty.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeSetting, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeSetting, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,10 @@ func (this *apiComp) SettingJob(session comm.IUserSession, req *pb.SociatySettin
|
|||||||
if errdata = this.SettingJobCheck(session, req); errdata != nil {
|
if errdata = this.SettingJobCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{}
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -34,13 +33,19 @@ func (this *apiComp) SettingJob(session comm.IUserSession, req *pb.SociatySettin
|
|||||||
// 权限校验
|
// 权限校验
|
||||||
if !this.module.modelSociaty.isRight(uid, sociaty,
|
if !this.module.modelSociaty.isRight(uid, sociaty,
|
||||||
pb.SociatyJob_PRESIDENT) {
|
pb.SociatyJob_PRESIDENT) {
|
||||||
code = pb.ErrorCode_SociatyNoRight
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoRight,
|
||||||
|
Title: pb.ErrorCode_SociatyNoRight.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 不能设置自己
|
// 不能设置自己
|
||||||
if uid == req.TargetId {
|
if uid == req.TargetId {
|
||||||
code = pb.ErrorCode_SociatySelfSetting
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatySelfSetting,
|
||||||
|
Title: pb.ErrorCode_SociatySelfSetting.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,13 +54,19 @@ func (this *apiComp) SettingJob(session comm.IUserSession, req *pb.SociatySettin
|
|||||||
jobCount := this.module.modelSociaty.getJobCount(req.Job, sociaty)
|
jobCount := this.module.modelSociaty.getJobCount(req.Job, sociaty)
|
||||||
if req.Job == pb.SociatyJob_VICEPRESIDENT && jobCount >= int(globalConf.GuildViceAllianceLeaderMaxNum) ||
|
if req.Job == pb.SociatyJob_VICEPRESIDENT && jobCount >= int(globalConf.GuildViceAllianceLeaderMaxNum) ||
|
||||||
req.Job == pb.SociatyJob_ADMIN && jobCount >= int(globalConf.GuildAdministratorsMaxNum) {
|
req.Job == pb.SociatyJob_ADMIN && jobCount >= int(globalConf.GuildAdministratorsMaxNum) {
|
||||||
code = pb.ErrorCode_SociatyMemberCountLimit
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyMemberCountLimit,
|
||||||
|
Title: pb.ErrorCode_SociatyMemberCountLimit.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置职位
|
// 设置职位
|
||||||
if err := this.module.modelSociaty.settingJob(req.TargetId, req.Job, sociaty); err != nil {
|
if err := this.module.modelSociaty.settingJob(req.TargetId, req.Job, sociaty); err != nil {
|
||||||
code = pb.ErrorCode_SociatySettingJob
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatySettingJob,
|
||||||
|
Title: pb.ErrorCode_SociatySettingJob.ToString(),
|
||||||
|
}
|
||||||
this.module.Errorf("设置公会职位", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "params": req, "err": err.Error()})
|
this.module.Errorf("设置公会职位", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "params": req, "err": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -66,8 +77,6 @@ func (this *apiComp) SettingJob(session comm.IUserSession, req *pb.SociatySettin
|
|||||||
Job: req.Job,
|
Job: req.Job,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeSettingJob, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeSettingJob, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -16,31 +16,36 @@ func (this *apiComp) Sign(session comm.IUserSession, req *pb.SociatySignReq) (er
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
data = &pb.ErrorData{}
|
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 不是该公会成员
|
// 不是该公会成员
|
||||||
if !this.module.modelSociaty.isMember(uid, sociaty) {
|
if !this.module.modelSociaty.isMember(uid, sociaty) {
|
||||||
code = pb.ErrorCode_SociatyNoAdded
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatyNoAdded,
|
||||||
|
Title: pb.ErrorCode_SociatyNoAdded.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否已签到
|
// 判断是否已签到
|
||||||
if this.module.modelSociaty.IsSign(uid, sociaty) {
|
if this.module.modelSociaty.IsSign(uid, sociaty) {
|
||||||
code = pb.ErrorCode_SociatySigned
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SociatySigned,
|
||||||
|
Title: pb.ErrorCode_SociatySigned.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 签到
|
// 签到
|
||||||
if err := this.module.modelSociaty.sign(uid, sociaty); err != nil {
|
if err := this.module.modelSociaty.sign(uid, sociaty); err != nil {
|
||||||
code = pb.ErrorCode_SociatySign
|
errdata = &pb.ErrorData{
|
||||||
data.Title = code.ToString()
|
Code: pb.ErrorCode_SociatySign,
|
||||||
data.Message = err.Error()
|
Title: pb.ErrorCode_SociatySign.ToString(),
|
||||||
|
}
|
||||||
this.module.Error("签到失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "sociatyId", Value: sociaty.Id}, log.Field{Key: "err", Value: err.Error()})
|
this.module.Error("签到失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "sociatyId", Value: sociaty.Id}, log.Field{Key: "err", Value: err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -51,13 +56,12 @@ func (this *apiComp) Sign(session comm.IUserSession, req *pb.SociatySignReq) (er
|
|||||||
for _, v := range this.module.sociatySignConf.GetDataList() {
|
for _, v := range this.module.sociatySignConf.GetDataList() {
|
||||||
if lastSignCount >= v.Down && lastSignCount <= v.Up {
|
if lastSignCount >= v.Down && lastSignCount <= v.Up {
|
||||||
// 发放签到奖励
|
// 发放签到奖励
|
||||||
if errdata = this.module.DispenseRes(session, v.Reward, true); code == pb.ErrorCode_Success {
|
if errdata = this.module.DispenseRes(session, v.Reward, true); errdata == nil {
|
||||||
signCfgId = v.Id
|
signCfgId = v.Id
|
||||||
} else {
|
} else {
|
||||||
log.Error("发放签到奖励失败",
|
log.Error("发放签到奖励失败",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
||||||
log.Field{Key: "code", Value: code},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -91,8 +95,6 @@ func (this *apiComp) Sign(session comm.IUserSession, req *pb.SociatySignReq) (er
|
|||||||
SociatyId: sociaty.Id,
|
SociatyId: sociaty.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeSign, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeSign, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,10 @@ func (this *apiComp) TaskListCheck(session comm.IUserSession, req *pb.SociatyTas
|
|||||||
|
|
||||||
func (this *apiComp) TaskList(session comm.IUserSession, req *pb.SociatyTaskListReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) TaskList(session comm.IUserSession, req *pb.SociatyTaskListReq) (errdata *pb.ErrorData) {
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
data = &pb.ErrorData{}
|
|
||||||
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
sociaty := this.module.modelSociaty.getUserSociaty(uid)
|
||||||
if sociaty == nil {
|
if sociaty == nil {
|
||||||
code = pb.ErrorCode_SociatyNoFound
|
|
||||||
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -47,8 +47,7 @@ func (this *apiComp) TaskList(session comm.IUserSession, req *pb.SociatyTaskList
|
|||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data.Title = code.ToString()
|
|
||||||
data.Message = err.Error()
|
|
||||||
this.module.Error("更新公会任务列表失败",
|
this.module.Error("更新公会任务列表失败",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
||||||
@ -56,8 +55,6 @@ func (this *apiComp) TaskList(session comm.IUserSession, req *pb.SociatyTaskList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeTasklist, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeTasklist, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ func (s *ModelSociatyBoss) setFormation(sociaty *pb.DBSociaty, uid string, teams
|
|||||||
return s.moduleSociaty.modelSociaty.updateSociaty(sociaty.Id, update)
|
return s.moduleSociaty.modelSociaty.updateSociaty(sociaty.Id, update)
|
||||||
}
|
}
|
||||||
|
|
||||||
//挑战开始
|
// 挑战开始
|
||||||
func (s *ModelSociatyBoss) challengestart(session comm.IUserSession, sociaty *pb.DBSociaty) error {
|
func (s *ModelSociatyBoss) challengestart(session comm.IUserSession, sociaty *pb.DBSociaty) error {
|
||||||
//组装阵容数据
|
//组装阵容数据
|
||||||
var formations []*pb.BattleFormation
|
var formations []*pb.BattleFormation
|
||||||
@ -195,8 +195,8 @@ func (s *ModelSociatyBoss) challengestart(session comm.IUserSession, sociaty *pb
|
|||||||
Ptype: pb.PlayType_sociaty,
|
Ptype: pb.PlayType_sociaty,
|
||||||
Title: "公会BOSS",
|
Title: "公会BOSS",
|
||||||
Format: formations,
|
Format: formations,
|
||||||
}); errdata != nil {
|
}); code != nil {
|
||||||
return comm.NewCustomError(code)
|
return comm.NewCustomError(pb.ErrorCode_ExternalModule)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -8,7 +8,10 @@ import (
|
|||||||
// 活跃度列表
|
// 活跃度列表
|
||||||
func (this *apiComp) ActiveListCheck(session comm.IUserSession, req *pb.TaskActiveListReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) ActiveListCheck(session comm.IUserSession, req *pb.TaskActiveListReq) (errdata *pb.ErrorData) {
|
||||||
if req.TaskTag <= 0 || req.TaskTag > 2 {
|
if req.TaskTag <= 0 || req.TaskTag > 2 {
|
||||||
code = pb.ErrorCode_TaskTagEmpty
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ReqParameterError,
|
||||||
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -20,10 +23,7 @@ func (this *apiComp) ActiveList(session comm.IUserSession, req *pb.TaskActiveLis
|
|||||||
|
|
||||||
resp := &pb.TaskActiveListResp{}
|
resp := &pb.TaskActiveListResp{}
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := session.SendMsg(string(this.module.GetType()), TaskSubTypeActiveList, resp); err != nil {
|
session.SendMsg(string(this.module.GetType()), TaskSubTypeActiveList, resp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// 获取玩家活跃度
|
// 获取玩家活跃度
|
||||||
|
@ -9,11 +9,17 @@ import (
|
|||||||
|
|
||||||
// 活跃度领取
|
// 活跃度领取
|
||||||
func (this *apiComp) ActiveReceiveCheck(session comm.IUserSession, req *pb.TaskActiveReceiveReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) ActiveReceiveCheck(session comm.IUserSession, req *pb.TaskActiveReceiveReq) (errdata *pb.ErrorData) {
|
||||||
|
var code pb.ErrorCode
|
||||||
if req.Id == 0 {
|
if req.Id == 0 {
|
||||||
code = pb.ErrorCode_TaskIdEmpty
|
code = pb.ErrorCode_TaskIdEmpty
|
||||||
} else if req.TaskTag <= 0 || req.TaskTag > 2 {
|
} else if req.TaskTag <= 0 || req.TaskTag > 2 {
|
||||||
code = pb.ErrorCode_TaskTagEmpty
|
code = pb.ErrorCode_TaskTagEmpty
|
||||||
}
|
}
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: code,
|
||||||
|
Title: code.ToString(),
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +40,11 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ue == nil {
|
if ue == nil {
|
||||||
code = pb.ErrorCode_UserExpandNull
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_UserExpandNull,
|
||||||
|
Title: pb.ErrorCode_UserExpandNull.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var rewards []*cfg.Gameatn
|
var rewards []*cfg.Gameatn
|
||||||
@ -58,12 +68,21 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
|||||||
|
|
||||||
if req.TaskTag == int32(comm.TASK_DAILY) {
|
if req.TaskTag == int32(comm.TASK_DAILY) {
|
||||||
if ue.Activeday < conf.Active {
|
if ue.Activeday < conf.Active {
|
||||||
code = pb.ErrorCode_TaskActiveNoenough
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_TaskActiveNoenough,
|
||||||
|
Title: pb.ErrorCode_TaskActiveNoenough.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else if req.TaskTag == int32(comm.TASK_WEEKLY) {
|
} else if req.TaskTag == int32(comm.TASK_WEEKLY) {
|
||||||
if ue.Activeweek < conf.Active {
|
if ue.Activeweek < conf.Active {
|
||||||
code = pb.ErrorCode_TaskActiveNoenough
|
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_TaskActiveNoenough,
|
||||||
|
Title: pb.ErrorCode_TaskActiveNoenough.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,7 +115,6 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
|||||||
this.module.Error("活跃度奖励",
|
this.module.Error("活跃度奖励",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "rewards", Value: rewards},
|
log.Field{Key: "rewards", Value: rewards},
|
||||||
log.Field{Key: "code", Value: code},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
go this.module.ModuleBuried.TriggerBuried(uid, comm.GetBuriedParam(comm.Rtype171, 1))
|
go this.module.ModuleBuried.TriggerBuried(uid, comm.GetBuriedParam(comm.Rtype171, 1))
|
||||||
@ -107,10 +125,7 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
|||||||
Id: req.Id,
|
Id: req.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = session.SendMsg(string(this.module.GetType()), TaskSubTypeActiveReceive, resp)
|
session.SendMsg(string(this.module.GetType()), TaskSubTypeActiveReceive, resp)
|
||||||
if err != nil {
|
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,6 @@ func (this *apiComp) Getrecord(session comm.IUserSession, req *pb.TaskGetrecordR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), TaskSubTypeGetrecord, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), TaskSubTypeGetrecord, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,10 @@ import (
|
|||||||
|
|
||||||
func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.TaskListReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.TaskListReq) (errdata *pb.ErrorData) {
|
||||||
if req.TaskTag <= 0 || req.TaskTag > 3 {
|
if req.TaskTag <= 0 || req.TaskTag > 3 {
|
||||||
code = pb.ErrorCode_TaskTagEmpty
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ReqParameterError,
|
||||||
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -20,17 +23,12 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.TaskListReq) (errda
|
|||||||
}
|
}
|
||||||
rsp := &pb.TaskListResp{}
|
rsp := &pb.TaskListResp{}
|
||||||
|
|
||||||
defer func() {
|
|
||||||
err := session.SendMsg(string(this.module.GetType()), TaskSubTypeList, rsp)
|
|
||||||
if err != nil {
|
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
task := this.module.modelTask.getTaskListByTag(session.GetUserId(), comm.TaskTag(req.TaskTag))
|
task := this.module.modelTask.getTaskListByTag(session.GetUserId(), comm.TaskTag(req.TaskTag))
|
||||||
if task == nil {
|
if task == nil {
|
||||||
code = pb.ErrorCode_TaskNotFound
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_TaskNotFound,
|
||||||
|
Title: pb.ErrorCode_TaskNotFound.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,5 +40,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.TaskListReq) (errda
|
|||||||
case int32(comm.TASK_ACHIEVE):
|
case int32(comm.TASK_ACHIEVE):
|
||||||
rsp.List = task.AchieveList
|
rsp.List = task.AchieveList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session.SendMsg(string(this.module.GetType()), TaskSubTypeList, rsp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -10,11 +10,16 @@ import (
|
|||||||
//任务奖励领取
|
//任务奖励领取
|
||||||
|
|
||||||
func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.TaskReceiveReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.TaskReceiveReq) (errdata *pb.ErrorData) {
|
||||||
|
var code pb.ErrorCode
|
||||||
if req.Id == 0 {
|
if req.Id == 0 {
|
||||||
code = pb.ErrorCode_TaskIdEmpty
|
code = pb.ErrorCode_TaskIdEmpty
|
||||||
} else if req.TaskTag == 0 {
|
} else if req.TaskTag == 0 {
|
||||||
code = pb.ErrorCode_TaskTagEmpty
|
code = pb.ErrorCode_TaskTagEmpty
|
||||||
}
|
}
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: code,
|
||||||
|
Title: code.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +32,10 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
userTask := this.module.modelTask.getUserTask(uid, req.Id)
|
userTask := this.module.modelTask.getUserTask(uid, req.Id)
|
||||||
|
|
||||||
if userTask == nil {
|
if userTask == nil {
|
||||||
code = pb.ErrorCode_TaskNotFound
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_TaskNotFound,
|
||||||
|
Title: pb.ErrorCode_TaskNotFound.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,12 +60,18 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
|
|
||||||
//判断是否完成
|
//判断是否完成
|
||||||
if taskData.Status == 0 {
|
if taskData.Status == 0 {
|
||||||
code = pb.ErrorCode_TaskNoFinished
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_TaskNoFinished,
|
||||||
|
Title: pb.ErrorCode_TaskNoFinished.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//判断任务是否领取
|
//判断任务是否领取
|
||||||
if taskData.Received == 1 {
|
if taskData.Received == 1 {
|
||||||
code = pb.ErrorCode_TaskReceived
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_TaskReceived,
|
||||||
|
Title: pb.ErrorCode_TaskReceived.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +81,6 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -139,18 +152,14 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
this.module.Error("活跃度奖励",
|
this.module.Error("活跃度奖励",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "rewards", Value: rewards},
|
log.Field{Key: "rewards", Value: rewards},
|
||||||
log.Field{Key: "code", Value: code},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
go this.module.ModuleBuried.TriggerBuried(uid, comm.GetBuriedParam(comm.Rtype171, 1))
|
go this.module.ModuleBuried.TriggerBuried(uid, comm.GetBuriedParam(comm.Rtype171, 1))
|
||||||
err := session.SendMsg(string(this.module.GetType()), "activereceive", &pb.TaskActiveReceivePush{
|
session.SendMsg(string(this.module.GetType()), "activereceive", &pb.TaskActiveReceivePush{
|
||||||
TaskTag: int32(comm.TASK_WEEKLY),
|
TaskTag: int32(comm.TASK_WEEKLY),
|
||||||
Id: maxTaskId,
|
Id: maxTaskId,
|
||||||
})
|
})
|
||||||
if err != nil {
|
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,7 +181,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
this.module.Error("发送奖励",
|
this.module.Error("发送奖励",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "rewards", Value: conf.Reword},
|
log.Field{Key: "rewards", Value: conf.Reword},
|
||||||
log.Field{Key: "code", Value: code},
|
log.Field{Key: "errdata", Value: errdata},
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -204,11 +213,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
}
|
}
|
||||||
resp.TaskId = taskData.TaskId
|
resp.TaskId = taskData.TaskId
|
||||||
|
|
||||||
err := session.SendMsg(string(this.module.GetType()), TaskSubTypeReceive, resp)
|
session.SendMsg(string(this.module.GetType()), TaskSubTypeReceive, resp)
|
||||||
if err != nil {
|
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,6 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.TaskSendReq) (errda
|
|||||||
rsp := &pb.TaskSendResp{
|
rsp := &pb.TaskSendResp{
|
||||||
IsSucc: true,
|
IsSucc: true,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), TaskSubTypeSend, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), TaskSubTypeSend, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -488,7 +488,7 @@ func (this *ModelTask) doTaskHandle(event interface{}, next func(event interface
|
|||||||
update map[string]interface{}
|
update map[string]interface{}
|
||||||
)
|
)
|
||||||
|
|
||||||
if code := this.moduleTask.ModuleRtask.CheckCondi(tl.Uid, conf.TypeId); code == pb.ErrorCode_Success {
|
if code := this.moduleTask.ModuleRtask.CheckCondi(tl.Uid, conf.TypeId); code == nil {
|
||||||
// update data
|
// update data
|
||||||
if ret != nil && len(ret.Data) > 0 {
|
if ret != nil && len(ret.Data) > 0 {
|
||||||
progress = ret.Data[0]
|
progress = ret.Data[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user