e 8 anos atrás
pai
commit
4edb59bc02

+ 15 - 10
www/protected/modules/o2o/controllers/RechargeController.php

@@ -34,7 +34,7 @@ class  RechargeController extends O2oBaseController{
                  }
                  }
                  $user_ids[] = $user->_id;
                  $user_ids[] = $user->_id;
                  $user_ids = array_unique($user_ids);
                  $user_ids = array_unique($user_ids);
-                 //var_dump(CommonFn::sendWxMessage($data));
+                 var_dump(CommonFn::sendWxMessage($data));
              }
              }
         }
         }
         $criteria_order = new EMongoCriteria();
         $criteria_order = new EMongoCriteria();
@@ -45,16 +45,21 @@ class  RechargeController extends O2oBaseController{
         $orders = CommonFn::getRowsFromCursor($cursor);
         $orders = CommonFn::getRowsFromCursor($cursor);
         foreach($orders as $order) {
         foreach($orders as $order) {
             //start充值活动暂用
             //start充值活动暂用
-            if ($order['time'] >= date_create("2016-11-11")->format('U') && $order['time'] <= date_create("2016-11-16")->format('U')) {
+            if ($order['time'] > date_create("2016-11-11")->format('U') && $order['time'] < date_create("2016-11-17")->format('U')) {
                 $user = RUser::model()->get(new MongoId($order['user']));
                 $user = RUser::model()->get(new MongoId($order['user']));
-                $num = intval(ceil((rand(100000, 999999))) / 10000);
-                $data = '{
-                    "touser": "' . $user->wx_pub_openid . '",
-                    "msgtype": "text",
-                    "text": {
-                    "content": "' . '恭喜您获得参与本次活动的权利,' . $num . '为您参加本活动的号码,' . '"
-                    }
-                }';
+                if (!in_array((string)$user->_id,$user_ids)) {
+                    $num = intval(ceil((rand(100000, 999999))) / 10000);
+                    $data = '{
+                        "touser": "' . $user->wx_pub_openid . '",
+                        "msgtype": "text",
+                        "text": {
+                        "content": "' . '恭喜您获得参与本次活动的权利,' . $num . '为您参加本活动的号码,' . '"
+                        }
+                    }';
+                    echo $i++;
+                }
+                $user_ids[] = $user->_id;
+                $user_ids = array_unique($user_ids);
                 var_dump(CommonFn::sendWxMessage($data));
                 var_dump(CommonFn::sendWxMessage($data));
             }
             }
         }
         }