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