|
|
@@ -65,6 +65,18 @@ class WechatService
|
|
|
(self::$app[$cid] === null || $cache === true) && (self::$app[$cid] = Factory::payment(self::options($cid)));
|
|
|
return self::$app[$cid];
|
|
|
}
|
|
|
+ public static function payment2($cache = false, $cid = 0) {
|
|
|
+ // 使用 isset() 检查下标,避免直接访问未定义键
|
|
|
+ if (!isset(self::$app[$cid])) {
|
|
|
+ $options = self::options($cid);
|
|
|
+ // 校验必要配置是否存在
|
|
|
+// if (empty($options['app_id']) || empty($options['mch_id'])) {
|
|
|
+// throw new \Exception("微信支付配置缺失: cid={$cid}");
|
|
|
+// }
|
|
|
+ self::$app[$cid] = Factory::payment($options);
|
|
|
+ }
|
|
|
+ return self::$app[$cid];
|
|
|
+ }
|
|
|
|
|
|
public static function serve($cid = 0): Response
|
|
|
{
|
|
|
@@ -630,7 +642,7 @@ class WechatService
|
|
|
{
|
|
|
@file_put_contents("quanju2.txt", $order_id . "-查询的订单id\r\n", 8);
|
|
|
@file_put_contents("quanju2.txt", $cid . "-cid\r\n", 8);
|
|
|
- $result = self::payment(false, $cid)->order->queryByOutTradeNumber(
|
|
|
+ $result = self::payment2(false, $cid)->order->queryByOutTradeNumber(
|
|
|
$order_id
|
|
|
);
|
|
|
@file_put_contents("quanju2.txt", json_encode($result) . "-查询签约状态返回结果\r\n", 8);
|
|
|
@@ -642,7 +654,6 @@ class WechatService
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- sleep(5);
|
|
|
return $result;
|
|
|
}
|
|
|
/**
|