wupengfei 2 years ago
parent
commit
1f8872d2a7

+ 7 - 6
.idea/workspace.xml

@@ -3,10 +3,11 @@
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Article.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Article.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Datum.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Datum.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Forum.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Forum.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/api/controller/FeedBack.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/FeedBack.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/api/controller/Press.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Press.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/application/common/model/UserMessage.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/common/model/UserMessage.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/user/controller/UserFeedback.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/user/controller/UserFeedback.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -215,7 +216,7 @@
       <workItem from="1663721089544" duration="18248000" />
       <workItem from="1663807609347" duration="18144000" />
       <workItem from="1663893231881" duration="18711000" />
-      <workItem from="1664152288609" duration="7789000" />
+      <workItem from="1664152288609" duration="10788000" />
     </task>
     <servers />
   </component>
@@ -241,10 +242,10 @@
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
     <state x="1175" y="519" key="#com.intellij.fileTypes.FileTypeChooser/0.0.2560.1400@0.0.2560.1400" timestamp="1659079177590" />
-    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1664163063271">
+    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1664171734445">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1664163063271" />
+    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1664171734445" />
     <state x="283" y="145" width="1942" height="1088" key="DiffContextDialog" timestamp="1663811165220">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>

+ 1 - 0
application/api/controller/FeedBack.php

@@ -1,6 +1,7 @@
 <?php
 namespace app\api\controller;
 use app\common\model\UserFeedBack;
+use app\common\model\UserMessage;
 
 
 /**

+ 6 - 0
application/api/controller/Press.php

@@ -1,8 +1,10 @@
 <?php
 namespace app\api\controller;
+use app\common\model\ArticleItem;
 use app\common\model\PressComment;
 use app\common\model\PlatformLike;
 use app\common\model\UserCollect;
+use app\common\model\UserMessage;
 use library\tools\Data;
 /**
  * @title 新闻
@@ -288,6 +290,10 @@ class Press extends Base
     public function pressSecondComment()
     {
         $comment = PressComment::where('id',input('post.id'))->find()->toArray();
+
+        $user_info = $this->userInfo('name');
+        UserMessage:: sendUserMessage($comment['user_id'],'press',1,0,$this->user_id,$comment['id'],$user_info['name'].'回复了您的评论');
+
         unset($comment['id']);
         unset($comment['create_at']);
         $comment['pid'] = input('post.id');

+ 48 - 5
application/common/model/UserMessage.php

@@ -16,7 +16,7 @@ class UserMessage extends Model
             2=>['title'=>'图文审核','msg'=>['恭喜您图文审核成功','抱歉啦图文审核失败~~']],
             3=>['title'=>'图文评论回复','msg'=>['']],
             4=>['title'=>'图文评论','msg'=>['']],
-            ],
+            ],//图文
         'datum'=>[
             1=>['title'=>'资料投稿','msg'=>['资料投稿成功请等待审核']],
             2=>['title'=>'资料审核','msg'=>['恭喜您资料审核成功','抱歉啦资料审核失败~~']],
@@ -39,11 +39,14 @@ class UserMessage extends Model
             5=>['title'=>'论坛回复','msg'=>['']],
         ],// 论坛
         'press'=>[
-
+            1=>['title'=>'评论回复','msg'=>['']],
         ],// 新闻
-        'supplier'=>[],// 供应商
-        'recruit'=>[],// 招聘
-        'mall'=>[],// 商城
+        'mall'=>[
+
+        ],// 商城
+        'feedback'=>[
+            1=>['title'=>'反馈内容回复','msg'=>['平台回复了您的反馈']],
+        ],// 反馈
     ];
 
     /**
@@ -71,5 +74,45 @@ class UserMessage extends Model
     }
 
 
+    function new_push($worker_id = 0,$alert = '您有一个新订单,请及时处理',$sound='sound.caf'){
+        if(empty($worker_id)) return false;
+        $appKey = '02a7faefd91c8a6a446a6a14';
+        $masterSecret = 'ba2e100db997024d9b6e5d35';
+        $client = new \JPush\Client($appKey, $masterSecret,null);
+        $push_payload = $client->push()
+            ->setPlatform(array('ios', 'android'))
+            ->addAlias(strval($worker_id))
+            ->iosNotification($alert, array(
+                'badge' => '+1',
+                'content-available' => true,
+                'mutable-content' => true,
+                'sound' => $sound,
+                'category' => 'jiguang',
+                'extras' => array(
+                    'key' => 'value',
+                    'jiguang'
+                ),
+            ))->androidNotification($alert, array(
+                'title' => '消息通知',
+                // 'builder_id' => 2,
+                'extras' => array(
+                    'key' => 'value',
+                    'jiguang'
+                ),
+            ))->options(array(
+                'apns_production' => True,
+            ));
+        try {
+            $response = $push_payload->send();
+            return $response;
+        } catch (\JPush\Exceptions\APIConnectionException $e) {
+            return $e;
+        } catch (\JPush\Exceptions\APIRequestException $e) {
+            return $e;
+        }
+    }
+
+
+
 
 }

+ 6 - 0
application/user/controller/UserFeedback.php

@@ -3,6 +3,7 @@
 
 namespace app\user\controller;
 
+use app\common\model\UserMessage;
 use library\Controller;
 use think\Db;
 
@@ -67,5 +68,10 @@ class UserFeedback extends Controller
         $this->_form($this->table,'form');
     }
 
+    protected function _form_filter(&$data)
+    {
+        $send_user = \app\common\model\UserFeedBack::where('id',$data['id'])->value('user_id');
+        UserMessage:: sendUserMessage($send_user,'feedback',1,0,0,$data['id']);
+    }
 
 }

+ 2 - 1
composer.json

@@ -29,7 +29,8 @@
     "qiniu/php-sdk": "^7.6",
     "alibabacloud/sdk": "^1.8",
     "alibabacloud/vod-20170321": "2.16.9",
-    "alibabacloud/sts-20150401": "1.1.1"
+    "alibabacloud/sts-20150401": "1.1.1",
+    "jpush/jpush": "^3.6"
   },
   "repositories": {
     "packagist": {