新增物流回调
This commit is contained in:
@@ -535,8 +535,6 @@ class CallBackController extends AbstractController
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 微信支付返回错误响应
|
||||
* @param string $message
|
||||
@@ -733,8 +731,87 @@ class CallBackController extends AbstractController
|
||||
}
|
||||
|
||||
// 处方平台物流回调
|
||||
public function platformLogisticsCallBack(){
|
||||
public function platformLogisticsCallBack(): ResponseInterface
|
||||
{
|
||||
$request_params = $this->request->all();
|
||||
try {
|
||||
Log::getInstance()->info("处方平台物流回调数据:" . json_encode($request_params,JSON_UNESCAPED_UNICODE));
|
||||
|
||||
if (!isset($request_params['sign']) ){
|
||||
Log::getInstance()->error("处方平台物流回调数据处理失败:缺少签名结果");
|
||||
return $this->platformLogisticsErrorReturn("缺少签名结果");
|
||||
}
|
||||
|
||||
if (!isset($request_params['nonce']) ){
|
||||
Log::getInstance()->error("处方平台物流回调数据处理失败:缺少随机数");
|
||||
return $this->platformLogisticsErrorReturn("缺少随机数");
|
||||
}
|
||||
|
||||
if (!isset($request_params['timestamp']) ){
|
||||
Log::getInstance()->error("处方平台物流回调数据处理失败:缺少签名时间戳");
|
||||
return $this->platformLogisticsErrorReturn("缺少签名时间戳");
|
||||
}
|
||||
|
||||
if (!isset($request_params['paramJsonStr']) ){
|
||||
Log::getInstance()->error("处方平台物流回调数据处理失败:缺少数据体");
|
||||
return $this->platformLogisticsErrorReturn("缺少数据体");
|
||||
}
|
||||
|
||||
$param_json_str = json_decode($request_params['paramJsonStr'],true);
|
||||
if (empty($param_json_str)){
|
||||
Log::getInstance()->error("处方平台物流回调数据处理失败:数据体解析失败");
|
||||
return $this->platformLogisticsErrorReturn("数据体解析失败");
|
||||
}
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// 验证失败
|
||||
Log::getInstance()->error("Im回调数据处理失败:" . $e->getMessage());
|
||||
return $this->platformLogisticsErrorReturn($e->getMessage());
|
||||
}
|
||||
|
||||
return $this->platformLogisticsSuccessReturn();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方平台物流返回错误响应
|
||||
* @param string $message
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
protected function platformLogisticsErrorReturn(string $message): ResponseInterface
|
||||
{
|
||||
return $this->response
|
||||
->withStatus(200)
|
||||
->withBody(
|
||||
new SwooleStream(
|
||||
strval(
|
||||
json_encode([
|
||||
'resultCode' => '0',
|
||||
'resultDesc' => $message,
|
||||
], JSON_UNESCAPED_UNICODE)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方平台物流返回正确响应
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
protected function platformLogisticsSuccessReturn(): ResponseInterface
|
||||
{
|
||||
return $this->response
|
||||
->withStatus(200)
|
||||
->withBody(
|
||||
new SwooleStream(
|
||||
strval(
|
||||
json_encode([
|
||||
'resultCode' => "1000",
|
||||
'resultDesc' => "成功",
|
||||
], JSON_UNESCAPED_UNICODE)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ class TestController extends AbstractController
|
||||
// $this->test_3();
|
||||
// $this->test_4();
|
||||
// $this->test_6();
|
||||
$this->test_9();
|
||||
// $this->test_9();
|
||||
|
||||
}
|
||||
|
||||
@@ -391,6 +391,12 @@ class TestController extends AbstractController
|
||||
public function test_9(){
|
||||
$ca = new Ca();
|
||||
$result = $ca->getSignedFile("491925054435950592","1638477783898161153");
|
||||
if (empty($result)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 上传阿里云oss
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user