Commit 55583574 authored by jianghaiming's avatar jianghaiming

update:添加自动上架和自动下架

parent 1dc5a253
...@@ -29,10 +29,10 @@ class Goods implements DaemonServiceInterface ...@@ -29,10 +29,10 @@ class Goods implements DaemonServiceInterface
GoodsSku::save($colums, $where); GoodsSku::save($colums, $where);
//更新es //更新es
GoodsService::updateGoodsInfoToEs($where['goods_sku_id']); GoodsService::updateGoodsInfoToEs($where['goods_sku_id']);
} }
$this->onlineGoods(); $this->onlineGoods();
$this->onlineOffGoods();
} }
...@@ -65,7 +65,7 @@ class Goods implements DaemonServiceInterface ...@@ -65,7 +65,7 @@ class Goods implements DaemonServiceInterface
sleep(2); sleep(2);
$orderData = [ $orderData = [
'online_type' => 2, 'online_type' => 2,
'online_status' => 0, 'online_status' => [0,1],
'audit_status' => 1, 'audit_status' => 1,
'online_start_time[<]' => date("Y-m-d H:i:s",time()), 'online_start_time[<]' => date("Y-m-d H:i:s",time()),
'LIMIT' => 100, 'LIMIT' => 100,
...@@ -84,4 +84,35 @@ class Goods implements DaemonServiceInterface ...@@ -84,4 +84,35 @@ class Goods implements DaemonServiceInterface
} }
} }
/**
*
* 自动下架
*/
public function onlineOffGoods()
{
sleep(2);
$orderData = [
'online_type' => 2,
'online_status' => 1,
'audit_status' => 1,
'online_end_time[<]' => date("Y-m-d H:i:s",time()),
'LIMIT' => 100,
];
$goodsList = GoodsSku::getRecords($orderData);
DaemonLog::info('DaemonServiceOnline_goods', json_encode($goodsList));
foreach ($goodsList as $key => $value) {
$where = [];
$where['goods_sku_id'] = !empty($value['goods_sku_id']) ? $value['goods_sku_id'] : '';
$colums = [
'online_status' => 2,
];
GoodsSku::save($colums, $where);
//更新es
GoodsService::updateGoodsInfoToEs($where['goods_sku_id']);
}
}
} }
\ No newline at end of file
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