hrjy 2 年之前
父節點
當前提交
386b37d33e

+ 3 - 0
app/admin/model/order/StoreOrder.php

@@ -130,6 +130,9 @@ class StoreOrder extends BaseModel
                     case 'yue':
                         $item['pay_type_name'] = '余额支付';
                         break;
+                    case 'ali':
+                        $item['pay_type_name'] = '支付宝支付';
+                        break;
                     case 'offline':
                         $item['pay_type_name'] = '线下支付';
                         break;

+ 1 - 1
app/api/controller/AlipayController.php

@@ -22,7 +22,7 @@ class AlipayController
                 $out_trade_no = substr(input('out_trade_no'), $count + 1);
             }
             parse_str(input('passback_params'), $attach);
-            (new Hook(PaymentRepositories::class, 'wechat'))->listen($attach['attach'], $out_trade_no);
+            (new Hook(PaymentRepositories::class, 'ali'))->listen($attach['attach'], $out_trade_no);
             echo 'success';
             exit();
         } else {

+ 15 - 0
crmeb/repositories/PaymentRepositories.php

@@ -57,6 +57,21 @@ class PaymentRepositories
             return false;
         }
     }
+    /**
+     * 订单支付成功之后
+     * @param string|null $order_id 订单id
+     * @return bool
+     */
+    public static function aliProduct(string $order_id = null)
+    {
+        try {
+            if (StoreOrder::be(['order_id' => $order_id, 'paid' => 1])) return true;
+            return StoreOrder::paySuccess($order_id, 'ali');
+        } catch (\Exception $e) {
+            return false;
+        }
+    }
+
 
     /**
      * 充值成功后