Commit bbb50c62 authored by hj's avatar hj

更新提交

parent 226388d4
<?php
namespace App\Console\Commands;
use App\Jobs\WuxiLabJob;
use App\Services\ThirdPlatform\WuxiLabNewService;
use App\Services\ThirdPlatform\WuxiLabService;
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
class WuxiLabNewJobCommand extends Command
{
use ConfirmableTrait;
/**
* 命令行的名称及用法。
*
* @var string
*/
protected $signature = 'wuxilabnew:job
{--action_type= : 任务操作类型}
{--params= : 任务参数}';
/**
* 命令行的概述。
*
* @var string
*/
protected $description = '药名康德任务命令行';
/**
* 创建新的命令实例。
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* 运行命令。
* @throws \Exception
*/
public function handle()
{
if (! $this->confirmToProceed()) {
return 1;
}
if($this->hasArgument('help')){
$this->help();
}else{
$action_type = $this->option('action_type');
$params = $this->option('params');
if(empty($action_type)){
$this->error('缺少命令参数,请输入具体的参数命令.如需帮助请输入 --help');
exit;
}
$service = app(WuxiLabNewService::class);
switch($action_type){
case 'initProductToExcel' :
if(!isset($params) || $params == 0){
$params['limit'] = 1000;
}
$service->initCreateProductsToExcel($params['limit']);
break;
case 'batchUpdatePackages' :
if(!isset($params) || $params == 0){
$params['limit'] = 1000;
}
$service->batchUpdatePackagesInfo($params);
break;
case 'batchUploadProducts' :
$service->batchUploadProducts();
break;
case 'batchUpdateToWuxiLab' :
$service->batchUpdateToWuxiLab();
break;
case 'batchUpdateProduct' :
$service->batchUpdateProducts();
break;
case 'test' :
$service->test($params);
break;
case 'test1' :
$service->test1();
break;
case 'batchUploadNewProducts' :
$service->batchUploadNewProducts();
break;
case 'batchUpdateProductPackages' :
$service->batchUploadPackages();
break;
case 'batchUpdateProductsShelves' :
$service->batchUpdateProductsShelves();
break;
case 'initToken' :
$service->initToken();
break;
default:
}
/*$productUpdateJob = (new WuxiLabJob($action_type,$params))->delay(100)->onQueue('slow');
app('Illuminate\Contracts\Bus\Dispatcher')->dispatch($productUpdateJob);*/
}
}
public function help()
{
$helpStr = "参数帮助说明";
$this->comment($this->setHelp($helpStr)->getProcessedHelp());
$this->line("action_type: 具体动作参数\n\n initProductToExcel => 初始化批量商品 \n batchUpdateProduct => 批量更新商品\n\nparams : 操作需要传入的参数.非必填项");
}
}
......@@ -78,7 +78,8 @@ class AppServiceProvider extends ServiceProvider
\App\Console\Commands\KafkaConsumerCommand::class,
\App\Console\Commands\TestJobCommand::class,
\App\Console\Commands\RhawnToolsJobCommand::class,
\App\Console\Commands\InvoiceJobCommand::class
\App\Console\Commands\InvoiceJobCommand::class,
\App\Console\Commands\WuxiLabNewJobCommand::class
]);
}
......
......@@ -41,8 +41,6 @@ class WuxiApiService extends PlatformAbstractService
$params = [];
$params['chemicalProducts'] = $this->mergeApiMetaData($product);
$response = $this->getPostClient($this->platformInfo['platform_url'].'/api/v1/update',$params, [
$this->platformInfo['platform_params']['username'], $this->platformInfo['platform_params']['password']
]);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment