From f537abe9f3646c739beaf15076246a2f71a347e9 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 20 二月 2025 16:57:55 +0800
Subject: [PATCH] IOS广告增加区域屏蔽

---
 src/main/java/com/yeshi/buwan/controller/parser/CommentParser.java |   56 +++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/controller/parser/CommentParser.java b/src/main/java/com/yeshi/buwan/controller/parser/CommentParser.java
index 1b22a41..ab54600 100644
--- a/src/main/java/com/yeshi/buwan/controller/parser/CommentParser.java
+++ b/src/main/java/com/yeshi/buwan/controller/parser/CommentParser.java
@@ -2,6 +2,7 @@
 
 import com.google.gson.GsonBuilder;
 import com.yeshi.buwan.domain.*;
+import com.yeshi.buwan.domain.system.DetailSystem;
 import com.yeshi.buwan.domain.user.LoginUser;
 import com.yeshi.buwan.dto.user.LoginInfoDto;
 import com.yeshi.buwan.dto.user.QQUserInfo;
@@ -21,6 +22,8 @@
 import com.yeshi.buwan.vo.AcceptData;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Controller;
 import org.yeshi.utils.entity.wx.WeiXinUser;
 
@@ -34,6 +37,9 @@
 
 @Controller
 public class CommentParser {
+
+    Logger logger = LoggerFactory.getLogger(CommentParser.class);
+
     @Resource
     private SystemService systemService;
     @Resource
@@ -89,6 +95,7 @@
         }
 
         LoginInfoDto loginInfoDto = new LoginInfoDto();
+        loginInfoDto.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort());
         loginInfoDto.setSystemId(acceptData.getDetailSystem().getSystem().getId());
 
         int loginTypeInt = Integer.parseInt(loginType);
@@ -109,28 +116,37 @@
         }
 
 
+        LoginUser lu = null;
         try {
-            LoginUser lu = userService.login(loginInfoDto);
-            if (lu != null) {
-                JSONObject object = new JSONObject();
-                object.put("LoginUid", lu.getId());
-                out.print(JsonUtil.loadTrueJson(object.toString()));
-            } else {
+            lu = userService.login(loginInfoDto);
+            if (lu == null) {
                 out.print(JsonUtil.loadFalseJson("鐧诲綍澶辫触"));
+                return;
             }
         } catch (LoginUserException e) {
             //鐢ㄦ埛涓嶅瓨鍦�
-            if (e.getCode() == LoginUserException.CODE_NO_USER && loginTypeInt == LoginUser.LOGIN_TYPE_EMAIL) {
+            if (e.getCode() == LoginUserException.CODE_NO_USER && loginTypeInt != LoginUser.LOGIN_TYPE_EMAIL) {
                 //娉ㄥ唽
                 try {
-                    userService.register(loginInfoDto);
+                    lu = userService.register(loginInfoDto);
                 } catch (RegisterUserException e1) {
                     out.print(JsonUtil.loadFalseJson("鐧诲綍澶辫触"));
+                    return;
                 }
 
             } else {
                 out.print(JsonUtil.loadFalseJson(e.getMessage()));
+                return;
             }
+        }
+        if (lu != null) {
+            JSONObject object = new JSONObject();
+            object.put("LoginUid", lu.getId());
+            object.put("Portrait", lu.getPortrait());
+            object.put("NickName", lu.getName());
+            out.print(JsonUtil.loadTrueJson(object.toString()));
+        } else {
+            out.print(JsonUtil.loadFalseJson("鐧诲綍澶辫触"));
         }
     }
 
@@ -143,9 +159,13 @@
         }
         //閫氳繃code鎹㈠彇涓汉淇℃伅
         WeiXinUser weiXinUser = MyWXLoginUtil.getUserInfo(code, MyWXLoginUtil.WEIXIN_APPID, MyWXLoginUtil.WEIXIN_SECRET);
+        try {
+            logger.error("寰俊鐧诲綍锛�" + new GsonBuilder().create().toJson(weiXinUser));
+        } catch (Exception e) {
 
+        }
         if (weiXinUser == null) {
-            out.print(JsonUtil.loadFalseJson("鑾峰彇鎺堟潈淇℃伅澶辫触"));
+            out.print(JsonUtil.loadFalseJson("鑾峰彇鎺堟潈淇℃伅澶辫触,璇风◢鍚庡啀璇�"));
             return;
         }
 
@@ -153,6 +173,7 @@
         loginInfoDto.setSystemId(acceptData.getDetailSystem().getSystem().getId());
         loginInfoDto.setLoginType(LoginUser.LOGIN_TYPE_WX);
         loginInfoDto.setWeiXinUser(weiXinUser);
+        loginInfoDto.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort());
 
 
         try {
@@ -169,7 +190,14 @@
             if (e.getCode() == LoginUserException.CODE_NO_USER) {
                 //娉ㄥ唽
                 try {
-                    userService.register(loginInfoDto);
+                    LoginUser lu = userService.register(loginInfoDto);
+                    if (lu != null) {
+                        JSONObject object = new JSONObject();
+                        object.put("user", new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(lu));
+                        out.print(JsonUtil.loadTrueJson(object.toString()));
+                    } else {
+                        out.print(JsonUtil.loadFalseJson("鐧诲綍澶辫触"));
+                    }
                 } catch (RegisterUserException e1) {
                     out.print(JsonUtil.loadFalseJson("鐧诲綍澶辫触"));
                 }
@@ -205,6 +233,9 @@
         }
         out.print(JsonUtil.loadTrueJson(""));
     }
+
+
+
 
 
     /**
@@ -271,7 +302,6 @@
         }
 
     }
-
 
     /**
      * 缁戝畾QQ
@@ -375,14 +405,18 @@
         } catch (SMSException e) {
             e.printStackTrace();
             out.print(JsonUtil.loadFalseJson(e.getMessage()));
+            logger.error("鍙戦�侀獙璇佺爜鍑洪敊锛歱hone-{} msg-{}",phone,e.getMessage(),e);
             return;
         } catch (Exception e) {
             out.print(JsonUtil.loadFalseJson("鐭俊鍙戦�佸嚭閿欙紝璇风◢鍚庡啀璇�"));
+            logger.error("鍙戦�侀獙璇佺爜鍑洪敊锛歱hone-{} msg-{}",phone,e.getMessage(),e);
             return;
         }
         out.print(JsonUtil.loadTrueJson(""));
     }
 
+
+
     public void getVideoCommentList(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
 
         String videoId = request.getParameter("VideoId");

--
Gitblit v1.8.0