|
@@ -28,28 +28,6 @@ class AsyncWorkCommand extends CConsoleCommand{
|
|
|
$user_id = $list->pop();
|
|
|
try {
|
|
|
$userAr = RUser::get(new MongoId($user_id));
|
|
|
-
|
|
|
- //用户注册后默认关注几个圈子
|
|
|
- $z_group = new ZGroup();
|
|
|
- $default_groups = $z_group->get_default_fllow_group();
|
|
|
- $mongo = new MongoClient(DB_CONNETC);
|
|
|
- $db = $mongo->wozhua_data;
|
|
|
- $collection = $db->selectCollection('groups');
|
|
|
- $conditions = array(
|
|
|
- '_id' => array('$in' => $default_groups)
|
|
|
- );
|
|
|
- $collection->update(
|
|
|
- $conditions,
|
|
|
- array('$inc' => array("users_count" => 1)),
|
|
|
- array("multiple" => true)
|
|
|
- );
|
|
|
-
|
|
|
- //注册后默认关注几个用户
|
|
|
- $default_fllow_users = Yii::app()->params['default_fllow_users'];
|
|
|
- $user_node = new UserNodeRecord($userAr->_id);
|
|
|
- foreach ($default_fllow_users as $fuser_id) {
|
|
|
- $user_node->follow($fuser_id);
|
|
|
- }
|
|
|
|
|
|
//抓取头像到七牛
|
|
|
$url = $userAr->avatar;
|
|
@@ -90,46 +68,6 @@ class AsyncWorkCommand extends CConsoleCommand{
|
|
|
|
|
|
}
|
|
|
|
|
|
- //七牛语音转码消息队列
|
|
|
- $list = new ARedisList(Yii::app()->params['voice_conv_list']);
|
|
|
- $qiniu_config = Yii::app()->params['qiniuConfig'];
|
|
|
- $bucket = $qiniu_config['voice'];
|
|
|
- while ($list->getCount() > 0) {
|
|
|
- $key = $list->pop();
|
|
|
- try {
|
|
|
- $status = CommonFn::ConvVoice($bucket,$key);
|
|
|
- } catch (Exception $e) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //打标签异步任务
|
|
|
- $list = new ARedisList('add_tag');
|
|
|
- while ($list->getCount() > 0) {
|
|
|
- $res = $list->pop();
|
|
|
- if(ENVIRONMENT != 'product'){
|
|
|
- continue;
|
|
|
- }
|
|
|
- $data = unserialize($res);
|
|
|
- try {
|
|
|
- $getui = Service::factory('PushService');
|
|
|
- $cids = $getui->queryCID($data['user_id']);
|
|
|
- if($cids){
|
|
|
- $tags = [];
|
|
|
- foreach ($cids as $cid){
|
|
|
- $res = $getui->getCidTags($cid);
|
|
|
- $new_tags = explode(' ',$res);
|
|
|
- $new_tags[] = $data['tag'];
|
|
|
- $res = $getui->setTag($cid,$new_tags);
|
|
|
- var_dump($res);
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception $e) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
//订单支付成功后异步任务
|
|
|
$list = new ARedisList('o2o_after_pay_success');
|
|
|
while ($list->getCount() > 0) {
|
|
@@ -246,74 +184,6 @@ class AsyncWorkCommand extends CConsoleCommand{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- //删帖后异步任务
|
|
|
- $list = new ARedisList('topic_del_new_list');
|
|
|
- $from_user = Yii::app()->params['sys_user'];
|
|
|
- $z_message = new ZMessage();
|
|
|
- $z_topic = new ZTopic();
|
|
|
- while ($list->getCount() > 0) {
|
|
|
- $res = $list->pop();
|
|
|
- try {
|
|
|
- $data = unserialize($res);
|
|
|
- $topic = Topic::get(new MongoId($data['id']));
|
|
|
- if($topic){
|
|
|
- Service::factory('ScoreService')->cutDownScore((string)$topic->user,'score_deltopic',2);
|
|
|
- $z_topic->syncData($topic->_id,'del');
|
|
|
- if($data['reason']){
|
|
|
- $content = '你的帖子 『'.mb_substr($topic->content,0,20,'utf-8').'』 被管理员删除了。'.$data['reason'];
|
|
|
- $data = array(
|
|
|
- 'from_user' => $from_user,
|
|
|
- 'to_user' => (string)$topic->user,
|
|
|
- 'content' => $content,
|
|
|
- 'pics' => array(),
|
|
|
- 'voice' => array(),
|
|
|
- 'video'=> array()
|
|
|
- );
|
|
|
- $z_message->addMessage($data);
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception $e) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //点喜欢后异步任务
|
|
|
- $list = new ARedisList('after_like_work');
|
|
|
- while ($list->getCount() > 0) {
|
|
|
- $key = $list->pop();
|
|
|
- try {
|
|
|
- $likeAr = Like::get(new MongoId($key));
|
|
|
- if($likeAr && $likeAr->type == 'topic'){
|
|
|
-
|
|
|
- // $parsed_like = $likeAr->parseRow($likeAr);
|
|
|
- // $getui = Service::factory('PushService');
|
|
|
- // $gt_content = [
|
|
|
- // 'title' => $parsed_like['user']['user_name'],
|
|
|
- // 'content' => '喜欢了你的帖子',
|
|
|
- // 'type' => 'like',
|
|
|
- // 'data' => $parsed_like
|
|
|
- // ];
|
|
|
- // $getui->pushMessageToSingle($getui->TransmissionTemplate(['transmissionType'=> 2,'alert' => $parsed_like['user']['user_name'].'喜欢了你的帖子','transmissionContent'=>$gt_content]),$parsed_like['like_obj']['user']['id']);
|
|
|
-
|
|
|
- $like_obj = Topic::get($likeAr->like_obj);
|
|
|
- $author = RUser::get($like_obj->user);
|
|
|
- $z_like = new ZLike();
|
|
|
- $z_like->addAction($likeAr);
|
|
|
- //帖子的被赞数加一
|
|
|
- $like_obj->like_count = $like_obj->like_count+1;
|
|
|
- //帖子的作者的被赞数加一
|
|
|
- $author->liked_count = $author->liked_count+1;
|
|
|
- $like_obj->update(array('like_count'), true);
|
|
|
- $author->update(array('liked_count'), true);
|
|
|
- //用户行为记录
|
|
|
- CommonFn::setInteraction($likeAr->user,$author->_id,'like');
|
|
|
- }
|
|
|
- } catch (Exception $e) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
//发送短信异步任务
|
|
|
$list = new ARedisList('send_sms_list');
|
|
@@ -328,14 +198,7 @@ class AsyncWorkCommand extends CConsoleCommand{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //帖子查看数异步处理
|
|
|
- $list = new ARedisList('topic_viewcounter_list');
|
|
|
- while ($list->getCount() > 0) {
|
|
|
- $topic_id = $list->pop();
|
|
|
- $topic = Topic::get(new MongoId($topic_id));
|
|
|
- $topic->visit_count = $topic->visit_count+10;
|
|
|
- $topic->update(array('visit_count'),true);
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|