diff --git a/api/controllers/wxapp/app/City.php b/api/controllers/wxapp/app/City.php index 363a8b03..12682e20 100644 --- a/api/controllers/wxapp/app/City.php +++ b/api/controllers/wxapp/app/City.php @@ -11,6 +11,8 @@ require_once APPPATH . 'controllers/wxapp/Wxapp.php'; class City extends Wxapp { + private $province_lists = [430000, 350000]; //开放省份 湖南 福建 + function __construct($inputs, $app_key) { parent::__construct($inputs, $app_key); @@ -77,7 +79,7 @@ class City extends Wxapp if ($this->session['province_id']) { $province_lists[] = $this->session['province_id']; } else { - $province_lists = [430000, 350000]; //开发城省份 湖南 福建 + $province_lists = $this->province_lists; //开发城省份 湖南 福建 } $lists = []; foreach ($province_lists as $item) { @@ -112,8 +114,7 @@ class City extends Wxapp $lists = []; switch ($type) { case 'city': - !$pid && $pid = 350000;//默认福建 - if ($this->biz_id) { + if(!$pid && $this->biz_id){ $biz = $this->biz_model->get(['id' => $this->biz_id]); $biz['province_id'] && $pid = $biz['province_id']; } @@ -136,7 +137,9 @@ class City extends Wxapp } break; default: - $res = $this->mdArea->select(null, null, null, null, 'distinct(province_id), province_name'); + $province_ids = implode(',', $this->province_lists); + $where = ["province_id in ($province_ids)" => null]; + $res = $this->mdArea->select($where, null, null, null, 'distinct(province_id), province_name'); foreach ($res as $v) { $lists[] = ['id' => $v['province_id'], 'name' => $v['province_name']]; } diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index 72f83228..1228f11b 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -152,9 +152,11 @@ class Customers extends Wxapp $re_biz = $this->get_biz(); $city_id = intval($re_biz['city_id']); $county_id = intval($re_biz['county_id']); + $province_id = intval($re_biz['province_id']); $c_brand = intval($re_biz['car_brand_id']); if ($id) { $re_cus = $this->customers_model->get(['id' => $id]); + $re_cus['province_id'] && $province_id = $re_cus['province_id']; $re_cus['city_id'] && $city_id = $re_cus['city_id']; $re_cus['county_id'] && $county_id = $re_cus['county_id']; $re_cus['c_brand'] && $c_brand = $re_cus['c_brand']; @@ -183,7 +185,7 @@ class Customers extends Wxapp } $tag_type == 1 && count($tag_checked) == 1 && $tag_id = $tag_checked_id; } - $res = ['tags' => $tags, 'city_id' => $city_id, 'county_id' => $county_id, 'c_brand' => $c_brand]; + $res = ['tags' => $tags, 'province_id' => $province_id, 'city_id' => $city_id, 'county_id' => $county_id, 'c_brand' => $c_brand]; $tag_type == 1 && $res['tag_id'] = $tag_id; return $res; } @@ -203,6 +205,7 @@ class Customers extends Wxapp } $buy_time = $this->input_param('buy_time'); //预计购车时间 $tag = $this->input_param('tag'); //客户标签 + $province_id = $this->input_param('province_id'); //省份id $city_id = $this->input_param('city_id'); //城市id $county_id = $this->input_param('county_id'); //区id $wxgr = $this->input_param('wxgr'); //是否加个微 @@ -230,6 +233,7 @@ class Customers extends Wxapp isset($c_brand) && $update['c_brand'] = $c_brand; $of_id && $update['of_id'] = $of_id; $of2_id && $update['of2_id'] = $of2_id; + $province_id && $update['province_id'] = $province_id; $city_id && $update['city_id'] = $city_id; $county_id && $update['county_id'] = $county_id; $wxgr && $update['wxgr'] = intval($wxgr) ? 1 : 0; @@ -296,6 +300,7 @@ class Customers extends Wxapp $of_id = $cf_row['pid']; $status = 0; //状态 $tag = $this->input_param('tag'); //客户标签 + $province_id = $this->input_param('province_id');//省份id $city_id = $this->input_param('city_id'); //城市id $county_id = $this->input_param('county_id'); //区id $wxgr = $this->input_param('wxgr'); //是否加个微 @@ -336,7 +341,7 @@ class Customers extends Wxapp 'cf_title' => '自有资源', 'cont_time' => $time, 'status' => $status, - 'province_id' => $biz_row['province_id'], + 'province_id' => $province_id, 'city_id' => $city_id, 'county_id' => $county_id, 'wxgr' => intval($wxgr) ? 1 : 0,