1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- class MobileGetCommand extends CConsoleCommand{
- public function run($args) {
- error_reporting(E_ALL);
- ini_set('memory_limit', '1024M');
- set_time_limit(0);
- $month = array('2015-9','2015-10','2015-11','2015-12','2016-1','2016-2');
- foreach ($month as $key => $value) {
- if($key == count($month)-1){
- break;
- }
- $value = array();
- $start_time = strtotime($value);
- $end_time = strtotime($month[$key+1]);
- $criteria = new EMongoCriteria();
- $criteria->order_time('<=',$start_time);
- $criteria->order_time('>=',$end_time);
- $cursor = ROrder::model()->findAll($criteria);
- foreach ($cursor as $order) {
- if(isset($order->address['mobile']) && $order->address['mobile']){
- if(!in_array($order->address['mobile'], $$value)){
- // $$value[] = $order->address['mobile'];
- array_push($$value, $order->address['mobile']);
- }
- }
- }
- $str = implode("\r\n", $$value);
- file_put_contents(APP_PATH.'/download/'.$value.'_order_mobile.txt',$str);
- unset($str);
- }
- // $criteria = new EMongoCriteria();
- // $criteria->order_time('<=',$current_time);
- // $criteria->order_time('>=',$current_time);
- // $criteria->status('==',1);
- // $cursor = ROrder::model()->findAll($criteria);
- // // $cache = new ARedisCache();
- // foreach ($cursor as $order) {
- // if(isset($order->address['mobile']) && $order->address['mobile']){
- // if(!$cache->get('sendsms_'.$order->address['mobile'])){
- // file_put_contents(APP_PATH.'/download/shanghai_foreign_mobile.txt',$order->address['mobile']."\r\n",FILE_APPEND);
- // // $cache->set('sendsms_'.$order->address['mobile'],1,86400);
- // }
- // }
- // }
- // $file = file_get_contents("D://shanghai_foreign_mobile.txt");
- // $mobile_arr = explode("\r\n",$file);
- // $mobile = array_unique($mobile_arr);
- // $file = file_get_contents("D://wz_shanghai_mobile.txt");
- // $wz_mobile = explode("\r\n",$file);
- // foreach ($mobile as $key => $value) {
- // if(!in_array($value,$wz_mobile)){
- // file_put_contents("D://only_foreign_mobile.txt",$value."\r\n",FILE_APPEND);
- // }
- // }
- }
- }
|