This commit is contained in:
苏尹岚
2021-02-05 16:33:46 +08:00
parent a388b89225
commit fb7ad6b750
3 changed files with 39 additions and 30 deletions

View File

@@ -58,7 +58,8 @@ type StoreDetail struct {
YbAppKey string `json:"ybAppKey"` YbAppKey string `json:"ybAppKey"`
YbStorePrefix string `json:"ybStorePrefix"` 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.*, 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.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.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, t3.value price_percentage_pack_str,
t4.value freight_deduction_pack_str, t4.value freight_deduction_pack_str,
province.name province_name, province.name province_name,

View File

@@ -454,7 +454,8 @@ type StoreMap struct {
YbAppKey string `orm:"size(255)" json:"ybAppKey"` YbAppKey string `orm:"size(255)" json:"ybAppKey"`
YbStorePrefix string `orm:"size(255)" json:"ybStorePrefix"` 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 { func (*StoreMap) TableUnique() [][]string {

View File

@@ -705,10 +705,12 @@ func (c *PurchaseHandler) SyncQualify(ctx *jxcontext.Context, storeDetail *dao.S
return fmt.Errorf("个人信息不全, [%v]", storeDetail.ID) return fmt.Errorf("个人信息不全, [%v]", storeDetail.ID)
} }
if storeDetail.StoreFrontPic == "" || storeDetail.StoreInPic == "" { if storeDetail.StoreFrontPic == "" || storeDetail.StoreInPic == "" {
return fmt.Errorf("门面门店照必须不全!, [%v]", storeDetail.ID) return fmt.Errorf("门面门店照不全!, [%v]", storeDetail.ID)
} }
if storeDetail.Licence2Code == "" || storeDetail.Licence2Image == "" { if storeDetail.EbaiSupplierID == EbaiSupplierIDsc {
return fmt.Errorf("食品经营许可证不全, [%v]", storeDetail.ID) 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 := make(map[string]interface{})
licence2Map["type_1"] = 2 if storeDetail.EbaiSupplierID == EbaiSupplierIDsc {
licence2Map["type_2"] = 202 //食品经营许可证
licence2Map["license_number"] = storeDetail.Licence2Code licence2Map["type_1"] = 2
licence2Map["license_address"] = storeDetail.LicenceAddress licence2Map["type_2"] = 202
licence2Map["legal_representative_name"] = storeDetail.LicenceOwnerName licence2Map["license_number"] = storeDetail.Licence2Code
licence2Map["license_name"] = storeDetail.LicenceCorpName licence2Map["license_address"] = storeDetail.LicenceAddress
licence2Map["photos"] = []map[string]interface{}{ licence2Map["legal_representative_name"] = storeDetail.LicenceOwnerName
map[string]interface{}{ licence2Map["license_name"] = storeDetail.LicenceCorpName
"photo_url": storeDetail.Licence2Image, licence2Map["photos"] = []map[string]interface{}{
"waterprinter_url": storeDetail.Licence2Image, map[string]interface{}{
}, "photo_url": storeDetail.Licence2Image,
} "waterprinter_url": storeDetail.Licence2Image,
if storeDetail.Licence2Expire == "" { },
licence2Map["long_term_valid"] = 1 }
} else { if storeDetail.Licence2Expire == "" {
if storeDetail.Licence2Valid != "" { licence2Map["long_term_valid"] = 1
if utils.Str2Time(storeDetail.Licence2Expire).Sub(utils.Str2Time(storeDetail.Licence2Valid)) > 0 {
licence2Map["license_validdate"] = storeDetail.Licence2Expire
} else {
licence2Map["license_validdate"] = storeDetail.Licence2Valid
}
} else { } 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{}) params := make(map[string]interface{})
maps := []map[string]interface{}{ maps := []map[string]interface{}{
licenceMap, licence2Map, idMap, map[string]interface{}{ licenceMap, idMap, map[string]interface{}{
"type_1": 5, "type_1": 5,
"type_2": 501, "type_2": 501,
"photos": []map[string]interface{}{ "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 params["aptitude"] = maps
err = api.EbaiAPI.ShopAptitudeUpload("", utils.Str2Int64(storeDetail.VendorStoreID), params) err = api.EbaiAPI.ShopAptitudeUpload("", utils.Str2Int64(storeDetail.VendorStoreID), params)
return err return err