tiams@foxmail.com il y a 9 ans
Parent
commit
d0d4f8ef15
2 fichiers modifiés avec 45 ajouts et 2 suppressions
  1. 26 0
      crontab/control/testpush.php
  2. 19 2
      data/logic/queue.logic.php

+ 26 - 0
crontab/control/testpush.php

@@ -0,0 +1,26 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: zry
+ * Date: 2016/5/9
+ * Time: 12:55
+ */
+defined('InShopNC') or exit('Access Invalid!');
+ini_set('default_socket_timeout', -1);
+
+class testpushControl extends BaseCronControl
+{
+
+    public function indexOp() {
+        if (ob_get_level()) ob_end_clean();
+
+        $param = array(
+            'member_id'=>'36489',
+            'text'     =>'Helloworld',
+            'go_type'  =>'bonus',
+        );
+
+        QueueClient::push('upushSendMsg',$param);
+
+    }
+}

+ 19 - 2
data/logic/queue.logic.php

@@ -14,6 +14,15 @@ class queueLogic
 {
 
     /**
+     * push app内容跳转类型
+     * @var array
+     */
+    protected $go_type = array(
+                               '',//跳转到app首页
+                               'bonus',//红包页
+                              );
+
+    /**
      * 添加会员积分
      * @param unknown $member_info
      */
@@ -376,17 +385,25 @@ class queueLogic
 
     /**
      * 推送服务
+     * @param $param  array
+     * 共有三个key : member_id , text, go_type
      */
     public function upushSendMsg($param)
     {
         if(!empty($param) || empty($param['member_id']) || empty($param['text'])){
-            Log::record("push info: 数据有误! data:".json_encode($param)."\t".json_encode($_SESSION));
+            Log::record("push info: 数据有误! param:".json_encode($param)."\t session:".json_encode($_SESSION));
+            return false;
         }
 
         if(!isset($param['go_type'])){
             $param['go_type'] = '';
         }
 
+        if(!in_array($param['go_type'],$this->go_type)){
+            Log::record("push info: go_type参数有误! param:".json_encode($param)."\t session:".json_encode($_SESSION));
+            return false;
+        }
+
         try{
             $push = new push_app();
             //androd
@@ -400,6 +417,6 @@ class queueLogic
             Log::record("push info: fall error\treturn:".$e->getMessage()."\t param:".json_encode($param));
         }
 
-        return;
+        return true;
     }
 }