| | |
| | | package com.yeshi.fanli.util.account;
|
| | |
|
| | | import java.lang.reflect.InvocationTargetException;
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | |
|
| | |
| | | if (rank == null)
|
| | | rank = 0;
|
| | |
|
| | | return String.format(Constant.systemCommonConfig.getBaseUserRankIconUrl() + "/rank_picture_%s.png",
|
| | | rank + "");
|
| | | return String.format(Constant.systemCommonConfig.getBaseUserRankIconUrl() + "/rank_picture_%s.png", rank + "");
|
| | | }
|
| | |
|
| | | public static String getInviteCode(Long uid) {
|
| | |
|
| | | long num = 1000000000L + uid;
|
| | |
|
| | | return convert10To36(num);
|
| | | }
|
| | |
|
| | | private static String convert10To36(Long num) {
|
| | | String numbers = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
| | | BigDecimal numBig = new BigDecimal(num);
|
| | |
|
| | | int ge = numBig.divideAndRemainder(new BigDecimal(36))[1].intValue();
|
| | | int n = 1;
|
| | | String result = "";
|
| | | result += numbers.charAt(ge);
|
| | |
|
| | | while (numBig.divideAndRemainder(new BigDecimal(36).pow(n))[0].compareTo(new BigDecimal(0)) > 0) {
|
| | | int w = numBig.divideAndRemainder(new BigDecimal(36).pow(n))[0].divideAndRemainder(new BigDecimal(36))[1]
|
| | | .intValue();
|
| | | result = numbers.charAt(w) + result;
|
| | | n++;
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | }
|