From 356206e34a9baf894f91f4c405a8c47968973694 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Mon, 30 Dec 2024 15:56:29 +0800 Subject: [PATCH] update --- app/svc/svc_im.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/svc/svc_im.go b/app/svc/svc_im.go index 9834f16..ecbdc11 100644 --- a/app/svc/svc_im.go +++ b/app/svc/svc_im.go @@ -16,6 +16,7 @@ import ( md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" "errors" + "fmt" "github.com/google/uuid" "github.com/shopspring/decimal" "google.golang.org/protobuf/proto" @@ -405,6 +406,31 @@ func GetImUser(userId int64, phone string) (user *pb.User, err error) { Phone: phone, }) if err != nil { + fmt.Println("GetImUser>>>>>>>>>>>>>", err.Error()) + var imUser model2.User + if phone != "" { + _, err = db.DbIm.Where("phone_number = ?", phone).Get(&imUser) + if err != nil { + return + } + } + if userId != 0 { + _, err = db.DbIm.Where("id = ?", userId).Get(&imUser) + if err != nil { + return + } + } + user = &pb.User{ + UserId: imUser.Id, + Nickname: imUser.Nickname, + Sex: imUser.Sex, + AvatarUrl: imUser.AvatarUrl, + Extra: imUser.Extra, + CreateTime: 0, + UpdateTime: 0, + IsAutoAddedFriends: 0, + PhoneNumber: imUser.PhoneNumber, + } return } return resp.User, nil