feat: MBTI头像与用户规则链路升级,三端页面与接口同步
Made-with: Cursor
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"soul-api/internal/database"
|
||||
@@ -295,6 +296,16 @@ func MatchUsers(c *gin.Context) {
|
||||
if r.Avatar != nil {
|
||||
avatar = resolveAvatarURL(*r.Avatar)
|
||||
}
|
||||
if avatar == "" && r.Mbti != nil {
|
||||
mbti := strings.ToUpper(strings.TrimSpace(*r.Mbti))
|
||||
if mbti != "" {
|
||||
avatar = resolveAvatarURL(getMbtiAvatar(db, mbti))
|
||||
}
|
||||
}
|
||||
mbtiOut := ""
|
||||
if r.Mbti != nil {
|
||||
mbtiOut = strings.TrimSpace(*r.Mbti)
|
||||
}
|
||||
wechat := ""
|
||||
if r.WechatID != nil {
|
||||
wechat = *r.WechatID
|
||||
@@ -331,7 +342,7 @@ func MatchUsers(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": true,
|
||||
"data": gin.H{
|
||||
"id": r.ID, "nickname": nickname, "avatar": avatar, "wechat": wechat, "phone": phone,
|
||||
"id": r.ID, "nickname": nickname, "avatar": avatar, "mbti": mbtiOut, "wechat": wechat, "phone": phone,
|
||||
"introduction": intro, "tags": []string{"创业者", tag},
|
||||
"matchScore": 80 + (r.CreatedAt.Unix() % 20),
|
||||
"commonInterests": []gin.H{
|
||||
|
||||
Reference in New Issue
Block a user