diff --git a/app/api/controller/PayController.php b/app/api/controller/PayController.php index 6603df95e..90e6bfceb 100644 --- a/app/api/controller/PayController.php +++ b/app/api/controller/PayController.php @@ -68,6 +68,7 @@ class PayController extends BaseApiController public function wechatQuery() { $order_no = $this->request->get('order_no'); + $recharge = $this->request->get('recharge',0); $order = [ 'out_trade_no' => $order_no, ]; @@ -75,7 +76,11 @@ class PayController extends BaseApiController $res = $app->wechat->query($order); 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('支付成功'); } else { return $this->fail('订单支付中'); diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 253436c97..9ac5b9b7a 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -61,7 +61,7 @@ class StoreController extends BaseApiController $order = UserRecharge::create($data); $order['pay_price']=$order['price']; - $result = PaymentLogic::codepay($auth_code, $order); + $result = PaymentLogic::codepay($auth_code, $order,'条码支付'); if (PaymentLogic::hasError()) { return $this->fail(PaymentLogic::getError(), $params); } diff --git a/app/common/logic/PaymentLogic.php b/app/common/logic/PaymentLogic.php index 98b0c7fb4..51df608a2 100644 --- a/app/common/logic/PaymentLogic.php +++ b/app/common/logic/PaymentLogic.php @@ -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}$/'; @@ -83,7 +83,7 @@ class PaymentLogic extends BaseLogic return false; } $order = [ - 'description' => '条码商品', + 'description' => $description, 'out_trade_no' => (string)$order['order_id'], 'payer' => [ 'auth_code' => (string)$auth_code