diff --git a/common/models/agent/Auto_product_city_model.php b/common/models/agent/Auto_product_city_model.php index e1951042..d4b70385 100644 --- a/common/models/agent/Auto_product_city_model.php +++ b/common/models/agent/Auto_product_city_model.php @@ -22,9 +22,15 @@ class Auto_product_city_model extends HD_Model $cityIds = []; foreach ($citys as $item) { $cityIds[] = $item[1]; + $replace_batch[] = [ + 'productId' => $productId, + 'provinceId' => $item[0], + 'cityId' => $item[1], + ]; } $cityIdString = implode(',', $cityIds); $cityIdString && $this->delete(['productId' => $productId, "cityId not in ($cityIdString)" => null]); + is_array($replace_batch) && $this->replace_batch($replace_batch); } else { $this->delete(['productId' => $productId]); }