Commit 36e41edc authored by hujun's avatar hujun

隐私号码

parent 3ab2ec4c
......@@ -3,9 +3,11 @@
error_reporting(E_ERROR | E_PARSE);
define('_MESSAGE_TYPE','SecretReport');
define('_QUEUE_NAME','Alicom-Queue-1186048444498461-SecretReport');
define('_EXPIRATION',1800);
define('_EXPIRATION',518400);
return [
'jwt_key' => 'tonglian+123',
'jwt_key' => 'tonglian+123',
// 应用模式状态
'app_status' => 'dev-config',
'app_status' => 'dev-config',
'_DefaultPoolKey' => 'FC100000022056027',
'tonglianshangyePoolKey' =>'FC100000027622039'
];
\ No newline at end of file
......@@ -8,16 +8,17 @@
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\untils\MsgDemo;
use app\api_broker\untils\PlsDemo;
use app\model\BindingPhone;
use think\Config;
use think\Db;
class CellPhone extends Basic
{
protected $code = 200;
protected $data;
protected $msg;
protected $msg = "";
/**
* 绑定手机号
......@@ -28,16 +29,30 @@ class CellPhone extends Basic
public function bindAXB() {
$params = $this->request->param();
if ($params['phone_a'] || $params['phone_b']) {
$result = PlsDemo::bindAxb($this->params['phone_a'], $this->params['phone_b'], _EXPIRATION, $params['record']);
if ($result['Code'] != 'OK') {
$expiration = date('Y-m-d H:i:s',time()+_EXPIRATION); //过期时间
$phone_a = $this->params['phone_a'];//经纪人手机号
$phone_b = $this->params['phone_b'];//客户手机号
$record = empty($this->params['record'])? false:true; //是否录音
$result = PlsDemo::bindAxb($phone_a, $phone_b, $expiration, $record, Config::get('_DefaultPoolKey'));
if ($result->Message == 'OK') {
Db::table('aliyun_binding_phone')->save([
'phone_a' => $phone_a,
'phone_b' => $phone_b,
'SubsId' => $result->SecretBindDTO->SubsId,
'RequestId' => $result->RequestId,
'record' => $record
]);
$this->msg = 'Binding success';
} else {
$this->code = 101;
$this->msg = '绑定失败';
$this->msg = 'Binding failure';
}
} else {
$this->code = 101;
$this->msg = 'phone_a or phone_b is null';
}
return $this->response($this->code, $this->msg,$this->data);
return $this->response($this->code, $this->msg);
}
public function updateBindAXB() {
......@@ -48,4 +63,8 @@ class CellPhone extends Basic
return $this->response($this->code, $this->msg,$this->data);*/
}
public function agentsUnBind() {
PlsDemo::unbindSubscription();
}
}
\ No newline at end of file
......@@ -69,14 +69,18 @@ class PlsDemo
return static::$acsClient;
}
/**
* AXB绑定接口
*
* @return stdClass
* @throws ClientException
* @param $phoneA
* @param $phoneB
* @param $time 过期时间
* @param bool $isRecordingEnabled 是否录音
* @param string $poolKey 号码池Key
* @param string $phoneNoX 中间号码
* @return mixed|\SimpleXMLElement
*/
public static function bindAxb($phoneA, $phoneB, $time, $isRecordingEnabled=false, $poolKey='FC100000022056027') {
public static function bindAxb($phoneA, $phoneB, $time, $isRecordingEnabled=false, $poolKey='FC100000022056027', $phoneNoX = '17091955105') {
//组装请求对象-具体描述见控制台-文档部分内容
$request = new BindAxbRequest();
......@@ -91,7 +95,7 @@ class PlsDemo
$request->setPhoneNoB($phoneB);
//可选:指定X号码进行绑定
$request->setPhoneNoX("17091955105");
$request->setPhoneNoX($phoneNoX);
//可选:期望分配X号码归属的地市(省去地市后缀后的城市名称)
$request->setExpectCity("北京");
......
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/1/20
* Time: 17:52
*/
namespace app\model;
class BindingPhone extends BaseModel
{
// 设置当前模型对应的完整数据表名称
protected $table = 'aliyun_binding_phone';
}
\ 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