添加平台门店免运配置,当前只有京东实现了
This commit is contained in:
@@ -24,6 +24,9 @@ const (
|
||||
|
||||
type tJdStoreInfo struct {
|
||||
model.Store
|
||||
|
||||
FreightDeductionPack string `orm:"size(32)" json:"freightDeductionPack"` //
|
||||
|
||||
JdCityCode int
|
||||
JdDistrictCode int
|
||||
JdStoreStatus int
|
||||
@@ -105,8 +108,9 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string
|
||||
func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName string) (err error) {
|
||||
var stores []*tJdStoreInfo
|
||||
sql := `
|
||||
SELECT t1.*, city.jd_code jd_city_code, district.jd_code jd_district_code, t2.status jd_store_status, t2.vendor_store_id,
|
||||
IF(t1.updated_at > t2.updated_at, t1.last_operator, t2.last_operator) real_last_operator, t2.sync_status
|
||||
SELECT t1.*, city.jd_code jd_city_code, district.jd_code jd_district_code,
|
||||
t2.status jd_store_status, t2.vendor_store_id, IF(t1.updated_at > t2.updated_at, t1.last_operator, t2.last_operator) real_last_operator,
|
||||
t2.sync_status, t2.freight_deduction_pack
|
||||
FROM store t1
|
||||
JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ? AND (t2.deleted_at = ?)
|
||||
LEFT JOIN place city ON t1.city_code = city.code
|
||||
@@ -160,6 +164,33 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
return err
|
||||
}
|
||||
}
|
||||
if store.FreightDeductionPack != "" {
|
||||
storeDetail, err2 := dao.GetStoreDetail(db, store.ID, model.VendorIDJD)
|
||||
if err2 == nil {
|
||||
if storeDetail.FreightDeductionPackObj != nil {
|
||||
freightParams := &jdapi.UpdateStoreFreightParam{
|
||||
StationNo: store.VendorStoreID,
|
||||
UserPin: userName,
|
||||
OpenDistanceFreight: true,
|
||||
IsFullFree: len(storeDetail.FreightDeductionPackObj.FreightDeductionList) > 0,
|
||||
StartCharge: int64(storeDetail.FreightDeductionPackObj.StartPrice),
|
||||
}
|
||||
if freightParams.IsFullFree {
|
||||
for _, v := range storeDetail.FreightDeductionPackObj.FreightDeductionList {
|
||||
freightParams.FreeFreightInfoList = append(freightParams.FreeFreightInfoList, &jdapi.FreeFreightInfo{
|
||||
FullFreeMoney: int64(v.BeginPrice),
|
||||
FreeType: jdapi.FreightFreeTypePartBase,
|
||||
FreeMoney: int64(v.DeductFreight),
|
||||
})
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debug(utils.Format4Output(freightParams, false))
|
||||
if globals.EnableJdStoreWrite {
|
||||
err = getAPI("").UpdateStoreFreightConfigNew(freightParams)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user