app
parent
ded43e4ed7
commit
28bbdc5fcd
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Enums\PayWay;
|
use App\Enums\PayWay;
|
||||||
use App\Exceptions\BizException;
|
|
||||||
use App\Models\Order;
|
use App\Models\Order;
|
||||||
use App\Services\DistributeService;
|
use App\Services\DistributeService;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
@ -62,8 +61,8 @@ class OrderProfitCommand extends Command
|
||||||
->where('completed_at', '<', now()->subDays($saleDays))
|
->where('completed_at', '<', now()->subDays($saleDays))
|
||||||
// 未支付提成
|
// 未支付提成
|
||||||
->whereNull('profit_paid')
|
->whereNull('profit_paid')
|
||||||
|
->limit(200)
|
||||||
->limit(200);
|
->get();
|
||||||
|
|
||||||
foreach ($orders as $order) {
|
foreach ($orders as $order) {
|
||||||
foreach($order->profits as $profit) {
|
foreach($order->profits as $profit) {
|
||||||
|
|
@ -79,8 +78,9 @@ class OrderProfitCommand extends Command
|
||||||
$service->wechatTransfer($profit);
|
$service->wechatTransfer($profit);
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
} catch (BizException $e) {
|
} catch (\Exception $e) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
// $this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 没有待付款的提成记录
|
// 没有待付款的提成记录
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,8 @@ class DistributeService
|
||||||
/**
|
/**
|
||||||
* 使用微信企业付款, 支付返利金额
|
* 使用微信企业付款, 支付返利金额
|
||||||
* 调用之前, 需要提前生成商户订单号
|
* 调用之前, 需要提前生成商户订单号
|
||||||
|
*
|
||||||
|
* @throws WeChatPayException
|
||||||
*/
|
*/
|
||||||
public function wechatTransfer(OrderProfit $profit)
|
public function wechatTransfer(OrderProfit $profit)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue