Commit 0c7fcc15 authored by hujun's avatar hujun

隐私号码保留7天有限期,绑定之前使用过的手机号码

parent 36e41edc
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
error_reporting(E_ERROR | E_PARSE); error_reporting(E_ERROR | E_PARSE);
define('_MESSAGE_TYPE','SecretReport'); define('_MESSAGE_TYPE','SecretReport');
define('_QUEUE_NAME','Alicom-Queue-1186048444498461-SecretReport'); define('_QUEUE_NAME','Alicom-Queue-1186048444498461-SecretReport');
define('_EXPIRATION',518400); define('_EXPIRATION',date('Y-m-d H:i:s',time()+518400));//手机号码保留七天
return [ return [
'jwt_key' => 'tonglian+123', 'jwt_key' => 'tonglian+123',
// 应用模式状态 // 应用模式状态
......
...@@ -10,7 +10,8 @@ namespace app\api_broker\controller; ...@@ -10,7 +10,8 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\untils\PlsDemo; use app\api_broker\untils\PlsDemo;
use app\model\BindingPhone;
use app\model\AliyunPhone;
use think\Config; use think\Config;
use think\Db; use think\Db;
...@@ -29,11 +30,14 @@ class CellPhone extends Basic ...@@ -29,11 +30,14 @@ class CellPhone extends Basic
public function bindAXB() { public function bindAXB() {
$params = $this->request->param(); $params = $this->request->param();
if ($params['phone_a'] || $params['phone_b']) { if ($params['phone_a'] || $params['phone_b']) {
$expiration = date('Y-m-d H:i:s',time()+_EXPIRATION); //过期时间 $expiration = _EXPIRATION; //过期时间
$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'])? false:true; //是否录音 $record = empty($this->params['record'])? false:true; //是否录音
$result = PlsDemo::bindAxb($phone_a, $phone_b, $expiration, $record, Config::get('_DefaultPoolKey'));
$bind = new AliyunPhone();
$phone_x = $bind->getAliYunPhone($phone_b);
$result = PlsDemo::bindAxb($phone_a, $phone_b, $expiration, $record, Config::get('_DefaultPoolKey'), $phone_x);
if ($result->Message == 'OK') { if ($result->Message == 'OK') {
Db::table('aliyun_binding_phone')->save([ Db::table('aliyun_binding_phone')->save([
......
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/1/20
* Time: 17:52
*/
namespace app\model;
use think\Db;
class AliyunPhone extends BaseModel
{
/**
* 获取未绑定的手机号码
*
* @param string $phone
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAliYunPhone($phone = '') {
$where['status'] = 1;
if ($phone) {
//查询之前一次绑定关系的号码
$phone_x = Db::table('aliyun_binding_phone')->field('phone_x')->alias('a')
->join('aliyun_phone b','a.aliyun_phone_id = b.id','left')
->where([
'phone_b' => $phone,
'a.status' => 1
])->value('phone_x');
$where['phone_x'] = $phone_x;
}
$result = Db::table('aliyun_phone')->field('phone_x')->whereOr($where)->find();
return $result;
}
}
\ 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