Commit aa8d88d9 authored by zhuwei's avatar zhuwei

肥家

parent c8cfcf0b
......@@ -59,6 +59,23 @@ class Square extends Basic
}
}
public function addcoment()
{
$params = $this->params;
if (!$params) {
return $this->response("101", "参数不全");
}
$result= $this->s_square->addcoment($params);
if($result){
return $this->response("200", "成功",$result);
}else{
return $this->response("200", "成功",$result);
}
}
......
......@@ -2,15 +2,21 @@
namespace app\api_broker\service;
use app\model\BComment;
use app\model\BCommentExt;
use app\model\BSquare;
class SquareService
{
private $m_square;
private $m_coment;
private $m_coment_ext;
public function __construct()
{
$this->m_square = new BSquare();
$this->m_coment = new BComment();
$this->m_coment_ext = new BCommentExt();
}
public function saveSquare($agent_id,$title,$content,$cover_img,$site_id,$district_id)
......@@ -32,8 +38,8 @@ class SquareService
}
public function getSquareList($params){
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
//搜索 时间
if (!empty($params['start_date']) && empty($params['end_date'])) {
......@@ -133,4 +139,56 @@ class SquareService
$res = $this->m_square->updateStatus($where_params, $update_params);
return $res;
}
public function addcoment($params)
{
if (isset($params['level'])) {
$this->addBCommentExt($params);
}else{
$this->addBComent($params);
}
}
public function addBComent($params)
{
// `square_id` int(10) DEFAULT '0' COMMENT '文章id',
// `comment` varchar(255) DEFAULT '' COMMENT '评价内容',
// `agent_id` int(10) DEFAULT '0' COMMENT '评论人',
// `sort` int(5) DEFAULT '0' COMMENT '排序 0没排序 大于0表示置顶数值越大排行越高',
// `sort_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '置顶时间',
// `is_del` tinyint(1) DEFAULT '0' COMMENT '是否删除 0正常 1删除',
$insert["square_id"] = $params["square_id"];//文章id
$insert["comment"] = $params["comment"];//评价内容
$insert["agent_id"] = $params["agent_id"];//评论人
$insert["sort"] = $params["sort"];//排序 0没排序 大于0表示置顶数值越大排行越高
// $insert["sort_time"] = $params["sort_time"];//置顶时间s
$insert["is_del"] = 0;//是否删除 0正常 1删除
$res = $this->m_coment->saveComment($insert);//int(1)
if($res == 1){
return true;
}else{
return false;
}
}
public function addBCommentExt($params)
{
$insert["comment_id"] = $params["comment_id"];//comment_id
$insert["agent_id_a"] = $params["agent_id_a"];//经纪人a 回复人
$insert["agent_id_b"] = $params["agent_id_b"];//经纪人b被回复人
$insert["comment"] = $params["comment_id"];//回复内容
$insert["level"] = $params['level'];//评论级别 1直接评论 2回复评论
$insert["is_del"] = 0;//是否删除 0正常 1删除
$res = $this->m_coment_ext->saveCommentExt($insert);//int(1)
if($res == 1){
return true;
}else{
return false;
}
}
}
\ No newline at end of file
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