Commit b951d479 authored by wwccw0591's avatar wwccw0591

upd

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