Ver Fonte

Merge branch 'test' of git.oschina.net:yiguanjia/php into test

洪海涛 há 8 anos atrás
pai
commit
325e317ac6

+ 1 - 0
www/protected/config/yiguanjia_const.php

@@ -57,6 +57,7 @@ $wz['o2o_service'] = array(
     8=>array("name"=>"母婴房清洁"),
     9=>array("name"=>"租房清洁"),
     10=>array("name"=>"擦玻璃"),
+    11=>array("name"=>"活动产品"),
 );
 
 //新手礼包

+ 25 - 16
www/protected/modules/o2o/controllers/OrderController.php

@@ -22,7 +22,7 @@ class  OrderController extends O2oBaseController{
         $balance = floatval(Yii::app()->getRequest()->getParam("balance",0));//余额支付的金额
 
         //CommonFn::requestAjax(false,'系统升级中,暂时不能下单');
-        
+
         if(!$precedence){
             $booking_check  = strtotime($booking_time);
             $verity_check = $booking_check - time();
@@ -31,43 +31,51 @@ class  OrderController extends O2oBaseController{
             //}
         }
 
-        //双十一活动暂用  start 判断用户是否购买过
-        /*$doubleEleventId = '581fe5a6a84ea0e36c8b45bb';
-        if($products[0]['product'] == $doubleEleventId) {
+        //双十一活动暂用  start 判断用户是否购买过  58227d2ba84ea0c17e8b45b2
+        $doubleEleventId = '581fe5a6a84ea0e36c8b45bb';
+        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
             $order = ROrder::model()->findAll($criteria_user);
-            if ($order) {
+            $o = CommonFn::getRowsFromCursor($order);
+            $booking_time='';
+            if (!empty($o)) {
+                var_dump($o);exit;
                 CommonFn::requestAjax(false, '对不起,你已经下过单');
             }
             //取出双十一活动暂用
             $criteria_time = new EMongoCriteria();
             $criteria_time->addCond('products.product', '==', new MongoId($doubleEleventId));
             $cursor_time = ROrder::model()->findAll($criteria_time);
-            $rows = CommonFn::getRowsFromCursor($cursor_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;
-            foreach ($rows as $orders) {
-                //判断订单是否达到111单
-                if ($total > 2) {
-                    CommonFn::requestAjax(false, '今天的双11订单已经抢购光了');
-                }
-                //判断是否是当天订单
-                if ($orders->order_time >= $day_start && $orders->order_time <= $day_end) {
-                    $total += 1;
+            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;
+                    }
                 }
             }
 
 
-        }*/
+        }
 
         //end
-
         if(!$user_id||!$products||!$address_id){
             CommonFn::requestAjax(false,CommonFn::getMessage('message','params_illegal'));
         }
@@ -86,6 +94,7 @@ class  OrderController extends O2oBaseController{
                 $address = $value;
             }
         }
+
         if(!$address){
             file_put_contents('/data/erroraddressc.log',var_export($address,true),FILE_APPEND);
             CommonFn::requestAjax(false,CommonFn::getMessage('o2o','address_false'));