Commit 72c66058 authored by hangjun83's avatar hangjun83

更新

parent c7e7676f
......@@ -53,13 +53,15 @@ class LeyanApiService extends PlatformAbstractService
}
}
public function pushBatchUpdateProduct($token)
public function pushBatchUpdateProductByPage($currentPage,$pageSize = 1000,$token)
{
try{
if($this->checkPlatformStatus()){
$params = [];
$params['nowPage'] = $currentPage;
$params['pageSize'] = $pageSize;
$uri = $this->platformInfo['platform_url'].'/ProductDate/findProductDataPool';
$uri = $this->platformInfo['platform_url'].'/ProductDate/findProductDataPoolPage';
$response = $this->getPostClient($uri,$params,null,[
'token' => $token,
],false);
......
......@@ -27,14 +27,17 @@ class LeyanService
public function updateProductsByEveryDay()
{
$result = $this->apiService->pushBatchUpdateProduct($this->getToken());
if(!$result){
return null;
}
try{
$result = $this->storeLeyanProducts($result);
}catch(\Exception $exception){
SimpleLogs::writeLog($exception->getMessage(),__CLASS__.':updateProductsByEveryDay', 'error');
$currentPage = 1;
while(true){
$result = $this->apiService->pushBatchUpdateProductByPage($currentPage,1000,$this->getToken());
if(!$result){
return null;
}
try{
$result = $this->storeLeyanProducts($result);
}catch(\Exception $exception){
SimpleLogs::writeLog($exception->getMessage(),__CLASS__.':updateProductsByEveryDay', 'error');
}
}
}
......
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