Commit d2d75ee8 authored by hujun's avatar hujun

绑定号码天数

parent a378e1c4
...@@ -81,17 +81,22 @@ class CellPhone extends Basic ...@@ -81,17 +81,22 @@ class CellPhone extends Basic
} }
$day_num = $redis->get('s_day_num'); $day_num = $redis->get('s_day_num');
$release = 1; //是否释放
if (empty($day_num)) { if (empty($day_num)) {
$time = _EXPIRATION; $time = _EXPIRATION;
} else { } else {
if (empty($this->params['landlord'])) { if (empty($this->params['landlord'])) {
$day_num += 1; $time = date('Y-m-d H:i:s', strtotime("+{$day_num} day"));
} else { } else {
$landlord_phone_day = $redis->get('s_landlord_phone_day'); $day_num = $redis->get('s_landlord_phone_day');
$day_num = $landlord_phone_day + 1;
if ($day_num == 0) {
$time = date('Y-m-d H:i:s', time() + 5);
$release = 0;
} else {
$time = date('Y-m-d H:i:s', strtotime("+{$day_num} day"));
}
} }
$time = date('Y-m-d H:i:s', strtotime("+{$day_num} day"));
} }
if ($is_privacy == 1) { if ($is_privacy == 1) {
...@@ -105,7 +110,7 @@ class CellPhone extends Basic ...@@ -105,7 +110,7 @@ class CellPhone extends Basic
if ($result->Code == 'OK') { if ($result->Code == 'OK') {
//记录绑定 //记录绑定
$bind->recordBindPhone($result->SecretBindDTO->SecretNo, $phone_a, $phone_b, $record, $time, $result, '', $is_privacy); $bind->recordBindPhone($result->SecretBindDTO->SecretNo, $phone_a, $phone_b, $record, $time, $result, '', $is_privacy, $release);
$this->msg = '绑定成功。'; $this->msg = '绑定成功。';
$this->data = [ 'phone' => $result->SecretBindDTO->SecretNo ]; $this->data = [ 'phone' => $result->SecretBindDTO->SecretNo ];
...@@ -127,12 +132,12 @@ class CellPhone extends Basic ...@@ -127,12 +132,12 @@ class CellPhone extends Basic
$aliYunPhone = new AliYunPhone(); $aliYunPhone = new AliYunPhone();
$phone_x = $aliYunPhone->getAliYunPhone($phone_a, $phone_b, $is_privacy); //获取未绑定隐号 $phone_x = $aliYunPhone->getAliYunPhone($phone_a, $phone_b, $is_privacy); //获取未绑定隐号
$result = $Rong->setNumber($phone_a, $phone_b, $phone_x['phone_x'], $phone_x['area'], $time, $record2);
$result = $Rong->setNumber($phone_a, $phone_b, $phone_x['phone_x'], $phone_x['area'], $time, $record2);
/*绑定成功*/ /*绑定成功*/
if ($result['statusCode'] == '000000') { if ($result['statusCode'] == '000000') {
$aliYunPhone = new AliYunPhone(); $bind->recordBindPhone($phone_x['phone_x'], $phone_a, $phone_b, $record, $time, 0, $result['data']['mappingId'], $is_privacy, $release); //记录绑定
$aliYunPhone->editStatus($phone_x, $phone_a, $phone_b, $record, $time, 0, $result['data']['mappingId'], $is_privacy); //记录绑定
$this->msg = '绑定成功'; $this->msg = '绑定成功';
$this->data = [ 'phone' => $phone_x['phone_x'] ]; $this->data = [ 'phone' => $phone_x['phone_x'] ];
} else { } else {
...@@ -145,8 +150,7 @@ class CellPhone extends Basic ...@@ -145,8 +150,7 @@ class CellPhone extends Basic
$result = $Rong->setNumber($phone_a, $phone_b, $phone_x['phone_x'], $phone_x['area'], $time, $record2); $result = $Rong->setNumber($phone_a, $phone_b, $phone_x['phone_x'], $phone_x['area'], $time, $record2);
if ($result['statusCode'] == '000000') { if ($result['statusCode'] == '000000') {
$aliYunPhone = new AliYunPhone(); $bind->recordBindPhone($phone_x['phone_x'], $phone_a, $phone_b, $record, $time, 0, $result['data']['mappingId'], $is_privacy, $release); //记录绑定
$aliYunPhone->editStatus($phone_x, $phone_a, $phone_b, $record, $time, 0, $result['data']['mappingId'], $is_privacy); //记录绑定
$this->msg = '绑定成功'; $this->msg = '绑定成功';
$this->data = [ 'phone' => $phone_x['phone_x'] ]; $this->data = [ 'phone' => $phone_x['phone_x'] ];
return $this->response($this->code, $this->msg, $this->data); return $this->response($this->code, $this->msg, $this->data);
......
...@@ -153,12 +153,13 @@ class BindingPhone extends BaseModel ...@@ -153,12 +153,13 @@ class BindingPhone extends BaseModel
* @param $result * @param $result
* @param string $mappingId * @param string $mappingId
* @param int $type * @param int $type
* @param int $status 绑定状态
* @return int|string * @return int|string
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function recordBindPhone($phone_x, $phone_a, $phone_b, $record, $time, $result, $mappingId = '', $type = 1) public function recordBindPhone($phone_x, $phone_a, $phone_b, $record, $time, $result, $mappingId = '', $type = 1, $status = 1)
{ {
$m_ali_phone = new AliYunPhone(); $m_ali_phone = new AliYunPhone();
$phone_id = $m_ali_phone->field('id,bind_num')->where('phone_x', $phone_x)->find(); $phone_id = $m_ali_phone->field('id,bind_num')->where('phone_x', $phone_x)->find();
...@@ -174,7 +175,7 @@ class BindingPhone extends BaseModel ...@@ -174,7 +175,7 @@ class BindingPhone extends BaseModel
$insert_data['aliYun_phone_id'] = $phone_id['id']; $insert_data['aliYun_phone_id'] = $phone_id['id'];
$insert_data['expiry_date'] = $time; $insert_data['expiry_date'] = $time;
$insert_data['type'] = $type; $insert_data['type'] = $type;
$insert_data['status'] = 1; $insert_data['status'] = $status;
return $this->insert($insert_data); return $this->insert($insert_data);
} }
} }
\ No newline at end of file
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