2022-08-08 16:00:47 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
|
|
use App\Models\Shop;
|
|
|
|
|
use App\Services\Business\BusinessFactory;
|
2022-08-09 10:34:36 +08:00
|
|
|
use App\Utils\DateTimeUtils;
|
2022-08-08 16:00:47 +08:00
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
|
|
class Test extends Command
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The name and signature of the console command.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $signature = 'test';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 mixed
|
|
|
|
|
*/
|
|
|
|
|
public function handle()
|
|
|
|
|
{
|
2022-08-09 16:56:52 +08:00
|
|
|
$shop = Shop::query()->find(1);
|
2022-08-08 16:00:47 +08:00
|
|
|
$business = BusinessFactory::init()->make($shop->plat_id);
|
|
|
|
|
$business->setShop($shop);
|
2022-08-09 10:34:36 +08:00
|
|
|
// 下载商品列表
|
|
|
|
|
// $business->downloadGoodsList();
|
|
|
|
|
|
|
|
|
|
// 下载单个商品
|
|
|
|
|
// $business->downloadGoods(1);
|
2022-08-08 18:53:38 +08:00
|
|
|
|
|
|
|
|
// 库存修改
|
|
|
|
|
// $business->incrQuantity(1);
|
|
|
|
|
|
2022-08-09 10:34:36 +08:00
|
|
|
// 订单下载
|
2022-08-11 02:13:19 +08:00
|
|
|
// $beginTime = DateTimeUtils::getMicroTime('2022-08-08');
|
|
|
|
|
// $endTime = DateTimeUtils::getMicroTime('2022-08-09');
|
|
|
|
|
// $business->downloadOrdersAndSave($beginTime, $endTime);
|
2022-08-09 10:34:36 +08:00
|
|
|
|
2022-08-08 18:53:38 +08:00
|
|
|
$this->info('执行测试成功');
|
2022-08-08 16:00:47 +08:00
|
|
|
}
|
|
|
|
|
}
|