|
@@ -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('提交成功,请等待审核');
|
|
|
}
|
|
|
|