Parcourir la source

Merge branch 'sess_0306' of 121.43.114.153:/home/git/repositories/shopnc into sess_0306

root il y a 9 ans
Parent
commit
309f1b37f9
3 fichiers modifiés avec 20 ajouts et 3 suppressions
  1. 4 2
      data/model/buy.model.php
  2. 14 1
      data/model/goods.model.php
  3. 2 0
      data/model/p_xianshi_goods.model.php

+ 4 - 2
data/model/buy.model.php

@@ -799,10 +799,12 @@ class buyModel {
 	 * @param array $buy_items 商品ID => 购买数量
 	 */
 	public function editGoodsNum($buy_items) {
-        $model = Model()->table('goods');
+        //$model = Model()->table('goods');
+        $model = Model('goods');
         foreach ($buy_items as $goods_id => $buy_num) {
         	$data = array('goods_storage'=>array('exp','goods_storage-'.$buy_num),'goods_salenum'=>array('exp','goods_salenum+'.$buy_num));
-        	$result = $model->where(array('goods_id'=>$goods_id))->update($data);
+        	//$result = $model->where(array('goods_id'=>$goods_id))->update($data);
+            $result = $model->editGoodsById($data, $goods_id);
         	if (!$result) throw new Exception(L('cart_step2_submit_fail'));
         }
 	}

+ 14 - 1
data/model/goods.model.php

@@ -355,10 +355,23 @@ class goodsModel extends Model
         $condition['goods_id'] = array('in', $goodsid_array);
         $update['goods_edittime'] = time();
         $result = $this->table('goods')->where($condition)->update($update);
-        if ($result) {
+        if ($result)
+        {
             foreach ((array)$goodsid_array as $value) {
                 $this->_dGoodsCache($value);
             }
+
+            $items = $this->table('goods')->field('goods_commonid')->where($condition)->limit(false)->select();
+
+            $commonids = array();
+            foreach($items as $key => $commid) {
+                array_push($commonids,intval($commid['goods_commonid']));
+            }
+            $commonids = array_unique($commonids);
+            foreach($commonids as $commid) {
+                $this->_dGoodsCommonCache($commid);
+                $this->_dGoodsSpecCache($commid);
+            }
         }
         return $result;
     }

+ 2 - 0
data/model/p_xianshi_goods.model.php

@@ -183,11 +183,13 @@ class p_xianshi_goodsModel extends Model{
      */
     public function getXianshiGoodsInfoByGoodsID($goods_id) {
         Log::record(__FUNCTION__ . " goods_id={$goods_id}.",Log::DEBUG);
+
         $info = $this->_rGoodsXianshiCache($goods_id);
         if(empty($info)) {
             $condition['state'] = self::XIANSHI_GOODS_STATE_NORMAL;
             $condition['end_time'] = array('gt', time());
             $condition['goods_id'] = $goods_id;
+            $this->cls();
             $xianshi_goods_list = $this->getXianshiGoodsExtendList($condition, null, 'start_time asc', '*', 1);
             $info['info'] = serialize($xianshi_goods_list[0]);
             $this->_wGoodsXianshiCache($goods_id, $info);