diff --git a/agent/admin/controllers/BaseCommon.php b/agent/admin/controllers/BaseCommon.php new file mode 100644 index 00000000..4b01355d --- /dev/null +++ b/agent/admin/controllers/BaseCommon.php @@ -0,0 +1,203 @@ +load->model('area_model'); + } + + /** + * 省市区数据 + * @return void + */ + public function regionsData() + { + $req = $this->area_model->getDataByTree(); + echo json_encode($req, JSON_UNESCAPED_UNICODE); + } + + /** + * 获取品牌 + * @return void + */ + public function autoBrand() + { + $this->load->model('auto/auto_brand_model', 'mdAutoBrand'); + $this->mdAutoBrand->set_db('ssdb'); + $where = [ + 'status>' => -1, + ]; + $lists = $this->mdAutoBrand->select($where, 'initial asc', 0, 0, 'id,name'); + echo json_encode($lists, JSON_UNESCAPED_UNICODE); + } + + /** + * 获取车系 + * @return void + */ + public function autoSeries() + { + $this->load->model('auto/auto_series_model', 'mdAutoSeries'); + $this->mdAutoSeries->set_db('ssdb'); + $brandId = intval($this->input->get('brandId')); + $where = [ + 'status>' => -1, + 'brand_id' => $brandId + ]; + $lists = $this->mdAutoSeries->select($where, 'id asc', 0, 0, 'id,name'); + echo json_encode($lists, JSON_UNESCAPED_UNICODE); + } + + /** + * 获取车型 + * @return void + */ + public function autoCar() + { + $this->load->model('auto/auto_cars_model', 'mdAutoCar'); + $this->mdAutoCar->set_db('ssdb'); + $seriesId = intval($this->input->get('seriesId')); + $where = [ + 'status>' => -1, + 'series_id' => $seriesId + ]; + $lists = $this->mdAutoCar->select($where, 'id asc', 0, 0, 'id,name'); + echo json_encode($lists, JSON_UNESCAPED_UNICODE); + } + + /** + * 获取所有门店 + * @return void + */ + public function allBiz() + { + $this->load->model('biz/biz_model'); + $this->load->model('biz/biz_car_brand_model'); + $this->load->model('agent/auto_product_model'); + $this->biz_model->set_db('ssdb'); + $this->biz_car_brand_model->set_db('ssdb'); + $productId = intval($this->input->get('productId')); + $types = Biz_model::BIZ_TYPE_4s . ',' . Biz_model::BIZ_TYPE_SPACE; + $where = [ + 'status' => 1, + ]; + if ($productId) { + $product = $this->auto_product_model->get(['id' => $productId]); + $brandId = $product['brandId'] ?: 0; + $brandBizList = $this->biz_car_brand_model->select(['brand_id' => $brandId], '', '', '', 'biz_id'); + $bizIdArray = array_column($brandBizList, 'biz_id'); + $bizIdString = $bizIdArray ? implode(',', $bizIdArray) : 0; + $where["(id in ({$bizIdString}) and type=" . Biz_model::BIZ_TYPE_4s . " or type=" . Biz_model::BIZ_TYPE_SPACE . ")"] = null; + } else { + $where["type in ({$types})"] = null; + } + $lists = $this->biz_model->select($where, 'id desc', 0, 0, 'id,biz_name as name,city_id'); + echo json_encode($lists, JSON_UNESCAPED_UNICODE); + } + + public function autoBrands() + { + $this->load->model('auto/auto_brand_model', 'mdAutoBrand'); + $this->load->model('auto/auto_series_model', 'mdAutoSeries'); + $this->load->model('auto/auto_cars_model', 'mdAutoCar'); + $this->mdAutoBrand->set_db('ssdb'); + $this->mdAutoSeries->set_db('ssdb'); + $this->mdAutoCar->set_db('ssdb'); + $redis = load_cache("redis"); + $cKey = 'SYS_BRAND_TREE_DATA'; + $cacheList = $redis->get($cKey); + if ($cacheList) { + die(json_encode($cacheList, JSON_UNESCAPED_UNICODE)); + } + $where = ['status' => 1]; + $brandRows = $this->mdAutoBrand->select($where, 'initial asc', 0, 0); + $seriesRows = $this->mdAutoSeries->map('brand_id', '', $where, 'id desc', 0, 0); + $carRows = $this->mdAutoCar->map('series_id', '', $where, 'id desc', 0, 0, 'id as value,name as label,series_id'); + $lists = []; + foreach ($brandRows as $brandRow) { + $children = []; + $brand = [ + 'value' => $brandRow['id'], + 'label' => $brandRow['name'], + ]; + if ($seriesRows[$brandRow['id']]) { + foreach ($seriesRows[$brandRow['id']] as $seriesRow) { + $seriesChildren = $carRows[$seriesRow['id']] ?: []; + $children[] = [ + 'value' => $seriesRow['id'], + 'label' => $seriesRow['name'], + 'children' => $seriesChildren + ]; + } + } + $brand['children'] = $children; + $lists[] = $brand; + } + $redis->save($cKey, $lists, 24 * 60 * 60); + echo json_encode($lists, JSON_UNESCAPED_UNICODE); + } + + /** + * 获取所有门店 + * @return void + */ + public function allProvinceBiz() + { + $this->load->model('area_model'); + $this->load->model('biz/biz_model'); + $this->load->model('agent/auto_product_model'); + $this->biz_model->set_db('ssdb'); + $this->area_model->set_db('ssdb'); + $type = Biz_model::BIZ_TYPE_4s; + $where = [ + 'status' => 1, + 'type' => $type + ]; + $lists = $this->biz_model->map('city_id', '', $where, 'id desc', 0, 0, 'id as value,biz_name as label,city_id'); + $provinceTree = $this->area_model->getDataByTree(); + $resList = []; + foreach ($provinceTree as $item) { + $children = $item['children']; + $newChildren = []; + foreach ($children as $key => $item2) { + if ($lists[$item2['value']]) { + $item2['children'] = $lists[$item2['value']]; + $newChildren[] = $item2; + } else { + $children[$key]['children'] = []; + } + } + if ($newChildren) { + $resList[] = [ + 'value' => $item['value'], + 'label' => $item['label'], + 'children' => $newChildren + ]; + } + } + echo json_encode($resList, JSON_UNESCAPED_UNICODE); + } + + /** + * 用户归属中心 + * @return void + */ + public function centerList() + { + $this->load->model('agent/pingan/pingan_users_model'); + $res = Pingan_users_model::TYPE_CENTER; + echo json_encode($res, JSON_UNESCAPED_UNICODE); + } + + public function orgNameList() + { + $this->load->model('agent/pingan/pingan_users_model'); + echo json_encode(Pingan_users_model::orgNameList, JSON_UNESCAPED_UNICODE); + } +} diff --git a/agent/admin/controllers/Common.php b/agent/admin/controllers/Common.php index deaf8c3f..75b569da 100644 --- a/agent/admin/controllers/Common.php +++ b/agent/admin/controllers/Common.php @@ -1,200 +1,12 @@ load->model('area_model'); - } - - /** - * 省市区数据 - * @return void - */ - public function regionsData() - { - $req = $this->area_model->getDataByTree(); - echo json_encode($req, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取品牌 - * @return void - */ - public function autoBrand() - { - $this->load->model('auto/auto_brand_model', 'mdAutoBrand'); - $this->mdAutoBrand->set_db('ssdb'); - $where = [ - 'status>' => -1, - ]; - $lists = $this->mdAutoBrand->select($where, 'initial asc', 0, 0, 'id,name'); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取车系 - * @return void - */ - public function autoSeries() - { - $this->load->model('auto/auto_series_model', 'mdAutoSeries'); - $this->mdAutoSeries->set_db('ssdb'); - $brandId = intval($this->input->get('brandId')); - $where = [ - 'status>' => -1, - 'brand_id' => $brandId - ]; - $lists = $this->mdAutoSeries->select($where, 'id asc', 0, 0, 'id,name'); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取车型 - * @return void - */ - public function autoCar() - { - $this->load->model('auto/auto_cars_model', 'mdAutoCar'); - $this->mdAutoCar->set_db('ssdb'); - $seriesId = intval($this->input->get('seriesId')); - $where = [ - 'status>' => -1, - 'series_id' => $seriesId - ]; - $lists = $this->mdAutoCar->select($where, 'id asc', 0, 0, 'id,name'); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取所有门店 - * @return void - */ - public function allBiz() - { - $this->load->model('biz/biz_model'); - $this->load->model('biz/biz_car_brand_model'); - $this->load->model('agent/auto_product_model'); - $this->biz_model->set_db('ssdb'); - $this->biz_car_brand_model->set_db('ssdb'); - $productId = intval($this->input->get('productId')); - $types = Biz_model::BIZ_TYPE_4s . ',' . Biz_model::BIZ_TYPE_SPACE; - $where = [ - 'status' => 1, - ]; - if ($productId) { - $product = $this->auto_product_model->get(['id' => $productId]); - $brandId = $product['brandId'] ?: 0; - $brandBizList = $this->biz_car_brand_model->select(['brand_id' => $brandId], '', '', '', 'biz_id'); - $bizIdArray = array_column($brandBizList, 'biz_id'); - $bizIdString = $bizIdArray ? implode(',', $bizIdArray) : 0; - $where["(id in ({$bizIdString}) and type=" . Biz_model::BIZ_TYPE_4s . " or type=" . Biz_model::BIZ_TYPE_SPACE . ")"] = null; - } else { - $where["type in ({$types})"] = null; - } - $lists = $this->biz_model->select($where, 'id desc', 0, 0, 'id,biz_name as name,city_id'); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - public function autoBrands() - { - $this->load->model('auto/auto_brand_model', 'mdAutoBrand'); - $this->load->model('auto/auto_series_model', 'mdAutoSeries'); - $this->load->model('auto/auto_cars_model', 'mdAutoCar'); - $this->mdAutoBrand->set_db('ssdb'); - $this->mdAutoSeries->set_db('ssdb'); - $this->mdAutoCar->set_db('ssdb'); - $redis = load_cache("redis"); - $cKey = 'SYS_BRAND_TREE_DATA'; - $cacheList = $redis->get($cKey); - if ($cacheList) { - die(json_encode($cacheList, JSON_UNESCAPED_UNICODE)); - } - $where = ['status' => 1]; - $brandRows = $this->mdAutoBrand->select($where, 'initial asc', 0, 0); - $seriesRows = $this->mdAutoSeries->map('brand_id', '', $where, 'id desc', 0, 0); - $carRows = $this->mdAutoCar->map('series_id', '', $where, 'id desc', 0, 0, 'id as value,name as label,series_id'); - $lists = []; - foreach ($brandRows as $brandRow) { - $children = []; - $brand = [ - 'value' => $brandRow['id'], - 'label' => $brandRow['name'], - ]; - if ($seriesRows[$brandRow['id']]) { - foreach ($seriesRows[$brandRow['id']] as $seriesRow) { - $seriesChildren = $carRows[$seriesRow['id']] ?: []; - $children[] = [ - 'value' => $seriesRow['id'], - 'label' => $seriesRow['name'], - 'children' => $seriesChildren - ]; - } - } - $brand['children'] = $children; - $lists[] = $brand; - } - $redis->save($cKey, $lists, 24 * 60 * 60); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取所有门店 - * @return void - */ - public function allProvinceBiz() - { - $this->load->model('area_model'); - $this->load->model('biz/biz_model'); - $this->load->model('agent/auto_product_model'); - $this->biz_model->set_db('ssdb'); - $this->area_model->set_db('ssdb'); - $type = Biz_model::BIZ_TYPE_4s; - $where = [ - 'status' => 1, - 'type' => $type - ]; - $lists = $this->biz_model->map('city_id', '', $where, 'id desc', 0, 0, 'id as value,biz_name as label,city_id'); - $provinceTree = $this->area_model->getDataByTree(); - $resList = []; - foreach ($provinceTree as $item) { - $children = $item['children']; - $newChildren = []; - foreach ($children as $key => $item2) { - if ($lists[$item2['value']]) { - $item2['children'] = $lists[$item2['value']]; - $newChildren[] = $item2; - } else { - $children[$key]['children'] = []; - } - } - if ($newChildren) { - $resList[] = [ - 'value' => $item['value'], - 'label' => $item['label'], - 'children' => $newChildren - ]; - } - } - echo json_encode($resList, JSON_UNESCAPED_UNICODE); - } - - /** - * 用户归属中心 - * @return void - */ - public function centerList() - { - $this->load->model('agent/pingan/pingan_users_model'); - $res = Pingan_users_model::TYPE_CENTER; - echo json_encode($res, JSON_UNESCAPED_UNICODE); - } - - public function orgNameList() - { - $this->load->model('agent/pingan/pingan_users_model'); - echo json_encode(Pingan_users_model::orgNameList, JSON_UNESCAPED_UNICODE); } } + diff --git a/agent/admin/controllers/api/Common.php b/agent/admin/controllers/api/Common.php index ed569ea3..53420b00 100644 --- a/agent/admin/controllers/api/Common.php +++ b/agent/admin/controllers/api/Common.php @@ -1,203 +1,12 @@ load->model('area_model'); } - /** - * 省市区数据 - * @return void - */ - public function regionsData() - { - $req = $this->area_model->getDataByTree(); - echo json_encode($req, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取品牌 - * @return void - */ - public function autoBrand() - { - $this->load->model('auto/auto_brand_model', 'mdAutoBrand'); - $this->mdAutoBrand->set_db('ssdb'); - $where = [ - 'status>' => -1, - ]; - $lists = $this->mdAutoBrand->select($where, 'initial asc', 0, 0, 'id,name'); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取车系 - * @return void - */ - public function autoSeries() - { - $this->load->model('auto/auto_series_model', 'mdAutoSeries'); - $this->mdAutoSeries->set_db('ssdb'); - $brandId = intval($this->input->get('brandId')); - $where = [ - 'status>' => -1, - 'brand_id' => $brandId - ]; - $lists = $this->mdAutoSeries->select($where, 'id asc', 0, 0, 'id,name'); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取车型 - * @return void - */ - public function autoCar() - { - $this->load->model('auto/auto_cars_model', 'mdAutoCar'); - $this->mdAutoCar->set_db('ssdb'); - $seriesId = intval($this->input->get('seriesId')); - $where = [ - 'status>' => -1, - 'series_id' => $seriesId - ]; - $lists = $this->mdAutoCar->select($where, 'id asc', 0, 0, 'id,name'); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取所有门店 - * @return void - */ - public function allBiz() - { - $this->load->model('biz/biz_model'); - $this->load->model('biz/biz_car_brand_model'); - $this->load->model('agent/auto_product_model'); - $this->biz_model->set_db('ssdb'); - $this->biz_car_brand_model->set_db('ssdb'); - $productId = intval($this->input->get('productId')); - $types = Biz_model::BIZ_TYPE_4s . ',' . Biz_model::BIZ_TYPE_SPACE; - $where = [ - 'status' => 1, - ]; - if ($productId) { - $product = $this->auto_product_model->get(['id' => $productId]); - $brandId = $product['brandId'] ?: 0; - $brandBizList = $this->biz_car_brand_model->select(['brand_id' => $brandId], '', '', '', 'biz_id'); - $bizIdArray = array_column($brandBizList, 'biz_id'); - $bizIdString = $bizIdArray ? implode(',', $bizIdArray) : 0; - $where["(id in ({$bizIdString}) and type=" . Biz_model::BIZ_TYPE_4s . " or type=" . Biz_model::BIZ_TYPE_SPACE . ")"] = null; - } else { - $where["type in ({$types})"] = null; - } - $lists = $this->biz_model->select($where, 'id desc', 0, 0, 'id,biz_name as name,city_id'); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - public function autoBrands() - { - $this->load->model('auto/auto_brand_model', 'mdAutoBrand'); - $this->load->model('auto/auto_series_model', 'mdAutoSeries'); - $this->load->model('auto/auto_cars_model', 'mdAutoCar'); - $this->mdAutoBrand->set_db('ssdb'); - $this->mdAutoSeries->set_db('ssdb'); - $this->mdAutoCar->set_db('ssdb'); - $redis = load_cache("redis"); - $cKey = 'SYS_BRAND_TREE_DATA'; - $cacheList = $redis->get($cKey); - if ($cacheList) { - die(json_encode($cacheList, JSON_UNESCAPED_UNICODE)); - } - $where = ['status' => 1]; - $brandRows = $this->mdAutoBrand->select($where, 'initial asc', 0, 0); - $seriesRows = $this->mdAutoSeries->map('brand_id', '', $where, 'id desc', 0, 0); - $carRows = $this->mdAutoCar->map('series_id', '', $where, 'id desc', 0, 0, 'id as value,name as label,series_id'); - $lists = []; - foreach ($brandRows as $brandRow) { - $children = []; - $brand = [ - 'value' => $brandRow['id'], - 'label' => $brandRow['name'], - ]; - if ($seriesRows[$brandRow['id']]) { - foreach ($seriesRows[$brandRow['id']] as $seriesRow) { - $seriesChildren = $carRows[$seriesRow['id']] ?: []; - $children[] = [ - 'value' => $seriesRow['id'], - 'label' => $seriesRow['name'], - 'children' => $seriesChildren - ]; - } - } - $brand['children'] = $children; - $lists[] = $brand; - } - $redis->save($cKey, $lists, 24 * 60 * 60); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取所有门店 - * @return void - */ - public function allProvinceBiz() - { - $this->load->model('area_model'); - $this->load->model('biz/biz_model'); - $this->load->model('agent/auto_product_model'); - $this->biz_model->set_db('ssdb'); - $this->area_model->set_db('ssdb'); - $type = Biz_model::BIZ_TYPE_4s; - $where = [ - 'status' => 1, - 'type' => $type - ]; - $lists = $this->biz_model->map('city_id', '', $where, 'id desc', 0, 0, 'id as value,biz_name as label,city_id'); - $provinceTree = $this->area_model->getDataByTree(); - $resList = []; - foreach ($provinceTree as $item) { - $children = $item['children']; - $newChildren = []; - foreach ($children as $key => $item2) { - if ($lists[$item2['value']]) { - $item2['children'] = $lists[$item2['value']]; - $newChildren[] = $item2; - } else { - $children[$key]['children'] = []; - } - } - if ($newChildren) { - $resList[] = [ - 'value' => $item['value'], - 'label' => $item['label'], - 'children' => $newChildren - ]; - } - } - echo json_encode($resList, JSON_UNESCAPED_UNICODE); - } - - /** - * 用户归属中心 - * @return void - */ - public function centerList() - { - $this->load->model('agent/pingan/pingan_users_model'); - $res = Pingan_users_model::TYPE_CENTER; - echo json_encode($res, JSON_UNESCAPED_UNICODE); - } - - public function orgNameList() - { - $this->load->model('agent/pingan/pingan_users_model'); - echo json_encode(Pingan_users_model::orgNameList, JSON_UNESCAPED_UNICODE); - } } diff --git a/agent/admin/controllers/pingan/Common.php b/agent/admin/controllers/pingan/Common.php index ed569ea3..53420b00 100644 --- a/agent/admin/controllers/pingan/Common.php +++ b/agent/admin/controllers/pingan/Common.php @@ -1,203 +1,12 @@ load->model('area_model'); } - /** - * 省市区数据 - * @return void - */ - public function regionsData() - { - $req = $this->area_model->getDataByTree(); - echo json_encode($req, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取品牌 - * @return void - */ - public function autoBrand() - { - $this->load->model('auto/auto_brand_model', 'mdAutoBrand'); - $this->mdAutoBrand->set_db('ssdb'); - $where = [ - 'status>' => -1, - ]; - $lists = $this->mdAutoBrand->select($where, 'initial asc', 0, 0, 'id,name'); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取车系 - * @return void - */ - public function autoSeries() - { - $this->load->model('auto/auto_series_model', 'mdAutoSeries'); - $this->mdAutoSeries->set_db('ssdb'); - $brandId = intval($this->input->get('brandId')); - $where = [ - 'status>' => -1, - 'brand_id' => $brandId - ]; - $lists = $this->mdAutoSeries->select($where, 'id asc', 0, 0, 'id,name'); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取车型 - * @return void - */ - public function autoCar() - { - $this->load->model('auto/auto_cars_model', 'mdAutoCar'); - $this->mdAutoCar->set_db('ssdb'); - $seriesId = intval($this->input->get('seriesId')); - $where = [ - 'status>' => -1, - 'series_id' => $seriesId - ]; - $lists = $this->mdAutoCar->select($where, 'id asc', 0, 0, 'id,name'); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取所有门店 - * @return void - */ - public function allBiz() - { - $this->load->model('biz/biz_model'); - $this->load->model('biz/biz_car_brand_model'); - $this->load->model('agent/auto_product_model'); - $this->biz_model->set_db('ssdb'); - $this->biz_car_brand_model->set_db('ssdb'); - $productId = intval($this->input->get('productId')); - $types = Biz_model::BIZ_TYPE_4s . ',' . Biz_model::BIZ_TYPE_SPACE; - $where = [ - 'status' => 1, - ]; - if ($productId) { - $product = $this->auto_product_model->get(['id' => $productId]); - $brandId = $product['brandId'] ?: 0; - $brandBizList = $this->biz_car_brand_model->select(['brand_id' => $brandId], '', '', '', 'biz_id'); - $bizIdArray = array_column($brandBizList, 'biz_id'); - $bizIdString = $bizIdArray ? implode(',', $bizIdArray) : 0; - $where["(id in ({$bizIdString}) and type=" . Biz_model::BIZ_TYPE_4s . " or type=" . Biz_model::BIZ_TYPE_SPACE . ")"] = null; - } else { - $where["type in ({$types})"] = null; - } - $lists = $this->biz_model->select($where, 'id desc', 0, 0, 'id,biz_name as name,city_id'); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - public function autoBrands() - { - $this->load->model('auto/auto_brand_model', 'mdAutoBrand'); - $this->load->model('auto/auto_series_model', 'mdAutoSeries'); - $this->load->model('auto/auto_cars_model', 'mdAutoCar'); - $this->mdAutoBrand->set_db('ssdb'); - $this->mdAutoSeries->set_db('ssdb'); - $this->mdAutoCar->set_db('ssdb'); - $redis = load_cache("redis"); - $cKey = 'SYS_BRAND_TREE_DATA'; - $cacheList = $redis->get($cKey); - if ($cacheList) { - die(json_encode($cacheList, JSON_UNESCAPED_UNICODE)); - } - $where = ['status' => 1]; - $brandRows = $this->mdAutoBrand->select($where, 'initial asc', 0, 0); - $seriesRows = $this->mdAutoSeries->map('brand_id', '', $where, 'id desc', 0, 0); - $carRows = $this->mdAutoCar->map('series_id', '', $where, 'id desc', 0, 0, 'id as value,name as label,series_id'); - $lists = []; - foreach ($brandRows as $brandRow) { - $children = []; - $brand = [ - 'value' => $brandRow['id'], - 'label' => $brandRow['name'], - ]; - if ($seriesRows[$brandRow['id']]) { - foreach ($seriesRows[$brandRow['id']] as $seriesRow) { - $seriesChildren = $carRows[$seriesRow['id']] ?: []; - $children[] = [ - 'value' => $seriesRow['id'], - 'label' => $seriesRow['name'], - 'children' => $seriesChildren - ]; - } - } - $brand['children'] = $children; - $lists[] = $brand; - } - $redis->save($cKey, $lists, 24 * 60 * 60); - echo json_encode($lists, JSON_UNESCAPED_UNICODE); - } - - /** - * 获取所有门店 - * @return void - */ - public function allProvinceBiz() - { - $this->load->model('area_model'); - $this->load->model('biz/biz_model'); - $this->load->model('agent/auto_product_model'); - $this->biz_model->set_db('ssdb'); - $this->area_model->set_db('ssdb'); - $type = Biz_model::BIZ_TYPE_4s; - $where = [ - 'status' => 1, - 'type' => $type - ]; - $lists = $this->biz_model->map('city_id', '', $where, 'id desc', 0, 0, 'id as value,biz_name as label,city_id'); - $provinceTree = $this->area_model->getDataByTree(); - $resList = []; - foreach ($provinceTree as $item) { - $children = $item['children']; - $newChildren = []; - foreach ($children as $key => $item2) { - if ($lists[$item2['value']]) { - $item2['children'] = $lists[$item2['value']]; - $newChildren[] = $item2; - } else { - $children[$key]['children'] = []; - } - } - if ($newChildren) { - $resList[] = [ - 'value' => $item['value'], - 'label' => $item['label'], - 'children' => $newChildren - ]; - } - } - echo json_encode($resList, JSON_UNESCAPED_UNICODE); - } - - /** - * 用户归属中心 - * @return void - */ - public function centerList() - { - $this->load->model('agent/pingan/pingan_users_model'); - $res = Pingan_users_model::TYPE_CENTER; - echo json_encode($res, JSON_UNESCAPED_UNICODE); - } - - public function orgNameList() - { - $this->load->model('agent/pingan/pingan_users_model'); - echo json_encode(Pingan_users_model::orgNameList, JSON_UNESCAPED_UNICODE); - } } diff --git a/agent/admin/controllers/pingan/car/Product.php b/agent/admin/controllers/pingan/car/Product.php index c104baa8..2524a6f5 100644 --- a/agent/admin/controllers/pingan/car/Product.php +++ b/agent/admin/controllers/pingan/car/Product.php @@ -120,6 +120,36 @@ class Product extends BaseController $this->return_response_list($data); } + //优惠券列表 + public function couponList_get() + { + $brands = $this->input_param('brands'); + $cityId = $this->input_param('cityId'); + $brandId = $brands[0]; + $seriesId = $brands[1]; + $page = 1; + $limit = 200; + if (!$seriesId || !$cityId) { + $this->return_response(); + } + $lists = []; + $where = [ + "(provinceId is null or cityId={$cityId})" => null, + "seriesId" => $seriesId, + ]; + $productList = $this->autoProduct->selectProduct($where, "", $page, $limit, 'id'); + print_r($productList); + exit; +// $coupons = $this->auto_product_coupon_model->select($where, 'id desc', $page, $lists); +// foreach ($coupons as $item) { +// $lists[] = [ +// 'id' => $item['id'], +// 'title' => $item['title'], +// ]; +// } + $this->return_response_list($lists); + } + private function productList($params) { $uid = intval($_SESSION['id']); @@ -231,4 +261,5 @@ class Product extends BaseController $data = ['list' => $list, 'count' => $count, 'columns' => $columns]; return $data; } + } diff --git a/agent/admin/controllers/pingan/receiver/Clues.php b/agent/admin/controllers/pingan/receiver/Clues.php index 05d51724..419e1654 100644 --- a/agent/admin/controllers/pingan/receiver/Clues.php +++ b/agent/admin/controllers/pingan/receiver/Clues.php @@ -488,6 +488,7 @@ class Clues extends BaseController 'poi' => $poi, 'isUnlock' => $is_unlock, 'level' => $v['level'], + 'cityId' => $v['city_id'] ]; } @@ -502,7 +503,7 @@ class Clues extends BaseController } /** - * 更新登记 + * 更新等级 * @return void */ public function level_post() @@ -517,5 +518,12 @@ class Clues extends BaseController } $this->return_response(); } + // 发放优惠券 + public function sendCoupon_post() + { + $brands = $this->input_param('brands'); + print_r($brands);exit; + $this->return_response(); + } } diff --git a/api/controllers/plan/CallBack.php b/api/controllers/plan/CallBack.php index 18180c95..ab7ca545 100644 --- a/api/controllers/plan/CallBack.php +++ b/api/controllers/plan/CallBack.php @@ -117,11 +117,10 @@ class CallBack extends CI_Controller $callData['userRingTime'] && $upData['userRingTime'] = $callData['userRingTime']; $callData['userAnswerTime'] && $upData['userAnswerTime'] = $callData['userAnswerTime']; $callData['endTime'] && $upData['endTime'] = $callData['endTime']; - if ($callData['endTime'] && $callData['agentAnswerTime']) { - $upData['telDuration'] = strtotime($callData['endTime']) - strtotime($callData['agentAnswerTime']); - } - if ($callData['endTime'] && $callData['userAnswerTime']) { - $upData['telDuration'] = strtotime($callData['endTime']) - strtotime($callData['userAnswerTime']); + if ($callData['hangupType'] == Receiver_call_wechat_model::FINISH_STATUS_FINISH) { + if ($callData['endTime'] && $callData['userAnswerTime']) { + $upData['telDuration'] = strtotime($callData['endTime']) - strtotime($callData['userAnswerTime']); + } } $this->callWechat->update($upData, ['id' => $row['id']]); if ($row['cfId'] && $row['cfPlatform'] == Receiver_call_wechat_model::CF_PLATFORM_WX_APP) { //理车宝 diff --git a/common/models/receiver/Receiver_call_wechat_model.php b/common/models/receiver/Receiver_call_wechat_model.php index 3ff39c24..8ba9a0dd 100644 --- a/common/models/receiver/Receiver_call_wechat_model.php +++ b/common/models/receiver/Receiver_call_wechat_model.php @@ -16,6 +16,10 @@ class Receiver_call_wechat_model extends HD_Model //状态 0 未拨打 1 已拨打 const STATUS_WAIT = 0; const STATUS_FINISH = 1; + // 通话完成状态 0:通话未完成 1:通话完成 2:通话失败 + const FINISH_STATUS_WAIT = 0; + const FINISH_STATUS_FINISH = 1; + const FINISH_STATUS_FAIL = 2; public function __construct()