wangwenju 1 ヶ月 前
コミット
15b2066070

+ 5 - 5
LiangZhiYUMao/pages/index/index.vue

@@ -262,16 +262,16 @@
 
 				// 公告数据
 				noticeList: [
-					{ id: 1, content: '【平台公告】本周成功牵手12对!红娘1对1服务限时8折!' },
-					{ id: 2, content: '【活动预告】周末单身联谊活动开始报名啦!名额有限,先到先得!' },
-					{ id: 3, content: '【好消息】恭喜会员小李和小王成功牵手,祝福他们!' }
+					// { id: 1, content: '【平台公告】本周成功牵手12对!红娘1对1服务限时8折!' },
+					// { id: 2, content: '【活动预告】周末单身联谊活动开始报名啦!名额有限,先到先得!' },
+					// { id: 3, content: '【好消息】恭喜会员小李和小王成功牵手,祝福他们!' }
 				],
 
 			// 功能入口
 			functionList: [
 				{ id: 1, name: '星命测算', icon: '💖', path: '/pages/astrology/index', bgColor: '#FF6B9D', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #FF6B9D 0%, #FF8EAB 100%)' },
-				// { id: 2, name: '红娘列表', icon: '👤', path: '/pages/matchmakers/list', bgColor: '#6BC5F8', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #6BC5F8 0%, #87CEEB 100%)' },
-				{ id: 3, name: '加入红娘', icon: '💕', path: '/pages/part-time-matchmaker/index', bgColor: '#9B7EDE', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #9B7EDE 0%, #B19CD9 100%)' },
+				{ id: 2, name: '红娘列表', icon: '👤', path: '/pages/matchmakers/list', bgColor: '#6BC5F8', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #6BC5F8 0%, #87CEEB 100%)' },
+				// { id: 3, name: '加入红娘', icon: '💕', path: '/pages/part-time-matchmaker/index', bgColor: '#9B7EDE', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #9B7EDE 0%, #B19CD9 100%)' },
 				{ id: 4, name: '精品课程', icon: '📚', path: '/pages/courses/list', bgColor: '#FF8C42', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #FF8C42 0%, #FFA366 100%)' },
 				{ id: 5, name: '今日缘分', icon: '💝', path: '/pages/recommend/index', bgColor: '#FF69B4', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #FF69B4 0%, #FF8CC8 100%)', needLogin: true },
 				// { id: 6, name: '专属定制', icon: '🎁', path: '/pages/customize/index', bgColor: '#FFA500', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #FFA500 0%, #FFB84D 100%)' }

+ 9 - 9
LiangZhiYUMao/pages/mine/index.vue

@@ -73,9 +73,9 @@
 				<view class="action-icon phone-icon">📞</view>
 				<text class="action-label">私人定制</text>
 			</view>
-			<view class="action-item" @click="goToPage('matchmakers')">
-				<view class="action-icon heart-icon">❤️</view>
-				<text class="action-label">红娘服务</text>
+			<view class="action-item" @click="goToPage('part-time-matchmaker')">
+				<view class="action-icon heart-icon">💕</view>
+				<text class="action-label">加入红娘</text>
 			</view>
 		</view>
 
@@ -923,16 +923,16 @@
 								})
 							}
 						})
-				} else if (page === 'matchmakers') {
-					console.log('✅ 跳转到红娘服务页面')
-					// 跳转到红娘服务页面
+				} else if (page === 'part-time-matchmaker') {
+					console.log('✅ 跳转到加入红娘页面')
+					// 跳转到加入红娘页面
 					uni.navigateTo({
-						url: '/pages/matchmakers/list',
+						url: '/pages/part-time-matchmaker/index',
 						success: () => {
-							console.log('✅ 红娘服务页面跳转成功')
+							console.log('✅ 加入红娘页面跳转成功')
 						},
 						fail: (err) => {
-							console.error('❌ 红娘服务页面跳转失败:', err)
+							console.error('❌ 加入红娘页面跳转失败:', err)
 							uni.showToast({
 								title: '页面跳转失败',
 								icon: 'none'

+ 8 - 1
LiangZhiYUMao/pages/page3/page3.vue

@@ -154,10 +154,16 @@
 			uni.login({
 				provider: 'weixin',
 				success: async (loginRes) => {
+					 const loginParams = {
+					        code: loginRes.code.trim(), // 必需:微信登录code
+					        nickname: Logon_Credentials.nickname?.trim() || '', // 可选:用户昵称(从Logon_Credentials获取)
+					        avatarUrl: Logon_Credentials.active?.trim() || '',  // 可选:用户头像(注意:后端字段是avatarUrl,前端若存的是active,需对应)
+					        phoneCode: Logon_Credentials.code?.trim() || ''     // 可选:手机号授权code(从Logon_Credentials获取)
+					      };
 					uni.showLoading({ title: '登录中...' })
 					try {
 						// 1. 微信授权登录
-						const wechatLoginResult = await api.auth.wechatLogin(loginRes.code)
+						const wechatLoginResult = await api.auth.wechatLogin(loginParams)
 						const token = wechatLoginResult?.token || wechatLoginResult?.data?.token
 						const user = wechatLoginResult?.user || wechatLoginResult?.data?.user
 						
@@ -166,6 +172,7 @@
 						}
 						
 						console.log('✅ 微信登录成功,用户ID:', user.userId)
+						uni.setStorageSync("userId", user.userId); 
 						
 						// 2. 获取手机号
 						const phoneCode = (Logon_Credentials && Logon_Credentials.code && String(Logon_Credentials.code).trim()) ? String(Logon_Credentials.code).trim() : 'mock_dev_code'

+ 4 - 3
LiangZhiYUMao/pages/plaza/publish.vue

@@ -167,12 +167,13 @@ export default {
 			
 			try {
 				const payload = {
-					userId: 1,
+					userId: uni.getStorageSync("userId"),
 					content: this.content,
 					mediaList: this.mediaList,
 					mediaType: this.mediaList.length > 0 ? 2 : 1, // 自动检测:有图片为2,纯文本为1
 					visibility: 1 // 默认公开
 				}
+				console.log(uni.getStorageSync("userId"))
 				const dynamicId = await api.dynamic.publish(payload)
 				uni.hideLoading()
 				uni.showToast({ title: '发布成功!开始你的缘分旅程~', icon: 'success' })
@@ -180,7 +181,7 @@ export default {
 				// 直接插入到广场页数据头部,避免全量刷新
 				uni.$emit('dynamic-insert', {
 					dynamicId,
-					userId: 1,
+					userId: uni.getStorageSync("userId"),
 					content: this.content,
 					mediaUrls: this.mediaList,
 					mediaType: this.mediaList.length > 0 ? 2 : 1,
@@ -193,7 +194,7 @@ export default {
 					isLiked: false,
 					isFavorited: false,
 					createdAt: new Date().toISOString(),
-					user: { userId: 1, nickname: '我', avatarUrl: '' }
+					user: { userId: uni.getStorageSync("userId"), nickname: '我', avatarUrl: '' }
 				})
 				
 				setTimeout(() => {

+ 3 - 1
LiangZhiYUMao/pages/profile/index.vue

@@ -308,7 +308,7 @@
 					realName: '',
 					idCard: '',
 					gender: null,
-					birthDate: '',
+					birthDate: '',	
 					height: null,
 					weight: null,
 					star: '',
@@ -904,6 +904,8 @@
 					idCard: this.profile.idCard,
 					height: this.profile.height,
 					weight: this.profile.weight,
+					gender: this.profile.gender,
+					birthDate: this.profile.birthDate,
 					star: this.profile.star,
 					animal: this.profile.animal,
 					educationLevel: this.profile.educationLevel,

+ 2 - 0
service/Essential/src/main/java/com/zhentao/entity/User.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -52,6 +53,7 @@ public class User implements Serializable {
      * 出生日期
      */
     @TableField("birth_date")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private LocalDate birthDate;
     
     /**

+ 7 - 0
service/Essential/src/main/java/com/zhentao/entity/UserProfile.java

@@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 import java.time.LocalDateTime;
+import java.util.Date;
 
 /**
  * 用户扩展信息实体类
@@ -30,6 +33,9 @@ public class UserProfile implements Serializable {
     private String idCard;
     private Integer educationLevel;
     private String hobby;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date birthDate;
     private String schoolName;
     private String company;
     private Integer salaryRange;
@@ -46,6 +52,7 @@ public class UserProfile implements Serializable {
     private Integer privacySalary;
     private Integer privacyPhone;
     private Integer authenticityScore;
+    private Integer gender;
     
     @TableField(exist = false)
     private LocalDateTime createTime;

+ 20 - 12
service/Essential/src/main/java/com/zhentao/service/impl/UserProfileServiceImpl.java

@@ -11,9 +11,12 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.Period;
+import java.time.ZoneId;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -35,19 +38,19 @@ public class UserProfileServiceImpl implements UserProfileService {
     @Override
     public Map<String, Object> getUserProfile(Long userId) {
         Map<String, Object> result = new HashMap<>();
-        
+
         // 1. 查询用户基本信息
-        User user = userMapper.selectById(userId);
+        UserProfile user = userProfileMapper.selectByUserId(userId);
         if (user == null) {
             throw new RuntimeException("用户不存在");
         }
         
         // 2. 设置基本信息
         result.put("userId", user.getUserId());
-        result.put("nickname", user.getNickname());
-        result.put("avatar", user.getAvatarUrl());
+        result.put("nickname", user.getRealName());
         result.put("gender", user.getGender());
-        result.put("birthDate", user.getBirthDate() != null ? user.getBirthDate().toString() : null);
+
+        result.put("birthDate", new SimpleDateFormat("yyyy-MM-dd").format(user.getBirthDate()));
         
         // 计算并设置年龄
         Integer age = calculateAge(user.getBirthDate());
@@ -263,20 +266,25 @@ public class UserProfileServiceImpl implements UserProfileService {
     /**
      * 计算年龄(改进版,处理边界情况)
      */
-    private Integer calculateAge(LocalDate birthDate) {
+    private Integer calculateAge(Date birthDate) {
         if (birthDate == null) {
             return null;
         }
-        
+
+
+        // 将Date转换为LocalDate(需处理时区)
+        LocalDate birthLocalDate = birthDate.toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDate();
         LocalDate now = LocalDate.now();
-        
+
         // 检查出生日期是否在未来
-        if (birthDate.isAfter(now)) {
+        if (birthLocalDate.isAfter(now)) {
             return 0;
         }
-        
-        // 使用Period计算准确年龄
-        Period period = Period.between(birthDate, now);
+
+        // 计算年龄
+        Period period = Period.between(birthLocalDate, now);
         return period.getYears();
     }
     

BIN
service/Essential/target/classes/com/zhentao/entity/User.class


BIN
service/Essential/target/classes/com/zhentao/entity/UserProfile.class


BIN
service/Essential/target/classes/com/zhentao/service/impl/UserProfileServiceImpl.class


+ 1 - 1
service/login/src/main/resources/application.yml

@@ -40,7 +40,7 @@ spring:
     port: 6377
     #password:
     database: 0
-    timeout: 3000ms
+    timeout: 10000ms
     lettuce:
       pool:
         max-active: 8

+ 1 - 1
service/login/target/classes/application.yml

@@ -40,7 +40,7 @@ spring:
     port: 6377
     #password:
     database: 0
-    timeout: 3000ms
+    timeout: 10000ms
     lettuce:
       pool:
         max-active: 8

+ 1 - 1
service/randomMatch/src/main/resources/application.yml

@@ -18,7 +18,7 @@ spring:
     port: 6377
     password: lsx@hfs?gln.lsc
     database: 0
-    timeout: 3000ms
+    timeout: 10000ms
     lettuce:
       pool:
         max-active: 8   # 连接池最大连接数

+ 1 - 1
service/randomMatch/target/classes/application.yml

@@ -18,7 +18,7 @@ spring:
     port: 6377
     password: lsx@hfs?gln.lsc
     database: 0
-    timeout: 3000ms
+    timeout: 10000ms
     lettuce:
       pool:
         max-active: 8   # 连接池最大连接数