This commit is contained in:
suyl
2021-04-25 17:47:53 +08:00
parent 6e3b989a13
commit 7ebac81dba
2 changed files with 0 additions and 29 deletions

View File

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

View File

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