37 lines
960 B
PHP
37 lines
960 B
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class Auto_product_city_model extends HD_Model
|
|
{
|
|
private $table_name = 'lc_auto_product_city';
|
|
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct($this->table_name, 'default');
|
|
}
|
|
|
|
/**
|
|
* @param $productId
|
|
* @param $citys
|
|
* @return true|void
|
|
*/
|
|
public function updateProductCity($productId, $citys = [])
|
|
{
|
|
if ($citys) {
|
|
$replace_batch = [];
|
|
foreach ($citys as $item) {
|
|
$replace_batch[] = [
|
|
'productId' => $productId,
|
|
'provinceId' => $item[0],
|
|
'cityId' => $item[1],
|
|
];
|
|
}
|
|
is_array($replace_batch) && $this->replace_batch($replace_batch);
|
|
} else {
|
|
$this->delete(['productId' => $productId]);
|
|
}
|
|
return true;
|
|
}
|
|
}
|