Commit cbe252a1 authored by zhuwei's avatar zhuwei

bug

parent d48b93fa
...@@ -108,6 +108,21 @@ class Square extends Basic ...@@ -108,6 +108,21 @@ class Square extends Basic
} }
public function getCommenInfo(){
$params = $this->params;
if (!isset($params['id'])) {
return $this->response("101", "参数不全");
}
$result= $this->s_square->getCommenInfo($params);
if($result){
return $this->response("200", "成功",$result);
}else{
return $this->response("200", "成功",$result);
}
}
......
...@@ -231,25 +231,10 @@ class SquareService ...@@ -231,25 +231,10 @@ class SquareService
} }
public function getCommenInfo($params){ public function getCommenInfo($params){
$field = 'Comment.id,Comment.comment,Comment.create_time,Agent.name,Agent.img';//
$field = 'Square.id,';// $get_params['Comment.id'] = $params['id'];
$field .= 'Square.title,';//标题 $res = $this->m_coment->getCommenInfo($field,$get_params);
$field .= 'Square.content,';//标题 $res['image_path'] = 'http://n.sinaimg.cn/ent/transform/20170921/FVGl-fymesmp0851702.jpg';
$field .= 'Square.cover_img,';//cover_img
$field .= 'Agent.name,';//发布人
$field .= 'Square.site_id,';//城市
$field .= 'Square.district_lable_id,';//部门
$field .= 'Square.create_time';//发布时间
$get_params['Square.id'] = $params['id'];
// $get_params['Square.status'] = 0;
$res = $this->m_square->getSquareInfo($field,$get_params);
// foreach ($res as $key => $val) {
//
// }
return [ 'data' => $res]; return [ 'data' => $res];
} }
......
...@@ -55,9 +55,7 @@ class BComment extends Model ...@@ -55,9 +55,7 @@ class BComment extends Model
$result = Db::table($this->table) $result = Db::table($this->table)
->field($field) ->field($field)
->alias('Comment') ->alias('Comment')
->join('a_agents Agent', 'Agent.id = Square.agent_id', 'left') ->join('a_agents Agent', 'Agent.id = Comment.agent_id', 'left')
->join('a_site Site', 'Site.id = Square.site_id', 'left')
->join('a_district District', 'District.id = Square.district_id', 'left')
->where($params) ->where($params)
->order($order) ->order($order)
->find(); ->find();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment