作者 郭盛
1 个管道 的构建 通过 耗费 1 秒

修改详情

... ... @@ -343,7 +343,6 @@ class Project extends Api
* @ApiSummary (项目溯源)
* @ApiMethod (POST)
* @ApiRoute (/api/project/pro_record)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="id", type="int", required=false, description="项目id")
*
... ... @@ -371,7 +370,6 @@ class Project extends Api
*/
public function pro_record()
{
$user_id = $this->getUserId();
$project_id = $this->request->param('id');
$data = Db::name('record')
->alias('a')
... ... @@ -1070,6 +1068,7 @@ class Project extends Api
"project_id"://项目id
"user_id"://用户ID
"content"://评论内容
"num"://评论个数
"good_name"://点赞数
"createtime"://评论时间
"is_zan"://是否点过赞(1否2是)
... ... @@ -1078,6 +1077,38 @@ class Project extends Api
*/
public function commentlist()
{
$token = $this->request->header('token');
if(empty($token)){
$param = $this->request->param();
$validate = new Validate([
'farm_id' => 'require',
'project_id' => 'require',
]);
if (!$validate->check($param)) {
$this->error($validate->getError());
}
$where['a.farm_id'] = $param['farm_id'];
$where['a.project_id'] = $param['project_id'];
$where['a.status'] = 2;
$data = Db::name('comment')
->alias('a')
->join('user b','a.user_id = b.id')
->field('a.*,b.avatar,b.nickname,a.createtime')
->where($where)
->select()
->toArray();
$data['num'] = Db::name('comment')
->alias('a')
->join('user b','a.user_id = b.id')
->field('a.*,b.avatar,b.nickname')
->where($where)
->count();
foreach ($data as &$v){
$v['is_zan'] = 1;
$v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
}
$this->success('success',$data);
}
$user_id = $this->getUserId();
$param = $this->request->param();
$validate = new Validate([
... ... @@ -1093,7 +1124,7 @@ class Project extends Api
$data = Db::name('comment')
->alias('a')
->join('user b','a.user_id = b.id')
->field('a.*,b.avatar,b.nickname')
->field('a.*,b.avatar,b.nickname,a.createtime')
->where($where)
->select();
foreach ($data as &$v){
... ...