Quellcode durchsuchen

move ugc to async

stanley-king vor 7 Jahren
Ursprung
Commit
1fa035a7f2

+ 2 - 2
admin/control/mb_special.php

@@ -826,12 +826,12 @@ class mb_specialControl extends SystemControl
 
             if($state == 'pass') {
                 $mod_special->editUserSpecial($special_id,['special_id' => $special_id], ['state' => 0,'check_time' => time()]);
-                QueueClient::push('onPublishSpecial',['user_id' => $special->memberid(),'specials'=> array(['type' => $special->reader_type(),'spid' => $special_id])]);
+                QueueClient::push('onAsyncUgcPublish',['special_id' => $special_id]);
             }
             elseif($state == 'unpass') {
                 $mod_special = Model('mb_special');
                 $mod_special->editUserSpecial($special_id,['special_id' => $special_id], ['state' => 1,'check_time' => time()]);
-                QueueClient::push('onDelSpecial',['user_id' => $special->memberid(),'specials'=> array(['type' => $special->reader_type(),'spid' => $special_id])]);
+                QueueClient::push('onAsyncUgcDel',['special_id' => $special_id]);
             }
             else {
 

+ 57 - 76
data/logic/queue.logic.php

@@ -604,6 +604,27 @@ class queueLogic
         }
     }
 
+    public function reset_fcode($param)
+    {
+        $pay_sn = $param['pay_sn'];
+        if(empty($pay_sn)) {
+            return callback(false);
+        }
+
+        $num = \fcode\operator::reset($pay_sn);
+        if($num > 0) {
+            return callback(true);
+        } else {
+            return callback(false);
+        }
+    }
+    public function onUseBonus($param)
+    {
+        stat_helper::onUseBonus($param);
+        return callback(true);
+    }
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     public function onAsyncRegister($param)
     {
         $user = $param['user'];
@@ -670,99 +691,59 @@ class queueLogic
         return callback(true);
     }
 
-    public function reset_fcode($param)
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    public function onAsyncUgcPublish($param)
     {
-        $pay_sn = $param['pay_sn'];
-        if(empty($pay_sn)) {
-            return callback(false);
-        }
-
-        $num = \fcode\operator::reset($pay_sn);
-        if($num > 0) {
-            return callback(true);
-        } else {
-            return callback(false);
-        }
+        $spid = $param['special_id'];
+        account_helper::onAsyncUgcPublish($spid);
+        return callback(true);
     }
-    public function onUseBonus($param)
+
+    public function onAsyncUgcDel($param)
     {
-        stat_helper::onUseBonus($param);
+        $spid = $param['special_id'];
+        account_helper::onAsyncUgcDel($spid);
         return callback(true);
     }
-    public function onPublishSpecial($param)
-    {
-        $publisher = new message\publisher();
-        $publisher->add_special($param['user_id'],$param['specials']);
 
-        $specials = $param['specials'];
-        $pub_count = 0;
-        $pri_count = 0;
-        foreach ($specials as $special)
-        {
-            if($special['type'] == 0) {
-                $pub_count++;
-            }
-            else {
-                $pri_count++;
-            }
-        }
+    public function onAsyncUgcSubmit($param)
+    {
+        $spid = $param['special_id'];
+        $user = $param['user_id'];
 
-        $result = search\relation_client::instance()->fetch_follow(array('user_id' => $param['user_id']));
-        if($result['code'] == 200)
-        {
-            $follows = $result['data']['follows'];
-            $pushor = new push_message();
-            if($pri_count > 0 || $pub_count > 0) {
-                $pushor->publish_special($follows,false,$pri_count);
-            }
-        }
+        account_helper::onAsyncUgcSubmit($spid,$user);
         return callback(true);
     }
 
-    public function onDelSpecial($param)
+    public function onAsyncUgcSupport($param)
     {
-        $publisher = new message\publisher();
-        $publisher->del_special($param['user_id'],$param['specials']);
+        $spid = $param['special_id'];
+        $user = $param['user_id'];
+        $comment_id = $param['comment_id'];
+
+        account_helper::onAsyncUgcSupport($spid,$comment_id,$user);
         return callback(true);
     }
 
-    public function onUgcComment($param)
+    public static function onAsyncUgcAppreciate($param)
     {
-        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()} 评论了您";
+        $spid = $param['special_id'];
+        $user = $param['user_id'];
+        $rate = $param['rate'];
+        $amount = $param['amount'];
+        account_helper::onAsyncUgcAppreciate($spid,$user,$rate,$amount);
+        return callback(true);
+    }
 
-            push_helper::comment($member_id,$special_id,$content);
-            return callback(true);
-        }
-        catch (Exception $ex)
-        {
-            return callback(false);
-        }
+    public function onAsyncUgcComment($param)
+    {
+        $special_id = intval($param['special_id']);
+        $comment_id = intval($param['comment_id']);
+        $user_id    = intval($param['user_id']);
+        account_helper::onAsyncUgcComment($special_id,$comment_id,$user_id);
+        return callback(true);
     }
+
     public function onClickSpecial($param)
     {
         $special_id = intval($param['special_id']);

+ 62 - 15
helper/account_helper.php

@@ -24,7 +24,7 @@ require_once(BASE_ROOT_PATH . '/helper/async/IAsync.php');
 require_once(BASE_ROOT_PATH . '/helper/async/status.php');
 require_once(BASE_ROOT_PATH . '/helper/async/register.php');
 require_once(BASE_ROOT_PATH . '/helper/async/order.php');
-require_once(BASE_ROOT_PATH . '/helper/async/ugc.php');
+require_once(BASE_ROOT_PATH . '/helper/async/qugc.php');
 
 require_once(BASE_ROOT_PATH . '/helper/order_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/fcode/present_manager.php');
@@ -224,7 +224,7 @@ class account_helper
 
     public static function appreciate($sender_id,$rate,$amount,$toid,$bless)
     {
-        $param = \bonus\parameters::appreciate($sender_id,intval($rate),$amount,$bless);
+        $param = bonus\parameters::appreciate($sender_id,intval($rate),$amount,$bless);
         $pred = new predeposit_helper($sender_id);
 
         $rate_moneys[] = ['rate' => $rate,'num' => 1,'amount' => $amount,'hold_amount' => $amount];
@@ -233,10 +233,6 @@ class account_helper
         $pred->inc_rate_version();
         $type_sn = $ret['type_sn'];
         $ret = bonus_helper::send($type_sn,[$toid]);
-        if($ret != false) {
-            push_helper::appreciate_bonus($sender_id,$toid);
-        }
-
         return ($ret != false);
     }
 
@@ -422,23 +418,74 @@ class account_helper
         }
     }
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    public static function onAsyncGoodsDiscount($gid)
+    public static function onAsyncUgcPublish($spid)
     {
-
+        try
+        {
+            $iPusher = new async\qugc($spid);
+            $iPusher->onPublish();
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
     }
-    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    public static function onAsyncDiscoverReward($spid)
+    public static function onAsyncUgcDel($spid)
     {
-
+        try
+        {
+            $iPusher = new async\qugc($spid);
+            $iPusher->onDel();
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
     }
-
-    public static function onAsyncDiscoverComment($spid,$commentid)
+    public static function onAsyncUgcSubmit($spid,$user)
     {
-
+        try
+        {
+            $iPusher = new async\qugc($spid);
+            $iPusher->onSubmit($user);
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
     }
-
+    public static function onAsyncUgcSupport($spid,$comment_id,$user)
+    {
+        try
+        {
+            $iPusher = new async\qugc($spid);
+            $iPusher->onSupport($comment_id,$user);
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
+    }
+    public static function onAsyncUgcComment($spid,$commentid,$userid)
+    {
+        try
+        {
+            $iPusher = new async\qugc($spid);
+            $iPusher->onComment($commentid,$userid);
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
+    }
+    public static function onAsyncUgcAppreciate($spid,$user,$rate,$amount)
+    {
+        try
+        {
+            $iPusher = new async\qugc($spid);
+            $iPusher->onAppreciate($user,$rate,$amount);
+        } catch (Exception $ex) {
+            Log::record($ex->getMessage(),Log::ERR);
+        }
+    }
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     public static function onAsyncFollow($user,$follow)
     {
 
     }
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    public static function onAsyncGoodsDiscount($gid)
+    {
+
+    }
 }

+ 142 - 0
helper/async/qugc.php

@@ -0,0 +1,142 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: stanley-king
+ * Date: 2017/11/7
+ * Time: 下午4:30
+ */
+
+namespace async;
+
+use message;
+use search;
+use ugc;
+use ugc_helper;
+use push_helper;
+
+class qugc extends IAsync
+{
+    private $special;
+    private $user;
+    private $special_id;
+
+    public function __construct($special_id)
+    {
+        $mod_special = Model('mb_special');
+        $info = $mod_special->getMbSpecialByID($special_id,'*',true);
+        $this->special = new ugc\special($info);
+        $this->user = $this->special->memberid();
+        $this->special_id = $special_id;
+    }
+
+    public function onPublish()
+    {
+        $read_type = $this->special->reader_type();
+        if($read_type != ugc_helper::private_self) {
+            $publisher = new message\publisher();
+            $publisher->add_special($this->user,array(['type' => $read_type,'spid' => $this->special_id]));
+            $follows = search\relation_client::instance()->fetch_follow(['user_id' => $this->user]);
+            $this->nofity_pub($follows);
+        }
+    }
+
+    private function nofity_pub($follows)
+    {
+        if(empty($follows)) return false;
+
+        $title = $this->special->share_title();
+        $this->ex_user($follows,$this->user);
+        foreach ($follows as $follow) {
+            push_helper::nofity_ugc_pub($follow,$this->user,$this->special_id,$title);
+        }
+    }
+
+    public function onDel()
+    {
+        $read_type = $this->special->reader_type();
+        $publisher = new message\publisher();
+        $publisher->del_special($this->user,array(['type' => $read_type,'spid' => $this->special_id]));
+    }
+
+    public function onSubmit($reader)
+    {
+        $reader = intval($reader);
+        if($reader > 0 && $this->user != $reader) {
+            $title = $this->special->share_title();
+            push_helper::nofity_ugc_submit($this->user,$reader,$this->special_id,$title);
+        }
+    }
+
+    public function onSupport($comment_id,$user)
+    {
+        $content = null;
+        if($comment_id > 0)
+        {
+            $mod = Model('ugc_comment');
+            $comments = $mod->getCommentList(['comment_id' => $comment_id],'*',0);
+            if(!empty($comments)) {
+                $author = intval($comments[0]['user_id']);
+                $content = $comments[0]['content'];
+                $fcomment = true;
+            }
+            else {
+                return false;
+            }
+        }
+        else {
+            $author = $this->user;
+            $fcomment = false;
+        }
+
+        if($author != $user) {
+            push_helper::nofity_ugc_support($author,$user,$fcomment,$this->special_id,$content,$this->special->share_title());
+        }
+
+        return true;
+    }
+
+    public function onComment($comment_id,$user)
+    {
+        if($user <= 0) return false;
+
+        $content = null;
+        if($comment_id > 0)
+        {
+            $mod = Model('ugc_comment');
+            $comments = $mod->getCommentList(['comment_id' => $comment_id],'*',0);
+            if(!empty($comments)) {
+                $author = intval($comments[0]['user_id']);
+                $content = $comments[0]['content'];
+                $fcomment = true;
+            }
+            else {
+                return false;
+            }
+        }
+        else {
+            $author = $this->user;
+            $fcomment = false;
+        }
+
+        if($author != $user) {
+            push_helper::nofity_ugc_comment($author,$user,$fcomment,$this->special_id,$content,$this->special->share_title());
+        }
+
+        return true;
+    }
+
+    public function onAppreciate($user,$rate,$amount)
+    {
+        if($user <= 0) return false;
+        $author = $this->special->memberid();
+        if($author != $user) {
+            push_helper::nofity_ugc_appreciate($author,$user,$this->special_id,$this->special->share_title(),$rate,$amount);
+        }
+        return true;
+    }
+
+    public function run()
+    {
+
+    }
+}

+ 0 - 23
helper/async/ugc.php

@@ -1,23 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 2017/11/7
- * Time: 下午4:30
- */
-
-namespace async;
-
-
-class ugc extends IAsync
-{
-    public function __construct($special_id)
-    {
-
-    }
-
-    public function run()
-    {
-
-    }
-}

+ 15 - 11
helper/bonus/parameters.php

@@ -82,10 +82,12 @@ class parameters
     public static function guide_inviter($nickname,$level)
     {
         $rate_moneys = [
-            ['amount' => 5,'num' => 1, 'rate' => 100],
-            ['amount' => 3,'num' => 1, 'rate' => 100],
-            ['amount' => 2,'num' => 1, 'rate' => 100],
-            ['amount' => 1,'num' => 1, 'rate' => 100]
+            ['amount' => 5,   'num' => 1, 'rate' => 100],
+            ['amount' => 2,   'num' => 1, 'rate' => 100],
+            ['amount' => 1,   'num' => 1, 'rate' => 100],
+            ['amount' => 0.5, 'num' => 1, 'rate' => 100],
+            ['amount' => 0.25,'num' => 1, 'rate' => 100],
+            ['amount' => 0.10,'num' => 1, 'rate' => 100],
         ];
 
         $count = count($rate_moneys);
@@ -111,16 +113,15 @@ class parameters
     public static function guide_invitee($inviter_name, $invitee_name, $level, $num)
     {
         $rate_moneys = [
-            ['amount' => 2,  'num' => $num, 'rate' => 100],
-            ['amount' => 1,  'num' => $num, 'rate' => 100],
-            ['amount' => 0.5,'num' => $num, 'rate' => 100]
+            ['amount' => 2,   'num' => $num, 'rate' => 100],
+            ['amount' => 1,   'num' => $num, 'rate' => 100],
+            ['amount' => 0.5, 'num' => $num, 'rate' => 100]
         ];
 
         $count = count($rate_moneys);
         $cur_index = $level < $count ? $level : $count -1;
 
         $params = [];
-
         $param['make_type'] = type::MakeInviteRewardType;
         $param['type_name'] = "好友加入,雨露均沾";
         $level = $level + 1;
@@ -215,9 +216,12 @@ class parameters
     public static function order_complete_inviter($nickname,$level)
     {
         $rate_moneys = [
-            ['amount' => 3,'num' => 1, 'rate' => 100],
-            ['amount' => 2,'num' => 1, 'rate' => 100],
-            ['amount' => 1,'num' => 1, 'rate' => 100],
+            ['amount' => 3,   'num' => 1, 'rate' => 100],
+            ['amount' => 2,   'num' => 1, 'rate' => 100],
+            ['amount' => 1,   'num' => 1, 'rate' => 100],
+            ['amount' => 0.5, 'num' => 1, 'rate' => 100],
+            ['amount' => 0.25,'num' => 1, 'rate' => 100],
+            ['amount' => 0.10,'num' => 1, 'rate' => 100]
         ];
 
         $count = count($rate_moneys);

+ 125 - 39
helper/push_helper.php

@@ -102,27 +102,6 @@ class push_helper
             QueueClient::push('upushSendMsg',$push_param);
         }
     }
-
-    public static function appreciate_bonus($member_id,$to_id)
-    {
-        $sender = new member_info($member_id);
-        $name = $sender->nickname();
-        $text = "您的好友{$name}给您文章打赏一个红包,快去查看吧.";
-
-        $push_param['alias'] = $to_id;
-        $push_param['title'] = "文章打赏";
-        $push_param['text']  = $text;
-
-        $push_param['extra']['go_type']   = 'bonus';
-        $push_param['extra']['title']     = "文章打赏";
-        $push_param['extra']['text']      = $text;
-        $push_param['extra']['show_type'] = 'pop';
-        $push_param['extra']['url']       = 'xmmz://p.lrlz.com/main/index?index=2';
-        $push_param['extra']['image']     = $sender->avatar();
-
-        QueueClient::push('upushSendMsg',$push_param);
-    }
-
     public static function bonus_refund($member_id,$amount)
     {
         $sender = new member_info($member_id);
@@ -502,6 +481,130 @@ class push_helper
 
         QueueClient::push('upushSendMsg',$push_param);
     }
+
+    public static function nofity_ugc_pub($follow,$author_id,$special_id,$title)
+    {
+        $author = new member_info($author_id);
+        $text = "您的好友{$author->nickname()} 发表文章《{$title}》";
+
+        $push_param['alias'] = $follow;
+        $push_param['title'] = "好友发表文章";
+        $push_param['text']  = $text;
+
+        $push_param['extra']['go_type']  = 'bonus';
+        $push_param['extra']['title']    = "好友发表文章";
+        $push_param['extra']['text']     = $text;
+        $push_param['extra']['show_type']= 'pop';
+
+        $push_param['extra']['url']      = schema_helper::ugc($title,$special_id);
+        $push_param['extra']['image']    = $author->avatar();
+
+        QueueClient::push('upushSendMsg',$push_param);
+    }
+
+    public static function nofity_ugc_submit($author,$reader,$special_id,$title)
+    {
+        $user = new member_info($reader);
+        $text = "您的好友{$user->nickname()} 阅读了您的文章《{$title}》";
+
+        $push_param['alias'] = $author;
+        $push_param['title'] = "好友阅读文章";
+        $push_param['text']  = $text;
+
+        $push_param['extra']['go_type']  = 'bonus';
+        $push_param['extra']['title']    = "好友阅读文章";
+        $push_param['extra']['text']     = $text;
+        $push_param['extra']['show_type']= 'pop';
+
+        $push_param['extra']['url']      = schema_helper::ugc($title,$special_id);
+        $push_param['extra']['image']    = $user->avatar();
+
+        QueueClient::push('upushSendMsg',$push_param);
+    }
+
+    public static function nofity_ugc_comment($author,$commender,$fcomment,$special_id,$content,$article_title)
+    {
+        $commender = new member_info($commender);
+        if($fcomment) {
+            $title = '收到留言回复';
+            $text = "您的好友{$commender->nickname()} 回复您的评论:{$content}";
+        } else {
+            $title = '收到文章评论';
+            $text = "您的文章《{$article_title}》收到一个新评论";
+        }
+
+        $push_param['alias'] = $author;
+        $push_param['title'] = $title;
+        $push_param['text']  = $text;
+
+        $push_param['extra']['go_type'] = '';
+        $push_param['extra']['title']= $title;
+        $push_param['extra']['text'] = $text;
+        $push_param['extra']['show_type'] = 'pop';
+        $push_param['extra']['url']      = schema_helper::ugc($article_title,$special_id);
+        $push_param['extra']['image'] = $commender->avatar();
+
+        QueueClient::push('upushSendMsg',$push_param);
+    }
+
+    public static function nofity_ugc_support($author,$commender,$fcomment,$special_id,$content,$article_title)
+    {
+        if($commender > 0)
+        {
+            $commender = new member_info($commender);
+
+            if($fcomment) {
+                $text = "{$commender->nickname()} 点赞您的评论:{$content}";
+            } else {
+                $text = "{$commender->nickname()} 点赞您的文章《{$article_title}》";
+            }
+            $push_param['extra']['image'] = $commender->avatar();
+        }
+        else
+        {
+            if($fcomment) {
+                $text = "刚刚有人点赞您的评论:{$content}";
+            } else {
+                $text = "刚刚有人点赞您的文章《{$article_title}》";
+            }
+            $push_param['extra']['image'] = "";
+        }
+
+        $push_param['alias'] = $author;
+        $push_param['title'] = '收到点赞';
+        $push_param['text']  = $text;
+
+        $push_param['extra']['go_type'] = '';
+        $push_param['extra']['title']= '收到点赞';
+        $push_param['extra']['text'] = $text;
+        $push_param['extra']['show_type'] = 'pop';
+        $push_param['extra']['url']      = schema_helper::ugc($article_title,$special_id);
+
+        QueueClient::push('upushSendMsg',$push_param);
+    }
+
+    public static function nofity_ugc_appreciate($author,$user,$special_id,$article,$rate,$amount)
+    {
+        $user_info = new member_info($user);
+
+        $name = $user_info->nickname();
+        $desc = self::money_rate_desc($amount,$rate);
+        $text = "{$name}打赏您的文章《{$article}》{$desc}红包,快去查看吧.";
+
+        $push_param['alias'] = $author;
+        $push_param['title'] = "文章打赏";
+        $push_param['text']  = $text;
+
+        $push_param['extra']['go_type']   = 'bonus';
+        $push_param['extra']['title']     = "文章打赏";
+        $push_param['extra']['text']      = $text;
+        $push_param['extra']['show_type'] = 'pop';
+        $push_param['extra']['url']       = schema_helper::ugc($article,$special_id);
+        $push_param['extra']['image']     = $user_info->avatar();
+
+        QueueClient::push('upushSendMsg',$push_param);
+    }
+
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
     public static function fcode_unlock($member_id,$num)
@@ -595,23 +698,6 @@ class push_helper
 
         QueueClient::push('upushSendMsg',$push_param);
     }
-    public static function comment($member_id,$special_id,$content)
-    {
-        $minfo = new member_info($member_id);
-
-        $push_param['alias'] = $member_id;
-        $push_param['title'] = "用户评价";
-        $push_param['text']      = $content;
-
-        $push_param['extra']['go_type'] = '';
-        $push_param['extra']['title']= "用户评价";
-        $push_param['extra']['text'] = $content;
-        $push_param['extra']['show_type'] = 'pop';
-        $push_param['extra']['image'] = $minfo->avatar();
-
-        QueueClient::push('upushSendMsg',$push_param);
-    }
-
     public static function format_msg($member_id,$content)
     {
         $param['alias'] = $member_id;
@@ -690,7 +776,7 @@ class push_helper
     }
 }
 
-class push_message
+class push_event
 {
     static public function publish_special($member_ids,$ispub,$count)
     {

+ 6 - 0
helper/schema_helper.php

@@ -42,6 +42,12 @@ class schema_helper
         $url = urlencode($url);
         return self::prefix . "/web/web?title={$title}&url={$url}";
     }
+    static public function ugc($title,$special_id)
+    {
+        $url = BASE_SITE_URL . "/mobile/index.php?act=special&op=index&special_id={$special_id}&client_type=wap";
+        $url = urlencode($url);
+        return self::prefix . "/web/web?title={$title}&url={$url}";
+    }
     static public function groupbuy() {
         return self::prefix . "/act_type/limit_groupbuy";
     }

+ 9 - 2
helper/search/tcp_client.php

@@ -313,8 +313,15 @@ class relation_client extends tcp_client
     }
     public function fetch_follow($param)
     {
-        $param = array("act" => 'follow','op' => 'fetch', "params" => $param);
-        return $this->request($param);
+        $param = ["act" => 'follow','op' => 'fetch', "params" => $param];
+        $result = $this->request($param);
+        $code = intval($result['code']);
+        if($code != 200) {
+            return false;
+        }
+        else {
+            return $result['data']['follows'];
+        }
     }
     public function add_special($param)
     {

+ 13 - 3
helper/ugc_helper.php

@@ -29,6 +29,10 @@ use ugc\special_support;
 
 class ugc_helper
 {
+    const public_all = 0;
+    const protected_self = 1;
+    const private_self   = 2;
+
     public static function crate_special($data,&$err)
     {
         $generator = new ugc\generator();
@@ -58,9 +62,9 @@ class ugc_helper
         if($ret != false)
         {
             $type = $setting->reader_type();
-            if($type != \ugc\setting::mine_type) {
+            if($type != ugc\setting::mine_type) {
                 $spid = intval($special_id);
-                QueueClient::push('onPublishSpecial',['user_id' => session_helper::memberid(),'specials'=> array(['type' => $type,'spid' => $spid])]);
+                QueueClient::push('onAsyncUgcPublish',['special_id'=> $spid]);
             }
          }
         return $ret;
@@ -84,7 +88,7 @@ class ugc_helper
         if($ret != false) {
             $type = $special->reader_type();
             $spid = intval($special_id);
-            QueueClient::push('onDelSpecial',['user_id' => session_helper::memberid(),'specials'=> array(['type' => $type,'spid' => $spid])]);
+            QueueClient::push('onAsyncUgcDel',['user_id' => session_helper::memberid(),'specials'=> array(['type' => $type,'spid' => $spid])]);
             return $ret;
         } else {
             $err = ['code' => errcode::ErrSpecial,'msg' => "删除失败"];
@@ -173,6 +177,8 @@ class ugc_helper
             }
         }
 
+        QueueClient::push('onAsyncUgcSubmit',['special_id' => $special_id,'user_id' => session_helper::memberid()]);
+
         return ['vote_result' => $vote_result,'answer_diff' => $answer_diff,'type_sn' => $type_sn,'num' => $num,'amount' => $amount,'bonus_type' => $bonus_type];
     }
 
@@ -188,6 +194,10 @@ class ugc_helper
             $supported = true;
         }
 
+        if($supported) {
+            QueueClient::push('onAsyncUgcSupport',['special_id' => $special_id,'comment_id' => $comment_id,'user_id' => session_helper::memberid()]);
+        }
+
         return $supported;
     }
 

+ 6 - 1
helper/url_helper.php

@@ -54,5 +54,10 @@ class url_helper
         $url = BASE_SITE_URL . "/mobile/index.php?act=mshop&op=goods&goods_id={$goods_id}&relay_id={$relay_id}";
         return $url;
     }
-
+    public static function ugc_url($special_id)
+    {
+        $relay_id = session_helper::share_id();
+        $url = BASE_SITE_URL . "/mobile/index.php?act=special&op=index&special_id={$special_id}&client_type=wap&relay_id={$relay_id}";
+        return $url;
+    }
 }

+ 4 - 1
mobile/control/member_ugc.php

@@ -504,8 +504,8 @@ class member_ugcControl extends specialControl
             $comments = $comments_obj->comments();
             $uids = $comments_obj->users();
             $members = $this->users($uids);
-            QueueClient::push('onUgcComment',['special_id' => $special_id, 'comment_id' => $comment_id,'member_id' => session_helper::memberid()]);
 
+            QueueClient::push('onAsyncUgcComment',['special_id' => $special_id, 'comment_id' => $comment_id,'user_id' => session_helper::memberid()]);
             return self::outsuccess(['comments' => $comments,'members' => $members,'mobile_page' => mobile_page(0)]);
         }
     }
@@ -561,6 +561,9 @@ class member_ugcControl extends specialControl
                 $mod_special->table('mb_special')->where(['special_id' => $special_id])->update(array('appreciates' => ['exp', 'appreciates + 1'],
                                                                                                       'appreciate_amonut' => ['exp', "appreciate_amonut + {$money}"]));
             }
+            QueueClient::push('onAsyncUgcAppreciate',['special_id' => $special_id,
+                                                      'user_id' => session_helper::memberid(),
+                                                      'rate' => $rate,'amount' => $money]);
             return self::outsuccess(null);
         }
     }

+ 2 - 2
mobile/control/special.php

@@ -14,6 +14,7 @@ require_once(BASE_ROOT_PATH . '/helper/activity_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/model_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/user_session/storage.php');
 require_once(BASE_ROOT_PATH . '/helper/ugc_helper.php');
+require_once(BASE_ROOT_PATH . '/helper/url_helper.php');
 
 class specialControl extends mobileHomeControl
 {
@@ -238,8 +239,7 @@ class tpl_ugc
     }
     public function url() {
         $special_id = $this->special_id();
-        $url = BASE_SITE_URL . "/mobile/index.php?act=special&op=index&special_id={$special_id}&client_type=wap";
-        return $url;
+        return url_helper::ugc_url($special_id);
     }
 
     public function sub_title()

+ 0 - 6
test/TestPush.php

@@ -62,10 +62,4 @@ class TestPush extends PHPUnit_Framework_TestCase
         push_helper::first_present(self::test_android_member_id,'http://192.168.0.200/mobile/index.php?act=webpush&op=fcode&client_type=ios');
         push_helper::first_present(self::test_ios_member_id,'http://192.168.0.200/mobile/index.php?act=webpush&op=fcode&client_type=ios');
     }
-
-    public function testEvent()
-    {
-
-    }
-
 }

Datei-Diff unterdrückt, da er zu groß ist
+ 12 - 171
test/TestUGC.php