Charlie 8 жил өмнө
parent
commit
915de68502

+ 0 - 3
webshell/dailyAnalys.sh

@@ -1,3 +0,0 @@
-#! /bin/bash
-cd /data/php/www/protected
-/usr/local/php/bin/php yiic dailyanalys

+ 0 - 4
webshell/hourlyWork.sh

@@ -1,4 +0,0 @@
-#! /bin/bash
-cd /data/php/www/protected
-/usr/local/php/bin/php yiic hourlywork
-/usr/local/php/bin/php yiic dealvideoconv

+ 0 - 156
www/protected/commands/HourlyWorkCommand.php

@@ -1,156 +0,0 @@
-<?php
-require_once(APP_PATH."/protected/vendors/tencent/XingeApp.php");
-class HourlyWorkCommand extends CConsoleCommand{
-    public function run($args) {
-        error_reporting(E_ERROR);
-        ini_set('memory_limit', '256M');
-        set_time_limit(0);
-
-
-        //用户活跃度异步任务
-        $list = new ARedisList('user_active_list');
-        while ($list->getCount() > 0) {
-            $key = $list->pop();
-            try {
-                Service::factory('LevelService')->addActive($key);
-            } catch (Exception $e) {
-                continue;
-            }
-        }
-
-        $end_time = time();
-        $start_time = $end_time - 3600*2;
-        $criteria = new EMongoCriteria();
-        $criteria->time('>=',$start_time);
-        $criteria->time('<',$end_time);
-        $cursor = Topic::model()->findAll($criteria);
-        $i=1;
-        $docs_to_upload = array();
-        foreach ($cursor as $topic) {
-            $i++;
-            if($i%200 == 0){
-                $result = Service::factory('SearchService')->addTopic($docs_to_upload);
-                var_dump($result);
-                sleep(3);
-                $docs_to_upload = array();
-            }
-            $item = array();
-            $item['cmd'] = 'update';
-            //添加文档内容
-            $item["fields"] = array(
-                                    'id'=>(string)$topic->_id,
-                                    "content" => $topic->content,
-                                    "search_rank" => $topic->search_rank,
-                                    'status'=>$topic->status,
-                                    'time'=>$topic->time
-                                );
-            $docs_to_upload[] = $item;
-        }
-        if(!empty($docs_to_upload)){
-            $result = Service::factory('SearchService')->addTopic($docs_to_upload);
-            var_dump($result);
-        }
-        $docs_to_upload = array();
-        echo "end_topic:";
-
-        $end_time = time();
-        $start_time = $end_time - 3600*2;
-        $criteria = new EMongoCriteria();
-        $criteria->time('>=',$start_time);
-        $criteria->time('<',$end_time);
-        $cursor = Post::model()->findAll($criteria);
-        $i=1;
-        $docs_to_upload = array();
-        foreach ($cursor as $post) {
-            $i++;
-            if($i%200 == 0){
-                $result = Service::factory('SearchService')->addPost($docs_to_upload);
-                var_dump($result);
-                sleep(3);
-                $docs_to_upload = array();
-            }
-            $item = array();
-            $item['cmd'] = 'update';
-            //添加文档内容
-            $item["fields"] = array(
-                                    'id'=>(string)$post->_id,
-                                    "content" => $post->content,
-                                    'time'=>$post->time,
-                                    'status'=>$post->status,
-                                );
-            $docs_to_upload[] = $item;
-        }
-        if(!empty($docs_to_upload)){
-            $result = Service::factory('SearchService')->addPost($docs_to_upload);
-        }
-        $docs_to_upload = array();
-        echo "end_post:";
-        var_dump($result);
-
-        $criteria = new EMongoCriteria();
-        $start_time = $end_time - 3600*2;
-        $criteria->register_time('>=',$start_time);
-        $criteria->register_time('<',$end_time);
-        $cursor = RUser::model()->findAll($criteria);
-        $i=1;
-        $docs_to_upload = array();
-        foreach ($cursor as $user) {
-            $i++;
-            if($i%100 == 0){
-                $result = Service::factory('SearchService')->addUser($docs_to_upload);
-                var_dump($result);
-                sleep(3);
-                $docs_to_upload = array();
-            }
-            $item = array();
-            $item['cmd'] = 'ADD';
-            //添加文档内容
-            $item["fields"] = array(
-                                    'id'=>(string)$user->_id,
-                                    "user_name" => $user->user_name,
-                                    "status" => $user->status,
-                                );
-            $docs_to_upload[] = $item;
-        }
-        if(!empty($docs_to_upload)){
-            $result = Service::factory('SearchService')->addUser($docs_to_upload);
-        }
-        $docs_to_upload = array();
-        echo "end_user:";
-        var_dump($result);
-
-        //用户信息更新,每小时更新
-        $list = new ARedisList('user_info_update');
-        while ($list->getCount() > 0) {
-            $res = $list->pop();
-            $syncData = unserialize($res);
-            try {
-                $user_obj = RUser::get(new MongoId($syncData['user_id']));
-                $user_obj->app_client_id = $syncData['app_client_id'];
-                $user_obj->device_id = $syncData['device_id'];
-                $user_obj->channel = $syncData['channel'];
-                $user_obj->app_version = $syncData['app_version'];
-                $user_obj->phone_type = $syncData['phone_type'];
-                $user_obj->os_version = $syncData['os_version'];
-                $user_obj->last_visit_time = $syncData['last_visit_time'];
-                $user_obj->update(array('last_visit_time','app_version','app_client_id','device_id','channel','phone_type','os_version'),true);
-                    $getui = Service::factory('PushService');
-                    $cids = $getui->queryCID($syncData['user_id']);
-                    if($cids){
-                        $tags = [];
-                        foreach ($cids as $cid){
-                            $res = $getui->getCidTags($cid);
-                            $new_tags = preg_replace('/\d+(\.\d+){0,2}/',$syncData['app_version'],$res);
-                            $new_tags = explode(' ',$new_tags);
-                            $res = $getui->setTag($cid,$new_tags);
-                            var_dump($res);
-                        }
-                    }
-            } catch (Exception $e) {
-                continue;
-            }
-        }
-        
-
-    }
-}