feat: 增加微信支付查询接口及条码支付功能
This commit is contained in:
parent
1eb395bbe0
commit
f1219258c3
@ -68,6 +68,7 @@ class PayController extends BaseApiController
|
|||||||
public function wechatQuery()
|
public function wechatQuery()
|
||||||
{
|
{
|
||||||
$order_no = $this->request->get('order_no');
|
$order_no = $this->request->get('order_no');
|
||||||
|
$recharge = $this->request->get('recharge',0);
|
||||||
$order = [
|
$order = [
|
||||||
'out_trade_no' => $order_no,
|
'out_trade_no' => $order_no,
|
||||||
];
|
];
|
||||||
@ -75,7 +76,11 @@ class PayController extends BaseApiController
|
|||||||
|
|
||||||
$res = $app->wechat->query($order);
|
$res = $app->wechat->query($order);
|
||||||
if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') {
|
if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') {
|
||||||
PayNotifyLogic::handle('wechat_common', $res['out_trade_no'], $res);
|
if($recharge==0){
|
||||||
|
PayNotifyLogic::handle('wechat_common', $res['out_trade_no'], $res);
|
||||||
|
}else{
|
||||||
|
PayNotifyLogic::handle('recharge', $res['out_trade_no'], $res);
|
||||||
|
}
|
||||||
return $this->success('支付成功');
|
return $this->success('支付成功');
|
||||||
} else {
|
} else {
|
||||||
return $this->fail('订单支付中');
|
return $this->fail('订单支付中');
|
||||||
|
@ -61,7 +61,7 @@ class StoreController extends BaseApiController
|
|||||||
$order = UserRecharge::create($data);
|
$order = UserRecharge::create($data);
|
||||||
|
|
||||||
$order['pay_price']=$order['price'];
|
$order['pay_price']=$order['price'];
|
||||||
$result = PaymentLogic::codepay($auth_code, $order);
|
$result = PaymentLogic::codepay($auth_code, $order,'条码支付');
|
||||||
if (PaymentLogic::hasError()) {
|
if (PaymentLogic::hasError()) {
|
||||||
return $this->fail(PaymentLogic::getError(), $params);
|
return $this->fail(PaymentLogic::getError(), $params);
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ class PaymentLogic extends BaseLogic
|
|||||||
/**
|
/**
|
||||||
* 微信条码支付
|
* 微信条码支付
|
||||||
*/
|
*/
|
||||||
public static function codepay($auth_code, $order)
|
public static function codepay($auth_code, $order,$description='条码商品')
|
||||||
{
|
{
|
||||||
$pattern = '/^(10|11|12|13|14|15)\d{16}$/';
|
$pattern = '/^(10|11|12|13|14|15)\d{16}$/';
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ class PaymentLogic extends BaseLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$order = [
|
$order = [
|
||||||
'description' => '条码商品',
|
'description' => $description,
|
||||||
'out_trade_no' => (string)$order['order_id'],
|
'out_trade_no' => (string)$order['order_id'],
|
||||||
'payer' => [
|
'payer' => [
|
||||||
'auth_code' => (string)$auth_code
|
'auth_code' => (string)$auth_code
|
||||||
|
Loading…
x
Reference in New Issue
Block a user