36 lines
784 B
Go
36 lines
784 B
Go
package user
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.UserInfoReq) (code pb.ErrorCode) {
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) Info(session comm.IUserSession, req *pb.UserInfoReq) (code pb.ErrorCode, data proto.Message) {
|
|
if code = this.InfoCheck(session, req); code != pb.ErrorCode_Success {
|
|
return
|
|
}
|
|
|
|
dbUser := this.module.GetUser(session.GetUserId())
|
|
|
|
ue, err := this.module.GetUserExpand(session.GetUserId())
|
|
if err != nil {
|
|
code = pb.ErrorCode_DBError
|
|
}
|
|
|
|
rsp := &pb.UserInfoResp{
|
|
Data: dbUser,
|
|
Ex: ue,
|
|
}
|
|
|
|
if err := session.SendMsg(string(this.module.GetType()), UserSubTypeInfo, rsp); err != nil {
|
|
code = pb.ErrorCode_SystemError
|
|
}
|
|
return
|
|
}
|