6
0
Fork 0
panliang 2026-06-29 20:40:49 +08:00
parent 590079bfe6
commit 528d47a263
1 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,67 @@
<?php
namespace App\Console\Commands;
use App\Models\PayLog;
use App\Services\WxMpService;
use Illuminate\Console\Command;
class WxOrderUploadShipping extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'wx-order:upload-shipping {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");
$payLog = PayLog::findOrFail($id);
$openid = "oU7xS5UspzVvpPEBqKZuW6N9WXDg";
$data = [
"order_key" => [
"mchid" => config("wechat.payment.sub.mch_id"),
"out_trade_no" => $payLog->pay_sn,
"order_number_type" => 1,
"transaction_id" => $payLog->out_trade_no,
],
"logistics_type" => 4,
"delivery_mode" => 1,
"shipping_list" => [
["item_desc" => "定制服务"]
],
"upload_time" => $payLog->pay_at->format('Y-m-d\TH:i:s.vP'),
"payer" => [
"openid" => $openid
]
];
logger("微信小程序-发货信息录入", $data);
WxMpService::make()->uploadShippingInfo($data);
return 0;
}
}