Service注入
parent
5fb7848dc8
commit
96373a81dd
|
|
@ -10,7 +10,7 @@ public class CacheConstants
|
|||
/**
|
||||
* 缓存有效期,默认720(分钟)
|
||||
*/
|
||||
public final static long EXPIRATION = 720;
|
||||
public final static long EXPIRATION = 43200;
|
||||
|
||||
/**
|
||||
* 缓存刷新时间,默认120(分钟)
|
||||
|
|
|
|||
|
|
@ -78,6 +78,32 @@ public class TokenService
|
|||
return rspMap;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> createAPPToken(LoginUser loginUser)
|
||||
{
|
||||
String token = IdUtils.fastUUID();
|
||||
Long userId = 0L;
|
||||
String userName = null;
|
||||
userId = loginUser.getUserid();
|
||||
userName = loginUser.getUsername();
|
||||
loginUser.setToken(token);
|
||||
loginUser.setUserid(userId);
|
||||
loginUser.setIpaddr(IpUtils.getIpAddr());
|
||||
refreshToken(loginUser);
|
||||
|
||||
// Jwt存储信息
|
||||
Map<String, Object> claimsMap = new HashMap<String, Object>();
|
||||
claimsMap.put(SecurityConstants.USER_KEY, token);
|
||||
claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId);
|
||||
claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName);
|
||||
|
||||
// 接口返回信息
|
||||
Map<String, Object> rspMap = new HashMap<String, Object>();
|
||||
rspMap.put("access_token", JwtUtils.createToken(claimsMap));
|
||||
rspMap.put("expires_in", 43200);
|
||||
rspMap.put("userId", userId);
|
||||
return rspMap;
|
||||
}
|
||||
/**
|
||||
* 获取用户身份信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class AppLoginController {
|
|||
loginUser.setUsername(userName);
|
||||
loginUser.setIpaddr(IpUtils.getIpAddr());
|
||||
loginUser.setExpireTime(43200L);
|
||||
return R.ok(tokenService.createToken(loginUser));
|
||||
return R.ok(tokenService.createAPPToken(loginUser));
|
||||
}
|
||||
|
||||
private static AppRegister setAppRegister(RegisterForm registerForm) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ import com.alipay.api.DefaultAlipayClient;
|
|||
import com.alipay.api.request.AlipayTradeCreateRequest;
|
||||
import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||
import com.alipay.api.response.AlipayTradeCreateResponse;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AlipayService {
|
||||
|
||||
// 支付宝网关
|
||||
|
|
|
|||
Loading…
Reference in New Issue