Commit 861567a2 authored by 万继龙's avatar 万继龙

Merge branch 'develop' into 'master'

add: 增加解密工具,增加日志跟踪

See merge request bp/pay!39
parents 10c1a6e2 c427e71e
...@@ -22,9 +22,10 @@ class Sdk { ...@@ -22,9 +22,10 @@ class Sdk {
*/ */
public static function call($url, $params, $headers = []) { public static function call($url, $params, $headers = []) {
/**/ /**/ // X-TRACE-ID、X-REQUEST-ID
$header = [ $header = [
'X-REQUEST-ID'=>Tracer::getTraceId(), //HTTP-X-TRACE-ID
'X-TRACE-ID'=>Tracer::getTraceId(),
]; ];
$headers = array_merge($headers, $header); $headers = array_merge($headers, $header);
...@@ -43,10 +44,7 @@ class Sdk { ...@@ -43,10 +44,7 @@ class Sdk {
] ]
*/ */
$isTrace = \Yaf\Application::app()->getConfig()->get('trace.open'); FileLog::info('sdk api:', ['traceId'=>Tracer::getTraceId(), 'url'=>$url, 'req'=>$params, 'res'=>$data]);
if($isTrace != false) {
FileLog::info('sdk api:', ['traceId'=>Tracer::getTraceId(), 'url'=>$url, 'req'=>$params, 'res'=>$data]);
}
if(!empty($data['response']['code'])) { if(!empty($data['response']['code'])) {
throw new BaseException(['msg'=>$data['response']['reason']??'', 'code'=>$data['response']['code']]); throw new BaseException(['msg'=>$data['response']['reason']??'', 'code'=>$data['response']['code']]);
......
...@@ -99,4 +99,17 @@ class CallbackController extends Base ...@@ -99,4 +99,17 @@ class CallbackController extends Base
$this->success(['result'=>$list, 'step'=>$step]); $this->success(['result'=>$list, 'step'=>$step]);
} }
public function decryptAction() {
$params = $this->params;
$key = $params['key'] ?? '';
if(empty($key)) {
throw new \App\Exception\BaseException(['msg'=>'请传入解密数据', 'code'=>'2031']);
}
$decrypt = gzuncompress(base64_decode($key));
$this->success(['result'=>$decrypt]);
}
} }
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