添加平台门店免运配置,当前只有京东实现了

This commit is contained in:
gazebo
2019-10-14 14:41:40 +08:00
parent dd7eea1a02
commit 11526da5db
6 changed files with 146 additions and 20 deletions

View File

@@ -829,6 +829,7 @@ func GetStoreVendorMaps(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, vend
return storeMaps, dao.GetEntitiesByKV(db, &storeMaps, cond, false)
}
// todo 需要对字段做有效性检查
func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, storeMap *model.StoreMap) (outStoreMap *model.StoreMap, err error) {
if storeID == 0 {
return nil, fmt.Errorf("storeID不能为0")
@@ -923,14 +924,26 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
if valid["status"] != nil {
syncStatus |= model.SyncFlagStoreStatus
}
if valid["pricePercentagePack"] != nil {
if pricePercentagePack := utils.Interface2String(valid["pricePercentagePack"]); pricePercentagePack != "" {
_, err2 := dao.QueryConfigs(db, pricePercentagePack, model.ConfigTypePricePack, "")
if err = err2; err != nil {
return 0, err
for _, v := range [][]string{
[]string{
"pricePercentagePack",
model.ConfigTypePricePack,
},
[]string{
"freightDeductionPack",
model.ConfigTypeFreightPack,
},
} {
if valid[v[0]] != nil {
if value := utils.Interface2String(valid[v[0]]); value != "" {
_, err2 := dao.QueryConfigs(db, value, v[1], "")
if err = err2; err != nil {
return 0, err
}
}
}
}
if vendorStoreID := utils.Interface2String(valid["vendorStoreID"]); vendorStoreID != "" {
vendorStoreInfo, err2 := storeHandler.ReadStore(ctx, vendorStoreID)
if err = err2; err == nil {