diff --git a/app/Console/Commands/OrderProfitCommand.php b/app/Console/Commands/OrderProfitCommand.php index ce56a076..0c7385f9 100644 --- a/app/Console/Commands/OrderProfitCommand.php +++ b/app/Console/Commands/OrderProfitCommand.php @@ -3,7 +3,6 @@ namespace App\Console\Commands; use App\Enums\PayWay; -use App\Exceptions\BizException; use App\Models\Order; use App\Services\DistributeService; use Illuminate\Console\Command; @@ -62,8 +61,8 @@ class OrderProfitCommand extends Command ->where('completed_at', '<', now()->subDays($saleDays)) // 未支付提成 ->whereNull('profit_paid') - - ->limit(200); + ->limit(200) + ->get(); foreach ($orders as $order) { foreach($order->profits as $profit) { @@ -79,8 +78,9 @@ class OrderProfitCommand extends Command $service->wechatTransfer($profit); } DB::commit(); - } catch (BizException $e) { + } catch (\Exception $e) { DB::rollBack(); + // $this->error($e->getMessage()); } } // 没有待付款的提成记录 diff --git a/app/Services/DistributeService.php b/app/Services/DistributeService.php index 0a5f6d83..eb67cfeb 100644 --- a/app/Services/DistributeService.php +++ b/app/Services/DistributeService.php @@ -157,6 +157,8 @@ class DistributeService /** * 使用微信企业付款, 支付返利金额 * 调用之前, 需要提前生成商户订单号 + * + * @throws WeChatPayException */ public function wechatTransfer(OrderProfit $profit) { diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index b0659f13..0fa6430d 100644 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -29,7 +29,7 @@ class UserSeeder extends Seeder DB::table('wallet_to_bank_logs')->truncate(); DB::table('sales_value_logs')->truncate(); - + DB::table('balances')->truncate(); DB::table('users')->truncate(); $this->faker = $this->withFaker();