This commit is contained in:
suyl
2021-08-13 14:49:00 +08:00
parent 49b9213c52
commit c0d0669e21
3 changed files with 59 additions and 2 deletions

View File

@@ -226,14 +226,18 @@ func (p *PurchaseHandler) getUploadImgPoiCode() (poiCode string) {
return poiCode
}
func GetAPI(appOrgCode string, vendorStoreID string) (apiObj *mtwmapi.API) {
func GetAPI(appOrgCode string, storeID int, vendorStoreID string) (apiObj *mtwmapi.API) {
if appOrgCode == "" {
globals.SugarLogger.Debugf("getAPI appOrgCode is empty")
}
apiObj = partner.CurAPIManager.GetAPI(model.VendorIDMTWM, appOrgCode).(*mtwmapi.API)
if appOrgCode == globals.Mtwm2Code {
var storeDetail *dao.StoreDetail
storeDetail, _ = dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreID, model.VendorIDMTWM, appOrgCode)
if storeID != 0 {
storeDetail, _ = dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDMTWM, appOrgCode)
} else if vendorStoreID != "" {
storeDetail, _ = dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreID, model.VendorIDMTWM, appOrgCode)
}
if storeDetail != nil {
apiObj.SetToken(storeDetail.MtwmToken)
}