700 lines
24 KiB
PHP
700 lines
24 KiB
PHP
<?php
|
||
|
||
defined('BASEPATH') or exit('No direct script access allowed');
|
||
|
||
class Clues extends HD_Controller
|
||
{
|
||
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名', 'void' => 'voId', );
|
||
private $bizs = array(
|
||
'350' => array(
|
||
'name' => '福建',
|
||
'list' => array(
|
||
|
||
'100958' => array(
|
||
'biz' => '福州齐安路',
|
||
'sa' => '陈秋龙',
|
||
'mobile' => '17758949069'
|
||
),
|
||
'100966' => array(
|
||
'biz' => '泉州南环路',
|
||
'sa' => '傅玲玲',
|
||
'mobile' => '18519510420'
|
||
),
|
||
'101077' => array(
|
||
'biz' => '晋江豪信',
|
||
'sa' => '杨晓默',
|
||
'mobile' => '13799859101'
|
||
),
|
||
'100619' => array(
|
||
'biz' => '漳州狸车',
|
||
'sa' => '陈鸿喜',
|
||
'mobile' => '17750151079'
|
||
),
|
||
'100231' => array(
|
||
'biz' => '宁德辉科',
|
||
'sa' => '余玮',
|
||
'mobile' => '18659197547'
|
||
),
|
||
'100421' => array(
|
||
'biz' => '南平绿衡',
|
||
'sa' => '周伟豪',
|
||
'mobile' => '16659478792'
|
||
),
|
||
'100179' => array(
|
||
'biz' => '莆田众诚',
|
||
'sa' => '林昉',
|
||
'mobile' => '18760550059'
|
||
),
|
||
'100690' => array(
|
||
'biz' => '龙岩胜华成',
|
||
'sa' => '郭晓芬',
|
||
'mobile' => '13600983210'
|
||
),
|
||
'101207' => array(
|
||
'biz' => '厦门胜华嘉',
|
||
'sa' => '',
|
||
'mobile' => ''
|
||
),
|
||
),
|
||
),
|
||
'440' => array(
|
||
'name' => '广东',
|
||
'list' => array(
|
||
'101071' => array(
|
||
'biz' => '江门朋赢',
|
||
'sa' => '余镜苗',
|
||
'mobile' => '18127125536'
|
||
),
|
||
'100647' => array(
|
||
'biz' => '珠海金浩',
|
||
'sa' => '占杨',
|
||
'mobile' => '18923392948'
|
||
),
|
||
'100832' => array(
|
||
'biz' => '中山金玺',
|
||
'sa' => '黄美愉',
|
||
'mobile' => '17329610587'
|
||
),
|
||
'101252' => array(
|
||
'biz' => '佛山鑫明宇',
|
||
'sa' => '陈惠伦',
|
||
'mobile' => '13790011910'
|
||
),
|
||
'101289' => array(
|
||
'biz' => '深圳东浩',
|
||
'sa' => '余佳思',
|
||
'mobile' => '15889556579'
|
||
),
|
||
'101204' => array(
|
||
'biz' => '东莞金屹',
|
||
'sa' => '林耿文',
|
||
'mobile' => '17620573545'
|
||
),
|
||
'101043' => array(
|
||
'biz' => '惠州新零致',
|
||
'sa' => '张安琪',
|
||
'mobile' => '15999955547'
|
||
),
|
||
'100671' => array(
|
||
'biz' => '梅州利兴',
|
||
'sa' => '石绿绿',
|
||
'mobile' => '14718175658'
|
||
),
|
||
'101214' => array(
|
||
'biz' => '汕头骏华',
|
||
'sa' => '黎旭',
|
||
'mobile' => '15766613213'
|
||
),
|
||
'100917' => array(
|
||
'biz' => '揭阳顺鹏',
|
||
'sa' => '吴佳鸿',
|
||
'mobile' => '19902714365'
|
||
),
|
||
'101487' => array(
|
||
'biz' => '广州长瑞',
|
||
'sa' => '吴国腾',
|
||
'mobile' => '15323380908'
|
||
),
|
||
)
|
||
),
|
||
|
||
);
|
||
protected $log_dir;
|
||
|
||
public function __construct()
|
||
{
|
||
parent::__construct();
|
||
$this->load->model('hdcloud/hdcloud_clues_model', 'clues_model');
|
||
$this->load->model('hdcloud/hdcloud_clue_oplogs_model', 'clue_oplogs_model');
|
||
}
|
||
|
||
//首页信息
|
||
public function index()
|
||
{
|
||
$this->lists();
|
||
}
|
||
|
||
public function lists($where = array())
|
||
{
|
||
$statusAry = $this->clues_model->statusAry();
|
||
$params = $this->input->get();
|
||
|
||
$this->data['pro_id'] = $pro_id = intval($params['pro_id']);
|
||
$this->data['biz_id'] = $biz_id = intval($params['biz_id']);
|
||
|
||
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||
|
||
if ($params['title']) {
|
||
$where["{$params['search_tp']} like '%{$params['title']}%'"] = null;
|
||
}
|
||
|
||
//创建时间
|
||
if ($params['c_time']) {
|
||
$c_time = explode(' ~ ', $params['c_time']);
|
||
if ($c_time[0]) {
|
||
$where["c_time >="] = strtotime($c_time[0] . ' 00:00:00');
|
||
}
|
||
if ($c_time[1]) {
|
||
$where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
|
||
}
|
||
}
|
||
|
||
strlen($params['status']) && $where["status"] = $params['status'];
|
||
|
||
$pro_id && $where['pro_id'] = $pro_id;
|
||
$biz_id && $where['biz_id'] = $biz_id;
|
||
|
||
$count = $this->clues_model->count($where);
|
||
$lists = [];
|
||
|
||
if ($count) {
|
||
$fileds = 'id,void, name,mobile,c_time,admin_id,status,status2';
|
||
$rows = $this->clues_model->select($where, 'id desc', $page, $size, $fileds);
|
||
|
||
foreach ($rows as $key => $val) {
|
||
$status_name = $statusAry[$val['status']]['name'];
|
||
$val['status2'] && $status_name .= '‒' . $statusAry[$val['status']]['list'][$val['status2']];
|
||
$val['status_name'] = $status_name;
|
||
$lists[] = $val;
|
||
}
|
||
}
|
||
$statusList = array();
|
||
foreach ($this->clues_model->statusAry() as $key => $value) {
|
||
$cate = array();
|
||
$where = array("status" => $key);
|
||
|
||
$count1 = $this->clues_model->count($where);
|
||
if ($value['list']) {
|
||
foreach ($value['list'] as $key2 => $value2) {
|
||
$where['status2'] = $key2;
|
||
$count2 = $this->clues_model->count($where);
|
||
$cate[] = array("id" => $key2, "name" => $value2, "count" => $count2);
|
||
}
|
||
}
|
||
$statusList[] = array("id" => $key, "name" => $value['name'], "cate" => $cate, "count" => $count1);
|
||
}
|
||
|
||
$this->data['lists'] = $lists;
|
||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||
$this->data['searchTpAry'] = $this->searchTpAry;
|
||
$this->data['params'] = $params;
|
||
$this->data['statusList'] = $statusList;
|
||
$this->data['maintainAry'] = $this->maintainAry;
|
||
$this->data['_title'] = '线索池列表';
|
||
|
||
|
||
return $this->show_view('hdcloud/clues/lists', true);
|
||
}
|
||
|
||
public function get()
|
||
{
|
||
$params = $this->input->get();
|
||
$id = intval($params['id']);
|
||
if (!$id) {
|
||
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
|
||
}
|
||
$statusList = $status2List = $logsList = [];
|
||
$re = $this->clues_model->get(array('id' => $id));
|
||
if (!$re || empty($re)) {
|
||
return $this->show_json(SYS_CODE_FAIL, '线索不存在!');
|
||
}
|
||
$dataInfo = $re;
|
||
foreach ($this->clues_model->statusAry() as $key => $value) {
|
||
$statusList[] = array("id" => $key, "name" => $value['name']);
|
||
}
|
||
if (strlen($re['status'])) {
|
||
foreach ($this->clues_model->statusAry($re['status'])['list'] as $key => $value) {
|
||
$status2List[] = array("id" => $key, "name" => $value);
|
||
}
|
||
}
|
||
$dataInfo['editType'] = 0;
|
||
$info_show['statusList'] = $statusList;
|
||
$info_show['status2List'] = $status2List;
|
||
$info_show['c_time'] = date('Y-m-d H:i', $re['c_time']);
|
||
|
||
$info_show['logsList'] = $logsList;
|
||
//意向信息
|
||
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
|
||
//获取城市区域
|
||
$dataInfo['city_id'] = $re['city_id'];
|
||
$dataInfo['county_id'] = $re['county_id'];
|
||
|
||
$this->data['info'] = $dataInfo;
|
||
$this->data['info_show'] = $info_show;
|
||
$this->data['_title'] = '线索详情';
|
||
return $this->show_view('hdcloud/clues/edit', true);
|
||
}
|
||
|
||
/**
|
||
* 新增
|
||
* @return bool
|
||
*/
|
||
function get_add()
|
||
{
|
||
$id = $this->input->get('id');
|
||
|
||
if ($id) {
|
||
$row = $this->clues_model->get(array('id' => $id));
|
||
if (!$row) {
|
||
return $this->show_json(SYS_CODE_FAIL, '记录不存在');
|
||
}
|
||
|
||
$info = array(
|
||
'name' => $row['name'],
|
||
'mobile' => $row['mobile'],
|
||
);
|
||
$title = "编辑线索";
|
||
$action = "edit";
|
||
} else {
|
||
$info = array(
|
||
'name' => '',
|
||
'mobile' => '',
|
||
'cf_id1' => '',
|
||
'cf_id2' => '',
|
||
);
|
||
$title = "新增线索";
|
||
$action = "add";
|
||
}
|
||
|
||
$where = array('status' => 1, 'pid' => 0);
|
||
$select = 'id, title';
|
||
|
||
$this->data['info'] = $info;
|
||
$this->data['action'] = $action;
|
||
|
||
$this->data['_title'] = $title;
|
||
return $this->show_view('hdcloud/clues/get');
|
||
}
|
||
|
||
//添加单条数据
|
||
public function add()
|
||
{
|
||
$info = $this->input->post('info');
|
||
|
||
if (!$info['name']) {
|
||
return $this->show_json(SYS_CODE_FAIL, '请填写姓名');
|
||
}
|
||
|
||
if (!mobile_valid($info['mobile'])) {
|
||
return $this->show_json(SYS_CODE_FAIL, '手机号码不准确');
|
||
}
|
||
if ($this->clues_model->get(['mobile' => $info['mobile']])) {
|
||
return $this->show_json(SYS_CODE_FAIL, '手机号已存在');
|
||
}
|
||
|
||
$add = array(
|
||
'name' => $info['name'],
|
||
'mobile' => $info['mobile'],
|
||
'admin_id' => $this->uid,
|
||
'c_time' => time(),
|
||
);
|
||
$ret = $this->clues_model->add($add);
|
||
if (!$ret) {
|
||
debug_log("[error]# add fail; " . $this->clues_model->db->last_query(), __FUNCTION__, $this->log_dir);
|
||
return $this->show_json(SYS_CODE_FAIL, '添加失败');
|
||
}
|
||
|
||
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
|
||
}
|
||
|
||
public function add_log()
|
||
{
|
||
$params = $this->input->post();
|
||
if (!$params['id']) {
|
||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||
}
|
||
if (!$params['log']) {
|
||
return $this->show_json(SYS_CODE_FAIL, '请输入内容!');
|
||
}
|
||
$addData = array(
|
||
'clue_id' => $params['id'],
|
||
'uid' => $this->uid,
|
||
'uname' => $this->username,
|
||
'type' => intval($params['type']),
|
||
'log' => $params['log'],
|
||
'c_time' => time()
|
||
);
|
||
$id = $this->mdOplogs->add($addData);
|
||
if ($id) {
|
||
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
|
||
} else {
|
||
return $this->show_json(SYS_CODE_FAIL, '添加失败');
|
||
}
|
||
}
|
||
|
||
function add_excel()
|
||
{
|
||
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
|
||
$res = $this->upload();
|
||
if (!$res['code']) {
|
||
return $this->show_json(0, $res['message']);
|
||
}
|
||
$file = $res['path'];
|
||
if ($res['file_ext'] == '.xls') {
|
||
$reader = \PHPExcel_IOFactory::createReader('Excel5'); // 读取 excel 文档
|
||
} elseif ($res['file_ext'] == '.xlsx') {
|
||
$reader = \PHPExcel_IOFactory::createReader('Excel2007'); // 读取 excel 文档
|
||
} else {
|
||
return $this->show_json(SYS_CODE_FAIL, '文件无法识别');
|
||
}
|
||
$PHPExcel = $reader->load($file); // 文档名称
|
||
$objWorksheet = $PHPExcel->getActiveSheet();
|
||
$rowCnt = $objWorksheet->getHighestRow(); //获取总行数
|
||
if ($rowCnt > 800) {
|
||
@unlink($file);
|
||
return $this->show_json(0, '数据大于800请拆分多个表格导入');
|
||
}
|
||
$data = array();
|
||
for ($_row = 2; $_row <= $rowCnt; $_row++) { //读取内容
|
||
$data[] = array(
|
||
'name' => $objWorksheet->getCell('A' . $_row)->getValue(),
|
||
'mobile' => $objWorksheet->getCell('B' . $_row)->getValue(),
|
||
'cfrom' => $objWorksheet->getCell('C' . $_row)->getValue(),
|
||
);
|
||
}
|
||
$done = $this->add_batch($data);
|
||
@unlink($file);
|
||
$this->data['load_num'] = count($data);
|
||
$this->data['done'] = $done;
|
||
return $this->show_json(SYS_CODE_SUCCESS, "成功导入{$done}条");
|
||
}
|
||
|
||
//编辑单条数据
|
||
public function edit()
|
||
{
|
||
$info = $this->input->post('info');
|
||
if (!$info) {
|
||
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
|
||
}
|
||
$re = $this->clues_model->get(array('id' => $info['id']));
|
||
if (!$re || empty($re)) {
|
||
return $this->show_json(SYS_CODE_FAIL, '线索不存在!');
|
||
}
|
||
$msg = '修改成功';
|
||
$code = SYS_CODE_SUCCESS;
|
||
if ($info['editType'] == 1) {
|
||
$statusAry = $this->clues_model->statusAry();
|
||
if ($info['status'] == $re['status'] && $info['status2'] == $re['status2']) {
|
||
return $this->show_json(SYS_CODE_FAIL, '状态未修改!');
|
||
}
|
||
$status_name = $statusAry[$re['status']]['name'];
|
||
$status_name_up = $statusAry[$info['status']]['name'];
|
||
if ($info['status2']) {
|
||
$status_name .= '-' . $statusAry[$re['status']]['list'][$re['status2']];
|
||
$status_name_up .= '-' . $statusAry[$info['status']]['list'][$info['status2']];
|
||
}
|
||
$log = '更新状态(' . $status_name . ')为(' . $status_name_up . ')';
|
||
$ret = $this->clues_model->update(array('status' => $info['status'], 'status2' => $info['status2']), array('id' => $info['id']));
|
||
if (!$ret) {
|
||
$code = SYS_CODE_FAIL;
|
||
$msg = '修改状态失败';
|
||
} else {
|
||
$msg = '修改状态成功';
|
||
$this->addLog(array('clue_id' => $info['id'], 'type' => 0, 'log' => $log));
|
||
}
|
||
} else if ($info['editType'] == 2) {
|
||
if ($info['name'] == $re['name']) {
|
||
return $this->show_json(SYS_CODE_FAIL, '客户姓名未修改!');
|
||
}
|
||
$log = '更新客户姓名(' . $re['name'] . ')为(' . $info['name'] . ')';
|
||
$ret = $this->clues_model->update(array('name' => $info['name']), array('id' => $info['id']));
|
||
if (!$ret) {
|
||
$code = SYS_CODE_FAIL;
|
||
$msg = '修改用户信息失败';
|
||
} else {
|
||
$msg = '修改用户信息成功';
|
||
$this->addLog(array('clue_id' => $info['id'], 'type' => 0, 'log' => $log));
|
||
}
|
||
} else if ($info['editType'] == 3) {
|
||
$up_data = [
|
||
'city_id' => $info['city_id'],
|
||
'county_id' => $info['county_id']
|
||
];
|
||
$ret = $this->clues_model->update($up_data, array('id' => $info['id']));
|
||
if (!$ret) {
|
||
$code = SYS_CODE_FAIL;
|
||
$msg = '修改意向信息失败';
|
||
} else {
|
||
$msg = '修改意向信息成功';
|
||
$this->addLog(array('clue_id' => $info['id'], 'type' => 0, 'log' => '修改意向信息'));
|
||
}
|
||
}
|
||
return $this->show_json($code, $msg);
|
||
}
|
||
|
||
/**
|
||
* Notes:增加日志
|
||
* Created on: 2021/7/23 10:48
|
||
* Created by: dengbw
|
||
* @param array $ary
|
||
* @return mixed
|
||
*/
|
||
private function addLog($ary = array())
|
||
{
|
||
$id = 0;
|
||
if ($ary['log']) {
|
||
$addData = array(
|
||
'clue_id' => $ary['clue_id'],
|
||
'uid' => $this->uid,
|
||
'uname' => $this->username,
|
||
'type' => intval($ary['type']),
|
||
'log' => $ary['log'],
|
||
'c_time' => time()
|
||
);
|
||
$id = $this->mdOplogs->add($addData);
|
||
}
|
||
return $id;
|
||
}
|
||
|
||
//删除单条数据
|
||
public function del()
|
||
{
|
||
|
||
}
|
||
|
||
//批量操作(默认修改状态)
|
||
public function batch()
|
||
{
|
||
$id = intval($this->input->post('id'));
|
||
$status = $this->input->post('value');
|
||
if (!$id || !$status) {
|
||
$this->show_json(0, '参数错误');
|
||
}
|
||
$status_ary = explode('-', $status);
|
||
$up_data['status'] = intval($status_ary[0]);
|
||
$up_data['status2'] = intval($status_ary[1]);
|
||
$this->clues_model->update($up_data, ['id' => $id]);
|
||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||
}
|
||
|
||
//导出数据列表
|
||
public function export()
|
||
{
|
||
|
||
}
|
||
|
||
public function get_bizs(){
|
||
$pro_id = $this->input->get('pro_id');
|
||
|
||
if($pro_id){
|
||
$bizs = $this->bizs[$pro_id];
|
||
if($bizs){
|
||
|
||
foreach ($bizs['list'] as $k => $v){
|
||
$this->data[] = array(
|
||
'id' => $k,
|
||
'biz_name' => $v['biz'],
|
||
'sa' => $v['sa'],
|
||
'mobile' => $v['mobile'],
|
||
);
|
||
}
|
||
}
|
||
}
|
||
|
||
return $this->show_json(SYS_CODE_SUCCESS);
|
||
}
|
||
|
||
public function get_adviser()
|
||
{
|
||
$id = $this->input->get('id');
|
||
$this->data['id'] = $id;
|
||
|
||
return $this->show_view('hdcloud/clues/get_adviser');
|
||
}
|
||
|
||
public function edit_adviser(){
|
||
$id = $this->input->post('id');
|
||
$pro_id = $this->input->post('pro_id');
|
||
$biz_id = $this->input->post('biz_id');
|
||
$intent = $this->input->post('intent');
|
||
$remark = $this->input->post('remark');
|
||
|
||
$biz = $this->bizs[$pro_id]['list'][$biz_id];
|
||
|
||
if (!$biz) {
|
||
return $this->show_json(SYS_CODE_FAIL, '请选择分配门店!');
|
||
}
|
||
$biz['id'] = $biz_id;
|
||
|
||
$clue_row = $this->clues_model->get(['id' => $id]);
|
||
if ($clue_row) {
|
||
if($clue_row['status']){
|
||
return $this->show_json(SYS_CODE_FAIL, '已分配!');
|
||
}
|
||
|
||
$result = $this->push_neta($clue_row['name'], $clue_row['mobile'], $pro_id, $biz, $intent, $remark);
|
||
$json = json_decode($result, true);
|
||
|
||
if($json['dataInfo']['rtnMessage'] == '处理成功'){
|
||
|
||
$this->clues_model->update(['status' => 1], ['id' => $id]);
|
||
|
||
|
||
return $this->show_json(SYS_CODE_SUCCESS, '分配成功!');
|
||
}
|
||
}
|
||
|
||
return $this->show_json(SYS_CODE_FAIL, '分配失败!');
|
||
}
|
||
|
||
private function upload()
|
||
{
|
||
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
|
||
$config['allowed_types'] = 'xls|xlsx';
|
||
$config['max_size'] = 5120;
|
||
$config['file_name'] = 'receiver_clues' . time() . rand(1, 99999);
|
||
$this->load->library('upload', $config);
|
||
if (!$this->upload->do_upload('file')) {
|
||
return array('code' => SYS_CODE_FAIL, 'message' => $this->upload->display_errors('', ''));
|
||
} else {
|
||
$data = $this->upload->data();
|
||
return array('code' => SYS_CODE_SUCCESS, 'path' => $data['full_path'], 'file_ext' => $data['file_ext']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 批量新增
|
||
* @param $lists
|
||
* @return int
|
||
*/
|
||
private function add_batch($lists)
|
||
{
|
||
$done = 0;
|
||
$adds = array();
|
||
|
||
$where = array('status' => 1);
|
||
$select = 'id, title';
|
||
$map_cfrom = $this->clues_cfrom_model->map('title', 'id', $where, '', 0, 0, $select);
|
||
$fails = array();
|
||
foreach ($lists as $k => $v) {
|
||
if (!$v['name']) {
|
||
$fails[] = array('data' => $v, 'msg' => 'name is null');
|
||
continue;
|
||
}
|
||
if (!mobile_valid($v['mobile'])) {
|
||
$fails[] = array('data' => $v, 'msg' => 'mobile valid fail');
|
||
continue;
|
||
}
|
||
if ($this->clues_model->get(['mobile' => $v['mobile']])) {
|
||
$fails[] = array('data' => $v, 'msg' => '手机号已存在');
|
||
continue;
|
||
}
|
||
$cf_id = $map_cfrom[$v['cfrom']];
|
||
$adds[] = array(
|
||
'name' => $v['name'],
|
||
'mobile' => $v['mobile'],
|
||
'cf_id' => $cf_id ? $cf_id : 0,
|
||
'c_time' => time(),
|
||
);
|
||
$done++;
|
||
}
|
||
|
||
$fails && debug_log('[warning]# fails=' . json_encode($fails), __FUNCTION__, $this->log_dir);
|
||
|
||
if ($adds) {
|
||
$ret = $this->clues_model->add_batch($adds);
|
||
if (!$ret) {
|
||
debug_log("[error] add_batch fail; " . $this->clues_model->db->last_query(), __FUNCTION__, $this->log_dir);
|
||
$done = 0;
|
||
}
|
||
}
|
||
|
||
return $done;
|
||
}
|
||
|
||
//获取线索来源
|
||
public function get_cfroms()
|
||
{
|
||
$id = $this->input->get('id');
|
||
$where = [
|
||
'status' => 1,
|
||
'pid' => 0
|
||
];
|
||
$id && $where['pid'] = $id;
|
||
if ($this->role == 37) {
|
||
!$id && $where['id'] = 36;
|
||
}
|
||
$rows = $this->clues_cfrom_model->select($where, 'id desc', '', '', 'id,title');
|
||
$this->data['data'] = $rows;
|
||
return $this->show_json(SYS_CODE_SUCCESS);
|
||
}
|
||
|
||
public function get_bizInfo()
|
||
{
|
||
$id = $this->input->get('id');
|
||
$info = $this->biz_model->get(['id' => $id], 'city_id,county_id,address');
|
||
$city = $this->area_model->get(['county_id' => $info['county_id']]);
|
||
$bizinfo['city_name'] = $city['city_name'];
|
||
$bizinfo['county_name'] = $city['county_name'];
|
||
$bizinfo['address'] = $info['address'];
|
||
$this->data['bizinfo'] = $bizinfo;
|
||
return $this->show_json(SYS_CODE_SUCCESS);
|
||
}
|
||
|
||
public function push_neta($customerName, $mobile, $pro_id, $biz, $intentModel = '', $remark = '')
|
||
{
|
||
$voId = $pro_id . date('mdHis') . sprintf("%06d", rand(1,999999));
|
||
|
||
$data[] = array(
|
||
'voId' => $voId,
|
||
'cusSource3' => '023409',
|
||
'customerName' => $customerName,
|
||
'dealerCode' => $biz['id'],
|
||
'fromSystem' => "好店云",
|
||
'mobile' => $mobile,
|
||
'saMobile' => $biz['mobile'],
|
||
'cusType' => '30111001',
|
||
'remark' => $remark,
|
||
'intentModel' => $intentModel,
|
||
);
|
||
|
||
$data = json_encode($data, JSON_UNESCAPED_UNICODE);
|
||
|
||
//测试地址
|
||
$url = 'https://salespp-sit.hozonauto.com/appservice/app/if/salesclue/createSalesclue';
|
||
//$url = 'https://salesapp.hozonauto.com/appservice/app/if/salesclue/createSalesclue';
|
||
|
||
$ch = curl_init();
|
||
curl_setopt($ch, CURLOPT_POST, 1);
|
||
curl_setopt($ch, CURLOPT_URL, $url);
|
||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||
//https
|
||
if (strlen($url) > 5 && strtolower(substr($url, 0, 5)) == "https") {
|
||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||
}
|
||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||
'Content-Type: application/json; charset=utf-8',
|
||
'Content-Length: ' . strlen($data)
|
||
)
|
||
);
|
||
$response = curl_exec($ch);
|
||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||
curl_close($ch);
|
||
|
||
return $response;
|
||
}
|
||
}
|