57 lines
1.2 KiB
PHP
57 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Enums\OfflineOrderStatus;
|
|
use App\Models\OfflineOrder;
|
|
use App\Services\OfflineOrderService;
|
|
use Illuminate\Console\Command;
|
|
|
|
class OfflineOrderSuccess extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'offline-order:success {id}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = '';
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function handle()
|
|
{
|
|
$id = $this->argument("id");
|
|
$order = OfflineOrder::findOrFail($id);
|
|
if ($order->status !== OfflineOrderStatus::Pending) {
|
|
$this->warn("订单已处理: " . $order->status->text());
|
|
}
|
|
OfflineOrderService::make()->paySuccess($order, [
|
|
"payment_sn" => "000",
|
|
"payment_method" => "wxpay_mp",
|
|
"payment_time" => now(),
|
|
"out_trade_no" => "000"
|
|
]);
|
|
return 0;
|
|
}
|
|
}
|