weizong song 1 year ago
parent a07eee9ef5
commit a378e381d3

@ -60,7 +60,8 @@ class SyncWeixinRechargeState extends Command
}
foreach ($recharges as $recharge) {
$result = (new WxMicroPay())->manualQuery($recharge);
$order = $recharge->order;
$result = (new WxMicroPay($order->project_id))->manualQuery($recharge);
dump($result);
}

@ -542,7 +542,7 @@ class OrdersController extends CommonController
public function cancelOrder($id)
{
$order = (new Orders())->with(["orderItems"])->find($id);
$order = (new Orders())->with(["orderItems", "customer"])->find($id);
Log::info($order);
if ($order->status !== Orders::STATUS_UNCONFIRMED) {
return response()->json([

@ -1403,7 +1403,7 @@ class OrdersController extends CommonController
]);
}
$order = (new Orders())->find($order_id);
$order = (new Orders())->with("wechatpayAccount")->find($order_id);
$recharge = (new Recharge())->create([
"customer_id" => $order->customer->id,
"money" => request()->money,
@ -1415,9 +1415,9 @@ class OrdersController extends CommonController
switch (request()->type) {
case "weixin":
$res = (new WxMicroPay())->pay($recharge);
$res = (new WxMicroPay($order->project_id))->pay($recharge);
$recharge->update([
"merchant_id" => env("WEIXINPAY_MCHID")
"merchant_id" => $order->wechatpayAccount->mchid
]);
if ($res === true) {

@ -15,13 +15,14 @@ class WxPayCommon
public $parameters = [];
public $query_url = "https://api.mch.weixin.qq.com/pay/orderquery";
public function __construct()
public function __construct($project_id)
{
$project = \App\Models\Project::with("wechatpayAccount")->find($project_id);
$this->app_id = env("WEIXINPAY_APPID");
$this->key = env("WEIXINPAY_KEY");
$this->merchant_id = env("WEIXINPAY_MCHID");
$this->ssl_cert_path = env("WEIXINPAY_SSLCERT_PATH");
$this->ssl_key_path = env("WEIXINPAY_KEY_PATH");
$this->merchant_id = $project->wechatpayAccount->mchid;
$this->key = $project->wechatpayAccount->key;
$this->ssl_cert_path = env("WEIXINPAY_CERT_PUBLIC_PATH") . $project->mchid . "/apiclient_cert.pem";
$this->ssl_key_path = env("WEIXINPAY_CERT_PUBLIC_PATH") . $project->mchid . "/apiclient_key.pem";
}
function trimString($value)

Loading…
Cancel
Save