kk před 8 měsíci
rodič
revize
efde48162e

+ 145 - 49
game-business/src/main/java/com/game/business/controller/AppUserAgentController.java

@@ -5,30 +5,29 @@ import java.util.stream.Collectors;
 import javax.servlet.http.HttpServletResponse;
 
 import cn.hutool.core.util.IdUtil;
-import com.game.business.domain.AppGame;
-import com.game.business.domain.AppGameBetting;
-import com.game.business.domain.AppGameCommission;
+import cn.hutool.core.util.RandomUtil;
+import com.game.business.domain.*;
 import com.game.business.dto.AppUserAgentDTO;
+import com.game.business.dto.AppUserDTO;
 import com.game.business.service.IAppGameCommissionService;
 import com.game.business.service.IAppGameService;
+import com.game.business.service.IAppUserService;
+import com.game.business.util.Md5Utils;
 import com.game.business.vo.AppGameBettingDetailsCountVO;
 import com.game.business.vo.AppGameCommissionVO;
 import com.game.business.vo.AppUserAgentVO;
 import com.game.common.annotation.Anonymous;
-import com.game.common.core.domain.HttpRet;
-import com.game.common.core.domain.HttpRetPageArr;
-import com.game.common.core.domain.R;
+import com.game.common.core.domain.*;
+import com.game.common.utils.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import com.game.common.annotation.Log;
 import com.game.common.core.controller.BaseController;
-import com.game.common.core.domain.AjaxResult;
 import com.game.common.enums.BusinessType;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import com.game.business.domain.AppUserAgent;
 import com.game.business.service.IAppUserAgentService;
 import com.game.common.utils.poi.ExcelUtil;
 import com.game.common.core.page.TableDataInfo;
@@ -53,30 +52,26 @@ public class AppUserAgentController extends BaseController
     @Autowired
     private IAppGameService appGameService;
 
+    @Autowired
+    private IAppUserService appUserService;
+
 
     @Anonymous
-    @PostMapping("/add")
+    @PostMapping("/addAgent")
     @ApiOperation(value = "添加代理", notes = "添加代理")
-    public HttpRet addAgent(@RequestBody AppUserAgentDTO appUserAgent)
+    public HttpRet addAgent(@RequestBody AppUserDTO appUserDTO)
     {
-        if(appUserAgent == null){
-            return HttpRet.fail("代理数据为空。");
-        }
 
-        if(appUserAgent.getPid() == null){
-            return HttpRet.fail("上级代理ID为空。");
+        if(appUserService.getMobileCount(appUserDTO.getMobile())){
+            return HttpRet.fail("用户手机号码已存在。");
         }
 
-        AppUserAgent userAgent = new AppUserAgent();
-        userAgent.setUserId(appUserAgent.getUserId());
-        List<AppUserAgent> list = appUserAgentService.selectAppUserAgentList(userAgent);
+        AppUser appUser = getAppUser(appUserDTO.getMobile(), appUserDTO.getPassWord());
 
-        if(list != null && !list.isEmpty()){
-            return HttpRet.fail("当前用户已经是代理。");
-        }
+        appUserService.insertAppUser(appUser);
 
         AppUserAgent pUserAgent = new AppUserAgent();
-        pUserAgent.setUserId(appUserAgent.getPid());
+        pUserAgent.setUserId(appUserDTO.getUserId());
         List<AppUserAgent> pList = appUserAgentService.selectAppUserAgentList(pUserAgent);
 
         if(pList == null || pList.isEmpty()){
@@ -84,38 +79,31 @@ public class AppUserAgentController extends BaseController
         }
 
         AppUserAgent dbPuserAgent = pList.get(0);
-        AppUserAgent dbUserAgent = new AppUserAgent();
-        BeanUtils.copyProperties(appUserAgent, dbUserAgent);
 
-        dbUserAgent.setTopId(dbPuserAgent.getTopId());
-        dbUserAgent.setAuditStatus("0");
-        dbUserAgent.setCreateTime(new Date());
-        dbUserAgent.setId(IdUtil.getSnowflakeNextId());
-        appUserAgentService.insertAppUserAgent(dbUserAgent);
+        AppUserAgent appUserAgent = new AppUserAgent();
+        appUserAgent.setTopId(dbPuserAgent.getTopId() == null ? dbPuserAgent.getUserId() : dbPuserAgent.getTopId());
+        appUserAgent.setPid(dbPuserAgent.getUserId());
+        appUserAgent.setUserId(appUser.getUserid());
+        appUserAgent.setAuditStatus("1");
+        appUserAgent.setCreateTime(new Date());
 
-        if(appUserAgent.getCommissions() != null && !appUserAgent.getCommissions().isEmpty()){
-            List<AppGameCommission> commissionList = appUserAgent.getCommissions();
-            for(AppGameCommission commission : commissionList){
-                if(commission.getPid() == null){
-                    commission.setPid(appUserAgent.getPid());
-                }
-                commission.setId(IdUtil.getSnowflakeNextId());
-                appGameCommissionService.insertAppGameCommission(commission);
-            }
-        }
+        appUserAgentService.insertAppUserAgent(appUserAgent);
 
-        return  HttpRet.success("添加成功");
+        return HttpRet.success("添加成功");
     }
 
+
     @Anonymous
-    @PostMapping("/update")
-    @ApiOperation(value = "修改代理", notes = "修改代理")
-    public HttpRet updateAgent(@RequestBody AppUserAgentDTO appUserAgent)
+    @PostMapping("/updateConfig")
+    @ApiOperation(value = "修改代理配置", notes = "修改代理配置")
+    public HttpRet addAgent(@RequestBody AppUserAgentDTO appUserAgent)
     {
+        if(appUserAgent == null){
+            return HttpRet.fail("代理数据为空。");
+        }
 
         AppUserAgent dbUserAgent = new AppUserAgent();
-        dbUserAgent.setLiveRate(appUserAgent.getLiveRate());
-        dbUserAgent.setDividendGuaranteeRate(appUserAgent.getDividendGuaranteeRate());
+        BeanUtils.copyProperties(appUserAgent, dbUserAgent);
         dbUserAgent.setUpdateTime(new Date());
         appUserAgentService.updateAppUserAgent(dbUserAgent);
 
@@ -125,9 +113,9 @@ public class AppUserAgentController extends BaseController
                 if(commission.getId() == null){
                     if(commission.getPid() == null){
                         commission.setPid(appUserAgent.getPid());
+                        commission.setId(IdUtil.getSnowflakeNextId());
+                        appGameCommissionService.insertAppGameCommission(commission);
                     }
-                    commission.setId(IdUtil.getSnowflakeNextId());
-                    appGameCommissionService.insertAppGameCommission(commission);
                 }else{
                     appGameCommissionService.updateAppGameCommission(commission);
                 }
@@ -138,7 +126,32 @@ public class AppUserAgentController extends BaseController
     }
 
     /**
-     * 游戏输赢详情列表
+     * 获取代理成员列表
+     */
+    @Anonymous
+    @PostMapping(value = "/getUserAgentList")
+    @ApiOperation(value = "获取代理成员列表", notes = "获取代理成员列表")
+    public HttpRetArr<AppUserAgentVO> getUserAgentList(@RequestParam(name = "userId") Long userId)
+    {
+        AppUserAgent userAgent = new AppUserAgent();
+        userAgent.setPid(userId);
+        List<AppUserAgent> userAgents = appUserAgentService.selectAppUserAgentList(userAgent);
+        List<AppUserAgentVO> resultList = new ArrayList<>();
+        for (int i = 0; i < userAgents.size(); i++) {
+            AppUserAgentVO appUserAgentVO = new AppUserAgentVO();
+            BeanUtils.copyProperties(userAgents.get(0), appUserAgentVO);
+
+            AppUser appUser = appUserService.selectAppUserByUserid(appUserAgentVO.getUserId());
+            if(appUser != null){
+                appUserAgentVO.setNickName(appUser.getNickname());
+                appUserAgentVO.setAvatar(appUser.getAvatar());
+            }
+        }
+        return HttpRetArr.success("查询成功", resultList);
+    }
+
+    /**
+     * 获取代理成员设置
      */
     @Anonymous
     @PostMapping(value = "/getUserAgent")
@@ -161,7 +174,7 @@ public class AppUserAgentController extends BaseController
         appGameCommission.setPid(pid);
         appGameCommission.setUserId(userId);
         List<AppGameCommission> gameCommissions = appGameCommissionService.selectAppGameCommissionList(appGameCommission);
-        Map<Long, List<AppGameCommission>> idGameMap = null;
+        Map<Long, List<AppGameCommission>> idGameMap;
         if(gameCommissions != null && !gameCommissions.isEmpty()){
             idGameMap = gameCommissions.stream().collect(Collectors.groupingBy(AppGameCommission::getGameId));
         }else{
@@ -194,4 +207,87 @@ public class AppUserAgentController extends BaseController
         appUserAgentVO.setCommissions(gameCommissionVOList);
         return HttpRet.success("查询成功", appUserAgentVO);
     }
+
+    /**
+     * 新增用户
+     * @return 用户id
+     * @author jiang
+     * @date 2021/9/25 16:28
+     */
+    public AppUser getAppUser(String mobile, String password) {
+
+        AppUser appUser = new AppUser();
+
+        appUser.setUserid(IdUtil.getSnowflakeNextId());
+        if (StringUtils.isNotBlank(password)) {
+            appUser.setPassword(Md5Utils.md5(Md5Utils.md5(password) + appUser.getSalt()));
+        }
+        appUser.setUsername(mobile);
+        appUser.setAvatar(null);
+        appUser.setSex(0L);
+        appUser.setSignature("这家伙很懒...");
+        appUser.setSalt(RandomUtil.randomString(8));
+
+        // 基础信息
+        appUser.setMobile(mobile);
+        appUser.setPassword(password);
+        appUser.setRegType(0L);
+        appUser.setOpenid(null);
+        appUser.setRegisterIp("127.0.0.1");
+        appUser.setRegType(0L);
+        appUser.setCreateTime(new Date());
+        appUser.setLoginType("1");
+
+        appUser.setUserType(2L);
+        appUser.setBirthday("1990-01-01");
+        appUser.setStatus(0L);
+        appUser.setDelFlag(0L);
+        appUser.setIshot(1L);
+        appUser.setIsRecommend(0L);
+        appUser.setIssuper(1L);
+        appUser.setRole(0L);
+        appUser.setCity("墨西哥");
+        appUser.setAddress("墨西哥");
+        appUser.setLat(114.31);
+        appUser.setLng(30.52);
+
+        // 用户开关
+        appUser.setGiftGlobalBroadcast(1L);
+        appUser.setIsShowHomePage(1L);
+
+        // 金币相关
+        appUser.setCoin(0.00);
+        appUser.setVotes(0.00);
+        appUser.setAmount(0.00);
+        appUser.setTotalAmount(0.00);
+        appUser.setVotestotal(0.00);
+        appUser.setTotalCharge(0.00);
+        appUser.setTotalAmountCash(0.00);
+        appUser.setTotalCash(0.00);
+        appUser.setConsumption(0.00);
+
+        // 等级积分相关
+        appUser.setUserPoint(0L);
+        appUser.setAnchorPoint(0L);
+        appUser.setCharmPoint(0L);
+        appUser.setUserGrade(1L);
+        appUser.setAnchorGrade(1L);
+        appUser.setWealthGrade(1L);
+        appUser.setNobleGrade(0L);
+        appUser.setCharmGrade(0L);
+
+        appUser.setIsShowHomePage(1L);
+        appUser.setIpaddr("墨西哥");
+        appUser.setAppVersion(null);
+        appUser.setAppVersionCode(null);
+        appUser.setPhoneSystem(null);
+        appUser.setPhoneFirm(null);
+        appUser.setPhoneModel(null);
+        appUser.setPhoneUuid(null);
+        appUser.setSource(null);
+        appUser.setIszombie(1L);
+        appUser.setIszombiep(1L);
+
+        return appUser;
+    }
 }

+ 2 - 0
game-business/src/main/java/com/game/business/dto/AppUserAgentDTO.java

@@ -13,4 +13,6 @@ public class AppUserAgentDTO extends AppUserAgent {
     @ApiModelProperty(value = "游戏设置集合")
     private List<AppGameCommission> commissions;
 
+
+
 }

+ 19 - 0
game-business/src/main/java/com/game/business/dto/AppUserDTO.java

@@ -0,0 +1,19 @@
+package com.game.business.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+@Data
+public class AppUserDTO {
+
+    @ApiModelProperty(value = "操作人ID")
+    private Long userId;
+
+    @ApiModelProperty(value = "手机号码")
+    private String mobile;
+
+    @ApiModelProperty(value = "密码")
+    private String passWord;
+
+}

+ 2 - 0
game-business/src/main/java/com/game/business/service/IAppUserService.java

@@ -60,4 +60,6 @@ public interface IAppUserService extends IService<AppUser> {
     public int deleteAppUserByUserid(Long userid);
 
     public int getCount(Long pid,String beginTime,String endTime);
+
+    boolean getMobileCount(String mobile);
 }

+ 7 - 0
game-business/src/main/java/com/game/business/service/impl/AppUserServiceImpl.java

@@ -113,4 +113,11 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
         }
         return appUserMapper.selectCount(queryWrapper).intValue();
     }
+
+    @Override
+    public boolean getMobileCount(String mobile) {
+        LambdaQueryWrapper<AppUser> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AppUser::getMobile, mobile);
+        return appUserMapper.selectCount(queryWrapper) > 0;
+    }
 }

+ 98 - 0
game-business/src/main/java/com/game/business/util/DigestUtils.java

@@ -0,0 +1,98 @@
+/**
+ * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
+ */
+package com.game.business.util;
+
+import org.apache.commons.lang3.Validate;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.GeneralSecurityException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+
+/**
+ * 不可逆加密工具类
+ * 
+ * @author ThinkGem
+ */
+public class DigestUtils {
+
+	private static SecureRandom random = getSecureRandom();
+
+	static SecureRandom getSecureRandom() {
+		try {
+			return SecureRandom.getInstance("SHA1PRNG");
+		} catch (NoSuchAlgorithmException e) {
+			return null;
+		}
+
+	}
+
+	/**
+	 * 生成随机的Byte[]作为salt密钥.
+	 * 
+	 * @param numBytes byte数组的大小
+	 */
+	public static byte[] genSalt(int numBytes) {
+		Validate.isTrue(numBytes > 0, "numBytes argument must be a positive integer (1 or larger)", numBytes);
+		byte[] bytes = new byte[numBytes];
+		random.nextBytes(bytes);
+		return bytes;
+	}
+
+	/**
+	 * 对字符串进行散列, 支持md5与sha1算法.
+	 * 
+	 * @param input      需要散列的字符串
+	 * @param algorithm  散列算法("SHA-1"、"MD5")
+	 * @param salt
+	 * @param iterations 迭代次数
+	 * @return
+	 */
+	public static byte[] digest(byte[] input, String algorithm, byte[] salt, int iterations) {
+		try {
+			MessageDigest digest = MessageDigest.getInstance(algorithm);
+
+			if (salt != null) {
+				digest.update(salt);
+			}
+
+			byte[] result = digest.digest(input);
+
+			for (int i = 1; i < iterations; i++) {
+				digest.reset();
+				result = digest.digest(result);
+			}
+			return result;
+		} catch (GeneralSecurityException e) {
+			throw ExceptionUtils.unchecked(e);
+		}
+	}
+
+	/**
+	 * 对文件进行sha1散列.
+	 * 
+	 * @param input     需要散列的流
+	 * @param algorithm 散列算法("SHA-1"、"MD5")
+	 */
+	public static byte[] digest(InputStream input, String algorithm) throws IOException {
+		try {
+			MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
+			int bufferLength = 8 * 1024;
+			byte[] buffer = new byte[bufferLength];
+			int read = input.read(buffer, 0, bufferLength);
+
+			while (read > -1) {
+				messageDigest.update(buffer, 0, read);
+				read = input.read(buffer, 0, bufferLength);
+			}
+
+			return messageDigest.digest();
+		} catch (GeneralSecurityException e) {
+			throw ExceptionUtils.unchecked(e);
+		}
+	}
+
+}

+ 215 - 0
game-business/src/main/java/com/game/business/util/EncodeUtils.java

@@ -0,0 +1,215 @@
+/**
+ * Copyright (c) 2005-2012 springside.org.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ */
+package com.game.business.util;
+
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.codec.binary.Hex;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.regex.Pattern;
+
+
+/**
+ * 封装各种格式的编码解码工具类.
+ * 1.Commons-Codec的 hex/base64 编码
+ * 2.自制的base62 编码
+ * 3.Commons-Lang的xml/html escape
+ * 4.JDK提供的URLEncoder
+ * @author calvin
+ * @version 2013-01-15
+ */
+public class EncodeUtils {
+	
+	private static final Logger logger = LoggerFactory.getLogger(EncodeUtils.class);
+	private static final String DEFAULT_URL_ENCODING = "UTF-8";
+	private static final char[] BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".toCharArray();
+
+	/**
+	 * Hex编码.
+	 */
+	public static String encodeHex(byte[] input) {
+		return new String(Hex.encodeHex(input));
+	}
+
+	/**
+	 * Hex解码.
+	 */
+	public static byte[] decodeHex(String input) {
+		try {
+			return Hex.decodeHex(input.toCharArray());
+		} catch (DecoderException e) {
+			throw ExceptionUtils.unchecked(e);
+		}
+	}
+
+	/**
+	 * Base64编码.
+	 */
+	public static String encodeBase64(byte[] input) {
+		return new String(Base64.encodeBase64(input));
+	}
+	
+	/**
+	 * Base64编码.
+	 */
+	public static String encodeBase64(String input) {
+		try {
+			return new String(Base64.encodeBase64(input.getBytes(DEFAULT_URL_ENCODING)));
+		} catch (UnsupportedEncodingException e) {
+			return "";
+		}
+	}
+
+//	/**
+//	 * Base64编码, URL安全(将Base64中的URL非法字符'+'和'/'转为'-'和'_', 见RFC3548).
+//	 */
+//	public static String encodeUrlSafeBase64(byte[] input) {
+//		return Base64.encodeBase64URLSafe(input);
+//	}
+
+	/**
+	 * Base64解码.
+	 */
+	public static byte[] decodeBase64(String input) {
+		return Base64.decodeBase64(input.getBytes());
+	}
+	
+	/**
+	 * Base64解码.
+	 */
+	public static String decodeBase64String(String input) {
+		try {
+			return new String(Base64.decodeBase64(input.getBytes()), DEFAULT_URL_ENCODING);
+		} catch (UnsupportedEncodingException e) {
+			return "";
+		}
+	}
+
+	/**
+	 * Base62编码。
+	 */
+	public static String encodeBase62(byte[] input) {
+		char[] chars = new char[input.length];
+		for (int i = 0; i < input.length; i++) {
+			chars[i] = BASE62[((input[i] & 0xFF) % BASE62.length)];
+		}
+		return new String(chars);
+	}
+
+
+
+
+	/**
+	 * URL 编码, Encode默认为UTF-8. 
+	 */
+	public static String encodeUrl(String part) {
+		return encodeUrl(part, DEFAULT_URL_ENCODING);
+	}
+
+	/**
+	 * URL 编码, Encode默认为UTF-8. 
+	 */
+	public static String encodeUrl(String part, String encoding) {
+		if (part == null){
+			return null;
+		}
+		try {
+			return URLEncoder.encode(part, encoding);
+		} catch (UnsupportedEncodingException e) {
+			throw ExceptionUtils.unchecked(e);
+		}
+	}
+
+	/**
+	 * URL 解码, Encode默认为UTF-8. 
+	 */
+	public static String decodeUrl(String part) {
+		return decodeUrl(part, DEFAULT_URL_ENCODING);
+	}
+
+	/**
+	 * URL 解码, Encode默认为UTF-8. 
+	 */
+	public static String decodeUrl(String part, String encoding) {
+
+		try {
+			return URLDecoder.decode(part, encoding);
+		} catch (UnsupportedEncodingException e) {
+			throw ExceptionUtils.unchecked(e);
+		}
+	}
+	
+	/**
+	 * URL 解码(两次), Encode默认为UTF-8. 
+	 */
+	public static String decodeUrl2(String part) {
+		return decodeUrl(decodeUrl(part));
+	}
+	
+	// 预编译XSS过滤正则表达式
+	private static Pattern p1 = Pattern.compile("<\\s*(script|link|style|iframe)(.|\\n)*<\\s*\\/\\s*\\1\\s*>\\s*", Pattern.CASE_INSENSITIVE);
+	private static Pattern p2 = Pattern.compile("\\s*on[a-z]+\\s*=\\s*(\"[^\"]+\"|'[^']+'|[^\\s]+)\\s*(?=>)", Pattern.CASE_INSENSITIVE);
+	private static Pattern p3 = Pattern.compile("\\s*(href|src)\\s*=\\s*(\"\\s*(javascript|vbscript):[^\"]+\"|'\\s*(javascript|vbscript):[^']+'|(javascript|vbscript):[^\\s]+)\\s*(?=>)", Pattern.CASE_INSENSITIVE);
+	private static Pattern p4 = Pattern.compile("epression\\((.|\\n)*\\);?", Pattern.CASE_INSENSITIVE);
+	
+	/**
+	 * XSS 非法字符过滤
+	 * 内容以<!--HTML-->开头的用以下规则(保留标签,去掉js脚本):
+	 * 	1、<(script|link|style|iframe)(.|\n)*<\/\1>\s* 
+	 * 	2、\s*on[a-z]+\s*=\s*("[^"]+"|'[^']+'|[^\s]+)\s*(?=>) 
+	 * 	3、\s*(href|src)\s*=\s*("\s*(javascript|vbscript):[^"]+"|'\s*(javascript|vbscript):[^']+'|(javascript|vbscript):[^\s]+)\s*(?=>) 
+	 * 	4、epression\((.|\n)*\);? 
+	 * 其它情况下:进行HTML4编码
+	 * @author ThinkGem
+	 */
+	public static String xssFilter(String text) {
+		if (text != null){
+			String oriValue = StringUtils.trim(text), value = oriValue;
+			value = p1.matcher(value).replaceAll("");
+			value = p2.matcher(value).replaceAll("");
+			value = p3.matcher(value).replaceAll("");
+			value = p4.matcher(value).replaceAll("");
+			// 如果开始不是HTML,XML,JOSN格式,则再进行HTML的 "、<、> 转码。
+			if (!StringUtils.startsWithIgnoreCase(value, "<!--HTML-->") 	// HTML
+					&& !StringUtils.startsWithIgnoreCase(value, "<?xml ") 	// XML
+					&& !StringUtils.contains(value, "id=\"FormHtml\"") 		// JFlow
+					&& !(StringUtils.startsWith(value, "{") && StringUtils.endsWith(value, "}")) // JSON Object
+					&& !(StringUtils.startsWith(value, "[") && StringUtils.endsWith(value, "]")) // JSON Array
+				){
+				value = value.replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
+			}
+			if (logger.isInfoEnabled() && !value.equals(oriValue)){
+				logger.info("xssFilter: {} to {}", text, value);
+			}
+			return value;
+		}
+		return null;
+	}
+	
+	// 预编译SQL过滤正则表达式
+	private static Pattern p5 = Pattern.compile("(?:')|(?:--)|(/\\*(?:.|[\\n\\r])*?\\*/)|(\\b(select|update|and|or|delete|insert|trancate|char|into|substr|ascii|declare|exec|count|master|into|drop|execute)\\b)", Pattern.CASE_INSENSITIVE);
+			
+	/**
+	 * SQL过滤,防止注入,传入参数输入有select相关代码,替换空。
+	 * @author ThinkGem
+	 */
+	public static String sqlFilter(String text){
+		if (text != null){
+			String value = p5.matcher(text).replaceAll("");
+			if (logger.isWarnEnabled() && !value.equals(text)){
+				logger.warn("sqlFilter: {} to {}", text, value);
+				return StringUtils.EMPTY;
+			}
+			return value;
+		}
+		return null;
+	}
+}

+ 74 - 0
game-business/src/main/java/com/game/business/util/ExceptionUtils.java

@@ -0,0 +1,74 @@
+/**
+ * Copyright (c) 2005-2012 springside.org.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ */
+package com.game.business.util;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * 关于异常的工具类.
+ * @author calvin
+ * @version 2014-8-19
+ */
+public class ExceptionUtils {
+
+	/**
+	 * 在request中获取异常类
+	 * @param request
+	 * @return 
+	 */
+	public static Throwable getThrowable(HttpServletRequest request){
+		Throwable ex = null;
+		if (request.getAttribute("exception") != null) {
+			ex = (Throwable) request.getAttribute("exception");
+		} else if (request.getAttribute("javax.servlet.error.exception") != null) {
+			ex = (Throwable) request.getAttribute("javax.servlet.error.exception");
+		}
+		return ex;
+	}
+
+	/**
+	 * 将ErrorStack转化为String.
+	 */
+	public static String getStackTraceAsString(Throwable e) {
+		if (e == null){
+			return "";
+		}
+		StringWriter stringWriter = new StringWriter();
+		e.printStackTrace(new PrintWriter(stringWriter));
+		return stringWriter.toString();
+	}
+
+	/**
+	 * 判断异常是否由某些底层的异常引起.
+	 */
+	@SuppressWarnings("unchecked")
+	public static boolean isCausedBy(Exception ex, Class<? extends Exception>... causeExceptionClasses) {
+		Throwable cause = ex.getCause();
+		while (cause != null) {
+			for (Class<? extends Exception> causeClass : causeExceptionClasses) {
+				if (causeClass.isInstance(cause)) {
+					return true;
+				}
+			}
+			cause = cause.getCause();
+		}
+		return false;
+	}
+	
+	/**
+	 * 将CheckedException转换为UncheckedException.
+	 */
+	public static RuntimeException unchecked(Exception e) {
+		if (e instanceof RuntimeException) {
+			return (RuntimeException) e;
+		} else {
+			return new RuntimeException(e);
+		}
+	}
+	
+}

+ 67 - 0
game-business/src/main/java/com/game/business/util/Md5Utils.java

@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
+ */
+package com.game.business.util;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * MD5不可逆加密工具类
+ * @author ThinkGem
+ */
+public class Md5Utils {
+
+	private static final String MD5 = "MD5";
+	private static final String DEFAULT_ENCODING = "UTF-8";
+
+
+	/**
+	 * 对输入字符串进行md5散列.
+	 * @param input 加密字符串
+	 */
+	public static String md5(String input) {
+		return md5(input, 1);
+	}
+
+	/**
+	 * 对输入字符串进行md5散列.
+	 * @param input 加密字符串
+	 * @param iterations 迭代次数
+	 */
+	public static String md5(String input, int iterations) {
+		try {
+			return EncodeUtils.encodeHex(DigestUtils.digest(input.getBytes(DEFAULT_ENCODING), MD5, null, iterations));
+		} catch (UnsupportedEncodingException e) {
+			return StringUtils.EMPTY;
+		}
+	}
+
+	/**
+	 * 对输入字符串进行md5散列.
+	 * @param input 加密字符串
+	 */
+	public static byte[] md5(byte[] input) {
+		return md5(input, 1);
+	}
+
+	/**
+	 * 对输入字符串进行md5散列.
+	 * @param input 加密字符串
+	 * @param iterations 迭代次数
+	 */
+	public static byte[] md5(byte[] input, int iterations) {
+		return DigestUtils.digest(input, MD5, null, iterations);
+	}
+
+	/**
+	 * 对文件进行md5散列.
+	 */
+	public static byte[] md5(InputStream input) throws IOException {
+		return DigestUtils.digest(input, MD5);
+	}
+
+}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 320 - 0
game-business/src/main/java/com/game/business/util/StringUtils.java


+ 6 - 0
game-business/src/main/java/com/game/business/vo/AppUserAgentVO.java

@@ -12,4 +12,10 @@ public class AppUserAgentVO extends AppUserAgent {
     @ApiModelProperty(value = "游戏设置集合")
     private List<AppGameCommissionVO> commissions;
 
+    @ApiModelProperty(value = "用户昵称")
+    private String nickName;
+
+    @ApiModelProperty(value = "用户头像")
+    private String avatar;
+
 }

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů