Explorar o código

优惠券发放时间

DengTao %!s(int64=8) %!d(string=hai) anos
pai
achega
d630638ebc

+ 3 - 2
www/protected/modules/common/controllers/ActivityController.php

@@ -35,8 +35,9 @@ class ActivityController extends O2oBaseController
   //扫码跳转11元订单页面,回掉微信接口,注册用户信息,然后生成订单
   public function actionScanCoupon()
   {
-    $this->redirect('http://common.yiguanjia.me/index.php?r=o2o/web/index');
-
+    //$this->redirect('http://common.yiguanjia.me/index.php?r=o2o/web/index');
+    var_dump(date_create("2016-11-10")->format('U'));
+    var_dump(time());
   }
 
 

+ 4 - 5
www/protected/modules/o2o/controllers/WebController.php

@@ -65,10 +65,9 @@ class WebController extends O2oBaseController {
                     //$criteria->coupon('==',$coupon_id);
                     $criteria->user('==', $userId);
                     $user_coupon = UserCoupon::model()->find($criteria);
-                    echo "1";
-                    //if (empty($user_coupon) && time() >= date_create("2016-11-10")->format('U') && time() <= date_create("2016-11-13")->format('U')) {
-                        echo "2";
-                        //var_dump(time());
+
+                    if (empty($user_coupon) && time() >= date_create("2016-11-10")->format('U') && time() <= date_create("2016-11-13")->format('U')) {
+
                         $coupons = array(
                             0 => array('5822df8aa84ea04e238b456f', '5822df7ba84ea03e238b456d'),
                             1 => array('57fe10c69f5160b5048b45d0', '57fe0ed09f5160a2048b456b'),
@@ -98,7 +97,7 @@ class WebController extends O2oBaseController {
                                 Service::factory('CouponService')->giveCoupon($userId, $coupon_id, $start_time, $end_time);//发放代金券
                             }
                         }
-                    //}
+                    }
                     //end