Prechádzať zdrojové kódy

feat(api): 添加喜欢我的用户功能

- 在api.js中新增getLikedMeUsers和getLikedMeUsersCount接口方法
- 实现获取喜欢我的用户列表功能,支持分页和偏移量参数
- 添加VIP支付状态查询接口checkPayStatus
- 优化代码格式和缩进一致性
- 在liked-me.vue页面实现加载更多和下拉刷新功能
- 添加用户头像错误处理和默认头像显示
- 在RecommendController中新增liked-me-users接口端点
- 实现liked-by-me.vue页面的用户数据加载和展示功能
李思佳 4 dní pred
rodič
commit
99bca197c7

+ 29 - 29
LiangZhiYUMao/pages/mine/liked-by-me.vue

@@ -5,7 +5,7 @@
       <uni-loading type="circle" color="#E91E63"></uni-loading>
       <text class="loading-text">加载中...</text>
     </view>
-    
+
     <!-- 空数据状态 -->
     <view class="empty-container" v-else-if="users.length === 0">
       <text class="empty-icon">💔</text>
@@ -14,7 +14,7 @@
         <button class="action-btn" @click="goRecommend">去推荐看看</button>
       </view>
     </view>
-    
+
     <!-- 用户列表 -->
     <scroll-view class="user-list" scroll-y="true" @refresherrefresh="onRefresh" @scrolltolower="onLoadMore" refresher-enabled="true" refresher-triggered="refreshing">
       <view class="user-item" v-for="user in users" :key="user.userId" @click="goUserDetail(user.userId)">
@@ -38,7 +38,7 @@
           <text class="like-icon">❤️</text>
         </view>
       </view>
-      
+
       <!-- 加载更多提示 -->
       <view class="load-more" v-if="users.length > 0">
         <text v-if="hasMore">加载中...</text>
@@ -87,7 +87,7 @@ export default {
           salaryText: this.formatSalary(user.salaryRange),
           location: this.formatLocation(user.provinceId, user.cityId, user.areaId)
         }))
-        
+
         // 根据是否是刷新操作来处理数据
         if (this.pageNum === 1) {
           // 首次加载或刷新,直接替换数据
@@ -96,7 +96,7 @@ export default {
           // 加载更多,追加数据
           this.users = [...this.users, ...formattedUsers]
         }
-        
+
         // 判断是否还有更多数据
         this.hasMore = formattedUsers.length >= this.pageSize
       } catch (error) {
@@ -110,7 +110,7 @@ export default {
         this.refreshing = false
       }
     },
-    
+
     // 下拉刷新
     async onRefresh() {
       this.refreshing = true
@@ -118,14 +118,14 @@ export default {
       this.hasMore = true
       await this.loadUsers()
     },
-    
+
     // 上拉加载更多
     async onLoadMore() {
       if (this.loading || !this.hasMore) return
       this.pageNum++
       await this.loadUsers()
     },
-    
+
     // 计算年龄
     calculateAge(birthDate) {
       if (!birthDate) return ''
@@ -137,28 +137,28 @@ export default {
       }
       return age
     },
-    
+
     // 格式化教育程度
     formatEducation(educationLevel) {
       if (!educationLevel) return ''
       const map = {1:'高中',2:'大专',3:'本科',4:'硕士',5:'博士'}
       return map[educationLevel] || ''
     },
-    
+
     // 格式化薪资
     formatSalary(salaryRange) {
       if (!salaryRange) return ''
       const map = {1:'<5k',2:'5-10k',3:'10-20k',4:'20-50k',5:'50k+'}
       return map[salaryRange] || ''
     },
-    
+
     // 格式化地理位置
     formatLocation(provinceId, cityId, areaId) {
       // 这里简化处理,实际可以根据ID查询名称
       // 由于没有实时获取地区名称的API,暂时返回空字符串
       return ''
     },
-    
+
     // 取消喜欢
     async cancelLike(targetUserId) {
       try {
@@ -175,7 +175,7 @@ export default {
         uni.showToast({ title: '取消喜欢失败', icon: 'none' })
       }
     },
-    
+
     // 跳转到用户详情页
     goUserDetail(userId) {
       uni.navigateTo({
@@ -189,7 +189,7 @@ export default {
         }
       })
     },
-    
+
     // 跳转到推荐页面
     goRecommend() {
       uni.navigateTo({
@@ -215,7 +215,7 @@ export default {
   align-items: center;
   justify-content: center;
   padding: 100rpx 0;
-  
+
   .loading-text {
     margin-top: 20rpx;
     font-size: 28rpx;
@@ -229,18 +229,18 @@ export default {
   align-items: center;
   justify-content: center;
   padding: 150rpx 0;
-  
+
   .empty-icon {
     font-size: 120rpx;
     margin-bottom: 30rpx;
   }
-  
+
   .empty-text {
     font-size: 32rpx;
     color: #999999;
     margin-bottom: 40rpx;
   }
-  
+
   .action-btn {
     background: linear-gradient(135deg, #FF6B9D 0%, #E91E63 100%);
     color: #FFFFFF;
@@ -252,7 +252,7 @@ export default {
     box-shadow: 0 6rpx 20rpx rgba(233, 30, 99, 0.3);
     transition: all 0.3s ease;
     letter-spacing: 1rpx;
-    
+
     &:active {
       transform: translateY(2rpx);
       box-shadow: 0 3rpx 12rpx rgba(233, 30, 99, 0.4);
@@ -284,12 +284,12 @@ export default {
   margin-bottom: 20rpx;
   box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
   transition: all 0.3s ease;
-  
+
   &:active {
     transform: translateY(2rpx);
     box-shadow: 0 1rpx 5rpx rgba(0, 0, 0, 0.05);
   }
-  
+
   .user-avatar {
     width: 120rpx;
     height: 120rpx;
@@ -298,34 +298,34 @@ export default {
     border: 4rpx solid #FFF9F9;
     box-shadow: 0 4rpx 15rpx rgba(233, 30, 99, 0.2);
   }
-  
+
   .user-info {
     flex: 1;
-    
+
     .user-basic {
       display: flex;
       align-items: center;
       margin-bottom: 10rpx;
-      
+
       .user-nickname {
         font-size: 32rpx;
         font-weight: bold;
         color: #333333;
         margin-right: 15rpx;
       }
-      
+
       .user-age {
         font-size: 28rpx;
         color: #666666;
       }
     }
-    
+
     .user-details {
       display: flex;
       flex-wrap: wrap;
       gap: 15rpx;
       margin-bottom: 10rpx;
-      
+
       .detail-item {
         font-size: 24rpx;
         color: #999999;
@@ -334,7 +334,7 @@ export default {
         border-radius: 15rpx;
       }
     }
-    
+
     .user-location {
       .location-text {
         font-size: 24rpx;
@@ -342,7 +342,7 @@ export default {
       }
     }
   }
-  
+
   .like-status {
     .like-icon {
       font-size: 40rpx;

+ 221 - 14
LiangZhiYUMao/pages/mine/liked-me.vue

@@ -1,13 +1,11 @@
 <template>
   <view class="like-page">
-    <!-- 数据加载状态 -->
-    <view class="loading-container" v-if="loading">
+    <view v-if="loading && users.length === 0" class="loading-container">
       <uni-loading type="circle" color="#E91E63"></uni-loading>
       <text class="loading-text">加载中...</text>
     </view>
     
-    <!-- 空数据状态 -->
-    <view class="empty-container" v-else-if="users.length === 0">
+    <view v-else-if="users.length === 0" class="empty-container">
       <text class="empty-icon">😊</text>
       <text class="empty-text">暂无用户喜欢您</text>
       <view class="empty-action">
@@ -15,10 +13,9 @@
       </view>
     </view>
     
-    <!-- 用户列表 -->
-    <scroll-view class="user-list" scroll-y="true">
+    <scroll-view v-else class="user-list" scroll-y="true" @scrolltolower="loadMoreUsers">
       <view class="user-item" v-for="user in users" :key="user.userId" @click="goUserDetail(user.userId)">
-        <image class="user-avatar" :src="user.avatar" mode="aspectFill"></image>
+        <image class="user-avatar" :src="user.avatar" mode="aspectFill" @error="handleAvatarError(user)"></image>
         <view class="user-info">
           <view class="user-basic">
             <text class="user-nickname">{{ user.nickname }}</text>
@@ -38,6 +35,15 @@
           <text class="like-icon">💖</text>
         </view>
       </view>
+      
+      <view v-if="loadingMore" class="loading-more">
+        <uni-loading type="circle" color="#E91E63" size="20"></uni-loading>
+        <text class="loading-more-text">加载更多...</text>
+      </view>
+      
+      <view v-else-if="!hasMore && users.length > 0" class="no-more">
+        <text class="no-more-text">没有更多了</text>
+      </view>
     </scroll-view>
   </view>
 </template>
@@ -45,28 +51,162 @@
 <script>
 import api from '@/utils/api.js'
 
+const EDUCATION_MAP = {
+  1: '初中',
+  2: '高中',
+  3: '大专',
+  4: '本科',
+  5: '硕士',
+  6: '博士'
+}
+
+const SALARY_MAP = {
+  1: '3k以下',
+  2: '3k-5k',
+  3: '5k-8k',
+  4: '8k-12k',
+  5: '12k-20k',
+  6: '20k-50k',
+  7: '50k以上'
+}
+
 export default {
   data() {
     return {
       users: [],
       loading: true,
+      loadingMore: false,
       pageNum: 1,
       pageSize: 20,
-      hasMore: true
+      hasMore: true,
+      currentUserId: null
     }
   },
   onLoad() {
-    this.loadUsers()
+    this.getCurrentUserId()
+  },
+  onShow() {
+    if (!this.users.length || this.users.length === 0) {
+      this.loadUsers()
+    }
   },
   methods: {
-    // 加载喜欢我的用户列表
+    getCurrentUserId() {
+      try {
+        const userInfo = uni.getStorageSync('userInfo')
+        if (userInfo) {
+          this.currentUserId = userInfo.userId || userInfo.id
+        }
+        if (!this.currentUserId) {
+          const token = uni.getStorageSync('token')
+          if (token) {
+            console.warn('无法获取当前用户ID,请检查登录状态')
+          }
+        }
+      } catch (e) {
+        console.error('获取用户信息失败:', e)
+      }
+    },
+    
+    transformUserData(user) {
+      if (!user) return null
+      
+      const birthDate = user.birthDate || user.birth_date
+      let age = ''
+      if (birthDate) {
+        try {
+          const birth = new Date(birthDate)
+          if (!isNaN(birth.getTime())) {
+            const today = new Date()
+            let userAge = today.getFullYear() - birth.getFullYear()
+            const monthDiff = today.getMonth() - birth.getMonth()
+            if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) {
+              userAge--
+            }
+            age = userAge > 0 ? userAge : ''
+          }
+        } catch (e) {
+          console.error('计算年龄失败:', e)
+        }
+      }
+      
+      let educationText = ''
+      if (user.educationLevel !== undefined && user.educationLevel !== null) {
+        educationText = EDUCATION_MAP[user.educationLevel] || ''
+      }
+      
+      let salaryText = ''
+      if (user.salaryRange !== undefined && user.salaryRange !== null) {
+        salaryText = SALARY_MAP[user.salaryRange] || ''
+      }
+      
+      let location = ''
+      if (user.cityId || user.provinceId) {
+        location = this.formatLocation(user.provinceId, user.cityId)
+      }
+      
+      return {
+        userId: user.userId || user.user_id,
+        nickname: user.nickname || '匿名用户',
+        avatar: user.avatarUrl || user.avatar_url || user.avatar || '/static/default-avatar.png',
+        age: age,
+        height: user.height || '',
+        weight: user.weight || '',
+        educationText: educationText,
+        salaryText: salaryText,
+        location: location,
+        gender: user.gender
+      }
+    },
+    
+    formatLocation(provinceId, cityId) {
+      if (!provinceId && !cityId) return ''
+      const locationMap = this.$const.LOCATION_MAP
+      if (locationMap && locationMap.length > 0) {
+        try {
+          const province = locationMap.find(p => p.id === provinceId)
+          const city = province && province.children ? province.children.find(c => c.id === cityId) : null
+          if (city) {
+            return city.name || ''
+          }
+        } catch (e) {
+          console.error('获取位置信息失败:', e)
+        }
+      }
+      return ''
+    },
+    
     async loadUsers() {
+      if (!this.currentUserId) {
+        this.getCurrentUserId()
+        if (!this.currentUserId) {
+          uni.showToast({
+            title: '请先登录',
+            icon: 'none'
+          })
+          this.loading = false
+          return
+        }
+      }
+      
       try {
         this.loading = true
-        // 不调用真实API,显示空数据
-        this.users = []
+        const res = await api.recommend.getLikedMeUsers(this.currentUserId, this.pageSize, 0)
+        
+        if (res && Array.isArray(res)) {
+          this.users = res.map(user => this.transformUserData(user))
+          this.hasMore = res.length >= this.pageSize
+        } else {
+          this.users = []
+          this.hasMore = false
+        }
+        
+        if (this.users.length === 0) {
+          console.log('没有喜欢我的用户')
+        }
       } catch (error) {
         console.error('加载喜欢我的用户失败:', error)
+        this.users = []
         uni.showToast({
           title: '加载失败,请重试',
           icon: 'none'
@@ -76,8 +216,53 @@ export default {
       }
     },
     
-    // 跳转到用户详情页
+    async loadMoreUsers() {
+      if (this.loadingMore || !this.hasMore) {
+        return
+      }
+      
+      if (!this.currentUserId) {
+        return
+      }
+      
+      try {
+        this.loadingMore = true
+        const offset = (this.pageNum) * this.pageSize
+        const res = await api.recommend.getLikedMeUsers(this.currentUserId, this.pageSize, offset)
+        
+        if (res && Array.isArray(res) && res.length > 0) {
+          const newUsers = res.map(user => this.transformUserData(user))
+          this.users = this.users.concat(newUsers)
+          this.pageNum++
+          this.hasMore = res.length >= this.pageSize
+        } else {
+          this.hasMore = false
+        }
+      } catch (error) {
+        console.error('加载更多用户失败:', error)
+        uni.showToast({
+          title: '加载更多失败',
+          icon: 'none'
+        })
+      } finally {
+        this.loadingMore = false
+      }
+    },
+    
+    handleAvatarError(user) {
+      if (user) {
+        user.avatar = '/static/default-avatar.png'
+      }
+    },
+    
     goUserDetail(userId) {
+      if (!userId) {
+        uni.showToast({
+          title: '用户信息不完整',
+          icon: 'none'
+        })
+        return
+      }
       uni.navigateTo({
         url: `/pages/recommend/index?userId=${userId}`,
         fail: (err) => {
@@ -90,7 +275,6 @@ export default {
       })
     },
     
-    // 跳转到推荐页面
     goRecommend() {
       uni.navigateTo({
         url: '/pages/profile/index'
@@ -241,4 +425,27 @@ export default {
     }
   }
 }
+
+.loading-more {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 30rpx 0;
+  
+  .loading-more-text {
+    margin-left: 16rpx;
+    font-size: 26rpx;
+    color: #999999;
+  }
+}
+
+.no-more {
+  text-align: center;
+  padding: 30rpx 0;
+  
+  .no-more-text {
+    font-size: 26rpx;
+    color: #999999;
+  }
+}
 </style>

+ 243 - 235
LiangZhiYUMao/utils/api.js

@@ -4,9 +4,9 @@
 
 // 开发环境和生产环境的 API 基础地址
 // 所有请求通过网关转发
-const BASE_URL = process.env.NODE_ENV === 'development' 
-  ? 'https://api.zhongruanke.cn/api'  // 开发环境 - 通过网关
-  : 'https://api.zhongruanke.cn/api'  // 生产环境
+const BASE_URL = process.env.NODE_ENV === 'development'
+    ? 'https://api.zhongruanke.cn/api'  // 开发环境 - 通过网关
+    : 'https://api.zhongruanke.cn/api'  // 生产环境
 
 /**
  * 封装 uni.request
@@ -27,7 +27,7 @@ const request = (options) => {
       header: headers,
       dataType: 'json',
       success: (res) => {
-        
+
         if (res.statusCode === 200) {
           // 根据后端约定的数据格式处理
           if (res.data.code === 200 || res.data.code === 0 || res.data.success) {
@@ -115,27 +115,27 @@ export default {
   user: {
     // 获取用户信息
     getInfo: () => request({ url: '/user/info' }),
-    
+
     // 获取指定用户的详细信息(包含简介和照片)
     getDetailInfo: (userId) => request({
       url: `/user/info?userId=${userId}`
     }),
-    
+
     // 查询用户是否为红娘
     getMatchmakerStatus: (userId) => request({
       url: `/user/matchmaker-status?userId=${userId}`
     }),
-    
+
     // 获取今日匹配数
     getMatchCount: () => request({ url: '/user/match-count' }),
-    
+
     // 更新用户基本信息(昵称、头像等)
-    updateInfo: (data) => request({ 
-      url: '/user/basic', 
-      method: 'PUT', 
-      data 
+    updateInfo: (data) => request({
+      url: '/user/basic',
+      method: 'PUT',
+      data
     }),
-    
+
     // 更新单个字段
     updateField: (userId, fieldName, fieldValue) => request({
       url: `/user/basic/field?userId=${userId}&fieldName=${fieldName}&fieldValue=${encodeURIComponent(fieldValue)}`,
@@ -186,16 +186,16 @@ export default {
   home: {
     // 获取轮播图
     getBanners: () => request({ url: '/home/banners' }),
-    
+
     // 获取公告列表
     getNotices: () => request({ url: '/announcement/active' }),
-    
+
     // 获取首页金刚区功能列表
     getFunctionGrid: () => request({ url: '/home/function-grid' }),
-    
+
     // 根据类型获取金刚区功能列表
     getFunctionGridByType: (type) => request({ url: `/home/function-grid/type?type=${type}` }),
-    
+
     // 获取未读消息数
     getUnreadCount: () => request({ url: '/home/unread-count' })
   },
@@ -203,20 +203,20 @@ export default {
   // 成功案例
   successCase: {
     // 获取成功案例列表
-    getList: (params) => request({ 
+    getList: (params) => request({
       url: '/success-case/list',
       method: 'GET',
-      data: params 
+      data: params
     }),
-    
+
     // 获取成功案例详情
-    getDetail: (caseNo) => request({ 
+    getDetail: (caseNo) => request({
       url: `/success-case/detail/${caseNo}`,
       method: 'GET'
     }),
-    
+
     // 获取案例时间线
-    getTimeline: (caseNo) => request({ 
+    getTimeline: (caseNo) => request({
       url: `/success-case/timeline/${caseNo}`,
       method: 'GET'
     })
@@ -225,37 +225,37 @@ export default {
   // 活动相关
   activity: {
     // 获取活动列表
-    getList: (params) => request({ 
+    getList: (params) => request({
       url: '/activity/list',
       method: 'GET',
-      data: params 
+      data: params
     }),
-    
+
     // 获取活动详情
-    getDetail: (id) => request({ 
+    getDetail: (id) => request({
       url: `/activity/detail/${id}`,
       method: 'GET'
     }),
-    
+
     // 报名活动
-    register: (activityId, userId) => request({ 
-      url: `/activity/register/${activityId}?userId=${userId}`, 
+    register: (activityId, userId) => request({
+      url: `/activity/register/${activityId}?userId=${userId}`,
       method: 'POST'
     }),
-    
+
     // 取消报名
-    cancelRegister: (activityId) => request({ 
-      url: `/activity/cancel/${activityId}`, 
-      method: 'POST' 
+    cancelRegister: (activityId) => request({
+      url: `/activity/cancel/${activityId}`,
+      method: 'POST'
     }),
-    
+
     // 获取我的活动列表
-    getMyActivities: (params) => request({ 
+    getMyActivities: (params) => request({
       url: '/activity/my',
       method: 'GET',
-      data: params 
+      data: params
     }),
-    
+
     // 创建活动订单并获取支付参数
     createOrder: (userId, activityId, activityName, price) => request({
       url: '/activity-order/create',
@@ -272,52 +272,52 @@ export default {
   // 课程相关
   course: {
     // 获取课程列表
-    getList: (params) => request({ 
+    getList: (params) => request({
       url: '/course/list',
       method: 'GET',
-      data: params 
+      data: params
     }),
-    
+
     // 获取课程详情(带学习进度)
-    getDetail: (courseId, makerId) => request({ 
+    getDetail: (courseId, makerId) => request({
       url: `/course/detail/${courseId}${makerId ? '?makerId=' + makerId : ''}`,
       method: 'GET'
     }),
-    
+
     // 更新学习进度
     updateProgress: (makerId, courseId, progress) => request({
       url: '/course/progress',
       method: 'POST',
       data: { makerId, courseId, progress }
     }),
-    
+
     // 完成课程(领取积分)
     complete: (makerId, courseId) => request({
       url: '/course/complete',
       method: 'POST',
       data: { makerId, courseId }
     }),
-    
+
     // 获取我的学习记录
     getMyProgress: (makerId) => request({
       url: `/course/my-progress?makerId=${makerId}`,
       method: 'GET'
     }),
-    
+
     // 购买课程(旧接口-模拟)
-    purchase: (courseId, data) => request({ 
-      url: `/course/purchase/${courseId}`, 
-      method: 'POST', 
-      data 
+    purchase: (courseId, data) => request({
+      url: `/course/purchase/${courseId}`,
+      method: 'POST',
+      data
     }),
-    
+
     // 积分兑换课程(红娘端 - 旧接口,已废弃)
     exchange: (data) => request({
       url: '/course/exchange',
       method: 'POST',
       data
     }),
-    
+
     // 获取已兑换的课程列表(红娘端 - 旧接口,已废弃)
     getPurchasedList: (makerId) => request({
       url: `/course/purchased?makerId=${makerId}`,
@@ -333,38 +333,38 @@ export default {
       method: 'GET',
       data: params
     }),
-    
+
     // 根据分类获取红娘课程列表
     getListByCategory: (categoryName) => request({
       url: `/matchmaker-course/list/category?categoryName=${encodeURIComponent(categoryName)}`,
       method: 'GET'
     }),
-    
+
     // 获取所有课程分类
     getCategories: () => request({
       url: '/matchmaker-course/categories',
       method: 'GET'
     }),
-    
+
     // 获取红娘课程详情
     getDetail: (id) => request({
       url: `/matchmaker-course/detail/${id}`,
       method: 'GET'
     }),
-    
+
     // 检查是否已兑换
     checkExchanged: (makerId, courseId) => request({
       url: `/matchmaker-course/check-exchanged?makerId=${makerId}&courseId=${courseId}`,
       method: 'GET'
     }),
-    
+
     // 积分兑换课程
     exchange: (data) => request({
       url: '/matchmaker-course/exchange',
       method: 'POST',
       data
     }),
-    
+
     // 获取已兑换的课程列表
     getPurchasedList: (makerId) => request({
       url: `/matchmaker-course/purchased?makerId=${makerId}`,
@@ -380,13 +380,13 @@ export default {
       method: 'POST',
       data
     }),
-    
+
     // 检查是否已购买课程
     checkPurchased: (userId, courseId) => request({
       url: `/course-order/check?userId=${userId}&courseId=${courseId}`,
       method: 'GET'
     }),
-    
+
     // 获取已购买的课程列表
     getPurchasedCourses: (userId) => request({
       url: `/course-order/purchased?userId=${userId}`,
@@ -395,115 +395,115 @@ export default {
   },
 
   // 红娘相关
-    matchmaker: {
-        // 获取红娘列表
-        getList: (params) => request({ 
-            url: '/matchmaker/list', 
-            method: 'POST',
-            data: params 
-        }),
-        
-        // 获取全职红娘列表
-        getFormalList: (pageNum, pageSize) => request({ 
-            url: `/matchmaker/formal?pageNum=${pageNum}&pageSize=${pageSize}` 
-        }),
-        
-        // 获取红娘详情
-        getDetail: (id) => request({ 
-            url: `/matchmaker/detail/${id}` 
-        }),
-        
-        // 根据userId查询红娘信息
-        getByUserId: (userId) => request({ 
-            url: `/matchmaker/by-user/${userId}` 
-        }),
-        
-        // 预约红娘
-        book: (matchmakerId, data) => request({ 
-            url: `/matchmaker/book/${matchmakerId}`, 
-            method: 'POST', 
-            data 
-        }),
-        
-        // 提交红娘申请
-        submitApply: (data) => request({
-            url: '/matchmaker-apply/submit',
-            method: 'POST',
-            data
-        }),
-        
-        // 查询红娘申请状态
-        getApplyStatus: (userId) => request({
-            url: `/matchmaker-apply/status?userId=${userId}`,
-            method: 'GET'
-        }),
-        
-        // 工作台相关
-        getWorkbenchData: () => request({ url: '/matchmaker/workbench/data' }),
-        
-        // 获取我的资源
-        getMyResources: (params) => request({ 
-            url: '/matchmaker/resources', 
-            method: 'GET',
-            data: params 
-        }),
-        
-        // 获取排行榜数据(总排行榜)
-        getRankingData: (params) => request({ 
-            url: '/matchmaker/ranking', 
-            method: 'GET',
-            data: params 
-        }),
-        
-        // 获取本周排行榜(按点赞数和成功人数平均数排名)
-        getWeeklyRanking: (params) => request({ 
-            url: '/matchmaker/weekly-ranking', 
-            method: 'GET',
-            data: params 
-        }),
-        
-        // 给红娘点赞(一周只能给同一红娘点赞一次)
-        likeMatchmaker: (userId, matchmakerId) => request({ 
-            url: `/matchmaker/like?userId=${userId}&matchmakerId=${matchmakerId}`, 
-            method: 'POST'
-        }),
-        
-        // 检查是否已点赞
-        checkLikeStatus: (userId, matchmakerId) => request({ 
-            url: `/matchmaker/check-like?userId=${userId}&matchmakerId=${matchmakerId}`, 
-            method: 'GET'
-        }),
-        
-        // 签到相关
-        checkinStatus: (makerId) => request({ 
-            url: `/matchmaker/checkin/status?makerId=${makerId}` 
-        }),
-        
-        checkinStats: (makerId) => request({ 
-            url: `/matchmaker/checkin/stats?makerId=${makerId}` 
-        }),
-        
-        doCheckin: (makerId) => request({ 
-            url: `/matchmaker/checkin/do?makerId=${makerId}`, 
-            method: 'POST' 
-        }),
-        
-        // 获取签到信息,包括当月已签到日期
-        checkinInfo: (makerId, year, month) => request({ 
-            url: `/matchmaker/checkin/info?makerId=${makerId}&year=${year}&month=${month}` 
-        }),
-
-        // 更新红娘资料(编辑资料页使用)
-        updateProfile: (matchmakerId, data) => request({
-            url: `/matchmaker/update/${matchmakerId}`,
-            method: 'PUT',
-            data
-        }),
-        
-        // 获取本月签到记录
-        checkinList: (makerId, year, month) => request({
-            url: `/matchmaker/checkin/list?makerId=${makerId}&year=${year}&month=${month}`
-        })
+  matchmaker: {
+    // 获取红娘列表
+    getList: (params) => request({
+      url: '/matchmaker/list',
+      method: 'POST',
+      data: params
+    }),
+
+    // 获取全职红娘列表
+    getFormalList: (pageNum, pageSize) => request({
+      url: `/matchmaker/formal?pageNum=${pageNum}&pageSize=${pageSize}`
+    }),
+
+    // 获取红娘详情
+    getDetail: (id) => request({
+      url: `/matchmaker/detail/${id}`
+    }),
+
+    // 根据userId查询红娘信息
+    getByUserId: (userId) => request({
+      url: `/matchmaker/by-user/${userId}`
+    }),
+
+    // 预约红娘
+    book: (matchmakerId, data) => request({
+      url: `/matchmaker/book/${matchmakerId}`,
+      method: 'POST',
+      data
+    }),
+
+    // 提交红娘申请
+    submitApply: (data) => request({
+      url: '/matchmaker-apply/submit',
+      method: 'POST',
+      data
+    }),
+
+    // 查询红娘申请状态
+    getApplyStatus: (userId) => request({
+      url: `/matchmaker-apply/status?userId=${userId}`,
+      method: 'GET'
+    }),
+
+    // 工作台相关
+    getWorkbenchData: () => request({ url: '/matchmaker/workbench/data' }),
+
+    // 获取我的资源
+    getMyResources: (params) => request({
+      url: '/matchmaker/resources',
+      method: 'GET',
+      data: params
+    }),
+
+    // 获取排行榜数据(总排行榜)
+    getRankingData: (params) => request({
+      url: '/matchmaker/ranking',
+      method: 'GET',
+      data: params
+    }),
+
+    // 获取本周排行榜(按点赞数和成功人数平均数排名)
+    getWeeklyRanking: (params) => request({
+      url: '/matchmaker/weekly-ranking',
+      method: 'GET',
+      data: params
+    }),
+
+    // 给红娘点赞(一周只能给同一红娘点赞一次)
+    likeMatchmaker: (userId, matchmakerId) => request({
+      url: `/matchmaker/like?userId=${userId}&matchmakerId=${matchmakerId}`,
+      method: 'POST'
+    }),
+
+    // 检查是否已点赞
+    checkLikeStatus: (userId, matchmakerId) => request({
+      url: `/matchmaker/check-like?userId=${userId}&matchmakerId=${matchmakerId}`,
+      method: 'GET'
+    }),
+
+    // 签到相关
+    checkinStatus: (makerId) => request({
+      url: `/matchmaker/checkin/status?makerId=${makerId}`
+    }),
+
+    checkinStats: (makerId) => request({
+      url: `/matchmaker/checkin/stats?makerId=${makerId}`
+    }),
+
+    doCheckin: (makerId) => request({
+      url: `/matchmaker/checkin/do?makerId=${makerId}`,
+      method: 'POST'
+    }),
+
+    // 获取签到信息,包括当月已签到日期
+    checkinInfo: (makerId, year, month) => request({
+      url: `/matchmaker/checkin/info?makerId=${makerId}&year=${year}&month=${month}`
+    }),
+
+    // 更新红娘资料(编辑资料页使用)
+    updateProfile: (matchmakerId, data) => request({
+      url: `/matchmaker/update/${matchmakerId}`,
+      method: 'PUT',
+      data
+    }),
+
+    // 获取本月签到记录
+    checkinList: (makerId, year, month) => request({
+      url: `/matchmaker/checkin/list?makerId=${makerId}&year=${year}&month=${month}`
+    })
   },
 
   // 推荐相关
@@ -531,8 +531,8 @@ export default {
       data: query
     }),
     // 获取今日推荐
-    getTodayRecommend: () => request({ 
-      url: '/recommend/today' 
+    getTodayRecommend: () => request({
+      url: '/recommend/today'
     }),
     // 获取用户喜欢的列表
     getLikedUsers: (userId, limit, offset) => request({
@@ -541,27 +541,35 @@ export default {
     // 获取用户喜欢的用户数量
     getLikedUsersCount: (userId) => request({
       url: `/recommend/liked-users-count?userId=${userId}`
+    }),
+    // 获取喜欢我的用户列表
+    getLikedMeUsers: (userId, limit, offset) => request({
+      url: `/recommend/liked-me-users?userId=${userId}${limit ? `&limit=${limit}` : ''}${offset ? `&offset=${offset}` : ''}`
+    }),
+    // 获取喜欢我的用户数量
+    getLikedMeUsersCount: (userId) => request({
+      url: `/recommend/liked-me-users-count?userId=${userId}`
     })
   },
 
   // 消息相关
   message: {
     // 获取消息列表
-    getList: (params) => request({ 
-      url: '/message/list', 
-      data: params 
+    getList: (params) => request({
+      url: '/message/list',
+      data: params
     }),
-    
+
     // 获取会话列表
-    getConversations: () => request({ 
-      url: '/message/conversations' 
+    getConversations: () => request({
+      url: '/message/conversations'
     }),
-    
+
     // 发送消息
-    send: (data) => request({ 
-      url: '/message/send', 
-      method: 'POST', 
-      data 
+    send: (data) => request({
+      url: '/message/send',
+      method: 'POST',
+      data
     }),
 
     // ===== 系统消息 =====
@@ -768,17 +776,17 @@ export default {
     // 单个文件上传方法
     uploadSingle: (filePath) => {
       return new Promise((resolve, reject) => {
-    
+
 
         uni.uploadFile({
           url: BASE_URL + '/dynamic/publish/upload',
           filePath: filePath,
           name: 'file',
           success: (res) => {
-           
+
             try {
               const data = JSON.parse(res.data)
-              
+
 
               if (data.code === 200 || data.code === 0 || data.success) {
                 resolve(data.data)
@@ -840,22 +848,22 @@ export default {
       method: 'POST',
       data
     }),
-    
+
     // 获取用户收藏列表
     getFavoritesList: (userId, pageNum = 1, pageSize = 10) => request({
       url: `/dynamic/favorites?userId=${userId}&pageNum=${pageNum}&pageSize=${pageSize}`
     }),
-    
+
     // 获取用户点赞列表
     getLikedList: (userId, pageNum = 1, pageSize = 10) => request({
       url: `/dynamic/likes?userId=${userId}&pageNum=${pageNum}&pageSize=${pageSize}`
     }),
-    
+
     // 获取用户浏览记录列表
     getBrowseHistoryList: (userId, pageNum = 1, pageSize = 10) => request({
       url: `/dynamic/browse-history?userId=${userId}&pageNum=${pageNum}&pageSize=${pageSize}`
     }),
-    
+
     // 清空用户浏览记录
     clearBrowseHistory: (userId) => request({
       url: `/dynamic/browse-history?userId=${userId}`,
@@ -865,35 +873,35 @@ export default {
 
   // VIP相关
   vip: {
-      // 获取VIP信息(状态、套餐等)
-      getInfo: (userId) => request({ 
-        url: `/vip/info?userId=${userId}` 
-      }),
-      
-      // 获取VIP套餐列表
-      getPackages: () => request({ 
-        url: '/vip/packages' 
-      }),
-      
-      // 购买VIP套餐(获取支付参数)
-      purchase: (userId, packageId) => request({ 
-        url: '/vip/purchase', 
-        method: 'POST', 
-        data: { userId, packageId } 
-      }),
-      
-      // 查询订单状态
-      getOrderStatus: (orderNo) => request({ 
-        url: `/vip/order/status?orderNo=${orderNo}` 
-      }),
-  	  // 新增:查询支付状态(userId + packageId)
-  	    checkPayStatus: (userId, packageId) => request({
-  	      url: '/vip/checkPayStatus',
-  	      method: 'GET',
-  	      data: { userId, packageId }
-  	    })
+    // 获取VIP信息(状态、套餐等)
+    getInfo: (userId) => request({
+      url: `/vip/info?userId=${userId}`
+    }),
+
+    // 获取VIP套餐列表
+    getPackages: () => request({
+      url: '/vip/packages'
+    }),
+
+    // 购买VIP套餐(获取支付参数)
+    purchase: (userId, packageId) => request({
+      url: '/vip/purchase',
+      method: 'POST',
+      data: { userId, packageId }
+    }),
+
+    // 查询订单状态
+    getOrderStatus: (orderNo) => request({
+      url: `/vip/order/status?orderNo=${orderNo}`
+    }),
+    // 新增:查询支付状态(userId + packageId)
+    checkPayStatus: (userId, packageId) => request({
+      url: '/vip/checkPayStatus',
+      method: 'GET',
+      data: { userId, packageId }
+    })
   },
-  
+
   // 用户反馈
   feedback: {
     // 提交用户反馈
@@ -937,44 +945,44 @@ export default {
       method: 'GET',
       data: params
     }),
-    
+
     // 获取推荐商品
     getRecommendProducts: (limit = 10) => request({
       url: `/points/products/recommend?limit=${limit}`,
       method: 'GET'
     }),
-    
+
     // 获取商品详情
     getProductDetail: (id) => request({
       url: `/points/products/${id}`,
       method: 'GET'
     }),
-    
+
     // 获取积分余额
     getBalance: (makerId) => request({
       url: `/points/balance?makerId=${makerId}`,
       method: 'GET'
     }),
-    
+
     // 获取积分明细
     getRecords: (makerId, pageNum = 1, pageSize = 20) => request({
       url: `/points/records?makerId=${makerId}&pageNum=${pageNum}&pageSize=${pageSize}`,
       method: 'GET'
     }),
-    
+
     // 获取积分规则
     getRules: () => request({
       url: '/points/rules',
       method: 'GET'
     }),
-    
+
     // 兑换商品
     exchange: (data) => request({
       url: '/points/exchange',
       method: 'POST',
       data
     }),
-    
+
     // 获取订单列表
     getOrders: (makerId, status, pageNum = 1, pageSize = 10) => {
       let url = `/points/orders?makerId=${makerId}&pageNum=${pageNum}&pageSize=${pageSize}`
@@ -983,13 +991,13 @@ export default {
       }
       return request({ url, method: 'GET' })
     },
-    
+
     // 获取订单详情
     getOrderDetail: (orderNo) => request({
       url: `/points/orders/${orderNo}`,
       method: 'GET'
     }),
-    
+
     // 增加积分(签到等)
     addPoints: (makerId, ruleType, reason) => request({
       url: '/points/add',
@@ -1008,7 +1016,7 @@ export default {
       }
       return request({ url })
     },
-    
+
     // 搜索资源(按姓名或手机号)
     search: (matchmakerId, keyword, gender) => {
       let url = `/my-resource/search?matchmakerId=${matchmakerId}`
@@ -1020,7 +1028,7 @@ export default {
       }
       return request({ url })
     },
-    
+
     // 获取资源下拉列表
     getDropdown: (matchmakerId, gender) => {
       let url = `/my-resource/dropdown?matchmakerId=${matchmakerId}`
@@ -1029,7 +1037,7 @@ export default {
       }
       return request({ url })
     },
-    
+
     // 获取已注册用户的资源下拉列表(user_id不为空)
     getRegisteredDropdown: (matchmakerId, gender) => {
       let url = `/my-resource/registered-dropdown?matchmakerId=${matchmakerId}`
@@ -1038,7 +1046,7 @@ export default {
       }
       return request({ url })
     },
-    
+
     // 搜索已注册用户的资源(user_id不为空)
     searchRegistered: (matchmakerId, keyword, gender) => {
       let url = `/my-resource/registered-search?matchmakerId=${matchmakerId}`
@@ -1060,12 +1068,12 @@ export default {
       method: 'POST',
       data
     }),
-    
+
     // 获取成功案例列表
     getList: (matchmakerId, pageNum = 1, pageSize = 10) => request({
       url: `/success-case-upload/list?matchmakerId=${matchmakerId}&pageNum=${pageNum}&pageSize=${pageSize}`
     }),
-    
+
     // 获取审核记录列表
     getAuditRecords: (matchmakerId, auditStatus, pageNum = 1, pageSize = 20) => {
       let url = `/success-case-upload/audit-records?matchmakerId=${matchmakerId}&pageNum=${pageNum}&pageSize=${pageSize}`
@@ -1074,18 +1082,18 @@ export default {
       }
       return request({ url })
     },
-    
+
     // 获取审核记录详情
     getAuditRecordDetail: (id) => request({
       url: `/success-case-upload/audit-records/${id}`
     }),
-    
+
     // 标记审核记录为已读
     markAsRead: (id) => request({
       url: `/success-case-upload/audit-records/${id}/read`,
       method: 'POST'
     }),
-    
+
     // 获取未读审核记录数量
     getUnreadCount: (matchmakerId) => request({
       url: `/success-case-upload/audit-records/unread-count?matchmakerId=${matchmakerId}`

+ 30 - 0
service/Recommend/src/main/java/com/zhentao/controller/RecommendController.java

@@ -291,6 +291,36 @@ public class RecommendController {
         }
     }
 
+    // 获取喜欢我的用户列表
+    @GetMapping("/liked-me-users")
+    public Result<List<RecommendUserVO>> getUsersWhoLikedMe(
+            @RequestParam("userId") Integer userId,
+            @RequestParam(value = "offset", required = false, defaultValue = "0") Integer offset,
+            @RequestParam(value = "limit", required = false, defaultValue = "20") Integer limit
+    ) {
+        try {
+            List<RecommendUserVO> list = recommendService.getUsersWhoLikedMe(userId, offset, limit);
+            return Result.success(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("获取喜欢我的用户列表失败: " + e.getMessage());
+        }
+    }
+    
+    // 获取喜欢我的用户数量
+    @GetMapping("/liked-me-users-count")
+    public Result<Integer> getUsersWhoLikedMeCount(
+            @RequestParam("userId") Integer userId
+    ) {
+        try {
+            Integer count = recommendService.countUsersWhoLikedMe(userId);
+            return Result.success(count);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("获取喜欢我的用户数量失败: " + e.getMessage());
+        }
+    }
+
 }
 
 

+ 6 - 0
service/Recommend/src/main/java/com/zhentao/mapper/RecommendMapper.java

@@ -48,6 +48,12 @@ public interface RecommendMapper {
     
     // 查询用户喜欢的用户数量
     Integer countLikedUsers(@Param("userId") Integer userId);
+    
+    // 查询喜欢当前用户的用户列表
+    List<RecommendUserVO> selectUsersWhoLikedMe(@Param("userId") Integer userId, @Param("offset") Integer offset, @Param("limit") Integer limit);
+    
+    // 统计喜欢当前用户的用户数量
+    Integer countUsersWhoLikedMe(@Param("userId") Integer userId);
 }
 
 

+ 6 - 0
service/Recommend/src/main/java/com/zhentao/service/RecommendService.java

@@ -25,6 +25,12 @@ public interface RecommendService {
     
     // 获取用户喜欢的用户数量
     Integer countLikedUsers(Integer userId);
+    
+    // 获取喜欢当前用户的用户列表
+    List<RecommendUserVO> getUsersWhoLikedMe(Integer userId, Integer offset, Integer limit);
+    
+    // 获取喜欢当前用户的用户数量
+    Integer countUsersWhoLikedMe(Integer userId);
 }
 
 

+ 32 - 0
service/Recommend/src/main/java/com/zhentao/service/impl/RecommendServiceImpl.java

@@ -495,6 +495,38 @@ public class RecommendServiceImpl implements RecommendService {
             return 0;
         }
     }
+
+    @Override
+    public List<RecommendUserVO> getUsersWhoLikedMe(Integer userId, Integer offset, Integer limit) {
+        if (userId == null) {
+            throw new IllegalArgumentException("userId cannot be null");
+        }
+        if (limit == null || limit <= 0) {
+            limit = 20;
+        }
+        if (offset == null || offset < 0) {
+            offset = 0;
+        }
+        try {
+            return recommendMapper.selectUsersWhoLikedMe(userId, offset, limit);
+        } catch (Exception ex) {
+            log.error("getUsersWhoLikedMe failed", ex);
+            return java.util.Collections.emptyList();
+        }
+    }
+
+    @Override
+    public Integer countUsersWhoLikedMe(Integer userId) {
+        if (userId == null) {
+            throw new IllegalArgumentException("userId cannot be null");
+        }
+        try {
+            return recommendMapper.countUsersWhoLikedMe(userId);
+        } catch (Exception ex) {
+            log.error("countUsersWhoLikedMe failed", ex);
+            return 0;
+        }
+    }
 }
 
 

+ 45 - 0
service/Recommend/src/main/resources/mapper/RecommendMapper.xml

@@ -608,6 +608,51 @@
           AND u.status = 1
         ]]>
     </select>
+    
+    <!-- 查询喜欢当前用户的用户列表 -->
+    <select id="selectUsersWhoLikedMe" resultMap="RecommendUserMap">
+        <![CDATA[
+        SELECT DISTINCT
+            ulu.create_time,
+          u.user_id,
+          u.nickname,
+          u.gender,
+          u.birth_date,
+          p.province_id,
+          p.city_id,
+          p.area_id,
+          p.height,
+          p.weight,
+          p.education_level,
+          p.salary_range,
+          p.hobby,
+          p.star,
+          p.animal,
+          p.school_name,
+          p.job_title,
+          u.avatar_url,
+          u.last_active_at,
+          80.0 AS compatibility_score
+        FROM user_likes_user ulu
+        JOIN users u ON u.user_id = ulu.user_id
+        LEFT JOIN user_profile p ON p.user_id = u.user_id
+        WHERE ulu.like_user_id = #{userId}
+          AND u.status = 1
+        ORDER BY ulu.create_time DESC
+        LIMIT #{offset}, #{limit}
+        ]]>
+    </select>
+    
+    <!-- 统计喜欢当前用户的用户数量 -->
+    <select id="countUsersWhoLikedMe" resultType="java.lang.Integer">
+        <![CDATA[
+        SELECT COUNT(*) 
+        FROM user_likes_user ulu
+        JOIN users u ON u.user_id = ulu.user_id
+        WHERE ulu.like_user_id = #{userId}
+          AND u.status = 1
+        ]]>
+    </select>
 </mapper>