Browse Source

更新修改

chenweida 7 years ago
parent
commit
9b9c45d4df

+ 7 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GcTokenService.java

@ -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);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcTokenController.java

@ -61,7 +61,7 @@ public class GcTokenController {
            return resultOneModel;
        }
        //判断appSecret
        if (appSecret.equals(clientDetails.getAppSecret())) {
        if (!appSecret.equals(clientDetails.getAppSecret())) {
            ResultOneModel resultOneModel = new ResultOneModel(null);
            resultOneModel.setCode(BaseResultModel.codeEm.error_AppSecret.getCode());
            resultOneModel.setMessage(BaseResultModel.codeEm.error_AppSecret.getMessage());

+ 4 - 0
patient-co/patient-co-wlyy/src/main/resources/application.yml

@ -79,6 +79,10 @@ security:
    username: jkzl
    password: jkzlehr
accesstoken:
  time: 2 ##对外接的accesstoken什么周期 2小时
---
##测试的配置
spring: