/**
* @description: 邀请码
* @create: 2020-06-03 15:52
**/
package com.pdw.util;
import java.util.Random;
public class CodeUtils {
private static final long OFFSET = 1577808000000L;
private static final char[] r = new char[]{
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
/** 定义一个字符用来补全邀请码长度(该字符前面是计算出来的邀请码,后面是用来补全用的) */
private static final char b='0';
/** 进制长度 */
private static final int binLen = r.length;
/** 邀请码长度 */
private static final int s = 8;
/**
* 根据ID生成随机码
* @param id ID
* @return 随机码
*/
public static String toSerialCode(long id) {
char[
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交