修改计算通话时长

This commit is contained in:
lccsw
2025-12-05 11:39:26 +08:00
parent fd28b98d6c
commit ead67fbe06
8 changed files with 258 additions and 583 deletions
+203
View File
@@ -0,0 +1,203 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class BaseCommon extends CI_Controller
{
public function __construct()
{
parent::__construct();
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
header("Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With");
$this->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);
}
}
+3 -191
View File
@@ -1,200 +1,12 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/BaseCommon.php';
class Common extends CI_Controller
class Common extends BaseCommon
{
public function __construct()
{
parent::__construct();
$this->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);
}
}
+2 -193
View File
@@ -1,203 +1,12 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/BaseCommon.php';
class Common extends CI_Controller
class Common extends BaseCommon
{
public function __construct()
{
parent::__construct();
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
header("Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With");
$this->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);
}
}
+2 -193
View File
@@ -1,203 +1,12 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/BaseCommon.php';
class Common extends CI_Controller
class Common extends BaseCommon
{
public function __construct()
{
parent::__construct();
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
header("Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With");
$this->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);
}
}
@@ -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;
}
}
@@ -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();
}
}
+4 -5
View File
@@ -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) { //理车宝
@@ -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()