Commit fc94ffd1 authored by wwccw0591's avatar wwccw0591

cronab

parent a91837d9
......@@ -23,7 +23,7 @@ class ApiConst
const oneHour = 3600;
//预警时间
const storageAlarmHour = 10800;
const storageAlarmHour = 100000000000000;
const twoMinSecond = 120;
......@@ -420,7 +420,7 @@ class ApiConst
const messageRefundProccessing=104;
//售后待收货
const messageRefundWaitReceive=105;
//用户被其它用户登录请退出
//预警商品数量
const messageGoodsAlert=106;
//用户被其它用户登录请退出
const messageOtherLogin=107;
......
......@@ -1314,4 +1314,13 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}
public function getGoodsCount($storeIds){
$goodsDao=\DAO\GoodsModel::getInstance();
$storeIds=implode(',',$storeIds);
$where=Common::format(" store_id in({0}) and goods_storage<goods_storage_alarm",$storeIds);
$stores=$goodsDao->getListGroup($where,"store_id as storeId,count(*) as count","store_id");
return $stores;
}
}
......@@ -75,6 +75,9 @@ class GoodsModel extends \DAO\AbstractModel {
}
public function getListGroup($where,$field,$groupField){
$this->setDb($this->dbName);
if(is_array($where)){
$where=$this->db->getSqlWhereByArray($where);
}
return $this->db->select($field)->from($this->_tableName)->where($where)->group($groupField)->fetchAll();
}
// public function getOneById($id){
......
......@@ -85,14 +85,19 @@ class cliOrderClose extends basecli
$push->addOneToClient($addData);
}
$goodsCommonService=\Business\Goods\GoodsCommonServiceModel::getInstance();
$stores=$goodsCommonService->getAlertGoods();
if(!empty($stores)){
foreach($stores as $store){
$addData=array('storeId'=>$store['storeId'],'type'=>\Our\ApiConst::messageGoodsAlert,'op'=>\Our\NameConst::set,'num'=>$store['count'],'params'=>array());
$push->addOneToClient($addData);
}
$storesBase=$goodsCommonService->getAlertGoods();
if($storesBase){
$storesIds=array_column($storesBase,'storeId');
$stores=$goodsCommonService->getGoodsCount($storesIds);
if(!empty($stores)){
foreach($stores as $store){
$addData=array('storeId'=>$store['storeId'],'type'=>\Our\ApiConst::messageGoodsAlert,'op'=>\Our\NameConst::set,'num'=>$store['count'],'params'=>array());
$push->addOneToClient($addData);
}
}
}
$push->sendTcpMessage();
$redis->close();
}
......
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