Commit 818fa939 authored by clone's avatar clone

Merge branch 'test'

parents 15d755ff b41ad3ca
......@@ -14,7 +14,9 @@ use app\api_broker\untils\PlsDemo;
use app\model\AAgentsPhone;
use app\model\AliYunPhone;
use app\model\BindingPhone;
use think\Cache;
use think\Db;
use think\Log;
class CellPhone extends Basic
{
......@@ -37,14 +39,18 @@ class CellPhone extends Basic
$phone_a = $this->params['phone_a'];//经纪人手机号
$phone_b = $this->params['phone_b'];//客户手机号
$record = empty($this->params['record']) ? true : false; //是否录音
$setting = Cache::get('Setting'); //获取配置
$aliYunPhone = new AliYunPhone();
$bind = new BindingPhone();
$field = 'phone_x';
$where['a.status'] = 1;
$where['a.phone_a'] = $phone_a;
$where['a.phone_b'] = $phone_b;
$phone_x = $bind->getPhoneX($field, $where);
if ($setting['is_privacy'] == 1) {
$phone_x = $bind->getPhoneX($field, $where);
if ($phone_x) {
$this->data = ['phone' => $phone_x['phone_x']];
} else {
......@@ -52,7 +58,13 @@ class CellPhone extends Basic
//是否还有未绑定的中间号码
if ($phone_x) {
$result = PlsDemo::bindAxb($phone_a, $phone_b, _EXPIRATION, $record, $phone_x['phone_x']);
if (empty($setting['day_num'])) {
$time = _EXPIRATION;
} else {
$setting['day_num'] += 1;
$time = date('Y-m-d H:i:s',strtotime("+{$setting['day_num']} day"));
}
$result = PlsDemo::bindAxb($phone_a, $phone_b, $time, $record, $phone_x['phone_x']);
if ($result->Message == 'OK') {
$aliYunPhone->where('phone_x', $phone_x['phone_x'])->setField('status', 1);
Db::table('aliYun_binding_phone')->insert([
......@@ -62,7 +74,7 @@ class CellPhone extends Basic
'requestId' => $result->RequestId,
'record' => $record,
'aliYun_phone_id' => $phone_x['id'],
'expiry_date' => _EXPIRATION,
'expiry_date' => $time,
]);
$this->msg = 'Binding success.';
$this->data = ['phone' => $phone_x['phone_x']];
......@@ -70,11 +82,22 @@ class CellPhone extends Basic
$this->code = 101;
$this->msg = '绑定失败,请重试!';
}
Log::write(json_encode($result),'AliYunBindAxb'); //记录日志
} else {
$this->code = 102;
$this->msg = '号码使用完,请联系运营人员。';
}
}
} else {
$this->data = ['phone' => $phone_b];
Db::table('aliYun_secret_report')->insert([
'phone_no' => $phone_a,
'secret_no' => $phone_b,
'peer_no' => $phone_b,
'call_type' => 1,
'record_down' => 3,
]);
}
} else {
$this->code = 101;
$this->msg = 'phone_a or phone_b is null';
......@@ -129,6 +152,8 @@ class CellPhone extends Basic
$phone_b = $this->params['phone_b'];
if ($phone_x && $phone_a && $phone_b) {
$setting = Cache::get('Setting'); //获取配置
if ($setting['is_privacy'] == 1) {
$phone = new BindingPhone();
$subsId = $phone->getSubsId($phone_x,$phone_a,$phone_b,1);
......@@ -144,6 +169,7 @@ class CellPhone extends Basic
$this->code = 101;
$this->msg = 'dont\'t have about phone_x info';
}
}
} else {
$this->code = 101;
$this->msg = 'phone_x or phone_a or phone_b is null';
......
......@@ -37,7 +37,7 @@
<li role="presentation">
<a href="/admin.php/index/version.html"> 版本号管理</a>
</li>
<!-- <li role="presentation">
<li role="presentation">
<a href="/admin.php/index/auth.html">角色管理</a>
</li>
<li role="presentation">
......@@ -48,11 +48,11 @@
</li>
<li role="presentation">
<a href="/admin.php/index/districtList.html">部门列表</a>
</li>-->
</li>
<li role="presentation">
<a href="/admin.php/index/remarkFollowIndex.html">跟进列表</a>
</li>
<!-- <li role="presentation">
<li role="presentation">
<a href="/admin.php/index/authRuleIndex.html">权限管理</a>
</li>
<li role="presentation">
......@@ -63,7 +63,7 @@
</li>
<li role="presentation">
<a href="/admin.php/index/BusinessDistrict.html">商圈列表</a>
</li>-->
</li>
<li role="presentation">
<a href="/admin.php/index/CellPhoneAgentIndex.html">经纪人通话列表</a>
</li>
......
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