From 9f09e749e7198051b9af6c2421336a80b58b79a4 Mon Sep 17 00:00:00 2001
From: 喻健 <喻健@Admin>
Date: 星期三, 19 十二月 2018 16:33:12 +0800
Subject: [PATCH] 当日提现成功超过100元 返回高危标识

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 50 insertions(+), 6 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
index d2c7cc0..80d62ee 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
@@ -8,6 +8,7 @@
 import java.util.List;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
 import org.springframework.stereotype.Service;
@@ -51,6 +52,9 @@
 import com.yeshi.fanli.util.TimeUtil;
 import com.yeshi.fanli.util.factory.AccountDetailsFactory;
 import com.yeshi.fanli.util.wx.WXLoginUtil;
+
+import net.sf.json.JSONObject;
+
 import org.yeshi.utils.JsonUtil;
 import org.yeshi.utils.tencentcloud.COSManager;
 
@@ -97,9 +101,19 @@
 
 	@Transactional
 	@Override
-	public LoginResult login(HttpSession session, Boolean first, String appId, String code, String phone,
+	public LoginResult login(HttpServletRequest request, Boolean first, String appId, String code, String phone,
 			UserInfo tbUserInfo, boolean wxinstall, int loginType) throws UserAccountException {
 
+		JSONObject logInfo = new JSONObject();
+		logInfo.put("appId", appId);
+		logInfo.put("code", code);
+		logInfo.put("phone", phone);
+		if (tbUserInfo != null)
+			logInfo.put("tbUserInfo", tbUserInfo.getId());
+		logInfo.put("loginType", loginType);
+		LogHelper.lgoinInfo(logInfo.toString());
+
+		HttpSession session = request.getSession();
 		if (first != null && first == true)
 			session.removeAttribute("LAST_LOGIN_USER");
 		// 浼氳瘽涓笂娆$櫥褰曠殑鐢ㄦ埛
@@ -154,6 +168,11 @@
 							updateUserInfo.setPortrait(weiXinUser.getHeadimgurl());
 						updateUserInfo.setWxPic(weiXinUser.getHeadimgurl());
 						updateUserInfo.setWxName(weiXinUser.getNickname());
+						// 璁剧疆鐧诲綍鏃堕棿涓庣櫥褰曠被鍨�
+						updateUserInfo.setLastLoginTime(System.currentTimeMillis());
+						updateUserInfo.setLoginType(loginType);
+						updateUserInfo.setLastLoginIp(request.getRemoteHost());
+
 						userInfoMapper.updateByPrimaryKeySelective(updateUserInfo);
 						// 鍒犻櫎閭�璇峰浘鐗�
 						spreadUserImgService.deleteImgUrl(userInfo.getId());
@@ -167,6 +186,9 @@
 					userInfo.setWxOpenId(weiXinUser.getOpenid());
 					userInfo.setWxUnionId(weiXinUser.getUnionid());
 					userInfo.setWxPic(weiXinUser.getHeadimgurl());
+					userInfo.setLastLoginTime(System.currentTimeMillis());
+					userInfo.setLoginType(loginType);
+					userInfo.setLastLoginIp(request.getRemoteHost());
 					addUser(userInfo);
 
 					return new LoginResult(LoginResult.TYPE_NORMAL, userInfo);
@@ -247,6 +269,8 @@
 							userInfo.setTbPic(lastUser.getTbPic());
 						}
 						userInfo.setLastLoginTime(System.currentTimeMillis());
+						userInfo.setLoginType(loginType);
+						userInfo.setLastLoginIp(request.getRemoteHost());
 						addUser(userInfo);
 						session.removeAttribute("LAST_LOGIN_USER");
 						return new LoginResult(LoginResult.TYPE_NORMAL, userInfo);
@@ -292,6 +316,15 @@
 	@Override
 	public LoginResult loginNoInstallWX(String appId, String code, String phone, UserInfo tbUserInfo, int loginType)
 			throws UserAccountException {
+		JSONObject logInfo = new JSONObject();
+		logInfo.put("appId", appId);
+		logInfo.put("code", code);
+		logInfo.put("phone", phone);
+		if (tbUserInfo != null)
+			logInfo.put("tbUserInfo", tbUserInfo.getId());
+		logInfo.put("loginType", loginType);
+		LogHelper.lgoinInfo(logInfo.toString());
+
 		UserInfo userInfo = null;
 		WeiXinUser weiXinUser = null;
 		switch (loginType) {
@@ -508,7 +541,12 @@
 	 * @param unionId
 	 * @return
 	 */
-	public UserInfo getUserInfoByWXUnionId(String appId, String unionId) {
+	public UserInfo getUserInfoByWXUnionId(String appId, String unionId) throws UserAccountException {
+		if (StringUtil.isNullOrEmpty(appId))
+			throw new UserAccountException(1, "appId涓虹┖");
+		if (StringUtil.isNullOrEmpty(unionId))
+			throw new UserAccountException(2, "unionId涓虹┖");
+
 		return userInfoMapper.getUserInfoByAppIdAndWXUnionId(appId, unionId);
 	}
 
@@ -519,8 +557,11 @@
 	 * @param openId
 	 * @return
 	 */
-	public UserInfo getUserInfoByTaoBaoOpenId(String appId, String openId) {
-
+	public UserInfo getUserInfoByTaoBaoOpenId(String appId, String openId) throws UserAccountException {
+		if (StringUtil.isNullOrEmpty(appId))
+			throw new UserAccountException(1, "appId涓虹┖");
+		if (StringUtil.isNullOrEmpty(openId))
+			throw new UserAccountException(2, "openId涓虹┖");
 		return userInfoMapper.getUserInfoByAppIdAndTaoBaoOpenId(appId, openId);
 	}
 
@@ -531,8 +572,11 @@
 	 * @param phone
 	 * @return
 	 */
-	public UserInfo getUserInfoByPhone(String appId, String phone) {
-
+	public UserInfo getUserInfoByPhone(String appId, String phone) throws UserAccountException {
+		if (StringUtil.isNullOrEmpty(appId))
+			throw new UserAccountException(1, "appId涓虹┖");
+		if (StringUtil.isNullOrEmpty(phone))
+			throw new UserAccountException(2, "phone涓虹┖");
 		return userInfoMapper.getUserInfoByAppIdAndPhone(appId, phone);
 	}
 

--
Gitblit v1.8.0