|
@@ -1,6 +1,9 @@
|
|
|
<?php
|
|
|
namespace app\api\controller;
|
|
|
+use app\common\model\ArticleCommentLike;
|
|
|
use app\common\model\PlatformDemand;
|
|
|
+use app\common\model\DemandComment;
|
|
|
+use app\common\model\PlatformLike;
|
|
|
use app\common\model\UserDemand;
|
|
|
use app\common\model\UserSearch;
|
|
|
use library\tools\Data;
|
|
@@ -114,13 +117,90 @@ class Demand extends Base
|
|
|
|
|
|
/**
|
|
|
* @title 以下接口调用验证登录【需要header传Authorization】
|
|
|
- * @desc 转发成功后调用
|
|
|
+ * @desc
|
|
|
* @author qc
|
|
|
* @method
|
|
|
* @url /api/Demand/needLogin
|
|
|
*/
|
|
|
public function needLogin(){}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @title 需求评论
|
|
|
+ * @desc 需求评论
|
|
|
+ * @author qc
|
|
|
+ * @method POST
|
|
|
+ * @url /api/Demand/demandComment
|
|
|
+ * @header name:Authorization require:1 desc:Token
|
|
|
+ * @param name:id type:int default:1 desc:需求id
|
|
|
+ * @param name:content type:string default:-- desc:内容
|
|
|
+ * @return name:name type:string default:-- desc:会员名称
|
|
|
+ * @return name:headimg type:string default:-- desc:会员头像
|
|
|
+ * @return name:content type:string default:-- desc:内容
|
|
|
+ * @return name:create_at type:string default:-- desc:时间
|
|
|
+ */
|
|
|
+ public function demandComment()
|
|
|
+ {
|
|
|
+ $id = input('post.id');
|
|
|
+ $content = input('post.content',0);
|
|
|
+ if(!$content) $this->error('请输入评论内容');
|
|
|
+ $res = DemandComment::create(['user_id'=>$this->user_id,'content'=>$content,'first_id'=>$id,'type'=>1]);
|
|
|
+ $detail =DemandComment::where('p.id',$res->id)
|
|
|
+ ->alias('p')
|
|
|
+ ->field('p.id,p.content,p.create_at,u.name,u.headimg')
|
|
|
+ ->leftJoin('store_member u','u.id = p.user_id')
|
|
|
+ ->find()->toArray();
|
|
|
+ $this->success('评论成功',['detail'=>$detail]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @title 需求二级评论
|
|
|
+ * @desc 需求二级评论
|
|
|
+ * @author qc
|
|
|
+ * @method POST
|
|
|
+ * @url /api/Demand/demandSecondComment
|
|
|
+ * @header name:Authorization require:1 desc:Token
|
|
|
+ * @param name:id type:int default:1 desc:评论id
|
|
|
+ * @param name:content type:string default:-- desc:内容
|
|
|
+ * @return name:name type:string default:-- desc:会员名称
|
|
|
+ * @return name:headimg type:string default:-- desc:会员头像
|
|
|
+ * @return name:content type:string default:-- desc:内容
|
|
|
+ */
|
|
|
+ public function demandSecondComment()
|
|
|
+ {
|
|
|
+ $comment = DemandComment::where('id',input('post.id'))->find()->toArray();
|
|
|
+ unset($comment['id']);
|
|
|
+ unset($comment['create_at']);
|
|
|
+ $comment['pid'] = input('post.id');
|
|
|
+ $comment['user_id'] = $this->user_id;
|
|
|
+ $comment['content'] = input('post.content');
|
|
|
+ $comment['lev']++;
|
|
|
+ if(!$comment['source_id']) $comment['source_id'] = input('post.id');
|
|
|
+ $res = DemandComment::create($comment);
|
|
|
+ $detail = DemandComment::where('p.id',$res->id)
|
|
|
+ ->alias('p')
|
|
|
+ ->field('p.id,p.content,p.create_at,u.name,u.headimg')
|
|
|
+ ->leftJoin('store_member u','u.id = p.user_id')
|
|
|
+ ->find()->toArray();
|
|
|
+ $this->success('评论成功',['detail'=>$detail]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @title 评论点赞||取消点赞
|
|
|
+ * @desc 评论
|
|
|
+ * @author qc
|
|
|
+ * @method POST
|
|
|
+ * @url /api/Demand/commentTags
|
|
|
+ * @header name:Authorization require:1 desc:Token
|
|
|
+ * @param name:comment_id type:int default:1 desc:评论记录id
|
|
|
+ * @return name:tags type:int default:1 desc:0取消成功,1点赞成功
|
|
|
+ */
|
|
|
+ public function commentTags()
|
|
|
+ {
|
|
|
+ $ret_val = PlatformLike::userTags($this->user_id,input('post.comment_id'),6);
|
|
|
+ $this->success($ret_val == 1 ?'点赞成功':'取消成功',['tags'=>$ret_val]);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @title 用户提交||修改需求【用户】
|
|
|
* @desc 用户提交||修改需求
|