go_dreamfactory/modules/sociaty/api_cross_mine.go
2022-11-02 19:54:53 +08:00

51 lines
1.3 KiB
Go

package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
func (this *apiComp) MineCheck(session comm.IUserSession, req *pb.SociatyMineReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId()
userEx, err := this.module.ModuleUser.GetRemoteUserExpand(uid)
if err != nil {
this.module.Errorf("GetRemoteUserExpand uid: err:%v", uid, err)
code = pb.ErrorCode_UserSessionNobeing
return
}
rsp := &pb.SociatyMineResp{}
// 已加入公会
if userEx.SociatyId != "" {
sociaty := this.module.modelSociaty.getSociaty(userEx.SociatyId)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("sociatyId: %s no found", userEx.SociatyId)
return
}
// 获取会长
master := this.module.modelSociaty.getMasterInfo(sociaty)
if master != nil {
//判断当前玩家是否是会长
if master.Uid == uid { //会长
this.module.modelSociaty.extendJob(uid, sociaty)
}
}
rsp.Sociaty = sociaty
rsp.Master = master
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeMine, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}