...
|
...
|
@@ -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,7 +1077,8 @@ class Project extends Api |
|
|
*/
|
|
|
public function commentlist()
|
|
|
{
|
|
|
$user_id = $this->getUserId();
|
|
|
$token = $this->request->header('token');
|
|
|
if(empty($token)){
|
|
|
$param = $this->request->param();
|
|
|
$validate = new Validate([
|
|
|
'farm_id' => 'require',
|
...
|
...
|
@@ -1093,8 +1093,39 @@ class Project extends Api |
|
|
$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([
|
|
|
'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();
|
|
|
foreach ($data as &$v){
|
|
|
$good = Db::name('goodcomment')
|
...
|
...
|
|