DengTao 8 жил өмнө
parent
commit
e37499bdcd

+ 18 - 21
www/protected/modules/common/controllers/ActivityController.php

@@ -14,6 +14,9 @@ class ActivityController extends O2oBaseController  {
     }
     }
 
 
     public function actionGetCoupon() {
     public function actionGetCoupon() {
+
+
+
         $signPackage = CommonWeixin::get_sign();
         $signPackage = CommonWeixin::get_sign();
         $coupon_id = Yii::app()->request->getParam('coupon_id','');//获取代金券id
         $coupon_id = Yii::app()->request->getParam('coupon_id','');//获取代金券id
         $code = Yii::app()->getRequest()->getParam("code");
         $code = Yii::app()->getRequest()->getParam("code");
@@ -76,13 +79,16 @@ class ActivityController extends O2oBaseController  {
                     $coupon_id =new MongoId($coupon_id);
                     $coupon_id =new MongoId($coupon_id);
                     $start_time = time();                 //发放优惠券可用开始时间
                     $start_time = time();                 //发放优惠券可用开始时间
                     $end_time = $start_time + 86400*30;   //发放优惠券过期时间
                     $end_time = $start_time + 86400*30;   //发放优惠券过期时间
-
-                    if (CommonFn::isMongoId($coupon_id)) {
+                    $user_id = '57e238929f5160d6048b456d';
+                    $user_id = new MongoId($user_id);
+                    Service::factory('CouponService')->giveCoupon($user_id, $coupon_id, $start_time, $end_time);//发放代金券
+                    $this->renderpartial('index');
+                    /*if (CommonFn::isMongoId($coupon_id)) {
                         if (CommonFn::isMongoId($user->_id)) {
                         if (CommonFn::isMongoId($user->_id)) {
 
 
                             Service::factory('CouponService')->giveCoupon($user->_id, $coupon_id, $start_time, $end_time);//发放代金券
                             Service::factory('CouponService')->giveCoupon($user->_id, $coupon_id, $start_time, $end_time);//发放代金券
                         }
                         }
-                    }
+                    }*/
                 }else{
                 }else{
                     echo $accessInfo['errcode'];
                     echo $accessInfo['errcode'];
                     die();
                     die();
@@ -90,25 +96,16 @@ class ActivityController extends O2oBaseController  {
             }
             }
         }
         }
 
 
-        if($home_page){
-            $this->renderpartial('//o2o/index', array(
-                'version' => '2015111601',
-                'debug' => 'false',
-                'signPackage' => $signPackage,
-                'userId' => $userId,
-                'appToken' => $appToken,
-            ));
-        }else{
 
 
-            $this->renderpartial('getCoupon', array(
-                'version' => '2015111601',
-                'debug' => 'false',
-                'signPackage' => $signPackage,
-                'userId' => $userId,
-                'appToken' => $appToken,
-                'coupon_id' => $coupon_id,
-            ));
-        }
+
+        $this->renderpartial('getCoupon', array(
+            'version' => '2015111601',
+            'debug' => 'false',
+            'signPackage' => $signPackage,
+            'userId' => $userId,
+            'appToken' => $appToken,
+            'coupon_id' => $coupon_id,
+        ));
 
 
 
 
 
 

+ 0 - 0
www/protected/modules/common/views/activity/test.php → www/protected/modules/common/views/activity/index.php