From fb7ad6b750da82af0643a1c1f025248e5dbc36c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 5 Feb 2021 16:33:46 +0800 Subject: [PATCH] a --- business/model/dao/store.go | 5 +- business/model/store.go | 3 +- business/partner/purchase/ebai/store.go | 61 ++++++++++++++----------- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/business/model/dao/store.go b/business/model/dao/store.go index c0e595e4b..0a97fa52c 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -58,7 +58,8 @@ type StoreDetail struct { YbAppKey string `json:"ybAppKey"` YbStorePrefix string `json:"ybStorePrefix"` - MtwmToken string `json:"mtwmToken"` + MtwmToken string `json:"mtwmToken"` + EbaiSupplierID string `json:"ebaiSupplierID"` } // 带快递门店信息的 @@ -103,7 +104,7 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID, vendorOrgCo SELECT t1.*, t2.vendor_store_id, t2.status vendor_status, t2.delivery_fee_deduction_sill, t2.delivery_fee_deduction_fee, t2.sync_status, t2.vendor_org_code, t2.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name, t2.is_order, t2.yb_app_id, t2.yb_app_key, t2.yb_store_prefix, - t2.jds_street_code, t2.jds_street_name, t2.is_supply_goods, t2.vendor_pay_percentage, t2.mtwm_token, + t2.jds_street_code, t2.jds_street_name, t2.is_supply_goods, t2.vendor_pay_percentage, t2.mtwm_token, t2.ebai_supplier_id, t3.value price_percentage_pack_str, t4.value freight_deduction_pack_str, province.name province_name, diff --git a/business/model/store.go b/business/model/store.go index 4960a26a7..0d99d4b90 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -454,7 +454,8 @@ type StoreMap struct { YbAppKey string `orm:"size(255)" json:"ybAppKey"` YbStorePrefix string `orm:"size(255)" json:"ybStorePrefix"` - MtwmToken string `orm:"size(255)" json:"mtwmToken"` //美团外卖商超token,有效期30天,每20天刷一次 + MtwmToken string `orm:"size(255)" json:"mtwmToken"` //美团外卖商超token,有效期30天,每20天刷一次 + EbaiSupplierID string `orm:"column(ebai_supplier_id)" json:"ebaiSupplierID"` //饿百供应商ID } func (*StoreMap) TableUnique() [][]string { diff --git a/business/partner/purchase/ebai/store.go b/business/partner/purchase/ebai/store.go index 0077624fd..f6a526359 100644 --- a/business/partner/purchase/ebai/store.go +++ b/business/partner/purchase/ebai/store.go @@ -705,10 +705,12 @@ func (c *PurchaseHandler) SyncQualify(ctx *jxcontext.Context, storeDetail *dao.S return fmt.Errorf("个人信息不全, [%v]", storeDetail.ID) } if storeDetail.StoreFrontPic == "" || storeDetail.StoreInPic == "" { - return fmt.Errorf("门面门店照必须不全!, [%v]", storeDetail.ID) + return fmt.Errorf("门面门店照不全!, [%v]", storeDetail.ID) } - if storeDetail.Licence2Code == "" || storeDetail.Licence2Image == "" { - return fmt.Errorf("食品经营许可证不全, [%v]", storeDetail.ID) + if storeDetail.EbaiSupplierID == EbaiSupplierIDsc { + if storeDetail.Licence2Code == "" || storeDetail.Licence2Image == "" { + return fmt.Errorf("食品经营许可证不全, [%v]", storeDetail.ID) + } } //营业执照 @@ -739,31 +741,33 @@ func (c *PurchaseHandler) SyncQualify(ctx *jxcontext.Context, storeDetail *dao.S } } - //食品经营许可证 licence2Map := make(map[string]interface{}) - licence2Map["type_1"] = 2 - licence2Map["type_2"] = 202 - licence2Map["license_number"] = storeDetail.Licence2Code - licence2Map["license_address"] = storeDetail.LicenceAddress - licence2Map["legal_representative_name"] = storeDetail.LicenceOwnerName - licence2Map["license_name"] = storeDetail.LicenceCorpName - licence2Map["photos"] = []map[string]interface{}{ - map[string]interface{}{ - "photo_url": storeDetail.Licence2Image, - "waterprinter_url": storeDetail.Licence2Image, - }, - } - if storeDetail.Licence2Expire == "" { - licence2Map["long_term_valid"] = 1 - } else { - if storeDetail.Licence2Valid != "" { - if utils.Str2Time(storeDetail.Licence2Expire).Sub(utils.Str2Time(storeDetail.Licence2Valid)) > 0 { - licence2Map["license_validdate"] = storeDetail.Licence2Expire - } else { - licence2Map["license_validdate"] = storeDetail.Licence2Valid - } + if storeDetail.EbaiSupplierID == EbaiSupplierIDsc { + //食品经营许可证 + licence2Map["type_1"] = 2 + licence2Map["type_2"] = 202 + licence2Map["license_number"] = storeDetail.Licence2Code + licence2Map["license_address"] = storeDetail.LicenceAddress + licence2Map["legal_representative_name"] = storeDetail.LicenceOwnerName + licence2Map["license_name"] = storeDetail.LicenceCorpName + licence2Map["photos"] = []map[string]interface{}{ + map[string]interface{}{ + "photo_url": storeDetail.Licence2Image, + "waterprinter_url": storeDetail.Licence2Image, + }, + } + if storeDetail.Licence2Expire == "" { + licence2Map["long_term_valid"] = 1 } else { - licence2Map["license_validdate"] = storeDetail.Licence2Expire + if storeDetail.Licence2Valid != "" { + if utils.Str2Time(storeDetail.Licence2Expire).Sub(utils.Str2Time(storeDetail.Licence2Valid)) > 0 { + licence2Map["license_validdate"] = storeDetail.Licence2Expire + } else { + licence2Map["license_validdate"] = storeDetail.Licence2Valid + } + } else { + licence2Map["license_validdate"] = storeDetail.Licence2Expire + } } } @@ -800,7 +804,7 @@ func (c *PurchaseHandler) SyncQualify(ctx *jxcontext.Context, storeDetail *dao.S params := make(map[string]interface{}) maps := []map[string]interface{}{ - licenceMap, licence2Map, idMap, map[string]interface{}{ + licenceMap, idMap, map[string]interface{}{ "type_1": 5, "type_2": 501, "photos": []map[string]interface{}{ @@ -820,6 +824,9 @@ func (c *PurchaseHandler) SyncQualify(ctx *jxcontext.Context, storeDetail *dao.S }, }, } + if storeDetail.EbaiSupplierID == EbaiSupplierIDsc { + maps = append(maps, licence2Map) + } params["aptitude"] = maps err = api.EbaiAPI.ShopAptitudeUpload("", utils.Str2Int64(storeDetail.VendorStoreID), params) return err