|
@@ -73,15 +73,15 @@ class WebController extends O2oBaseController {
|
|
|
//三批
|
|
|
$criteria = new EMongoCriteria();
|
|
|
|
|
|
- $criteria->coupon('==',new MongoId('5822df8aa84ea04e238b456f'));
|
|
|
- $criteria->user('==', new MongoId('57e237ea9f5160b6048b4568'));
|
|
|
+ $criteria->coupon('==',new MongoId('57fe0aaa9f5160b1048b456c'));
|
|
|
+ $criteria->user('==', new MongoId($userId));
|
|
|
$user_coupon = UserCoupon::model()->find($criteria);
|
|
|
if (empty($user_coupon) && time() >= intval(date_create("2016-11-10")->format('U')) && time() <= intval(date_create("2016-11-17")->format('U'))) {
|
|
|
|
|
|
$coupons = array(
|
|
|
- 0 => array('5822df8aa84ea04e238b456f', '5822df7ba84ea03e238b456d'),
|
|
|
- 1 => array('57fe10c69f5160b5048b45d0', '57fe0ed09f5160a2048b456b'),
|
|
|
- 2 => array('57fe0e029f5160a9048b456a', '57fe0d9b9f5160a3048b4572')
|
|
|
+ 0 => array('57fe0aaa9f5160b1048b456c'),
|
|
|
+ 1 => array('57fe09fa9f5160d1048b456e'),
|
|
|
+ 2 => array('57fe0a779f5160aa048b456a')
|
|
|
);
|
|
|
foreach ($coupons as $key => $coupon) {
|
|
|
switch ($key) {
|
|
@@ -89,23 +89,33 @@ class WebController extends O2oBaseController {
|
|
|
case 0:
|
|
|
$start_time = date_create("2016-11-14")->format('U');//发放优惠券可用开始时间 2016.11.14
|
|
|
$end_time = date_create("2016-11-30")->format('U'); //发放优惠券过期时间 17天
|
|
|
+ foreach ($coupon as $c) {
|
|
|
+ $coupon_id = new MongoId($c);
|
|
|
+ Service::factory('CouponService')->giveCoupon($userId, $coupon_id, $start_time, $end_time);//发放代金券
|
|
|
+ }
|
|
|
break;
|
|
|
//第二批
|
|
|
case 1:
|
|
|
$start_time = date_create("2016-12-01")->format('U');//发放优惠券可用开始时间 2016.11.14
|
|
|
$end_time = date_create("2016-12-15")->format('U'); //发放优惠券过期时间 15天
|
|
|
+ foreach ($coupon as $c) {
|
|
|
+ $coupon_id = new MongoId($c);
|
|
|
+ Service::factory('CouponService')->giveCoupon($userId, $coupon_id, $start_time, $end_time);//发放代金券
|
|
|
+ }
|
|
|
break;
|
|
|
//第三批
|
|
|
case 2:
|
|
|
+
|
|
|
$start_time = date_create("2016-12-16")->format('U');//发放优惠券可用开始时间 2016.11.14
|
|
|
$end_time = $start_time + 86400 * 16; //发放优惠券过期时间 15天
|
|
|
+ foreach ($coupon as $c) {
|
|
|
+ $coupon_id = new MongoId($c);
|
|
|
+ Service::factory('CouponService')->giveCoupon($userId, $coupon_id, $start_time, $end_time);//发放代金券
|
|
|
+ }
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
- foreach ($coupon as $c) {
|
|
|
- $coupon_id = new MongoId($c);
|
|
|
- Service::factory('CouponService')->giveCoupon($userId, $coupon_id, $start_time, $end_time);//发放代金券
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
//end
|