From 6278131693201bb62468ca1d80a97c931287888d Mon Sep 17 00:00:00 2001 From: hujiebin Date: Wed, 7 Jun 2023 14:04:49 +0800 Subject: [PATCH] =?UTF-8?q?db=E5=8A=A0=E4=B8=80=E4=B8=AAtype?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/model/cp_m/anniversary.go | 2 ++ route/cp_r/anniversary.go | 28 +--------------------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/domain/model/cp_m/anniversary.go b/domain/model/cp_m/anniversary.go index e930fba..8fc06d0 100644 --- a/domain/model/cp_m/anniversary.go +++ b/domain/model/cp_m/anniversary.go @@ -3,6 +3,7 @@ package cp_m import ( "git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/resource/mysql" + "hilo-user/_const/enum/cp_e" "time" ) @@ -10,6 +11,7 @@ import ( type CpAnniversary struct { mysql.Entity CpId mysql.ID + Type cp_e.AnniversaryItemType UserId1 mysql.ID UserId2 mysql.ID Content string diff --git a/route/cp_r/anniversary.go b/route/cp_r/anniversary.go index 11f59e6..3ef8087 100644 --- a/route/cp_r/anniversary.go +++ b/route/cp_r/anniversary.go @@ -4,11 +4,8 @@ import ( "git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/mycontext" "github.com/gin-gonic/gin" - "hilo-user/_const/enum/cp_e" "hilo-user/cv/cp_cv" - "hilo-user/cv/user_cv" "hilo-user/domain/model/cp_m" - "hilo-user/domain/model/user_m" "hilo-user/myerr/bizerr" "hilo-user/req" "hilo-user/resp" @@ -94,33 +91,10 @@ func PageAnniversary(c *gin.Context) (*mycontext.MyContext, error) { } var response = make([]cp_cv.CvCpAnniversary, 0) model := domain.CreateModelContext(myCtx) - cpRelation, exits := cp_m.GetCpRelation(model, userId) - if exits { - userIds := []uint64{cpRelation.UserId1, cpRelation.UserId2} - users, err := user_m.GetUserMapByIds(model, userIds) - if err != nil { - return myCtx, err - } - cpUserId := cpRelation.UserId2 - if cpUserId == userId { - cpUserId = cpRelation.UserId1 - } - userInfo := user_cv.UserToTiny(users[userId]) - cpUserInfo := user_cv.UserToTiny(users[cpUserId]) - response = append(response, cp_cv.CvCpAnniversary{ - Type: cp_e.AnniversaryItemTypeAvatar, - CpInfo: &cp_cv.CvCpBase{ - UserInfo: *userInfo, - CpUserInfo: *cpUserInfo, - }, - Timestamp: cpRelation.CreatedTime.Unix(), - CanDel: false, - }) - } anniversary := cp_m.GetAllCpAnniversary(model, userId) for _, v := range anniversary { response = append(response, cp_cv.CvCpAnniversary{ - Type: cp_e.AnniversaryItemTypeNormal, + Type: v.Type, Id: v.ID, Content: v.Content, Timestamp: v.Timestamp, -- 2.22.0