Commit 2145880e authored by hujun's avatar hujun

释放不需要的号码

parent 99d86d75
......@@ -259,4 +259,14 @@ class BindingPhone extends BaseModel
public function updateAll($data) {
return $this->saveAll($data);
}
/**
* @param $data
* @param $where
* @return BindingPhone
*/
public function updateData($data, $where)
{
return $this->where($where)->update($data);
}
}
\ No newline at end of file
......@@ -768,6 +768,7 @@ Route::group('task', [
'updateDownVoiceId' => ['task/PrivacyNumber/updateDownVoiceIdV2', ['method' => 'post | get']], //更新下载数据库
'getVoiceByCallId' => ['task/PrivacyNumber/getVoiceByCallId', ['method' => 'post | get']], //更新下载数据库
'dateFilePath' => ['task/PrivacyNumber/dateFilePath', ['method' => 'post | get']], //修改下载路径
'releasePhoneB' => ['task/PrivacyNumber/releasePhoneB', ['method' => 'post | get']], //释放不需要的号码
'updateShopTask' => ['task/JobTask/updateShopTask', ['method' => 'post | get']], //默认跟进
'updateShopImageIdTask' => ['task/JobTask/updateShopImageIdTask', ['method' => 'post | get']], //默认图片
'image' => ['task/JobTask/image', ['method' => 'post | get']], //压缩图片
......
......@@ -16,6 +16,7 @@ use app\api_broker\untils\RongDemo;
use app\extra\RedisExt;
use app\model\AAgents;
use app\model\AAgentsPhone;
use app\model\AliYunPhone;
use app\model\AliYunSecretReport;
use app\model\AliyunVoiceDown;
use app\model\BindingPhone;
......@@ -640,6 +641,42 @@ class PrivacyNumber
return ;
}
/**
* 释放不需要的号码
*/
public function releasePhoneB() {
if (empty($_GET['phone_x'])) {
return Response::create(['code' => 101, 'msg' => '参数错误', 'data' => ''], 'json');
}
$m_phone = new AliYunPhone();
$phone_x_id = $m_phone->getFieldOneValue('id', ['phone_x' => $_GET['phone_x'], 'status' => ['<', 3]]);
if (empty($phone_x_id)) {
return Response::create(['code' => 101, 'msg' => '没有该号码', 'data' => ''], 'json');
}
$where['aliYun_phone_id'] = $phone_x_id;
$where['status'] = 1;
$total = $this->m_bind->getTotal($where);
$page_size = 100;
$page_total = ceil($total / $page_size);
$call = new CallPhoneService();
$num = 0;
for ($i = 0; $i < $page_total; $i++) {
$phone_data = $this->m_bind->getList($i, $page_size, '', 'id,phone_a,phone_b,subsId', $where);
foreach ($phone_data as $k => $v) {
$info = $this->redis->get($v['phone_a'].'_'.$_GET['phone_x'].'_'.$v['phone_b'].'_1');
$id = explode('_', $info);
$call->agentsUnBindRedis($v['phone_a'], $v['phone_b'], $_GET['phone_x'], 0, $id[0]);
$id_array[] = $v['id'];
}
if (isset($id_array)) {
$num += $this->m_bind->updateData(['status'=>0], ['id'=>['in', $id_array]]);
}
}
return Response::create(['code' => 200, 'msg' => '', 'data' => '释放数量:'.$num], 'json');
}
/**
* 阿里云回调下载录音
*/
......
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