Commit 12e52d3d authored by hangjun83's avatar hangjun83

队列更新

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