将菜市蜂鸟信息通知到果园去

This commit is contained in:
邹宗楠
2024-01-19 15:36:42 +08:00
parent b7100abe64
commit e523a00c91
5 changed files with 89 additions and 30 deletions

View File

@@ -2,6 +2,7 @@ package tasks
import (
"fmt"
"git.rosy.net.cn/baseapi/platformapi/fnpsapi"
"io/ioutil"
"net/http"
"time"
@@ -20,7 +21,6 @@ import (
"git.rosy.net.cn/jx-callback/globals"
"github.com/astaxie/beego/client/orm"
beego "github.com/astaxie/beego/server/web"
)
const (
@@ -159,14 +159,11 @@ func RefreshFnToken() (err error) {
dao.ExecuteSQL(dao.GetDB(), sql, []interface{}{
token, refreshToken, "fn",
})
//}
if beego.BConfig.RunMode == "jxgy" {
config := &legacymodel.Config{}
sql := `SELECT * FROM config WHERE thirdparty = 'fn'`
if err := dao.GetRow(dao.GetDB(), &config, sql, nil); err == nil {
token = config.Token
}
if _, err = fnpsapi.HttpToGuoYuanFN(map[string]interface{}{"token": curConfig.Token, "refresh_token": curConfig.RefreshToken}, fnpsapi.FengNiaoCallbackTypeToken); err != nil {
globals.SugarLogger.Debugf("菜市token通知到果园错误:%v", err)
}
return token, expireTimeStr, refreshToken
}, func(value, v2 string) {
api.FnAPI.SetToken(value)