From a3bfafde009c644c21ee8c9971b436f4cd7481f1 Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期日, 20 九月 2026 11:59:29 +0800
Subject: [PATCH] feat:手机号隐私问题
---
cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
index 06074d1..0019170 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
@@ -14,6 +14,7 @@
import com.dsh.other.enums.SiteBookingStatusEnum;
import com.dsh.other.mapper.QrLinkMapper;
import com.dsh.other.feignclient.CourseRecordClient;
+import com.dsh.other.feignclient.account.AppUserClient;
import com.dsh.other.feignclient.account.CityManagerClient;
import com.dsh.other.feignclient.activity.UserCouponClient;
import com.dsh.other.feignclient.activity.model.QueryUserCouponByIdAndUserId;
@@ -53,6 +54,7 @@
import java.util.*;
import java.security.SecureRandom;
import java.util.stream.Collectors;
+import java.util.regex.Pattern;
/**
* @author zhibing.pu
@@ -64,6 +66,7 @@
public class SiteController {
private static final char[] ENTRY_CODE_CHARS = "23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".toCharArray();
+ private static final Pattern MAINLAND_MOBILE = Pattern.compile("^1[3-9]\\d{9}$");
private final SecureRandom entryCodeRandom = new SecureRandom();
@Autowired
@@ -89,6 +92,8 @@
@Resource
private CityManagerClient cityManagerClient;
+ @Resource
+ private AppUserClient appUserClient;
@Autowired
private IOperatorUserService operatorUserService;
@@ -390,6 +395,19 @@
if (null == uid) {
return ResultUtil.tokenErr();
}
+ String phone = reservationSite.getPhone();
+ if (phone != null && phone.contains("*")) {
+ Map<String, Object> userPhone = appUserClient.siteBookingPhone(uid, "true");
+ Object originalPhone = userPhone == null ? null : userPhone.get("phone");
+ if (!(originalPhone instanceof String) || ((String) originalPhone).trim().isEmpty()) {
+ return ResultUtil.error("未获取到用户原始手机号");
+ }
+ reservationSite.setPhone((String) originalPhone);
+ } else if (phone == null || !MAINLAND_MOBILE.matcher(phone.trim()).matches()) {
+ return ResultUtil.error("请输入正确的手机号");
+ } else {
+ reservationSite.setPhone(phone.trim());
+ }
// Integer uid = 201;
return siteService.reservationSite(uid, reservationSite);
} catch (Exception e) {
--
Gitblit v1.7.1