|
|
@@ -3,9 +3,9 @@
|
|
|
namespace App\Http\Controllers\Api\v1;
|
|
|
|
|
|
use App\Http\Controllers\Api\BaseController;
|
|
|
+use App\Services\GongdengOrderService;
|
|
|
use App\Services\NotifyService;
|
|
|
use App\Services\RedisService;
|
|
|
-use App\Services\SiyuanService;
|
|
|
use App\Services\WechatService;
|
|
|
use Psr\Http\Message\MessageInterface;
|
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
@@ -19,23 +19,26 @@ use Psr\Http\Message\ResponseInterface;
|
|
|
*/
|
|
|
class NotifyController extends BaseController
|
|
|
{
|
|
|
+ protected $response = null;
|
|
|
+
|
|
|
/**
|
|
|
* 构造函数
|
|
|
* @author wesmiler
|
|
|
* @since 2020/11/11
|
|
|
* NotifyController constructor.
|
|
|
*/
|
|
|
- public function __construct()
|
|
|
+ public function __construct(ResponseInterface $response)
|
|
|
{
|
|
|
parent::__construct();
|
|
|
|
|
|
- $this->service = new SiyuanService();
|
|
|
+ $this->service = new GongdengOrderService();
|
|
|
+ $this->response = $response;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 支付回调
|
|
|
*/
|
|
|
- public function pay($scene, ResponseInterface $response){
|
|
|
+ public function pay($scene){
|
|
|
$postData = request()->all();
|
|
|
$sign = request()->headers->get('Wechatpay-Signature');
|
|
|
$nonce = request()->headers->get('Wechatpay-Nonce');
|
|
|
@@ -43,7 +46,7 @@ class NotifyController extends BaseController
|
|
|
/* $sign = 'JnLbXF3HLEeAVuyVoyedezPV8+mRZ93+rmlbHOIm1I0+YKboBTUmVNwlV9KKOVPXPBQENxjHqT6fR5Qx326uVZryb\/JM+lTdvl3j+XVD0F5NJWZKGu7Zykf69yYMY3wbe1++em\/iiouZLg8\/5KRp7nvNMLL383gemOMRbsYN3+dZ++62qrmVZxo00fHlK+AjxXmV38KRCLtfLWfIsUXw9Zi8hXqHbf+s\/pBthV+Ouasw0Eit4f4E3aDjp4baFD70s\/RsbcqTn8UqxCurRNgm7kCtLphzStPnEUC1dfvIWZQIuJ+BaAqstj9y7RW5CdF7aZPqhXnPETvB8ZynSTYl3Q==';
|
|
|
$timestamp = '1626663968';
|
|
|
$nonce = 'yWa6xnLUDyqfVYhjTnWcafDuNzgoXMNa';*/
|
|
|
- $body = NotifyService::getBody($response);
|
|
|
+ $body = NotifyService::getBody($this->response);
|
|
|
$signStr = "{$timestamp}\n{$nonce}\n{$body}\n";
|
|
|
$id = isset($postData['id'])? '_'.$postData['id'] : '';
|
|
|
RedisService::set('caches:payments:'.$scene.':result'.$id.'_'.date('YmdHis'), ['result'=> $postData,'sign'=> $sign,'date'=> date('Y-m-d H:i:s')], 7200);
|