stanley-king il y a 7 ans
Parent
commit
06448e186a
5 fichiers modifiés avec 34 ajouts et 16 suppressions
  1. 12 11
      helper/push_sender.php
  2. 19 4
      helper/ugc/comments.php
  3. 3 0
      restart.sh
  4. 0 1
      test/TestPush.php
  5. BIN
      ugcman

+ 12 - 11
helper/push_sender.php

@@ -84,6 +84,7 @@ class push_sender
         $customizedcast->setPredefinedKeyValue("alias", $pushinfo['member_id']);
         $customizedcast->setPredefinedKeyValue("alias_type", $this->ios_alias_type);
         $customizedcast->setPredefinedKeyValue("alert", $pushinfo['text']);
+        $customizedcast->setPredefinedKeyValue("badge", 1);
         $customizedcast->setPredefinedKeyValue("production_mode", "false");
         $customizedcast->setCustomizedField("custom", json_encode($pushinfo['custom']));
 
@@ -121,17 +122,17 @@ class push_sender
 
     public function send_message(array $info)
     {
-//        try
-//        {
-//            $ret = $this->sendAndroidCustomizedcastMessage($info);
-//            $data = json_decode($ret,true);
-//            if(strtoupper($data['ret']) == 'SUCCESS') {
-//                return true;
-//            }
-//        }
-//        catch (Exception $ex) {
-//            Log::record("push_app sendAndroid error",Log::ERR);
-//        }
+        try
+        {
+            $ret = $this->sendAndroidCustomizedcastMessage($info);
+            $data = json_decode($ret,true);
+            if(strtoupper($data['ret']) == 'SUCCESS') {
+                return true;
+            }
+        }
+        catch (Exception $ex) {
+            Log::record("push_app sendAndroid error",Log::ERR);
+        }
 
         try
         {

+ 19 - 4
helper/ugc/comments.php

@@ -55,10 +55,25 @@ class comments
 
             if($this->counter[$top_id] < self::max_response)
             {
-                if($response_id != 0) {
-                    $resp_comment = $comment_map[$response_id];
-                    $to_user = intval($resp_comment['user_id']);
-                } else {
+                if($response_id != 0)
+                {
+                    if(array_key_exists($response_id,$comment_map)) {
+                        $resp_comment = $comment_map[$response_id];
+                        $to_user = intval($resp_comment['user_id']);
+                    }
+                    else
+                    {
+                        $mod_comment = Model('ugc_comment');
+                        $resp_comment = $mod_comment->getCommentByID($response_id);
+                        if(!empty($resp_comment)) {
+                            $this->add_user($resp_comment);
+                            $to_user = intval($resp_comment['user_id']);
+                        } else {
+                            $to_user = 0;
+                        }
+                    }
+                }
+                else {
                     $to_user = 0;
                 }
 

+ 3 - 0
restart.sh

@@ -6,5 +6,8 @@ kill -9 $(pidof php)
 echo 'start searche server'
 php ./centra_srv.php
 
+echo 'start ugc server'
+php ./ugc_srv.php
+
 echo 'start fcgi seraver'
 spawn-fcgi -a 127.0.0.1 -p 9100 -F 10 -f "php fcgi_run.php"

+ 0 - 1
test/TestPush.php

@@ -50,6 +50,5 @@ class TestPush extends PHPUnit_Framework_TestCase
         $info['text'] = 'hello message';
         $info['custom'] = ['type' => 'add_special','special_id' => 300];
         $pushor->send_message($info);
-
     }
 }

BIN
ugcman