north 8 tahun lalu
induk
melakukan
e6e0f4de87

+ 46 - 46
www/protected/modules/o2o/controllers/OrderController.php

@@ -35,54 +35,54 @@ class  OrderController extends O2oBaseController{
         $doubleEleventId = '58324b7e9f5160a4048b5758';
         //$flag_book = 0;
 
-        /*  if($products[0]['product_id'] == $doubleEleventId) {
-
-           $criteria_user = new EMongoCriteria();
-           $criteria_user->user('==', new MongoId($user_id));
-           $criteria_user->addCond('products.product', '==', new MongoId($doubleEleventId));//双十一产品id
-           //$criteria_user->addCond('status','==',1);
-           $order = ROrder::model()->findAll($criteria_user);
-           $o = CommonFn::getRowsFromCursor($order);
-
-           foreach ($o as $value) {
-               if ($value['status'] == 0 || $value['status'] == -1) {
-                   $t = ROrder::model()->get(new MongoId($value['_id']));
-                   $t->delete();
-               } else {
-                   CommonFn::requestAjax(false, '对不起,日常保洁两小时体验只能购买一单,你已经抢购过');
-               }
-           }
-          //取出双十一活动暂用
-             $criteria_time = new EMongoCriteria();
-             $criteria_time->addCond('products.product', '==', new MongoId($doubleEleventId));
-             $cursor_time = ROrder::model()->findAll($criteria_time);
-             $rows = array();
-             if(!empty($cursor_time)) {
-                 $rows = CommonFn::getRowsFromCursor($cursor_time);
-             }
-             $y = date("Y");
-             $m = date("m");
-             $d = date("d");
-             $day_start = mktime(0, 0, 0, $m, $d, $y);
-             $day_end = mktime(23, 59, 59, $m, $d, $y);
-             $total = 0;
-             if ($rows) {
-                 foreach ($rows as $orders) {
-                     //判断订单是否达到111单
-                     if ($total >= 111) {
-                         CommonFn::requestAjax(false, '今天的双11订单已经抢购光了');
-
-                     }
-
-                     //判断是否是当天订单
-                     if ($orders['order_time'] >= $day_start && $orders['order_time'] <= $day_end) {
-                         $total += 1;
-                     }
-                 }
-             }
+        if($products[0]['product_id'] == $doubleEleventId) {
+
+            $criteria_user = new EMongoCriteria();
+            $criteria_user->user('==', new MongoId($user_id));
+            $criteria_user->addCond('products.product', '==', new MongoId($doubleEleventId));//双十一产品id
+            //$criteria_user->addCond('status','==',1);
+            $order = ROrder::model()->findAll($criteria_user);
+            $o = CommonFn::getRowsFromCursor($order);
+
+            foreach ($o as $value) {
+                if ($value['status'] == 0 || $value['status'] == -1) {
+                    $t = ROrder::model()->get(new MongoId($value['_id']));
+                    $t->delete();
+                } else {
+                    CommonFn::requestAjax(false, '对不起,日常保洁两小时体验只能购买一单,你已经抢购过');
+                }
+            }
+          /*  //取出双十一活动暂用
+            $criteria_time = new EMongoCriteria();
+            $criteria_time->addCond('products.product', '==', new MongoId($doubleEleventId));
+            $cursor_time = ROrder::model()->findAll($criteria_time);
+            $rows = array();
+            if(!empty($cursor_time)) {
+                $rows = CommonFn::getRowsFromCursor($cursor_time);
+            }
+            $y = date("Y");
+            $m = date("m");
+            $d = date("d");
+            $day_start = mktime(0, 0, 0, $m, $d, $y);
+            $day_end = mktime(23, 59, 59, $m, $d, $y);
+            $total = 0;
+            if ($rows) {
+                foreach ($rows as $orders) {
+                    //判断订单是否达到111单
+                    if ($total >= 111) {
+                        CommonFn::requestAjax(false, '今天的双11订单已经抢购光了');
+
+                    }
+
+                    //判断是否是当天订单
+                    if ($orders['order_time'] >= $day_start && $orders['order_time'] <= $day_end) {
+                        $total += 1;
+                    }
+                }
+            }*/
 
             //$flag_book = 1;
-        }*/
+        }
 
         //end  //取出双十一活动暂用
 

+ 6 - 0
www/protected/modules/o2o/views/web/index.php

@@ -70,6 +70,12 @@
         localStorage.clear();
         location.href = '<?php echo Yii::app()->request->baseUrl . '/o2o/web/wxIndex'; ?>';
       }
+      if (userID && appToken) {
+        window.onload=function(){
+          console.log("window onload");
+          window.location.href='http://commontest.yiguanjia.me/index.php?r=o2o/web/index';
+        }
+      }
       document.write('<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"><\/script>');
     }
     if (location.hash == '#rd') {