[REV]Update sql

This commit is contained in:
崔斌 2017-12-03 22:35:01 +08:00
parent b563245ed1
commit 22f5f0f887
3 changed files with 5 additions and 4 deletions

View File

@ -113,7 +113,7 @@ func (c *CloudAction) CertDispatcher(gt *api_model.GetUserToken) ([]byte, []byte
if err != nil {
return nil, nil, err
}
keyFile = keyFile.(rsa.PrivateKey)
//keyFile = keyFile.(rsa.PrivateKey)
validHourTime := (gt.Body.ValidityPeriod - gt.Body.BeforeTime)
cer := &x509.Certificate{

View File

@ -83,8 +83,9 @@ func CreateDefaultTokenMap(conf option.Config) {
APIRange: "all",
ValidityPeriod: 3257894000,
}
defaultTokenMap := make(map[string]*dbmodel.RegionUserInfo)
defaultTokenMap[consoleToken] = rui
tokenMap := make(map[string]*dbmodel.RegionUserInfo)
tokenMap[consoleToken] = rui
defaultTokenMap = tokenMap
return
}

View File

@ -70,7 +70,7 @@ func (t *RegionUserInfoDaoImpl) GetTokenByEid(eid string) (*model.RegionUserInfo
func (t *RegionUserInfoDaoImpl) GetALLTokenInValidityPeriod() ([]*model.RegionUserInfo, error) {
var ruis []*model.RegionUserInfo
timestamp := int(time.Now().Unix())
if err := t.DB.Select("api_range", "validity_period", "token").Where("validity_period > ?", timestamp).Find(&ruis).Error; err != nil {
if err := t.DB.Select("api_range, validity_period, token").Where("validity_period > ?", timestamp).Find(&ruis).Error; err != nil {
return nil, err
}
return ruis, nil