Commit 72c66058 authored by hangjun83's avatar hangjun83

更新

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