重构匹配页面,通过新增登录和手机号绑定模态窗口来提升用户体验。在添加好友前,增加了通过微信和手机号绑定登录的功能。更新了API配置,并调整了用户联系信息的本地存储处理方式。改进了模态窗口的用户界面元素,并确保用户交互的数据流正确。

This commit is contained in:
2026-02-11 15:50:53 +08:00
parent 1e9ab0da71
commit ecee1bb2bb
10 changed files with 532 additions and 98 deletions

View File

@@ -88,8 +88,11 @@ func MatchUsers(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"success": false, "message": "缺少用户ID"})
return
}
// 只匹配已绑定微信或手机号的用户
var users []model.User
if err := database.DB().Where("id != ?", body.UserID).Order("created_at DESC").Limit(20).Find(&users).Error; err != nil || len(users) == 0 {
q := database.DB().Where("id != ?", body.UserID).
Where("((wechat_id IS NOT NULL AND wechat_id != '') OR (phone IS NOT NULL AND phone != ''))")
if err := q.Order("created_at DESC").Limit(20).Find(&users).Error; err != nil || len(users) == 0 {
c.JSON(http.StatusOK, gin.H{"success": false, "message": "暂无匹配用户", "data": nil})
return
}
@@ -114,9 +117,6 @@ func MatchUsers(c *gin.Context) {
phone := ""
if r.Phone != nil {
phone = *r.Phone
if len(phone) == 11 {
phone = phone[:3] + "****" + phone[7:]
}
}
intro := "来自Soul创业派对的伙伴"
matchLabels := map[string]string{"partner": "找伙伴", "investor": "资源对接", "mentor": "导师顾问", "team": "团队招募"}