From 4164ba59cb88d33b191f42d3bef122f6f7af6312 Mon Sep 17 00:00:00 2001
From: zyy <zyy@email.com>
Date: Mon, 09 Mar 2026 18:09:18 +0800
Subject: [PATCH] 1

---
 trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java b/trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java
index 0729726..f1a3eda 100644
--- a/trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java
+++ b/trading-order-service/src/main/java/com/yami/trading/service/impl/UserServiceImpl.java
@@ -662,6 +662,8 @@
                 if (!party_reco.isEnabled()) {
                     throw new YamiShopBindException("推荐人无权限推荐");
                 }
+            } else {
+                throw new YamiShopBindException("请填写推荐码");
             }
         }
 //        if ("true".equals(this.sysparaService.find("register_need_usercode_turn").getSvalue())) {
@@ -696,7 +698,11 @@
             if (StringUtils.isEmptyString(username) || username.length() > 20) {
                 throw new YamiShopBindException("请输入正确的手机号码");
             }
-            this.savePhone(username, party.getUserId().toString());
+            User partyPhone = findPartyByVerifiedPhone(username);
+            if (null != partyPhone) {
+                throw new YamiShopBindException("电话号码已绑定其他用户");
+            }
+            this.savePhone(username, party.getUserId());
         } else {
             // 邮箱注册
             if (!Strings.isEmail(username)) {
@@ -722,6 +728,7 @@
             userRecom.setUserId(party_reco.getUserId());
             userRecom.setRecomUserId(party.getUserId());
             this.userRecomService.save(userRecom);
+            party = getById(party.getUserId());
             party.setUserRecom(party_reco.getUserId());
             updateById(party);
         }
@@ -1047,6 +1054,7 @@
         party.setSafePassword(passwordEncoder.encode("000000"));
         party.setLoginPassword(passwordEncoder.encode(password));
         party.setRoleName(Constants.SECURITY_ROLE_GUEST);
+        party.setCreditScore(80);
         save(party);
         if (!StringUtils.isNullOrEmpty(parents_usercode)) {
             User party_parents = findUserByUserCode(parents_usercode);
@@ -1474,6 +1482,19 @@
     }
 
     @Override
+    public User findByUserNameOrEmailOrPhone(String userName) {
+        User user = getOne(new LambdaQueryWrapper<User>()
+                .eq(User::getUserName, userName)
+                .or(x ->
+                        x.eq(User::getUserMobile, userName).eq(User::isUserMobileBind, true))
+                .or(x ->
+                        x.eq(User::getUserMail, userName).eq(User::isMailBind, true))
+
+        );
+        return user;
+    }
+
+    @Override
     public User findByUserMobile(String mobile) {
         return getOne(new LambdaQueryWrapper<User>().eq(User::getUserMobile, mobile));
     }
@@ -1563,7 +1584,7 @@
             throw new YamiShopBindException("用户名重复");
         }
         party.setUserName(username);
-        save(party);
+        updateById(party);
         if (type.equals("1")) {
             // 手机注册
 //			if (StringUtils.isEmptyString(reg.getUsername()) || !Strings.isNumber(reg.getUsername()) || reg.getUsername().length() > 15) {

--
Gitblit v1.9.3