Commit 818fa939 authored by clone's avatar clone

Merge branch 'test'

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