fly 5 年之前
父节点
当前提交
31ed21e7e4
共有 1 个文件被更改,包括 20 次插入20 次删除
  1. 20 20
      app/Http/Controllers/QuickApp/Order/OrdersController.php

+ 20 - 20
app/Http/Controllers/QuickApp/Order/OrdersController.php

@@ -26,6 +26,7 @@ use App\Modules\Channel\Services\PayTemplateService;
 use App\Modules\Trade\Models\PayMerchant;
 use App\Modules\Trade\Models\PayMerchant;
 use App\Modules\Trade\Pay\OrderArousePayFactory;
 use App\Modules\Trade\Pay\OrderArousePayFactory;
 use App\Modules\Trade\Pay\OrderPaySuccess;
 use App\Modules\Trade\Pay\OrderPaySuccess;
+use App\Modules\Trade\Services\PayMerchantService;
 use Exception;
 use Exception;
 use Log;
 use Log;
 
 
@@ -616,26 +617,25 @@ class OrdersController extends BaseController
     {
     {
         $param = $request->except('_url');
         $param = $request->except('_url');
         myLog('wxpay')->info($param);
         myLog('wxpay')->info($param);
-        $pay_merchant_name = $param['attach'];
-        $pay_merchant = PayMerchant::where('name', $pay_merchant_name)->first();
-        $pay_config = json_decode($pay_merchant->config_info);
-        $config = [
-            'appid'     => $pay_config->appid,
-            'merchant_id'     => $pay_config->merchant_id,
-            'key'    => $pay_config->key,
-        ];
-        $app = PayFactory::official($config);
-        $response = $app->notify()->handleNotify(function ($notify, $successful) {
-            if (!$successful) {
-                return 'fail';
-            }
-            if (OrderPaySuccess::handle($notify->out_trade_no, $notify->transaction_id)) {
-                return true;
-            } else {
-                return 'fail';
-            }
-        });
-        return $response;
+        if (isset($param['attach'])) {
+
+            $pay_merchant_name = $param['attach'];
+            $config = PayMerchantService::getPayConfigByNameStatic($pay_merchant_name);
+            $app = PayFactory::official($config);
+            $response = $app->notify()->handleNotify(function ($notify, $successful) {
+                if (!$successful) {
+                    return 'fail';
+                }
+                if (OrderPaySuccess::handle($notify->out_trade_no, $notify->transaction_id)) {
+                    return true;
+                } else {
+                    return 'fail';
+                }
+            });
+            return $response;
+        } else {
+            return 'fail';
+        }
     }
     }
 
 
     /**
     /**