|
@@ -7,6 +7,30 @@
|
|
|
*/
|
|
|
|
|
|
class ActivityController extends O2oBaseController {
|
|
|
+ /**
|
|
|
+ * 双十一给所有用户发券
|
|
|
+ * 57fe0aaa9f5160b1048b456c
|
|
|
+ */
|
|
|
+ public function actionDoubleEleven(){
|
|
|
+ $coupon_id = "5816a413a84ea0023f8b46ba";
|
|
|
+ $coupon_id =new MongoId($coupon_id);
|
|
|
+ $start_time = date_create("2016-11-11")->format('U'); //发放优惠券可用开始时间 2016.11.11
|
|
|
+ $end_time = $start_time + 86400*30; //发放优惠券过期时间 一个月
|
|
|
+ $cursor = RUser::model()->findAll();
|
|
|
+
|
|
|
+ $rows = CommonFn::getRowsFromCursor($cursor);
|
|
|
+ $flag = 0;
|
|
|
+ foreach ($rows as $value) {
|
|
|
+ if (CommonFn::isMongoId($value['_id'])) {
|
|
|
+ $userId = $value['_id'];
|
|
|
+ Service::factory('CouponService')->giveCoupon($userId, $coupon_id, $start_time, $end_time);//发放代金券
|
|
|
+ $flag +=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ echo "总共发送".$flag."个用户";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//扫码获取代金券
|
|
|
public function actionGetCoupon() {
|
|
|
$signPackage = CommonWeixin::get_sign();
|