Browse Source

activityController

DengTao 8 years ago
parent
commit
0f97d84938
1 changed files with 10 additions and 11 deletions
  1. 10 11
      www/protected/modules/common/controllers/ActivityController.php

+ 10 - 11
www/protected/modules/common/controllers/ActivityController.php

@@ -73,17 +73,8 @@ class ActivityController extends O2oBaseController  {
                         }
                     }
                     //用户注册后,发放代金券
+                    $userId = $user->_id;
 
-                    $coupon_id =new MongoId($coupon_id);
-                    $start_time = time();                 //发放优惠券可用开始时间
-                    $end_time = $start_time + 86400*30;   //发放优惠券过期时间
-                    var_dump($user->_id);
-                    if (CommonFn::isMongoId($coupon_id) && !$coupon_id) {
-                        if (CommonFn::isMongoId($user->_id) && !$user->_id) {
-                            Service::factory('CouponService')->giveCoupon($user->_id, $coupon_id, $start_time, $end_time);//发放代金券
-                            $this->renderpartial('index');exit;
-                        }
-                    }
                 }else{
                     echo $accessInfo['errcode'];
                     die();
@@ -93,7 +84,15 @@ class ActivityController extends O2oBaseController  {
             }
         }
 
-
+        $coupon_id =new MongoId($coupon_id);
+        $start_time = time();                 //发放优惠券可用开始时间
+        $end_time = $start_time + 86400*30;   //发放优惠券过期时间
+        if (CommonFn::isMongoId($coupon_id) && !$coupon_id) {
+            if (CommonFn::isMongoId($userId) && !$userId) {
+                Service::factory('CouponService')->giveCoupon($userId, $coupon_id, $start_time, $end_time);//发放代金券
+                $this->render('index');exit;
+            }
+        }
         if($home_page){
             var_dump($user->_id);exit;
             $this->renderpartial('index');