Pārlūkot izejas kodu

add comment push

stanley-king 7 gadi atpakaļ
vecāks
revīzija
6c563788f7
2 mainītis faili ar 44 papildinājumiem un 1 dzēšanām
  1. 35 1
      data/logic/queue.logic.php
  2. 9 0
      helper/push_helper.php

+ 35 - 1
data/logic/queue.logic.php

@@ -25,6 +25,7 @@ require_once (BASE_ROOT_PATH . '/helper/user_session/fcode.php');
 require_once (BASE_ROOT_PATH . '/helper/stat_helper.php');
 require_once (BASE_ROOT_PATH . '/helper/message/publisher.php');
 require_once (BASE_ROOT_PATH . '/helper/search/tcp_client.php');
+require_once (BASE_ROOT_PATH . '/helper/ugc_helper.php');
 
 class queueLogic
 {
@@ -703,6 +704,39 @@ class queueLogic
     }
     public function onUgcComment($param)
     {
-        return callback(true);
+        try
+        {
+            $special_id = intval($param['special_id']);
+            $comment_id = intval($param['comment_id']);
+            $senderid   = intval($param['member_id']);
+
+            if($comment_id > 0)
+            {
+                $mod = Model('ugc_comment');
+                $comments = $mod->getCommentList(['comment_id' => $comment_id],'*',0);
+                if(!empty($comments)) {
+                    $member_id = intval($comments['user_id']);
+                }
+            }
+            else
+            {
+                $mod_special = Model('mb_special');
+                $special_info = $mod_special->getMbSpecialByID($special_id,'*');
+                if(empty($special_info)) {
+                    return callback(false);
+                }
+                $special = new ugc\special($special_info);
+                $member_id = $special->memberid();
+            }
+            $sender   = new member_info($senderid);
+            $content = "{$sender->nickname()} 评论了您";
+
+            push_helper::comment($member_id,$special_id,$content);
+            return callback(true);
+        }
+        catch (Exception $ex)
+        {
+            return callback(false);
+        }
     }
 }

+ 9 - 0
helper/push_helper.php

@@ -188,6 +188,15 @@ class push_helper
 
         QueueClient::push('upushSendMsg',$push_param);
     }
+    public static function comment($member_id,$special_id,$content)
+    {
+        $push_param = array();
+        $push_param['member_id'] = $member_id;
+        $push_param['text']      = $content;
+        $push_param['go_type']   = '';
+
+        QueueClient::push('upushSendMsg',$push_param);
+    }
 
     public static function format_msg($member_id,$content)
     {