Commit 766ee90e authored by hangjun83's avatar hangjun83

震坤行

parent 7b2f2748
...@@ -101,10 +101,10 @@ class RhawnChemicalsService ...@@ -101,10 +101,10 @@ class RhawnChemicalsService
} }
} }
public function updateSyncRunTime($goods) public function updateSyncRunTime($zgId)
{ {
$dbConnect = DB::connection('rhawn_mysql'); $dbConnect = DB::connection('rhawn_mysql');
return $dbConnect->table('zkh_goods')->where('zg_id',$goods['zg_id'])->update(['zg_sync_time' => time()]); return $dbConnect->table('zkh_goods')->where('zg_id',$zgId)->update(['zg_sync_time' => time()]);
} }
public function getRawProductsThroughPid($pId) public function getRawProductsThroughPid($pId)
......
...@@ -56,13 +56,13 @@ class ZhenKhService ...@@ -56,13 +56,13 @@ class ZhenKhService
$goods = $params['goods']; $goods = $params['goods'];
try{ try{
$product = $this->rhawnService->getRawProductsThroughPid($goods['zg_r_pid']); $product = $this->rhawnService->getRawProductsThroughPid($goods->zg_r_pid);
if($product){ if($product){
while(true){ while(true){
$result = $this->apiService->updateReportProductPrice([ $result = $this->apiService->updateReportProductPrice([
'price' => round(bcmul($product->p_price,0.5,2),1), 'price' => round(bcmul($product->p_price,0.5,2),1),
'price_unit' => $goods['zg_unit'], 'price_unit' => $goods->zg_unit,
'sku' => $goods['zg_sku'] 'sku' => $goods->zg_sku
],$this->getToken()); ],$this->getToken());
if(!isset($result['reset']) || $result['reset'] != true){ if(!isset($result['reset']) || $result['reset'] != true){
break; break;
...@@ -75,9 +75,9 @@ class ZhenKhService ...@@ -75,9 +75,9 @@ class ZhenKhService
while(true){ while(true){
$result = $this->apiService->updateReportProductStock([ $result = $this->apiService->updateReportProductStock([
'warehouse' => '上海货仓', 'warehouse' => '上海货仓',
'address' => ['0' => $goods['zg_addr']], 'address' => ['0' => $goods->zg_addr],
'qty' => $product->p_stock, 'qty' => $product->p_stock,
'sku' => $goods['zg_sku'] 'sku' => $goods->zg_sku
],$this->getToken()); ],$this->getToken());
if(!isset($result['reset']) || $result['reset'] != true){ if(!isset($result['reset']) || $result['reset'] != true){
break; break;
...@@ -87,7 +87,7 @@ class ZhenKhService ...@@ -87,7 +87,7 @@ class ZhenKhService
} }
} }
} }
$result = $this->rhawnService->updateSyncRunTime($goods); $result = $this->rhawnService->updateSyncRunTime($goods->zg_id);
if($result){ if($result){
SimpleLogs::writeLog($goods['zg_sku'].'的价格和库存上报完成。完成时间:'.date('Y-m-d H:i:s',time()),__CLASS__.':consumerUpdateReportPriceAndStock'); SimpleLogs::writeLog($goods['zg_sku'].'的价格和库存上报完成。完成时间:'.date('Y-m-d H:i:s',time()),__CLASS__.':consumerUpdateReportPriceAndStock');
} }
......
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