Commit 29cc85d6 authored by hujun's avatar hujun

批量插入

parent 6eeb6be9
......@@ -250,4 +250,13 @@ class BindingPhone extends BaseModel
->where('create_time','between', [$date. ' 00:00:00', $date . ' 23:59:59'])
->count();
}
/**
* @param $data
* @return array|false
* @throws \Exception
*/
public function updateAll($data) {
return $this->saveAll($data);
}
}
\ No newline at end of file
......@@ -137,9 +137,7 @@ class PrivacyNumber
/**
* 释放过期的绑定关系
*
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \Exception
*/
public function releaseNumber()
{
......@@ -176,8 +174,10 @@ class PrivacyNumber
//释放阿里云隐私号码
$result = PlsDemo::unbindSubscription($v['subsId'], $v['phone_x']);
if ($result->Message == 'OK') {
// $bind->unBind($v['phone_x'], $v['phone_a'], $v['phone_b'], $result->RequestId);
$bind->unBindTable($v['id']);
$update[] = [
'id' => $v['id'],
'status' => 0
];
$binding_phone_id[$k] = $v['id'];
$phone_id[$k] = $v['aliYun_phone_id'];
}
......@@ -189,15 +189,20 @@ class PrivacyNumber
$tong_xun = new RongDemo();
$result = $tong_xun->releaseNumber($v['mappingId']);/*解绑*/
if ($result['statusCode'] == '000000') {
// $bind->unBind($v['phone_x'], $v['phone_a'], $v['phone_b']);
$bind->unBindTable($v['id']);
$binding_phone_id[$k] = $v['id'];
$phone_id[$k] = $v['aliYun_phone_id'];
$update[] = [
'id' => $v['id'],
'status' => 0
];
} else {
$yun_result = $tong_xun->getBindInfo($v['phone_a'], $v['phone_b'], $v['phone_x'], $v['mappingId']);
if (empty($yun_result['data']['mappingId'])) {
// $bind->unBind($v['phone_x'], $v['phone_a'], $v['phone_b']);
$bind->unBindTable($v['id']);
$update[] = [
'id' => $v['id'],
'status' => 0
];
}
}
......@@ -206,6 +211,11 @@ class PrivacyNumber
}
}
if (!empty($update)) {
$bind->updateAll($update);
unset($update);
}
$id['aliYun_binding_phone'] = implode(',', $binding_phone_id);
$id['aliYun_phone'] = implode(',', array_unique($phone_id));
Log::write(json_encode($id), 'AliYunReleaseNumber'); //记录日志
......@@ -305,10 +315,6 @@ class PrivacyNumber
/**
* 去除过期绑定关系
*
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function checkBindPhone()
{
......
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