微信分账金额保留整数
parent
13058f86c1
commit
f52746e965
|
|
@ -45,12 +45,19 @@ class OrderProfitCheck extends Command
|
|||
$service1 = new DistributeService();
|
||||
$list = OrderProfit::where('status', 1)->get()->groupBy('order_id');
|
||||
foreach ($list as $order_id => $profits) {
|
||||
$transaction_id = Order::where('id', $order_id)->value('out_trade_no');
|
||||
$order = Order::findOrFail($order_id);
|
||||
$transaction_id = $order->out_trade_no;
|
||||
$sn = data_get($profits->first(), 'pay_no');
|
||||
if ($transaction_id) {
|
||||
$result = $service->queryShare($transaction_id, $sn);
|
||||
$status = data_get($result, 'status');
|
||||
if ($status == 'FINISHED') {
|
||||
// 修改订单分账状态
|
||||
$attributes = ['share_sn' => $sn, 'status' => 'N'];
|
||||
$order->update([
|
||||
'wx_share' => $order->wx_share ? array_merge($order->wx_share, $attributes) : $attributes,
|
||||
'profit_paid' => now(),
|
||||
]);
|
||||
$service1->success($profits, $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class Handler extends ExceptionHandler
|
|||
'errcode' => 401,
|
||||
'message' => $exception->getMessage(),
|
||||
], 401)
|
||||
: redirect()->guest($exception->redirectTo() ?? route('login'));
|
||||
: redirect()->guest($exception->redirectTo() ?? url('/'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ class DistributeService
|
|||
array_push($receivers, [
|
||||
"type" => "PERSONAL_SUB_OPENID",
|
||||
"account" => $openid,
|
||||
"amount" => $item->money * 100,
|
||||
"amount" => floor($item->money * 100),
|
||||
"description" => "推荐返利"
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue