Commit b951d479 authored by wwccw0591's avatar wwccw0591

upd

parent b656e013
...@@ -326,25 +326,30 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -326,25 +326,30 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$storeDao = \DAO\StoreModel::getInstance(); $storeDao = \DAO\StoreModel::getInstance();
$statGoodsDao = \DAO\StatGoodsModel::getInstance(DbNameConst::masterDBConnectName); $statGoodsDao = \DAO\StatGoodsModel::getInstance(DbNameConst::masterDBConnectName);
$store_tmp = array(); $store_tmp = array();
if($datas = $goodsDao->getList($where, $field)) { //更新商品报表 $count = $statGoodsDao->getCountByWhere('1=1');
echo 'in:'.count($datas); if($count > 0) {
foreach ($datas as $key=>$val) { if($datas = $goodsDao->getList($where, $field)) { //更新商品报表
if(isset($store_tmp[$val['store_id']])) { echo 'in:'.count($datas);
$store_info = $store_tmp[$val['store_id']]; foreach ($datas as $key=>$val) {
} else { if(isset($store_tmp[$val['store_id']])) {
$store_info = $storeDao->getFieldsInfo(array('store_id'=>$val['store_id']), 'province_id, city_id, area_id'); $store_info = $store_tmp[$val['store_id']];
} } else {
$update_stat_goods = $val; $store_info = $storeDao->getFieldsInfo(array('store_id'=>$val['store_id']), 'province_id, city_id, area_id');
$update_stat_goods['upd_time'] = $endTime; }
$update_stat_goods['province_id'] = $store_info['province_id']; $update_stat_goods = $val;
$update_stat_goods['city_id'] = $store_info['city_id']; $update_stat_goods['upd_time'] = $endTime;
$update_stat_goods['area_id'] = $store_info['area_id']; $update_stat_goods['province_id'] = $store_info['province_id'];
unset($update_stat_goods['goods_id']); $update_stat_goods['city_id'] = $store_info['city_id'];
$where = 'goods_id='.$val['goods_id']. ' and upd_time <'.$beginTime; $update_stat_goods['area_id'] = $store_info['area_id'];
if(!$statGoodsDao->update($where, $update_stat_goods)){ unset($update_stat_goods['goods_id']);
$result = false; $where = 'goods_id='.$val['goods_id']. ' and upd_time <'.$beginTime;
if(!$statGoodsDao->update($where, $update_stat_goods)){
$result = false;
}
} }
} }
} else {
file_put_contents($this->baseDir . \Our\PathConst::goodsSellStatTime, '0');
} }
$where = 'goods_id not in (select sg.goods_id from han_stat_goods sg)'; $where = 'goods_id not in (select sg.goods_id from han_stat_goods sg)';
......
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