Commit b1b52367 authored by hujun's avatar hujun

隐私号码代码调整

parent 0cd91192
......@@ -13,7 +13,6 @@ use app\api_broker\untils\PlsDemo;
use app\model\AliYunPhone;
use app\model\BindingPhone;
use app\model\SecretReport;
use think\Db;
class CellPhone extends Basic
......@@ -110,88 +109,4 @@ class CellPhone extends Basic
$this->params['phone_x'];
return $this->response($this->code, $this->msg);
}
/**
* 通话列表、搜索
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function callLog() {
$result['code'] = 200;
$result['msg'] = '';
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$report = new SecretReport();
$field = 'agents_id,users_id,release_time,start_time,call_type,call_time,time';
$where = [];
if ($this->params['start_time']) {
$where['create_time'] = ['> time', $this->params['start_time']];
}
if ($this->params['end_time']) {
$where['create_time'] = ['< time', $this->params['end_time']];
}
if ($this->params['call_name']) {
$where['realName'] = ['LIKE', $this->params['call_name'].'%'];
}
if ($this->params['call_phone']) {
$where['phone_a'] = [$this->params['call_phone']];
}
if ($this->params['client_phone']) {
$where['phone_b'] = [$this->params['client_phone']];
}
if ($this->params['client_name']) {
$where['user_nick'] = ['LIKE', $this->params['client_name'].'%'];
}
$data = $report->getCallList($pageNo, $pageSize, 'id desc', $field, $where);
return $this->response($result['code'], $result['msg'], $data);
}
/**
* 经纪人通话汇总
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function callCollectList() {
$result['code'] = 200;
$result['msg'] = '';
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$report = new SecretReport();
$field = 'a.id,b.phone,sum(time) as time,agents_id,call_type';
$where = [];
if ($this->params['start_time']) {
$where['create_time'] = ['> time', $this->params['start_time']];
}
if ($this->params['end_time']) {
$where['create_time'] = ['< time', $this->params['end_time']];
}
if ($this->params['agents_name']) {
$where['realName'] = ['LIKE', $this->params['agents_name'].'%'];
}
if ($this->params['phone']) {
$where['phone'] = [$this->params['phone']];
}
$data = $report->getCallCollect($pageNo, $pageSize, 'id desc', $field, $where);
return $this->response($result['code'], $result['msg'], $data);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2018/2/12
* Time: 14:14
*/
namespace app\index\controller;
use app\index\extend\Basic;
use app\api_broker\untils\PlsDemo;
use app\model\AliYunPhone;
use app\model\BindingPhone;
use app\model\SecretReport;
use think\Db;
class CellPhone extends Basic
{
protected $code = 200;
protected $data = [];
protected $msg = "";
/**
* 绑定手机号
* 解绑之后有延迟
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function bindAXB() {
$params = $this->request->param();
if ($params['phone_a'] || $params['phone_b']) {
$expiration = _EXPIRATION; //过期时间
$phone_a = $this->params['phone_a'];//经纪人手机号
$phone_b = $this->params['phone_b'];//客户手机号
$record = empty($this->params['record'])? true:false; //是否录音
$bind = new AliYunPhone();
$phone_x = $bind->getAliYunPhone($phone_b);
//是否还有未绑定的中间号码
if ($phone_x) {
$result = PlsDemo::bindAxb($phone_a, $phone_b, $expiration, $record, $phone_x['phone_x']);
if ($result->Message == 'OK') {
$bind->where('phone_x',$phone_x['phone_x'])->setField('status',1);
Db::table('aliYun_binding_phone')->insert([
'phone_a' => $phone_a,
'phone_b' => $phone_b,
'subsId' => $result->SecretBindDTO->SubsId,
'requestId' => $result->RequestId,
'record' => $record,
'aliYun_phone_id' => $phone_x['id']
]);
$this->msg = 'Binding success.';
$this->data = ['phone'=>$phone_x['phone_x']];
} else {
$this->code = 101;
$this->msg = 'Binding failure.';
}
} else {
$this->code = 102;
$this->msg = 'Number pool run out.';
}
} else {
$this->code = 101;
$this->msg = 'phone_a or phone_b is null';
}
return $this->response($this->code, $this->msg, $this->data);
}
public function updateBindAXB() {
/* $params = $this->request->param();
if ($params['phone_a'] || $params['phone_b']) {
$this->data = PlsDemo::updateSubscription($this->params['phone_a'], $this->params['phone_b'], _EXPIRATION, $params['record']);
}
return $this->response($this->code, $this->msg,$this->data);*/
}
/**
* 解除绑定关系
*
* @return \think\Response
* @throws \think\exception\DbException
*/
public function agentsUnBind() {
$phone_x = $this->params['phone_x'];
$phone_a = $this->params['phone_a'];
if ($phone_x) {
$phone = new BindingPhone();
$subsId = $phone->getSubsId($phone_x,$phone_a,1);
if ($subsId) {
$result = PlsDemo::unbindSubscription($subsId, $phone_x);
if ($result->Message == 'OK') {
$phone->UnBind($phone_x);
} else {
$this->code = 101;
$this->msg = 'remove binding error';
}
} else {
$this->code = 101;
$this->msg = 'dont\'t have about phone_x info';
}
} else {
$this->code = 101;
$this->msg = 'phone_x is null';
}
$this->params['phone_x'];
return $this->response($this->code, $this->msg);
}
/**
* 通话列表、搜索
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function callLog() {
$result['code'] = 200;
$result['msg'] = '';
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$report = new SecretReport();
$field = 'agents_id,users_id,release_time,start_time,call_type,call_time,time';
$where = [];
if ($this->params['start_time']) {
$where['create_time'] = ['> time', $this->params['start_time']];
}
if ($this->params['end_time']) {
$where['create_time'] = ['< time', $this->params['end_time']];
}
if ($this->params['call_name']) {
$where['realName'] = ['LIKE', $this->params['call_name'].'%'];
}
if ($this->params['call_phone']) {
$where['phone_a'] = [$this->params['call_phone']];
}
if ($this->params['client_phone']) {
$where['phone_b'] = [$this->params['client_phone']];
}
if ($this->params['client_name']) {
$where['user_nick'] = ['LIKE', $this->params['client_name'].'%'];
}
$data = $report->getCallList($pageNo, $pageSize, 'id desc', $field, $where);
return $this->response($result['code'], $result['msg'], $data);
}
/**
* 经纪人通话汇总
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function callCollectList() {
$result['code'] = 200;
$result['msg'] = '';
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$report = new SecretReport();
$field = 'a.id,b.phone,sum(time) as time,agents_id,call_type';
$where = [];
if ($this->params['start_time']) {
$where['create_time'] = ['> time', $this->params['start_time']];
}
if ($this->params['end_time']) {
$where['create_time'] = ['< time', $this->params['end_time']];
}
if ($this->params['agents_name']) {
$where['realName'] = ['LIKE', $this->params['agents_name'].'%'];
}
if ($this->params['phone']) {
$where['phone'] = [$this->params['phone']];
}
$data = $report->getCallCollect($pageNo, $pageSize, 'id desc', $field, $where);
return $this->response($result['code'], $result['msg'], $data);
}
}
\ No newline at end of file
......@@ -143,6 +143,10 @@ Route::group('index', [
'phone_list'=>['index/Phone/index',['method'=>'get']],//隐私号码列表
'bindPhoneList'=>['index/Phone/bindPhoneList',['method'=>'get']],//绑定的隐私号码列表
'edit_aliYunPhone'=>['index/Phone/edit_aliYunPhone',['method'=>'get|post']],//新增或编辑中间号
'callLog' => [ 'index/CellPhone/callLog', [ 'method' => 'get' ] ],//通话记录
'callCollectList' => [ 'index/CellPhone/callCollectList', [ 'method' => 'get' ] ],//经纪人通话汇总
'bindAXB' => [ 'index/CellPhone/bindAXB', [ 'method' => 'post' ] ],//隐私号码
'agentsUnBind' => [ 'index/CellPhone/agentsUnBind', [ 'method' => 'post' ] ],//解除绑定关系
]);
......@@ -240,7 +244,7 @@ Route::group('broker', [
'callCollectList' => [ 'api_broker/CellPhone/callCollectList', [ 'method' => 'get' ] ],//经纪人通话汇总
'getShopList' => ['api_broker/Shop/getShopList', [ 'method' => 'get|post' ] ],
'getShopList' => ['api_broker/Shop/getShopList', [ 'method' => 'get' ] ],
]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment