|
@@ -27,12 +27,13 @@ import com.zanxiang.module.redis.service.IDistributedLockComponent;
|
|
|
import com.zanxiang.module.util.DateUtil;
|
|
|
import com.zanxiang.module.util.JsonUtil;
|
|
|
import com.zanxiang.module.util.bean.BeanUtil;
|
|
|
-import com.zanxiang.module.util.encryption.Md5Util;
|
|
|
+import com.zanxiang.module.util.encryption.AESUtil;
|
|
|
import com.zanxiang.module.util.exception.BaseException;
|
|
|
import com.zanxiang.module.util.pojo.ResultVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.logging.log4j.util.Strings;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import reactor.util.function.Tuple2;
|
|
|
import reactor.util.function.Tuples;
|
|
@@ -54,15 +55,15 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class UserTokenServiceImpl extends ServiceImpl<UserTokenMapper, UserToken> implements IUserTokenService {
|
|
|
|
|
|
+ @Value("${iapSdk.tokenSecret:unknown}")
|
|
|
+ private String tokenSecret;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RedisUtil<UserToken> redisUtil;
|
|
|
|
|
|
@Autowired
|
|
|
private WxApiService wxApiService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private IGameAppletService gameAppletService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private IGameService gameService;
|
|
|
|
|
@@ -341,10 +342,14 @@ public class UserTokenServiceImpl extends ServiceImpl<UserTokenMapper, UserToken
|
|
|
}
|
|
|
|
|
|
private String createToken(Long userId, Integer deviceType) {
|
|
|
- //生成随机数
|
|
|
- String random = userId + deviceType + UUID.randomUUID().toString() + System.currentTimeMillis();
|
|
|
+ String random = String.join("|",
|
|
|
+ userId.toString(),
|
|
|
+ deviceType.toString(),
|
|
|
+ UUID.randomUUID().toString(),
|
|
|
+ Long.toString(System.nanoTime())
|
|
|
+ );
|
|
|
//创建token
|
|
|
- return Md5Util.encrypt32(Md5Util.encrypt32(random));
|
|
|
+ return AESUtil.encrypt(random, this.tokenSecret);
|
|
|
}
|
|
|
|
|
|
private String getUserTokenKey(Long userId, Integer deviceType) {
|