- 平台多账号相关
This commit is contained in:
@@ -22,19 +22,25 @@ import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/zhongwuapi"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/cache"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/cache/redis"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/qiniu/api.v7/auth/qbox"
|
||||
)
|
||||
|
||||
type APIManager struct {
|
||||
}
|
||||
|
||||
var (
|
||||
curAPIManager *APIManager
|
||||
|
||||
JdAPI *jdapi.API
|
||||
JdPageAPI *jdapi.API
|
||||
ElmAPI *elmapi.API
|
||||
EbaiAPI *ebaiapi.API
|
||||
MtwmAPI *mtwmapi.API
|
||||
MtpsAPI *mtpsapi.API
|
||||
DadaAPI *dadaapi.API
|
||||
MtwmAPI *mtwmapi.API
|
||||
WeixinAPI *weixinapi.API // 微信公众号
|
||||
WeixinMiniAPI *weixinapi.API // 小程序
|
||||
WeixinMiniAPI2 *weixinapi.API // 小程序2
|
||||
@@ -59,12 +65,22 @@ var (
|
||||
Cacher cache.ICacher
|
||||
)
|
||||
|
||||
func (a *APIManager) GetAPI(vendorID int, name string) (pfAPI interface{}) {
|
||||
if vendorID == model.VendorIDJD {
|
||||
pfAPI = JdAPI
|
||||
}
|
||||
return pfAPI
|
||||
}
|
||||
|
||||
func init() {
|
||||
Init() // 这里必须要调用
|
||||
}
|
||||
|
||||
// 这样写的原因是在测试时,可以重新读取配置文件
|
||||
func Init() {
|
||||
curAPIManager = &APIManager{}
|
||||
// partner.InitAPIManager(curAPIManager)
|
||||
|
||||
if !beego.AppConfig.DefaultBool("disableJd", false) {
|
||||
JdAPI = jdapi.New(beego.AppConfig.String("jdToken"), beego.AppConfig.String("jdAppKey"), beego.AppConfig.String("jdSecret"))
|
||||
cookieValue := beego.AppConfig.DefaultString("jdStorePageCookie", "")
|
||||
|
||||
Reference in New Issue
Block a user