Commit 12e52d3d authored by hangjun83's avatar hangjun83

队列更新

parent bf776bd0
......@@ -89,6 +89,9 @@ class WuxiLabJobCommand extends Command
case 'batchUploadPackages' :
$service->batchUploadPackages();
break;
case 'initToken' :
$service->initToken();
break;
default:
}
......
......@@ -34,6 +34,11 @@ class WuxiLabService
$this->rhawnChemicalsService = app(RhawnChemicalsService::class);
}
public function initToken()
{
$this->apiService->removePlatformDataEntries('wuxilab_backlogin_token');
}
/**
* 批量更新商品
*/
......@@ -136,7 +141,6 @@ class WuxiLabService
],'wuxilab_product');
$countNum = 0;
$products = [];
sleep(5);
}
}
}
......@@ -220,7 +224,7 @@ class WuxiLabService
$newPackages[$pack['r_code']] = $pack;
}
}
ini_set('memory_limit','4068M');
ini_set('memory_limit','3072M');
$path = app(WuxiLabExport::class)->saveExcel(
['rawList' => $rawsList,'packageList' => $newPackages],
$params['type']
......@@ -235,7 +239,7 @@ class WuxiLabService
$result = $this->apiService->pushBatchUploadFile($params['type'],$fileName, $this->apiService->backgroundLogin());
if($result){
$cmd = 'rm -rf '.storage_path('app/'.$newPath);
//trim(shell_exec("$cmd 2>&1"));
trim(shell_exec("$cmd 2>&1"));
SimpleLogs::writeLog('文件名为:'.$fileName.'路径:'.$newPath.'药明康德后台上传完成', __CLASS__.':processNotExistProductsUpdate');
}
}
......@@ -264,7 +268,6 @@ class WuxiLabService
],'wuxilab_package');
$countNum = 0;
$products = [];
sleep(5);
}
}
}
......@@ -314,14 +317,14 @@ class WuxiLabService
}
//更新成功,批量更新包装规格
$storeEntries = $this->apiService->getPlatformDataEntries('wuxiLab_do_not_update_products','data_values');
if(!is_null($storeEntries) && count($storeEntries['products']) >= $this->apiService->getPlatformInfo('platform_params')['excelCreateLimit']){
/*if(!is_null($storeEntries) && count($storeEntries['products']) >= $this->apiService->getPlatformInfo('platform_params')['excelCreateLimit']){
$this->apiService->pushQueue([
'params' => ['products' => $storeEntries['products'],'type' => 'package'],
'consumer' => __CLASS__,
'method' => 'processProductsUpdateThroughtExcel'
],'wuxilab_package');
$this->apiService->removePlatformDataEntries('wuxiLab_do_not_update_products');
}
}*/
foreach($result['successProduct'] as $successProduct){
if(!is_null($storeEntries) && !empty($storeEntries['products'])){
if(!in_array($successProduct,$storeEntries['products'])){
......@@ -361,7 +364,7 @@ class WuxiLabService
$apiToken = $this->apiService->backgroundLogin();
if($apiToken){
$apiToken['currentTime'] = time();
$this->apiService->storePlatformDataEntries('zkh_api_token',$apiToken);
$this->apiService->storePlatformDataEntries('wuxilab_backlogin_token',$apiToken);
return $apiToken['token'];
}
}
......
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