Browse Source

老用户机构赠送采美豆

plf 4 năm trước cách đây
mục cha
commit
2ad0850514

+ 19 - 0
pay/src/main/java/com/caimei/module/pay/util/RandomCodeGenerator.java

@@ -28,6 +28,25 @@ public class RandomCodeGenerator {
 	};
 //	C,i,j,k,M,O,P,S,U,V,W,X,Z,l
 
+	private static char[] shortLink = {
+		'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
+		'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'O',
+		'W', 'X', 'Y', 'Z',
+		'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
+		'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'o',
+		'w', 'x', 'y', 'z' ,
+		'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'
+	};
+
+	public static String generateShortLink(int length) {
+		StringBuffer sb = new StringBuffer();
+		Random random = new Random();
+		for (int i = 0; i < shortLink.length && i < length; ++i) {
+			sb.append(shortLink[random.nextInt(shortLink.length)]);
+		}
+		return sb.toString();
+	}
+
 	public static String generateCode(int length) {
 		StringBuffer sb = new StringBuffer();
 		Random random = new Random();

+ 1 - 1
pay/src/main/resources/com-caimei-module-pay/PayMapper.xml

@@ -602,6 +602,6 @@
     </select>
 
     <update id="updateUserBeans">
-        UPDATE USER SET userBeans = #{userBeans} WHERE userID = #{userId}
+        UPDATE user SET userBeans = #{userBeans} WHERE userID = #{userId}
     </update>
 </mapper>