调整变量名称

This commit is contained in:
Anyon 2020-12-14 18:31:52 +08:00
parent 0df6a2480e
commit d98500dd75
4 changed files with 17 additions and 17 deletions

View File

@ -171,10 +171,10 @@ abstract class PaymentService extends Service
/** /**
* 支付通知处理 * 支付通知处理
* @param string $type * @param string $param 支付通道-支付编号
* @return string * @return string
*/ */
abstract public function notify(string $type = ''): string; abstract public function notify(string $param = ''): string;
/** /**
* 订单主动查询 * 订单主动查询

View File

@ -63,19 +63,19 @@ class AliPaymentService extends PaymentService
/** /**
* 支付结果处理 * 支付结果处理
* @param string $type 支付通道 * @param string $param 支付通道
* @return string * @return string
* @throws \WeChat\Exceptions\InvalidResponseException * @throws \WeChat\Exceptions\InvalidResponseException
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
*/ */
public function notify(string $type = ''): string public function notify(string $param = ''): string
{ {
if (is_numeric(stripos($type, '-'))) { if (is_numeric(stripos($param, '-'))) {
[$payType, $payId] = explode('-', $type); [$payType, $payId] = explode('-', $param);
} else { } else {
[$payType, $payId] = [$type ?: static::$type, static::$id]; [$payType, $payId] = [$param ?: static::$type, static::$id];
} }
$notify = \AliPay\App::instance($this->params)->notify(); $notify = \AliPay\App::instance($this->params)->notify();
if (in_array($notify['trade_status'], ['TRADE_SUCCESS', 'TRADE_FINISHED'])) { if (in_array($notify['trade_status'], ['TRADE_SUCCESS', 'TRADE_FINISHED'])) {

View File

@ -125,18 +125,18 @@ class JoinPaymentService extends PaymentService
/** /**
* 支付结果处理 * 支付结果处理
* @param string $type 支付通道 * @param string $param 支付通道
* @return string * @return string
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
*/ */
public function notify(string $type = ''): string public function notify(string $param = ''): string
{ {
if (is_numeric(stripos($type, '-'))) { if (is_numeric(stripos($param, '-'))) {
[$payType, $payId] = explode('-', $type); [$payType, $payId] = explode('-', $param);
} else { } else {
[$payType, $payId] = [$type ?: static::$type, static::$id]; [$payType, $payId] = [$param ?: static::$type, static::$id];
} }
$notify = $this->app->request->get(); $notify = $this->app->request->get();
foreach ($notify as &$item) $item = urldecode($item); foreach ($notify as &$item) $item = urldecode($item);

View File

@ -100,19 +100,19 @@ class WechatPaymentService extends PaymentService
/** /**
* 支付结果处理 * 支付结果处理
* @param string $type 支付通道 * @param string $param 支付通道
* @return string * @return string
* @throws \WeChat\Exceptions\InvalidResponseException * @throws \WeChat\Exceptions\InvalidResponseException
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
*/ */
public function notify(string $type = ''): string public function notify(string $param = ''): string
{ {
if (is_numeric(stripos($type, '-'))) { if (is_numeric(stripos($param, '-'))) {
[$payType, $payId] = explode('-', $type); [$payType, $payId] = explode('-', $param);
} else { } else {
[$payType, $payId] = [$type ?: static::$type, static::$id]; [$payType, $payId] = [$param ?: static::$type, static::$id];
} }
$notify = $this->payment->getNotify(); $notify = $this->payment->getNotify();
if ($notify['result_code'] == 'SUCCESS' && $notify['return_code'] == 'SUCCESS') { if ($notify['result_code'] == 'SUCCESS' && $notify['return_code'] == 'SUCCESS') {