作者 何书鹏
1 个管道 的构建 通过 耗费 1 秒

隐私通话测试

... ... @@ -182,7 +182,7 @@ class Dispute extends Backend
(new Wechat)->tmplmsg($openid,$send_data,$templateid,$url);
// 解绑隐私通话
\app\api\controller\Order::unbindPrivateNumber($order['id']);
\app\api\controller\Order::unbindPrivateNumber($row['order_id']);
// 修改数据
$result = $row->allowField(true)->save($params);
... ...
... ... @@ -95,22 +95,4 @@ if(!function_exists('range_time')){
return false;
}
}
}
if(!function_exists('build_wsse_header')){
/**
* 构建X-WSSE值
*
* @param string $appKey
* @param string $appSecret
* @return string
*/
function build_wsse_header($appKey, $appSecret) {
date_default_timezone_set("UTC");
$Created = date('Y-m-d\TH:i:s\Z'); //Created
$nonce = uniqid(); //Nonce
$base64 = base64_encode(hash('sha256', ($nonce . $Created . $appSecret), TRUE)); //PasswordDigest
return sprintf("UsernameToken Username=\"%s\",PasswordDigest=\"%s\",Nonce=\"%s\",Created=\"%s\"", $appKey, $base64, $nonce, $Created);
}
}
\ No newline at end of file
... ...
... ... @@ -813,7 +813,7 @@ class Order extends Api
if($count > 1){
$has_number->delete();
}else{
PrivateNumber::unbind($has_number['subscription_id']);
(new PrivateNumber)->unbind($has_number['subscription_id']);
}
}
}
... ...
... ... @@ -17,7 +17,7 @@ class PrivateNumber extends Api
//如果接口已经设置无需登录,那也就无需鉴权了
//
// 无需登录的接口,*表示全部
protected $noNeedLogin = ['bind', 'search', 'unbind'];
protected $noNeedLogin = ['*'];
// 无需鉴权的接口,*表示全部
protected $noNeedRight = ['*'];
... ... @@ -203,7 +203,7 @@ class PrivateNumber extends Api
/**
* 解绑接口
*/
public static function unbind($subscriptionId = '',$relationNum = '')
public function unbind($subscriptionId = '',$relationNum = '')
{
// 必填,请参考"开发准备"获取如下数据,替换为实际值
$realUrl = config('privatenumber.real_url'); // APP接入地址+接口访问URI
... ... @@ -250,11 +250,11 @@ class PrivateNumber extends Api
// print_r($response . PHP_EOL); // 打印响应结果
$res = json_decode($response,true);
if($res['resultcode'] != '0') {
self::error($res['resultdesc']);
$this->error($res['resultdesc']);
}
Db::name('private_number')->where('subscription_id',$subscriptionId)->delete();
} catch (Exception $e) {
self::error($e->getMessage());
$this->error($e->getMessage());
}
}
... ...
... ... @@ -417,3 +417,21 @@ if(!function_exists('send_sms2')) {
return $return;
}
}
if(!function_exists('build_wsse_header')){
/**
* 构建X-WSSE值
*
* @param string $appKey
* @param string $appSecret
* @return string
*/
function build_wsse_header($appKey, $appSecret) {
date_default_timezone_set("UTC");
$Created = date('Y-m-d\TH:i:s\Z'); //Created
$nonce = uniqid(); //Nonce
$base64 = base64_encode(hash('sha256', ($nonce . $Created . $appSecret), TRUE)); //PasswordDigest
return sprintf("UsernameToken Username=\"%s\",PasswordDigest=\"%s\",Nonce=\"%s\",Created=\"%s\"", $appKey, $base64, $nonce, $Created);
}
}
... ...