68 lines
1.6 KiB
PHP
68 lines
1.6 KiB
PHP
<?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;
|
|
}
|
|
}
|