40 lines
938 B
Go
40 lines
938 B
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
|
|
}
|
|
|
|
|
|
// 未加入公会
|
|
if userEx.SociatyId == "" {
|
|
code = pb.ErrorCode_SociatyNoAdded
|
|
return
|
|
}
|
|
|
|
sociaty := this.module.modelSociaty.getSociaty(userEx.SociatyId)
|
|
|
|
rsp := &pb.SociatyMineResp{
|
|
Sociaty: sociaty,
|
|
}
|
|
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeMine, rsp); err != nil {
|
|
code = pb.ErrorCode_SystemError
|
|
}
|
|
return
|
|
}
|