|
@ -6,6 +6,7 @@ import com.yihu.wlyy.repository.gateway.GcTokenDao;
|
|
|
import com.yihu.wlyy.repository.gateway.GcTokenLogDao;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@ -21,6 +22,8 @@ public class GcTokenService {
|
|
|
private GcTokenLogDao tokenLogDao;
|
|
|
@Autowired
|
|
|
private GcTokenDao tokenDao;
|
|
|
@Value("${accesstoken.time}")
|
|
|
private Integer tokenTime;
|
|
|
|
|
|
/**
|
|
|
* 根据appid生成token
|
|
@ -44,7 +47,10 @@ public class GcTokenService {
|
|
|
gc.setAppid(appid);
|
|
|
gc.setCreateTime(date);
|
|
|
//2小时过期
|
|
|
gc.setOutTime(DateUtil.getNextMin(date, 120));
|
|
|
if(tokenTime==null){
|
|
|
tokenTime=2;
|
|
|
}
|
|
|
gc.setOutTime(DateUtil.getNextMin(date, tokenTime*60));
|
|
|
gc.setAccesstoken(token);
|
|
|
gc.setDel(1);
|
|
|
tokenDao.save(gc);
|