aa
This commit is contained in:
@@ -101,7 +101,6 @@ func (h *Hub) GetToken(tokenType, oldToken string, waitTime time.Duration) (toke
|
||||
case EventTypeWXToken:
|
||||
token = api.WeixinAPI.CBGetToken()
|
||||
case EventTypeYLYToken:
|
||||
token = api.YilianyunAPI.GetToken()
|
||||
case EventTypeWeimobToken:
|
||||
if weimobToken := api.WeimobAPI.GetToken(); weimobToken != nil {
|
||||
token = string(utils.MustMarshal(weimobToken))
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/weimobapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/yilianyunapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
|
||||
@@ -255,33 +254,6 @@ func SaveWeimobToken(token *weimobapi.TokenInfo) (err error) {
|
||||
return dao.CreateOrUpdate(db, config)
|
||||
}
|
||||
|
||||
func RefreshYilianyunToken() (err error) {
|
||||
return RefreshConfig("yilianyun", yilianyunTokenExpires, func() (token string, expireTimeStr string) {
|
||||
globals.SugarLogger.Debugf("RefreshYilianyunToken RunMode:%s", beego.BConfig.RunMode)
|
||||
if globals.IsMainProductEnv() { // 只有京西菜市刷新易联云key
|
||||
if tokenInfo, err := api.YilianyunAPI.RetrieveToken(); err == nil {
|
||||
token = string(utils.MustMarshal(tokenInfo))
|
||||
} else {
|
||||
globals.SugarLogger.Errorf("RefreshYilianyunToken RefreshToken failed with error:%v", err)
|
||||
}
|
||||
} else {
|
||||
if tokenInfo := getYLYTokenFromRemote(api.YilianyunAPI.GetToken()); tokenInfo != nil {
|
||||
expireTimeStr = utils.Time2Str(time.Now().Add(-yilianyunTokenExpires))
|
||||
token = tokenInfo.Token
|
||||
}
|
||||
}
|
||||
return token, expireTimeStr
|
||||
}, func(value string) {
|
||||
token := value
|
||||
var tokenInfo *yilianyunapi.TokenInfo
|
||||
if err := utils.TryUnmarshalUseNumber([]byte(value), &tokenInfo); err == nil {
|
||||
token = tokenInfo.AccessToken
|
||||
}
|
||||
syseventhub.SysEventHub.OnNewYLYToken(token)
|
||||
api.YilianyunAPI.SetToken(token)
|
||||
})
|
||||
}
|
||||
|
||||
func PollingRemotEvent(remoteURL string, waitSecond int, params map[string]interface{}) (tokenInfo *syseventhub.TokenInfo) {
|
||||
if waitSecond == 0 {
|
||||
waitSecond = 5 * 60
|
||||
|
||||
Reference in New Issue
Block a user