mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 06:30:49 +00:00
91 lines
2.4 KiB
PHP
91 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Events\StockUpdateEvent;
|
|
use App\Models\BusinessGoodsSku;
|
|
use App\Models\GoodsSku;
|
|
use App\Models\Log;
|
|
use App\Models\Shop;
|
|
use App\Services\Business\BusinessFactory;
|
|
use App\Utils\DateTimeUtils;
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Facades\DB;
|
|
use App\Jobs\BusinessGoodsSkuIncrQuantity;
|
|
|
|
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()
|
|
{
|
|
$onSkuIds = [2823];
|
|
event(new StockUpdateEvent($onSkuIds));
|
|
exit();
|
|
$shop = Shop::query()->find(1);
|
|
$business = BusinessFactory::init()->make($shop->plat_id);
|
|
$business->setShop($shop);
|
|
var_dump($business->queryGroupStatus());
|
|
exit();
|
|
// 下架商品
|
|
// GoodsSku::query()->where('status', '<>', 0)->update(['status' => 0]);
|
|
// $this->info('全部下架');
|
|
// exit();
|
|
// 1-7 11
|
|
$shop = Shop::query()->find(1);
|
|
$business = BusinessFactory::init()->make($shop->plat_id);
|
|
$business->setShop($shop);
|
|
// 下载商品列表
|
|
// $business->downloadGoodsListAndBind();
|
|
|
|
// 下载单个商品
|
|
// $business->downloadGoods(1);
|
|
|
|
// 库存修改
|
|
// $business->incrQuantity(1);
|
|
|
|
// 订单下载
|
|
$beginTime = DateTimeUtils::getMicroTime('2022-08-30 19:17:03');
|
|
$endTime = DateTimeUtils::getMicroTime('2022-08-30 19:19:03');
|
|
$business->downloadOrdersAndSave($beginTime, $endTime);
|
|
|
|
// $shops = Shop::query()->where('status', 1)->get();
|
|
// $that = $this;
|
|
// foreach ($shops as $shop) {
|
|
// $business = BusinessFactory::init()->make($shop->plat_id);
|
|
// $business->setShop($shop);
|
|
// $beginTime = DateTimeUtils::getMicroTime('2022-08-10 00:00:00');
|
|
// $endTime = DateTimeUtils::getMicroTime('2022-08-11 00:00:00');
|
|
// $business->downloadOrdersAndSave($beginTime, $endTime);
|
|
// $that->info($shop->name);
|
|
// }
|
|
}
|
|
}
|