wupengfei 2 years ago
parent
commit
69b9975026

+ 8 - 7
.idea/workspace.xml

@@ -3,9 +3,9 @@
   <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/Video.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Video.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/api/controller/Demand.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Demand.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/operate/controller/Demand.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/operate/controller/Demand.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -213,7 +213,8 @@
       <workItem from="1663548946176" duration="17651000" />
       <workItem from="1663721089544" duration="18248000" />
       <workItem from="1663807609347" duration="18144000" />
-      <workItem from="1663893231881" duration="18579000" />
+      <workItem from="1663893231881" duration="18711000" />
+      <workItem from="1664152288609" duration="3156000" />
     </task>
     <servers />
   </component>
@@ -239,10 +240,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="1663927193732">
+    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1664156308292">
       <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="1663927193732" />
+    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1664156308292" />
     <state x="283" y="145" width="1942" height="1088" key="DiffContextDialog" timestamp="1663811165220">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
@@ -271,10 +272,10 @@
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
     <state x="459" y="215" width="1942" height="1088" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1658395058691" />
-    <state x="1059" y="515" key="com.intellij.ide.util.TipDialog" timestamp="1662599602510">
+    <state x="1059" y="515" key="com.intellij.ide.util.TipDialog" timestamp="1664152293260">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="1059" y="515" key="com.intellij.ide.util.TipDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1662599602510" />
+    <state x="1059" y="515" key="com.intellij.ide.util.TipDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1664152293260" />
     <state x="1166" y="605" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1663143970169">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>

+ 11 - 1
application/api/controller/Demand.php

@@ -5,6 +5,7 @@ use app\common\model\PlatformDemand;
 use app\common\model\DemandComment;
 use app\common\model\PlatformLike;
 use app\common\model\UserDemand;
+use app\common\model\UserMessage;
 use app\common\model\UserSearch;
 use library\tools\Data;
 
@@ -202,6 +203,9 @@ class Demand extends Base
         $id = input('post.id');
         $content = input('post.content',0);
         if(!$content) $this->error('请输入评论内容');
+        $send_user = PlatformDemand::where('id',$id)->value('user_id');
+        $user_info = $this->userInfo('name');
+        if($send_user) UserMessage:: sendUserMessage($send_user,'demand',4,0,$this->user_id,$id,$user_info['name'].'评论了您的需求');
         $res = DemandComment::create(['user_id'=>$this->user_id,'content'=>$content,'first_id'=>$id,'type'=>1]);
         $detail  =DemandComment::where('p.id',$res->id)
             ->alias('p')
@@ -227,6 +231,11 @@ class Demand extends Base
     public function demandSecondComment()
     {
         $comment = DemandComment::where('id',input('post.id'))->find()->toArray();
+
+        $user_info = $this->userInfo('name');
+        UserMessage:: sendUserMessage($comment['user_id'],'demand',3,0,$this->user_id,$comment['id'],$user_info['name'].'回复了您的评论');
+        $send_user = PlatformDemand::where('id',$comment['first_id'])->value('user_id');
+        if($send_user) UserMessage::sendUserMessage($send_user,'demand',4,0,$this->user_id,$comment['url_id'],$user_info['name'].'评论了您的需求');
         unset($comment['id']);
         unset($comment['create_at']);
         $comment['pid'] = input('post.id');
@@ -291,7 +300,7 @@ class Demand extends Base
         $company = input('post.company');
         $company_logo = input('post.company_logo');
         if(!$title || !$content) $this->error('标题和需求内容必填');
-        Data::save('UserDemand',[
+        $res = Data::save('UserDemand',[
             'title'=>$title,
             'content'=>$content,
             'user_id'=>$this->user_id,
@@ -303,6 +312,7 @@ class Demand extends Base
             'company'=>$company,
             'company_logo'=>$company_logo,
         ],'user_id',['user_id'=>$this->user_id,'id'=>$id]);
+        UserMessage::sendUserMessage($this->user_id,'demand',1,0,0,$id ? $id: intval($res));
         $this->success('提交成功,请等待审核');
     }
 

+ 1 - 0
application/common/model/UserMessage.php

@@ -30,6 +30,7 @@ class UserMessage extends Model
             1=>['title'=>'需求投稿','msg'=>['需求投稿成功请等待审核']],
             2=>['title'=>'需求审核','msg'=>['恭喜您需求审核成功','抱歉啦需求审核失败~~']],
             3=>['title'=>'需求评论回复','msg'=>['']],
+            4=>['title'=>'需求评论','msg'=>['']],
         ],// 需求
         'forum'=>[],// 论坛
         'press'=>[],// 新闻

+ 2 - 0
application/operate/controller/Demand.php

@@ -1,5 +1,6 @@
 <?php
 namespace app\operate\controller;
+use app\common\model\UserMessage;
 use library\Controller;
 use think\Db;
 use library\tools\Data;
@@ -78,6 +79,7 @@ class Demand extends Controller
         {
             $user_demand = Db::name('user_demand')->find($data['id']);
             if($user_demand['status'] != 0) $this->error('不能重复审核');
+            if($data['status'] > 0 )   UserMessage::sendUserMessage($data['user_id'],'demand',2,$data['status']-1,0,$data['id']);
         }
 
     }