فهرست منبع

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

stanley-king 9 سال پیش
والد
کامیت
cd60614431

+ 11 - 4
data/model/cart.model.php

@@ -94,11 +94,18 @@ class cartModel extends Model
         $check_cart = $this->checkCart($condition);
         if (!empty($check_cart)) {
 
-            // 更新数量
-            $data['goods_num'] = intval($check_cart['goods_num']) + $quantity;
-            $ret = $this->where($condition)->update($data);
+            // add by liax 20160118
+            $goods_model = Model("goods");
+            $goods_storage = $goods_model->getGoodsStorageById($goods_info['goods_id']);
 
-            return true;
+            if (intval($goods_storage) < intval($check_cart['goods_num']) + $quantity) {
+                return false;
+            } else {
+                // 更新数量
+                $data['goods_num'] = intval($check_cart['goods_num']) + $quantity;
+                $ret = $this->where($condition)->update($data);
+                return true;
+            }
         }
 
         $array = array();

+ 1 - 1
mobile/control/member_cart.php

@@ -110,7 +110,7 @@ class member_cartControl extends mobileMemberControl
         if($result) {
             joutput_data(array('result' => '1'));
         } else {
-            return joutput_error(errcode::ErrCart, '收藏失败');
+            return joutput_error(errcode::ErrCart, '添加购物车失败!');
         }
     }
 

+ 45 - 21
shop/control/h5_hb.php

@@ -59,28 +59,33 @@ class h5_hbControl extends BaseH5Control
         }
     }
 
+    public function checkCode($mobile, $code)
+    {
+        $ret = rcache($mobile, 'bonus');
+        if (empty($ret)) {
+            return false;
+        }
+
+        if ($ret['code'] == $code && $ret['mobile'] == $mobile) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
     // 验证校验码
     public function verifyCodeOp()
     {
         $mobile = trim($_POST['phone_num']);
         $code = trim($_POST['verifyCode']);
 
-        $ret = rcache($mobile, 'bonus');
-        if (empty($ret)) {
+        if (empty($mobile) || empty($code)) {
             echo(false);
-            return;
         }
 
-        if ($ret['code'] == $code && $ret['mobile'] == $mobile) {
+        $ret = $this->checkCode($mobile, $code);
 
-            if ($ret) {
-                echo(true);
-            } else {
-                echo(false);
-            }
-        } else {
-            echo(false);
-        }
+        echo $ret;
     }
 
     /**
@@ -126,19 +131,38 @@ class h5_hbControl extends BaseH5Control
     // 获取红包最后一步
     public function lastStepOp()
     {
-        $phone_num = $_GET['phone_num'];
-        $type_id = $_GET['type_id'];
+        $phone_num = trim($_GET['phone_num']);
+        $type_id = trim($_GET['type_id']);
+        $code = trim($_GET['verifyCode']);
+
+        $check_result = $this->checkCode($phone_num, $code);
+        if (!$check_result) {
+            Tpl::output('bonus_value', '');
+            Tpl::output('words', '亲,你已经领取了红包!');
+            Tpl::showpage('mode', 'h5_hb/success');
+        }
 
-        if (!empty($phone_num) && !empty($type_id)) {
+        $condition['user_mobile'] = $phone_num;
+        $condition['bonus_type_id'] = $type_id;
+        $ret = Model()->table('user_bonus')->where($condition)->select();
 
-            $result = $this->getOneBonus($type_id, $phone_num);
-            if (!empty($result)) {
-                Tpl::output('bonus_value', $result['bonus_value']);
-                Tpl::showpage('mode', 'h5_hb/success');
+        if (!empty($ret)) {
+            Tpl::output('bonus_value', '');
+            Tpl::output('words', '亲,你已经领取了红包!');
+            Tpl::showpage('mode', 'h5_hb/success');
+        } else {
+            if (!empty($phone_num) && !empty($type_id)) {
 
-            } else {
-                Tpl::showpage('mode', 'h5_hb/over');
+                $result = $this->getOneBonus($type_id, $phone_num);
+                if (!empty($result)) {
+                    Tpl::output('bonus_value', '¥' . $result['bonus_value']);
+                    Tpl::output('words', '立刻通过熊猫美妆去购物吧!');
+                    Tpl::showpage('mode', 'h5_hb/success');
+                } else {
+                    Tpl::showpage('mode', 'h5_hb/over');
+                }
             }
         }
     }
+
 }

+ 9 - 8
shop/templates/default/layout/h5_hb/css/index_commcon.css

@@ -34,6 +34,7 @@ body {
 
 .bag_center {
     width: 7.75rem;
+    height: 6rem;
     margin: -1px auto;
     padding-top: 1.5rem;
     padding-bottom: 2.66rem;
@@ -60,11 +61,11 @@ body {
     text-align: left;
 }
 .footer {
-    height: 2.3rem;
-    width: 100%;
-    background: url("../image/foot_bg.png") no-repeat;
-    background-size: 100% 100%;
-    position: fixed;
-    bottom: 0;
-    left: 0;
-}
+     height: 2.3rem;
+     width: 100%;
+     background: url("../image/foot_bg.png") no-repeat;
+     background-size: 100% 100%;
+     position: fixed;
+     bottom: 0;
+     left: 0;
+ }

+ 0 - 10
shop/templates/default/layout/h5_hb/css/success.css

@@ -4,9 +4,6 @@ html {
 .top {
    height: auto;
 }
-html,body {
-    min-height: 110%;
-}
 .bag_header p {
     width: 5.7rem;
     line-height: 0.5rem;
@@ -127,11 +124,4 @@ html,body {
     background-size: 100%;
 }
 
-.footer {
-    position: static;
-    height: 2.3rem;
-    width: 100%;
-    background: url("../image/foot_bg.png") no-repeat;
-    background-size: 100% 100%;
-}
 

+ 0 - 29
shop/templates/default/layout/h5_hb/over.php

@@ -16,36 +16,7 @@
             <p>你来晚咯~红包已经抢走</p>
         </div>
         <div class="bag_center center">
-            <div class="ropes font14">促销推荐</div>
-            <div class="recommend">
 
-                <div class="recommend_box left">
-                    <div class="img_box">
-                        <div class="img_border">
-                            <img src="image/loadicon.png" alt=""/>
-                        </div>
-                    </div>
-                    <div class="recommend_title font9">
-                        <p>兰芝BB气垫保湿霜兰芝BB气垫保湿霜</p>
-                    </div>
-                    <div class="price_box">
-                        <span class="font10">¥240元</span><span class="later font9">¥240元</span>
-                    </div>
-                </div>
-
-                <div class="recommend_box left">
-                    <div class="img_box">
-                        <div class="img_border">
-                            <img src="image/loadicon.png" alt=""/>
-                        </div>
-                    </div>
-                    <div class="recommend_title font9">
-                        <p>兰芝BB气垫保湿霜兰芝BB气垫保湿霜</p>
-                    </div>
-                    <div class="price_box">
-                        <span class="font10">¥240元</span><span class="later font9">¥240元</span>
-                    </div>
-                </div>
 
             </div>
         </div>

+ 3 - 63
shop/templates/default/layout/h5_hb/success.php

@@ -13,72 +13,12 @@
     <div class="top">
         <div class="rope"></div>
         <div class="bag_header center">
-            <p class="price_b font24"><span><?php echo($output['bonus_value']) ?></span></p>
+            <p class="price_b font24"><span><?php echo($output['bonus_value']) ?></span></p>
 
-            <p class="font14">立刻通过熊猫美妆去购物吧!</p>
+            <p class="font14"><?php echo($output['words']) ?></p>
         </div>
         <div class="bag_center center">
-            <div class="ropes font14">促销推荐</div>
-            <div class="recommend">
-
-                <div class="recommend_box left">
-                    <div class="img_box">
-                        <div class="img_border">
-                            <img src="image/loadicon.png" alt=""/>
-                        </div>
-                    </div>
-                    <div class="recommend_title font9">
-                        <p>兰芝BB气垫保湿霜兰芝BB气垫保湿霜</p>
-                    </div>
-                    <div class="price_box">
-                        <span class="font10">¥240元</span><span class="later font9">¥240元</span>
-                    </div>
-                </div>
-
-                <div class="recommend_box left">
-                    <div class="img_box">
-                        <div class="img_border">
-                            <img src="image/loadicon.png" alt=""/>
-                        </div>
-                    </div>
-                    <div class="recommend_title font9">
-                        <p>兰芝BB气垫保湿霜兰芝BB气垫保湿霜</p>
-                    </div>
-                    <div class="price_box">
-                        <span class="font10">¥240元</span><span class="later font9">¥240元</span>
-                    </div>
-                </div>
-
-                <div class="recommend_box left">
-                    <div class="img_box">
-                        <div class="img_border">
-                            <img src="image/loadicon.png" alt=""/>
-                        </div>
-                    </div>
-                    <div class="recommend_title font9">
-                        <p>兰芝BB气垫保湿霜兰芝BB气垫保湿霜</p>
-                    </div>
-                    <div class="price_box">
-                        <span class="font10">¥240元</span><span class="later font9">¥240元</span>
-                    </div>
-                </div>
-
-                <div class="recommend_box left">
-                    <div class="img_box">
-                        <div class="img_border">
-                            <img src="image/loadicon.png" alt=""/>
-                        </div>
-                    </div>
-                    <div class="recommend_title font9">
-                        <p>兰芝BB气垫保湿霜兰芝BB气垫保湿霜</p>
-                    </div>
-                    <div class="price_box">
-                        <span class="font10">¥240元</span><span class="later font9">¥240元</span>
-                    </div>
-                </div>
-
-            </div>
-        </div>
+           
     </div>
     <div class="footer"></div>
     <div class="banner center">