Explorar el Código

activityController

DengTao hace 8 años
padre
commit
31a64e54ae
Se han modificado 1 ficheros con 14 adiciones y 17 borrados
  1. 14 17
      www/protected/modules/common/controllers/ActivityController.php

+ 14 - 17
www/protected/modules/common/controllers/ActivityController.php

@@ -10,7 +10,7 @@ class ActivityController extends O2oBaseController  {
     //扫码获取代金券
 
     public function actionIndex(){
-
+        $this->render('index');exit;
     }
 
     public function actionGetCoupon() {
@@ -72,7 +72,18 @@ class ActivityController extends O2oBaseController  {
                             var_dump($userAr);exit;
                         }
                     }
-
+                    //用户注册后,发放代金券
+
+                    $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();
@@ -81,21 +92,7 @@ class ActivityController extends O2oBaseController  {
 
             }
         }
-        //用户注册后,发放代金券
-
-        $coupon_id =new MongoId($coupon_id);
-        $start_time = time();                 //发放优惠券可用开始时间
-        $end_time = $start_time + 86400*30;   //发放优惠券过期时间
-        var_dump($userId);exit;
-        $userId = new MongoId($userId);
-        var_dump($userId);exit;
-        if (CommonFn::isMongoId($coupon_id) && !$coupon_id) {
-            if (CommonFn::isMongoId($userId) && !$userId) {
-                Service::factory('CouponService')->giveCoupon($userId, $coupon_id, $start_time, $end_time);//发放代金券
-                echo "123";exit;
-                //$this->renderpartial('index');exit;
-            }
-        }
+
 
         if($home_page){
             var_dump($user->_id);exit;