Commit fc94ffd1 authored by wwccw0591's avatar wwccw0591

cronab

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