feat: import services and standardize Go 1.26.5
This commit is contained in:
73
apps/base/passport/internal/logic/account/get.go
Normal file
73
apps/base/passport/internal/logic/account/get.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.apinb.com/bsm-apps/passport/internal/impl"
|
||||
"git.apinb.com/bsm-apps/passport/internal/models"
|
||||
pb "git.apinb.com/bsm-apps/passport/pb"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
)
|
||||
|
||||
// 通过会员所有信息
|
||||
func Get(ctx context.Context, in *pb.Empty) (reply *pb.GetFullReply, err error) {
|
||||
AUTH, err := service.ParseMetaCtx(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
account, err := models.GetPassportAccountByField("id", AUTH.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tagRecords := make([]models.PassportTags, 0)
|
||||
impl.DBService.Model(&models.PassportTags{}).Where("passport_id=?", AUTH.ID).Find(&tagRecords)
|
||||
|
||||
tags := make([]*pb.TagItem, 0)
|
||||
for _, tag := range tagRecords {
|
||||
tags = append(tags, &pb.TagItem{
|
||||
Name: tag.Name,
|
||||
Icon: tag.Icon,
|
||||
})
|
||||
}
|
||||
|
||||
reply = &pb.GetFullReply{
|
||||
Identity: account.Identity,
|
||||
Account: account.Account,
|
||||
Phone: account.Phone,
|
||||
Email: account.Email,
|
||||
Tags: tags,
|
||||
}
|
||||
|
||||
data := &models.PassportData{}
|
||||
impl.DBService.Where("passport_id=?", AUTH.ID).First(data)
|
||||
if data != nil {
|
||||
bd := data.Birthday.Format("2006-01-02")
|
||||
if bd == "0001-01-01" {
|
||||
bd = ""
|
||||
}
|
||||
reply.Rights = data.Rights
|
||||
reply.Nickname = data.Nickname
|
||||
reply.Avatar = data.Avatar
|
||||
reply.Birthday = bd
|
||||
reply.Sex = int32(data.Sex)
|
||||
reply.Country = data.Country
|
||||
reply.Province = data.Province
|
||||
reply.City = data.City
|
||||
reply.Area = data.Area
|
||||
reply.Sign = data.Sign
|
||||
reply.Cover = data.Cover
|
||||
reply.Score = data.Score
|
||||
reply.Level = data.Level
|
||||
reply.VerifyStatus = &pb.VerifyStatus{
|
||||
EmailVerify: data.EmailVerify,
|
||||
PhoneVerify: data.PhoneVerify,
|
||||
FaceVerify: data.FaceVerify,
|
||||
DocumentVerify: data.DocumentVerify,
|
||||
KycVerify: data.KycVerify,
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user