Commit 5d0f79c1 authored by hujun's avatar hujun

释放号码修改

parent c81f5663
......@@ -3,7 +3,7 @@
error_reporting(E_ERROR | E_PARSE);
define('_MESSAGE_TYPE','SecretReport');
define('_QUEUE_NAME','Alicom-Queue-1186048444498461-SecretReport');
define('_EXPIRATION',date('Y-m-d H:i:s',time()+518400));//手机号码保留七天
define('_EXPIRATION',date('Y-m-d H:i:s',time()+604800));//手机号码保留七天+1天用于释放
return [
'jwt_key' => 'tonglian+123',
......
......@@ -60,7 +60,8 @@ class CellPhone extends Basic
'subsId' => $result->SecretBindDTO->SubsId,
'requestId' => $result->RequestId,
'record' => $record,
'aliYun_phone_id' => $phone_x['id']
'aliYun_phone_id' => $phone_x['id'],
'expiry_date' => _EXPIRATION,
]);
$this->msg = 'Binding success.';
$this->data = ['phone' => $phone_x['phone_x']];
......
......@@ -9,6 +9,7 @@
namespace app\task\controller;
use app\api_broker\untils\PlsDemo;
use app\model\BindingPhone;
use app\model\SecretReport;
use think\Db;
use think\Log;
......@@ -82,20 +83,29 @@ class PrivacyNumber
* @throws \think\exception\DbException
*/
public function releaseNumber() {
$bind_data = Db::table('aliYun_binding_phone')->field('id,aliYun_phone_id,create_time')->where('status',1)->select();
$bind_data = Db::table('aliYun_binding_phone')
->alias('a')
->join('aliyun_phone b','a.aliYun_phone_id=b.id','left')
->field('a.id,aliYun_phone_id,expiry_date,phone_x,phone_a,phone_b,subsId')
->where('a.status',1)
->select();
$time = strtotime(date('Y-m-d')); //今天0点
$binding_phone_id = [];
$phone_id = [];
$bind = new BindingPhone();
foreach ($bind_data as $k=>$v) {
$date = date('Y-m-d',strtotime($bind_data['create_time']) + _EXPIRATION); //有限期
$data = strtotime($date);
$date = strtotime(date('Y-m-d',strtotime($v['expiry_date'])));
//解除绑定
if ($data <= $time) {
Db::table('aliYun_binding_phone')->where('id',$v['id'])->setField('status',0);
Db::table('aliYun_phone')->where('id',$v['aliYun_phone_id'])->setField('status',0);
$binding_phone_id[$k] = $v['id'];
$phone_id[$k] = $v['aliYun_phone_id'];
if ($date <= $time) {
$subsId = $bind->getSubsId($v['phone_x'], $v['phone_a'], $v['phone_b'], 1);
$result = PlsDemo::unbindSubscription($subsId, $v['phone_x']);
if ($result->Message == 'OK') {
$bind->UnBind($v['phone_x'], $v['phone_a'], $v['phone_b']);
$binding_phone_id[$k] = $v['id'];
$phone_id[$k] = $v['aliYun_phone_id'];
}
}
}
......
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