Commit 865dadc7 authored by chenchuanwen's avatar chenchuanwen

Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into ccw

parents a9c78a18 7f132f3b
......@@ -161,7 +161,7 @@ class CartController extends \Our\Controller_AbstractApi{
$sess=\Yaf\Session::getInstance();
$currentAddress = $sess->get('currentAddress');
$result = $cartService->addOrder($data,$this->memberId,$currentAddress);
$result = $cartService->addOrder($data, $this->memberId,$currentAddress);
$this->success($result);
}
......
......@@ -145,10 +145,10 @@ class OrderConfirmUtil {
$cartList = $pBundlingService->getFormatCartListForOrder($storeCartList,$this->memberId,true,$dbName);
$gcIds = isset($cartList['gcIds'])?$cartList['gcIds']:array();
$storeCartData = array('cartList'=>$cartList['list'],'storeIds'=>array_keys($cartList['list']),'goodsIds'=>$storeCartList['goodsIds'],'goodsCommonIds'=>$storeCartList['goodsCommonIds'],'blIds'=>$storeCartList['blIds'],'gcIds'=>$gcIds);
}
if($this->storeCouponIds&&$this->couponIds){
$storeCartData = $this->checkCouponForOrder($storeCartData,$this->memberId);
if ($this->storeCouponIds&&$this->couponIds) {
$storeCartData = $this->checkCouponForOrder($storeCartData, $this->memberId);
}
return $storeCartData;
......@@ -1259,4 +1259,4 @@ class OrderConfirmUtil {
return self::$_instance;
}
}
\ No newline at end of file
}
......@@ -319,32 +319,37 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$endTime = TIMESTAMP;
$where = 'goods_edittime > '.$beginTime.' and goods_edittime<=' . $endTime . ' and goods_id in (select sg.goods_id from han_stat_goods sg)';
$field = 'goods_id,is_del,goods_name,goods_storage,goods_price,store_id';
$field = 'goods_id,goods_commonid,is_del,goods_name,goods_storage,goods_price,store_id';
$result = true;
$goodsDao = \DAO\GoodsModel::getInstance();
$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)';
......@@ -368,9 +373,13 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}
}
}
echo "\n";
if($result) { //商品报表更新成功
file_put_contents($this->baseDir . \Our\PathConst::goodsStatTime, $endTime);
echo "upd goods succ";
} else {
echo "upd goods fail";
}
return $result;
}
......@@ -382,7 +391,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
* Time: 下午 6:19
*/
public function updateStatGoodsSell(){
file_put_contents($this->baseDir . \Our\PathConst::goodsSellStatTime, '');
$beginTime = file_get_contents($this->baseDir . \Our\PathConst::goodsSellStatTime, TIMESTAMP);
$beginTime = $beginTime ? $beginTime : ApiConst::zero;
$endTime = TIMESTAMP;
......@@ -419,8 +427,12 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}
}
if(!$result) {
echo "\n";
echo 'upd sell fail';
$statGoodsDao->db->doRollback();
} else { //商品报表更新成功
echo "\n";
echo 'upd sell succ';
$statGoodsDao->db->doCommit();
file_put_contents($this->baseDir . \Our\PathConst::goodsSellStatTime, $endTime);
}
......
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