From 06dad2095dbe4c465025e5bc6e0220521636e2c2 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 15 十一月 2024 18:20:59 +0800
Subject: [PATCH] 代码提交

---
 xinquan-auth/src/main/java/com/xinquan/auth/util/HWSendSms.java                                            |  271 +++++++++++++++++++-------------------
 xinquan-auth/src/main/java/com/xinquan/auth/controller/TokenController.java                                |   15 +
 xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/service/impl/AppUserServiceImpl.java           |   36 +++++
 xinquan-auth/src/main/java/com/xinquan/auth/util/HuaWeiSMSUtil.java                                        |    6 
 xinquan-auth/src/main/java/com/xinquan/auth/service/SysLoginService.java                                   |   11 +
 xinquan-auth/pom.xml                                                                                       |    7 +
 xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserController.java |   18 ++
 7 files changed, 217 insertions(+), 147 deletions(-)

diff --git a/xinquan-auth/pom.xml b/xinquan-auth/pom.xml
index c91e1c7..8c83322 100644
--- a/xinquan-auth/pom.xml
+++ b/xinquan-auth/pom.xml
@@ -19,6 +19,13 @@
     </properties>
     
     <dependencies>
+        <dependency>
+            <groupId>com.huawei.apigateway</groupId>
+            <artifactId>java-sdk-core</artifactId>
+            <version>3.2.5</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/lib/java-sdk-core-3.2.5.jar</systemPath>
+        </dependency>
 <!--        <dependency>-->
 <!--            <groupId>com.huawei.apigateway</groupId>-->
 <!--            <artifactId>java-sdk-core</artifactId>-->
diff --git a/xinquan-auth/src/main/java/com/xinquan/auth/controller/TokenController.java b/xinquan-auth/src/main/java/com/xinquan/auth/controller/TokenController.java
index 0e4a139..3d696bf 100644
--- a/xinquan-auth/src/main/java/com/xinquan/auth/controller/TokenController.java
+++ b/xinquan-auth/src/main/java/com/xinquan/auth/controller/TokenController.java
@@ -105,6 +105,12 @@
                 return R.fail("当前手机号已注册");
             }
         }
+        if(type==3){
+            AppUser data = remoteAppUserService.getUserByPhone(cellPhone).getData();
+            if (data!=null){
+                return R.fail("当前手机号未注册");
+            }
+        }
         sysLoginService.sendCaptchaCode(cellPhone, type);
         return R.ok();
     }
@@ -211,15 +217,16 @@
     @ApiOperation(value = "苹果登录", tags = {"APP端"})
     @PostMapping("/app/appleLogin")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "appleId", value = "苹果ID", required = true, dataType = "String", paramType = "query"),
-            @ApiImplicitParam(name = "device", value = "设备码", required = true, dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "appleId", value = "苹果ID", required = true, dataType = "String", paramType = "query")
+//            @ApiImplicitParam(name = "device", value = "设备码", required = false, dataType = "String", paramType = "query"),
     }
     )
     public R<AppLoginUser> appleLogin(
             @RequestParam(value = "appleId", required = true) String appleId,
-            @RequestParam(value = "device", required = true) String device
+            @RequestParam(value = "device", required = false) String device
     ) {
-        AppLoginUser appLoginUser = sysLoginService.appleLogin(appleId,device);
+
+        AppLoginUser appLoginUser = sysLoginService.appleLogin(appleId, org.springframework.util.StringUtils.hasLength(device)?device:"");
         Long appUserId = appLoginUser.getAppUserId();
         AppUser data = remoteAppUserService.getAppUserById(appUserId + "").getData();
         if (data.getUserStatus() == 2){
diff --git a/xinquan-auth/src/main/java/com/xinquan/auth/service/SysLoginService.java b/xinquan-auth/src/main/java/com/xinquan/auth/service/SysLoginService.java
index 400539d..1d299f5 100644
--- a/xinquan-auth/src/main/java/com/xinquan/auth/service/SysLoginService.java
+++ b/xinquan-auth/src/main/java/com/xinquan/auth/service/SysLoginService.java
@@ -6,6 +6,7 @@
 import com.xinquan.auth.form.AppLoginBody;
 import com.xinquan.auth.form.AppRegisterBody;
 import com.xinquan.auth.form.VerifyResultVO;
+import com.xinquan.auth.util.HWSendSms;
 import com.xinquan.auth.util.HuaWeiSMSUtil;
 import com.xinquan.common.core.constant.CacheConstants;
 import com.xinquan.common.core.constant.Constants;
@@ -283,7 +284,10 @@
             default:
                 return "";
         }
+
     }
+    @Autowired
+    private HWSendSms hwSendSms;
     /**
      * 发送验证码
      *
@@ -299,9 +303,10 @@
                     TimeUnit.MINUTES);
             log.info("发送验证码成功,手机号:{} 验证码:{}", cellPhone, code);
             // TODO 修改sender参数及templateId
-             HuaWeiSMSUtil.sendSms("[\"" + code + "\"]", cellPhone, "8824110423893",
-                     "767ad27dce184a32a4b4863517fbd301");
-//            hwSendSms.sendSms(code, cellPhone);
+//             HuaWeiSMSUtil.sendSms("[\"" + code + "\"]", cellPhone, "8824110423893",
+//                     "767ad27dce184a32a4b4863517fbd301");
+
+            hwSendSms.sendSms(code, cellPhone);
         } catch (Exception e) {
             log.error("发送短信失败", e);
             throw new ServiceException("验证码发送失败");
diff --git a/xinquan-auth/src/main/java/com/xinquan/auth/util/HWSendSms.java b/xinquan-auth/src/main/java/com/xinquan/auth/util/HWSendSms.java
index c44dae6..1ebaada 100644
--- a/xinquan-auth/src/main/java/com/xinquan/auth/util/HWSendSms.java
+++ b/xinquan-auth/src/main/java/com/xinquan/auth/util/HWSendSms.java
@@ -1,140 +1,137 @@
-//package com.xinquan.auth.util;
+package com.xinquan.auth.util;
+
+import com.cloud.apigateway.sdk.utils.Client;
+import com.cloud.apigateway.sdk.utils.Request;
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.apache.http.util.EntityUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import javax.net.ssl.SSLContext;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.Arrays;
+
+@Component
+public class HWSendSms {
+    private static final Logger LOGGER = LoggerFactory.getLogger(HWSendSms.class);
+
+    public static final String UTF_8 = "UTF-8";
+
+    private static CloseableHttpClient client =  null;
+
+    public static void main(String[] args) throws Exception {
+        // 为防止因HTTPS证书认证失败造成API调用失败,需要先忽略证书信任问题
+    }
+
+    public void sendSms(String code,String receiver) throws Exception {
+        client = createIgnoreSSLHttpClient();
+        //必填,请参考"开发准备"获取如下数据,替换为实际值
+//        String url = "https://smsapi.ap-southeast-1.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址+接口访问URI
+//        // 认证用的appKey和appSecret硬编码到代码中或者明文存储都有很大的安全风险,建议在配置文件或者环境变量中密文存放,使用时解密,确保安全;
+//        String appKey = "c8RWg3gg************3Y7x1Ile"; //Application Key
+//        String appSecret = "q4Ii87Bh************80SfD7Al"; //Application Secret
+//        String sender = "csms12345678"; //中国大陆短信签名通道号或全球短信通道号
+//        String templateId = "8ff55eac1d0b478ab3c06c3c6a492300"; //模板ID
 //
-//import com.cloud.apigateway.sdk.utils.Client;
-//import com.cloud.apigateway.sdk.utils.Request;
-//import org.apache.http.Header;
-//import org.apache.http.HttpEntity;
-//import org.apache.http.HttpResponse;
-//import org.apache.http.client.methods.HttpRequestBase;
-//import org.apache.http.conn.ssl.NoopHostnameVerifier;
-//import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-//import org.apache.http.impl.client.CloseableHttpClient;
-//import org.apache.http.impl.client.HttpClients;
-//import org.apache.http.ssl.SSLContextBuilder;
-//import org.apache.http.util.EntityUtils;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.stereotype.Component;
+//        //条件必填,中国大陆短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称
+//        //全球短信不用关注该参数
+//        String signature = "华为云短信测试"; //签名名称
 //
-//import javax.net.ssl.SSLContext;
-//import java.io.UnsupportedEncodingException;
-//import java.net.URLEncoder;
-//import java.util.Arrays;
+//        //必填,全局号码格式(包含国家码),示例:+86151****6789,多个号码之间用英文逗号分隔
+//        String receiver = "+86151****6789,+86152****7890"; //短信接收人号码
 //
-//@Component
-//public class HWSendSms {
-//
-//
-//    private static final Logger LOGGER = LoggerFactory.getLogger(HWSendSms.class);
-//
-//    public static final String UTF_8 = "UTF-8";
-//
-//    private static CloseableHttpClient client =  null;
-//
-//    public static void main(String[] args) throws Exception {
-//        // 为防止因HTTPS证书认证失败造成API调用失败,需要先忽略证书信任问题
-////        client = createIgnoreSSLHttpClient();
-////        sendSms();
-//    }
-//
-//    public void sendSms(String code,String receiver) throws Exception {
-//        client = createIgnoreSSLHttpClient();
-//        //必填,请参考"开发准备"获取如下数据,替换为实际值
-////        String url = "https://smsapi.ap-southeast-1.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址+接口访问URI
-////        // 认证用的appKey和appSecret硬编码到代码中或者明文存储都有很大的安全风险,建议在配置文件或者环境变量中密文存放,使用时解密,确保安全;
-////        String appKey = "c8RWg3gg************3Y7x1Ile"; //Application Key
-////        String appSecret = "q4Ii87Bh************80SfD7Al"; //Application Secret
-////        String sender = "csms12345678"; //中国大陆短信签名通道号或全球短信通道号
-////        String templateId = "8ff55eac1d0b478ab3c06c3c6a492300"; //模板ID
-////
-////        //条件必填,中国大陆短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称
-////        //全球短信不用关注该参数
-////        String signature = "华为云短信测试"; //签名名称
-////
-////        //必填,全局号码格式(包含国家码),示例:+86151****6789,多个号码之间用英文逗号分隔
-////        String receiver = "+86151****6789,+86152****7890"; //短信接收人号码
-////
-////        //选填,短信状态报告接收地址,推荐使用域名,为空或者不填表示不接收状态报告
-//        String statusCallBack = "";
-//
-//        /**
-//         * 选填,使用无变量模板时请赋空值 String templateParas = "";
-//         * 单变量模板示例:模板内容为"您的验证码是${NUM_6}"时,templateParas可填写为"[\"111111\"]"
-//         * 双变量模板示例:模板内容为"您有${NUM_2}件快递请到${TXT_20}领取"时,templateParas可填写为"[\"3\",\"人民公园正门\"]"
-//         * 查看更多模板规范和变量规范:产品介绍>短信模板须知和短信变量须知
-//         */
-//        String templateParas = "[\""+code+"\"]"; //模板变量,此处以单变量验证码短信为例,请客户自行生成6位验证码,并定义为字符串类型,以杜绝首位0丢失的问题(例如:002569变成了2569)。
-//
-//        //请求Body,不携带签名名称时,signature请填null
-//        String body = buildRequestBody("8824110423893", receiver, "767ad27dce184a32a4b4863517fbd301", templateParas, statusCallBack, "心泉智慧");
-//        if (null == body || body.isEmpty()) {
-//            LOGGER.warn("body is null.");
-//            return;
-//        }
-//
-//        Request request = new Request();
-//        request.setKey("dFbKS778KG0jvQrQ672b9RaOktfV");
-//        request.setSecret("3QsteXCIY3KRfgXf5zXyi6f3cHBj");
-//        request.setMethod("POST");
-//        request.setUrl("https://smsapi.cn-north-4.myhuaweicloud.com:443/sms/batchSendSms/v1");
-//        request.addHeader("Content-Type", "application/x-www-form-urlencoded");
-//        request.setBody(body);
-//        LOGGER.info("Print the body: {}", body);
-//        try {
-//            HttpRequestBase signedRequest = Client.sign(request, "SDK-HMAC-SHA256");
-//            LOGGER.info("Print the authorization: {}", Arrays.toString(signedRequest.getHeaders("Authorization")));
-//            Header[] requestAllHeaders = signedRequest.getAllHeaders();
-//            for (Header h : requestAllHeaders) {
-//                LOGGER.info("req Header with name: {} and value: {}", h.getName(), h.getValue());
-//            }
-//
-//            HttpResponse response = client.execute(signedRequest);
-//
-//            LOGGER.info("Print the status line of the response: {}", response.getStatusLine().toString());
-//            Header[] resHeaders = response.getAllHeaders();
-//            for (Header h : resHeaders) {
-//                LOGGER.info("Processing Header with name: {} and value: {}", h.getName(), h.getValue());
-//            }
-//            HttpEntity resEntity = response.getEntity();
-//            if (resEntity != null) {
-//                LOGGER.info("Processing Body with name: {} and value: {}",
-//                        System.getProperty("line.separator"),
-//                    EntityUtils.toString(resEntity, "UTF-8"));
-//            }
-//        } catch (Exception e) {
-//            LOGGER.info(e.getMessage(), e);
-//            e.printStackTrace();
-//        }
-//    }
-//
-//    public CloseableHttpClient createIgnoreSSLHttpClient() throws Exception {
-//        SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, (x509CertChain, authType) -> true).build();
-//        return HttpClients.custom().setSSLSocketFactory(new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE)).build();
-//    }
-//
-//    static String buildRequestBody(String sender, String receiver, String templateId, String templateParas,
-//                                   String statusCallBack, String signature) throws UnsupportedEncodingException {
-//        if (null == sender || null == receiver || null == templateId || sender.isEmpty() || receiver.isEmpty()
-//            || templateId.isEmpty()) {
-//            System.out.println("buildRequestBody(): sender, receiver or templateId is null.");
-//            return null;
-//        }
-//
-//        StringBuilder body = new StringBuilder();
-//        appendToBody(body, "from=", sender);
-//        appendToBody(body, "&to=", receiver);
-//        appendToBody(body, "&templateId=", templateId);
-//        appendToBody(body, "&templateParas=", templateParas);
-//        appendToBody(body, "&statusCallback=", statusCallBack);
-//        appendToBody(body, "&signature=", signature);
-//        return body.toString();
-//    }
-//
-//    private static void appendToBody(StringBuilder body, String key, String val) throws UnsupportedEncodingException {
-//        if (null != val && !val.isEmpty()) {
-//            LOGGER.info("Print appendToBody: {}:{}", key, val);
-//            body.append(key).append(URLEncoder.encode(val, UTF_8));
-//        }
-//    }
-//}
+//        //选填,短信状态报告接收地址,推荐使用域名,为空或者不填表示不接收状态报告
+        String statusCallBack = "";
+
+        /**
+         * 选填,使用无变量模板时请赋空值 String templateParas = "";
+         * 单变量模板示例:模板内容为"您的验证码是${NUM_6}"时,templateParas可填写为"[\"111111\"]"
+         * 双变量模板示例:模板内容为"您有${NUM_2}件快递请到${TXT_20}领取"时,templateParas可填写为"[\"3\",\"人民公园正门\"]"
+         * 查看更多模板规范和变量规范:产品介绍>短信模板须知和短信变量须知
+         */
+        String templateParas = "[\""+code+"\"]"; //模板变量,此处以单变量验证码短信为例,请客户自行生成6位验证码,并定义为字符串类型,以杜绝首位0丢失的问题(例如:002569变成了2569)。
+
+        //请求Body,不携带签名名称时,signature请填null
+        String body = buildRequestBody("8823121426646", receiver, "767ad27dce184a32a4b4863517fbd301",
+                templateParas, statusCallBack, "心泉智慧");
+        if (null == body || body.isEmpty()) {
+            LOGGER.warn("body is null.");
+            return;
+        }
+
+        Request request = new Request();
+        request.setKey("dFbKS778KG0jvQrQ672b9RaOktfV");
+        request.setSecret("3QsteXCIY3KRfgXf5zXyi6f3cHBj");
+        request.setMethod("POST");
+        request.setUrl("https://smsapi.cn-north-4.myhuaweicloud.com:443/sms/batchSendSms/v1");
+        request.addHeader("Content-Type", "application/x-www-form-urlencoded");
+        request.setBody(body);
+        LOGGER.info("Print the body: {}", body);
+        try {
+            HttpRequestBase signedRequest = Client.sign(request, "SDK-HMAC-SHA256");
+            LOGGER.info("Print the authorization: {}", Arrays.toString(signedRequest.getHeaders("Authorization")));
+            Header[] requestAllHeaders = signedRequest.getAllHeaders();
+            for (Header h : requestAllHeaders) {
+                LOGGER.info("req Header with name: {} and value: {}", h.getName(), h.getValue());
+            }
+
+            HttpResponse response = client.execute(signedRequest);
+
+            LOGGER.info("Print the status line of the response: {}", response.getStatusLine().toString());
+            Header[] resHeaders = response.getAllHeaders();
+            for (Header h : resHeaders) {
+                LOGGER.info("Processing Header with name: {} and value: {}", h.getName(), h.getValue());
+            }
+            HttpEntity resEntity = response.getEntity();
+            if (resEntity != null) {
+                LOGGER.info("Processing Body with name: {} and value: {}",
+                        System.getProperty("line.separator"),
+                    EntityUtils.toString(resEntity, "UTF-8"));
+            }
+        } catch (Exception e) {
+            LOGGER.info(e.getMessage(), e);
+            e.printStackTrace();
+        }
+    }
+
+    public CloseableHttpClient createIgnoreSSLHttpClient() throws Exception {
+        SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, (x509CertChain, authType) -> true).build();
+        return HttpClients.custom().setSSLSocketFactory(new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE)).build();
+    }
+
+    static String buildRequestBody(String sender, String receiver, String templateId, String templateParas,
+                                   String statusCallBack, String signature) throws UnsupportedEncodingException {
+        if (null == sender || null == receiver || null == templateId || sender.isEmpty() || receiver.isEmpty()
+            || templateId.isEmpty()) {
+            System.out.println("buildRequestBody(): sender, receiver or templateId is null.");
+            return null;
+        }
+
+        StringBuilder body = new StringBuilder();
+        appendToBody(body, "from=", sender);
+        appendToBody(body, "&to=", receiver);
+        appendToBody(body, "&templateId=", templateId);
+        appendToBody(body, "&templateParas=", templateParas);
+        appendToBody(body, "&statusCallback=", statusCallBack);
+        appendToBody(body, "&signature=", signature);
+        return body.toString();
+    }
+
+    private static void appendToBody(StringBuilder body, String key, String val) throws UnsupportedEncodingException {
+        if (null != val && !val.isEmpty()) {
+            LOGGER.info("Print appendToBody: {}:{}", key, val);
+            body.append(key).append(URLEncoder.encode(val, UTF_8));
+        }
+    }
+}
diff --git a/xinquan-auth/src/main/java/com/xinquan/auth/util/HuaWeiSMSUtil.java b/xinquan-auth/src/main/java/com/xinquan/auth/util/HuaWeiSMSUtil.java
index 659de4d..67c7c76 100644
--- a/xinquan-auth/src/main/java/com/xinquan/auth/util/HuaWeiSMSUtil.java
+++ b/xinquan-auth/src/main/java/com/xinquan/auth/util/HuaWeiSMSUtil.java
@@ -33,8 +33,8 @@
 
     public static void main(String[] args) throws Exception {
 
-        sendSms("[\"" + 12356 + "\"]", "18283820718", "8823121426646",
-                "cf1707ec44694627b1b483b0277e12fd");
+        sendSms("[\"" + 12356 + "\"]", "19983174515", "8824110423893",
+                "767ad27dce184a32a4b4863517fbd301");
 
 //        sendSms("[\"17623778642\",\"蓉A-7823\"]","17623778642","8819122535459","6c848255000c4619833ab690e393f906");
 //        sendSms("[\"17623778642\",\"蓉A-7823\",\"2019/12/27\",\"14:00\"]","17623778642","8819122535459","bb13d00d11e043659001a89c72d54cab");
@@ -58,7 +58,7 @@
 
         // 条件必填,国内短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称
         // 国际/港澳台短信不用关注该参数
-        String signature = null; // 签名名称
+        String signature = "心泉智慧"; // 签名名称
 
         // 必填,全局号码格式(包含国家码),示例:+8615123456789,多个号码之间用英文逗号分隔
         String receiver = "+86" + phone; // 短信接收人号码
diff --git a/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserController.java b/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserController.java
index 1817d67..1048634 100644
--- a/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserController.java
+++ b/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserController.java
@@ -23,6 +23,7 @@
 import com.xinquan.course.api.domain.CourseCategory;
 import com.xinquan.course.api.domain.CourseDTO;
 import com.xinquan.course.api.domain.OrderCourseVO;
+import com.xinquan.meditation.api.domain.Meditation;
 import com.xinquan.order.api.feign.RemoteOrderService;
 import com.xinquan.system.api.RemoteBannerService;
 import com.xinquan.system.api.RemoteUserService;
@@ -1294,6 +1295,23 @@
         objectPage.setTotal(res.size());
         return R.ok(PageDTO.of(objectPage, InviteRankListVO.class)) ;
     }
+    @PostMapping("/inviteRankListShareInfo")
+    @ApiOperation(value = "爱心助力榜单详情-分页", tags = {"H5分享"})
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "id", name = "id", required = true, dataType = "Long"),
+            @ApiImplicitParam(value = "分页参数,当前页码", name = "pageCurr", required = true, dataType = "Integer"),
+            @ApiImplicitParam(value = "分页参数,每页数量", name = "pageSize", required = true, dataType = "Integer")
+    })
+    public R<PageDTO<InviteRankListVO>> inviteRankListShareInfo(
+            @RequestParam(value = "id") Integer id,
+            @RequestParam(value = "pageCurr", defaultValue = "1") Integer pageCurr,
+            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        LambdaQueryWrapper<AppUser> appUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        appUserLambdaQueryWrapper.eq(AppUser::getInviteUserId,id);
+        appUserLambdaQueryWrapper.ne(AppUser::getUserStatus,3);
+        Page<AppUser> page = appUserService.page(new Page<>(pageCurr, pageSize), appUserLambdaQueryWrapper);
+        return R.ok(PageDTO.of(page, InviteRankListVO.class)) ;
+    }
     @PostMapping("/getUserInfo")
     @ApiOperation(value = "获取用户信息", tags = {"个人中心"})
     public R<AppUserInfoVO> getUserInfo() {
diff --git a/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/service/impl/AppUserServiceImpl.java b/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/service/impl/AppUserServiceImpl.java
index e19abff..a19e79e 100644
--- a/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/service/impl/AppUserServiceImpl.java
+++ b/xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/service/impl/AppUserServiceImpl.java
@@ -317,6 +317,42 @@
                     // 初始化用户树苗
                     initUserTree(appUser.getId());
                 }
+            }else{
+                // 不存在账户,创建账户
+                // 注册用户信息
+                sysUser = new SysUser();
+                String nickname = "用户" + IdUtil.fastSimpleUUID().substring(0, 6);
+                sysUser.setNickName(nickname);
+                sysUser.setAvatar("https://xqgwzh.obs.cn-south-1.myhuaweicloud.com/Logo%E7%A1%AE%E8%AE%A4%E7%89%88%281%29.jpg");
+                sysUser.setUserName(nickname);
+                sysUser.setUserType("01"); // app用户
+                R<SysUser> registerResult = remoteUserService.registerAppUserInfo(sysUser,
+                        SecurityConstants.INNER);
+                if (registerResult.getCode() == Constants.FAIL) {
+                    throw new ServiceException(registerResult.getMsg());
+                }
+                SysUser sysUserRes = registerResult.getData();
+                appUser = new AppUser();
+                appUser.setAppleId(appleId);
+                appUser.setUserId(sysUserRes.getUserId());
+                appUser.setNickname(nickname);
+                appUser.setAvatar("https://xqgwzh.obs.cn-south-1.myhuaweicloud.com/Logo%E7%A1%AE%E8%AE%A4%E7%89%88%281%29.jpg"); // TODO 待完善默认头像
+                appUser.setBalance(BigDecimal.ZERO);
+                appUser.setSanskritFlag(DisabledEnum.NO.getCode());
+                appUser.setBalance(BigDecimal.ZERO);
+                appUser.setIncome(BigDecimal.ZERO);
+                appUser.setTotalEnergyValue(0);
+                appUser.setRegisterTime(LocalDateTime.now());
+                appUser.setLevelSettingId(TreeLevelEnum.SEED.getCode());
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
+                String format = simpleDateFormat.format(new Date());
+                appLoginUser.setBindStatus(DisabledEnum.YES.getCode());
+                // 生成四位随机数字
+                String randomCode = String.valueOf((int) ((Math.random() * 9 + 1) * 1000));
+                appUser.setCode("YH" + format + randomCode);
+                this.save(appUser);
+                // 初始化用户树苗
+                initUserTree(appUser.getId());
             }
         }
             appLoginUser.setUserid(sysUser.getUserId());

--
Gitblit v1.7.1