京东回调消息根据token动态选择不同的配置

This commit is contained in:
gazebo
2019-12-03 15:07:50 +08:00
parent ea3cd1b833
commit 84dac23be8
4 changed files with 78 additions and 29 deletions

View File

@@ -26,6 +26,22 @@ func getAPI(appOrgCode string) (apiObj *jdapi.API) {
return partner.CurAPIManager.GetAPI(model.VendorIDJD, appOrgCode).(*jdapi.API)
}
func GetAPIByToken(token string) (apiObj *jdapi.API) {
if token == "" {
apiObj = getAPI("")
} else {
apiList := partner.CurAPIManager.GetAPIList(model.VendorIDJD)
for _, v := range apiList {
jdAPI := v.(*jdapi.API)
if jdAPI.GetToken() == token {
apiObj = jdAPI
break
}
}
}
return apiObj
}
func (c *PurchaseHandler) GetVendorID() int {
return model.VendorIDJD
}