admin_clues_727

This commit is contained in:
dengbw
2021-07-27 15:33:27 +08:00
committed by lccsw
parent d8c455eff4
commit 25eaa5d1df
5 changed files with 231 additions and 29 deletions
+14 -14
View File
@@ -1077,7 +1077,7 @@ class Common extends CI_Controller
return $this->show_json(SYS_CODE_FAIL, '短信最多300个字');
}
if ($type == 1) {
$content = '【星盟卡】' . $content;
$content = '【狸车】' . $content;
} else if ($type == 2) {
$content = '【好店云】' . $content;
}
@@ -1098,16 +1098,16 @@ class Common extends CI_Controller
$this->data['result'] = $plaintext;
if ($plaintext) {
if ($id && $type == 1) {
$this->load->model('app/jdb/receiver_oplogs_model', 'mdReceiverOplogs');
$this->load->model('receiver/receiver_clue_oplogs_model', 'mdOplogs');
$data = array(
'rc_id' => $id,
'admin_id' => $this->uid,
'admin_name' => $this->username,
'type' => 2,
'clue_id' => $id,
'uid' => $this->uid,
'uname' => $this->username,
'type' => 1,
'log' => $content,
'c_time' => time()
);
$this->mdReceiverOplogs->add($data);//增加操作记录
$this->mdOplogs->add($data);//增加操作记录
}
return $this->show_json(SYS_CODE_SUCCESS, '发送短信成功');
} else {
@@ -1344,16 +1344,16 @@ class Common extends CI_Controller
$page = $this->input->post('page') ? intval($this->input->post('page')) : 1;
$size = $this->input->post('size') ? intval($this->input->post('size')) : 10;
$where = "status=1 ";
$brand_id && $where.=" and brand_id=$brand_id";
$s_id && $where.=" and s_id=$s_id";
$v_id && $where.=" and v_id=$v_id";
$cor_id && $where.=" and cor_id=$cor_id";
$incor_id && $where.=" and incor_id=$incor_id";
if($select_id){
$brand_id && $where .= " and brand_id=$brand_id";
$s_id && $where .= " and s_id=$s_id";
$v_id && $where .= " and v_id=$v_id";
$cor_id && $where .= " and cor_id=$cor_id";
$incor_id && $where .= " and incor_id=$incor_id";
if ($select_id) {
$fhwhere = [
"($where) or (id=$select_id)" => null
];
}else{
} else {
$fhwhere = [
"($where)" => null
];
+118 -15
View File
@@ -4,7 +4,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class Clues extends HD_Controller
{
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名');
private $cacheKeyPhone = 'xz_admin_phone';
protected $log_dir;
public function __construct()
@@ -14,6 +14,7 @@ class Clues extends HD_Controller
$this->load->model('receiver/receiver_clues_cfrom_model', 'clues_cfrom_model');
$this->load->model('receiver/receiver_customers_model', 'customers_model');
$this->load->model('receiver/receiver_clue_oplogs_model', 'mdOplogs');
$this->load->model('receiver/receiver_xz_model', 'mdReceiverXz');
$this->load->model('app/licheb/app_licheb_users_model');
$this->load->model("biz/biz_model");
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
@@ -108,8 +109,19 @@ class Clues extends HD_Controller
$setValue = array();
$setValue['uname'] = $value['uname'];
$setValue['log'] = $value['log'];
$setValue['type_name'] = '小记';
$setValue['type_name'] = $this->mdOplogs->typeAry()[$value['type']];
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
$rec_url = $rec_text = '';
if ($value['type'] == 2) {//拨打电话
$rec_text = '未接通';
$row = $this->mdReceiverXz->get(array('id' => $value['log']));
if ($row['duration']) {
$rec_url = $row['rec_url'] ? build_qiniu_image_url($row['rec_url'], 0,0,'video') : '';
$rec_text = '录音文件未生成';
}
}
$setValue['rec_url'] = $rec_url;
$setValue['rec_text'] = $rec_text;
$logsList[] = $setValue;
}
$info_show['logsList'] = $logsList;
@@ -144,16 +156,17 @@ class Clues extends HD_Controller
* 新增
* @return bool
*/
function get_add(){
function get_add()
{
$id = $this->input->get('id');
if($id){
if ($id) {
$row = $this->clues_model->get(array('id' => $id));
if(!$row){
if (!$row) {
return $this->show_json(SYS_CODE_FAIL, '记录不存在');
}
$info = array(
$info = array(
'name' => $row['name'],
'mobile' => $row['mobile'],
'cf_id' => $row['cf_id'],
@@ -468,14 +481,7 @@ class Clues extends HD_Controller
}
$mobile = $re['mobile'];
$cache = &load_cache('redis');
$cache_key = "xz_admin_phone";
$xz_admin_phone = $cache->get($cache_key);
// $xz_admins_numbers = array();
// $xz_admins_numbers['admins'][$this->uid] = '18916751561';
// $xz_admins_numbers['numbers']['18916751561'] = $this->uid;
// $cache->save($cache_key, $xz_admins_numbers);
// echo json_encode($xz_admin_phone,JSON_UNESCAPED_UNICODE);
// exit;
$xz_admin_phone = $cache->get($this->cacheKeyPhone);
$middleNumber = '';
if ($xz_admin_phone) {
$middleNumber = $xz_admin_phone['admins'][$this->uid];
@@ -498,7 +504,6 @@ class Clues extends HD_Controller
}
if ($result['code']) {
$this->data['middlenumber'] = $result['data']['virtualMobile'];
$this->load->model('receiver/receiver_xz_model', 'mdReceiverXz');
$add_data = [
'call_id' => $seq_id,
'display_number' => $result['data']['virtualMobile'],
@@ -517,6 +522,104 @@ class Clues extends HD_Controller
$this->show_view('receiver/clues/edit_xbind');
}
public function lists_call()
{
$this->load->model('sys/sys_admin_model', 'mdAdmin');
$cache = &load_cache('redis');
$xz_admin_phone = $cache->get($this->cacheKeyPhone);
$params = $this->input->get();
$username = $params['username'];
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$params['size'] = $params['size'] ? intval($params['size']) : 20;
$lists = array();
$where['status'] = 1;
if (!empty($username)) $where["username like '%$username%'"] = null;
if (!empty($params['mobile'])) $where['mobile'] = $params['mobile'];
$count = $this->mdAdmin->count($where);
if ($count) {
$res = $this->mdAdmin->select($where, 'id desc', $params['page'], $params['size'], 'id,username,mobile');
foreach ($res as $key => $value) {
$setValue = array();
$setValue['id'] = $value['id'];
$setValue['username'] = $value['username'];
$setValue['mobile'] = $value['mobile'];
$phone = $xz_admin_phone['admins'][$value['id']];
if ($phone) {
$phone_btn = '<a class="am-btn am-btn-danger am-btn-xs" data-action="/receiver/clues/edit_call" data-ajax="post"
data-params-type="1" data-params-id="' . $value['id'] . '" >取消分配</a>';
} else {
$phone = '未分配';
$phone_btn = '<a class="am-btn am-btn-primary am-btn-xs" data-action="/receiver/clues/edit_call" data-ajax="post"
data-params-type="0" data-params-id="' . $value['id'] . '" >分配号码</a>';
}
$setValue['phone'] = $phone;
$setValue['phone_btn'] = $phone_btn;
$lists[] = $setValue;
}
}
$this->data['params'] = $params;
$this->data['_title'] = '虚似号分配';
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
$this->data['lists'] = $lists;
return $this->show_view('receiver/clues/lists_call', true);
}
public function edit_call()
{
$id = intval($this->input->post('id'));
$type = $this->input->post('type');
if ($type != 3 && !$id) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$cache = &load_cache('redis');
$xz_admin_phone = $cache->get($this->cacheKeyPhone);
$mobiles = $this->mdReceiverXz->get_mobiles('admin');
shuffle($mobiles);
if ($type == 0) {//分配手机
if (!$mobiles) {
return $this->show_json(SYS_CODE_FAIL, '暂无虚似号');
}
$number = '';
foreach ($mobiles as $key => $value) {
if (!$xz_admin_phone['numbers'][$value]) {
$number = $value;
break;
}
}
if ($number) {
$xz_admin_phone['admins'][$id] = $number;
$xz_admin_phone['numbers'][$number] = $id;
$cache->save($this->cacheKeyPhone, $xz_admin_phone);
return $this->show_json(SYS_CODE_SUCCESS, '分配号码成功');
} else {
return $this->show_json(SYS_CODE_FAIL, '号码已全部分配完了');
}
} else if ($type == 1) {//取消分配
$number = $xz_admin_phone['admins'][$id];
unset($xz_admin_phone['admins'][$id]);
unset($xz_admin_phone['numbers'][$number]);
$cache->save($this->cacheKeyPhone, $xz_admin_phone);
return $this->show_json(SYS_CODE_SUCCESS, '取消分配成功');
} else if ($type == 3) {//全部重新分配
if (!$mobiles) {
return $this->show_json(SYS_CODE_FAIL, '暂无虚似号');
}
$xz_admin_phone_new = array();
$i = 0;
foreach ($xz_admin_phone['admins'] as $key => $value) {
$number = $mobiles[$i];
$id = $key;
if ($number) {
$xz_admin_phone_new['admins'][$id] = $number;
$xz_admin_phone_new['numbers'][$number] = $id;
}
$i++;
}
$cache->save($this->cacheKeyPhone, $xz_admin_phone_new);
return $this->show_json(SYS_CODE_SUCCESS, '重置已分配成功');
}
}
private function upload()
{
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
+67
View File
@@ -0,0 +1,67 @@
<div class="coms-table-wrap">
<div class="coms-table-hd clearfix no-border">
<form action="/receiver/clues/lists_call" class="form-search" onsubmit="return false">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label">用户名:</label>
<div class="am-para-inline w150">
<input type="text" value="<?= $params['username'] ?>"
name="username"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label">手机号:</label>
<div class="am-para-inline w150">
<input type="text" value="<?= $params['mobile'] ?>"
name="mobile"/>
</div>
</div>
<div class="am-form-group fl">
<div class="am-para-inline w150">
<button type="submit" class="am-btn ml20 am-btn-sm am-btn-success w100">搜索</button>
</div>
</div>
<div class="am-form-group fl">
<button type="button" data-action="/receiver/clues/edit_call" data-ajax="post"
data-params-type="3" class="add am-btn ml20 am-btn-sm am-btn-success w120">重置已分配
</button>
</div>
<div class="am-form-group fr" style="font-size: 15px;padding-right: 20px;padding-top: 6px;">
共有<?= $pager['totle'] ?>条数据
</div>
</div>
</form>
</div>
<div class="coms-table-bd">
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="3%"><span>ID</span></th>
<th width="10%"><span>用户名</span></th>
<th width="10%"><span>手机号</span></th>
<th width="10%"><span>分配号码</span></th>
<th width="10%"><span>操作</span></th>
</tr>
</thead>
<tbody>
<?php if ($lists) {
foreach ($lists as $v) { ?>
<tr>
<td><?= $v['id'] ?></td>
<td><?= $v['username'] ?></td>
<td><?= $v['mobile'] ?></td>
<td><?= $v['phone'] ?></td>
<td><?= $v['phone_btn'] ?></td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form"></div>
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
@@ -17,4 +17,15 @@ class Receiver_clue_oplogs_model extends HD_Model
parent::__construct($this->table_name, 'default');
}
/**
* Notes:类型
* Created on: 2021/7/27 10:31
* Created by: dengbw
* @return array
*/
public function typeAry()
{
return array(0 => '小记', 1 => '发短信', 2 => '拨打号码');
}
}
@@ -15,4 +15,25 @@ class Receiver_xz_model extends HD_Model
{
parent::__construct($this->table_name, 'default');
}
/**
* Notes:虚似号码
* Created on: 2021/7/26 14:20
* Created by: dengbw
* @param string $type
* @return array
*/
public function get_mobiles($type = 'admin')
{
if ($type == 'api') {//小程序接口专用
$mobile = array(
'18916735350','18916689195',
);
} else {//后台专用
$mobile = array(
'18916735350','18916689195',
);
}
return $mobile;
}
}