Commit 684583d3 authored by clone's avatar clone

1

parent 789aed54
...@@ -22,8 +22,8 @@ class SquareService ...@@ -22,8 +22,8 @@ class SquareService
$this->redis = new RedisCacheService(); $this->redis = new RedisCacheService();
if (CURRENT_URL == 'https://api.tonglianjituan.com/') { if (CURRENT_URL == 'https://api.tonglianjituan.com/') {
$this->internet_path = IMAGES_URL.'resource/lib/Attachments/images/'; $this->internet_path = IMAGES_URL . 'resource/lib/Attachments/images/';
}else { } else {
$this->internet_path = 'http://pre2.tonglianjituan.com/resource/lib/Attachments/images/'; $this->internet_path = 'http://pre2.tonglianjituan.com/resource/lib/Attachments/images/';
} }
} }
...@@ -32,17 +32,18 @@ class SquareService ...@@ -32,17 +32,18 @@ class SquareService
* 文章部门 * 文章部门
* @return array * @return array
*/ */
public function getDistrictLable(){ public function getDistrictLable()
$res[]=['id'=>0,'name'=>'全部']; {
$res[]=['id'=>1,'name'=>'一部']; $res[] = ['id' => 0, 'name' => '全部'];
$res[]=['id'=>2,'name'=>'二部']; $res[] = ['id' => 1, 'name' => '一部'];
$res[]=['id'=>3,'name'=>'三部']; $res[] = ['id' => 2, 'name' => '二部'];
$res[]=['id'=>4,'name'=>'四部']; $res[] = ['id' => 3, 'name' => '三部'];
$res[]=['id'=>5,'name'=>'五部']; $res[] = ['id' => 4, 'name' => '四部'];
$res[]=['id'=>6,'name'=>'六部']; $res[] = ['id' => 5, 'name' => '五部'];
$res[]=['id'=>7,'name'=>'七部']; $res[] = ['id' => 6, 'name' => '六部'];
$res[]=['id'=>8,'name'=>'八部']; $res[] = ['id' => 7, 'name' => '七部'];
$res[]=['id'=>9,'name'=>'九部']; $res[] = ['id' => 8, 'name' => '八部'];
$res[] = ['id' => 9, 'name' => '九部'];
// $res[]=['id'=>10,'name'=>'十部']; // $res[]=['id'=>10,'name'=>'十部'];
return $res; return $res;
} }
...@@ -58,7 +59,7 @@ class SquareService ...@@ -58,7 +59,7 @@ class SquareService
* @param $district_id * @param $district_id
* @return bool * @return bool
*/ */
public function saveSquare($agent_id,$title,$house_id,$content,$cover_img,$site_id,$district_id) public function saveSquare($agent_id, $title, $house_id, $content, $cover_img, $site_id, $district_id)
{ {
$insert["agent_id"] = $agent_id;//经纪人id $insert["agent_id"] = $agent_id;//经纪人id
$insert["title"] = $title;//标题 $insert["title"] = $title;//标题
...@@ -70,9 +71,9 @@ class SquareService ...@@ -70,9 +71,9 @@ class SquareService
$insert["status"] = 0;//状态: 0正常 1删除 $insert["status"] = 0;//状态: 0正常 1删除
$res = $this->m_square->saveSquare($insert);//int(1) $res = $this->m_square->saveSquare($insert);//int(1)
if($res == 1){ if ($res == 1) {
return true; return true;
}else{ } else {
return false; return false;
} }
} }
...@@ -82,13 +83,14 @@ class SquareService ...@@ -82,13 +83,14 @@ class SquareService
* @param $params * @param $params
* @return array * @return array
*/ */
public function getSquareList($params){ public function getSquareList($params)
{
$pageNo = empty($params['page_no']) ? 1 : $params['page_no']; $pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size']; $pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
//搜索 时间 //搜索 时间
if (!empty($params['start_date']) && !empty($params['end_date'])) { if (!empty($params['start_date']) && !empty($params['end_date'])) {
$get_params['Square.create_time'] = [ 'between time', [ $params['start_date'] . ' 00:00:00', $params['end_date'] . ' 23:59:59' ] ]; $get_params['Square.create_time'] = ['between time', [$params['start_date'] . ' 00:00:00', $params['end_date'] . ' 23:59:59']];
} }
//城市 //城市
...@@ -101,7 +103,7 @@ class SquareService ...@@ -101,7 +103,7 @@ class SquareService
} }
//文章标题 //文章标题
if (!empty($params['title'])) { if (!empty($params['title'])) {
$get_params['Square.title'] = [ 'LIKE', '%' . $params['title'] . '%' ]; $get_params['Square.title'] = ['LIKE', '%' . $params['title'] . '%'];
} }
$field = 'Square.id,'; $field = 'Square.id,';
...@@ -117,7 +119,7 @@ class SquareService ...@@ -117,7 +119,7 @@ class SquareService
$res_total = $this->m_square->getSquareListTotal($field, $get_params); $res_total = $this->m_square->getSquareListTotal($field, $get_params);
foreach ($res as $key => $val) { foreach ($res as $key => $val) {
$agent = $this->redis->getRedisCache(2, $val['agent_id']) ; $agent = $this->redis->getRedisCache(2, $val['agent_id']);
$res[$key]['name'] = $agent['name']; $res[$key]['name'] = $agent['name'];
$res[$key]['image_path'] = AGENTHEADERIMGURL . $agent['img']; $res[$key]['image_path'] = AGENTHEADERIMGURL . $agent['img'];
...@@ -130,10 +132,11 @@ class SquareService ...@@ -130,10 +132,11 @@ class SquareService
$res[$key]['cover_img_path'] = $val['cover_img'] ? $this->internet_path . $val['cover_img'] : ''; $res[$key]['cover_img_path'] = $val['cover_img'] ? $this->internet_path . $val['cover_img'] : '';
} }
return [ 'data' => $res, 'total' => $res_total ]; return ['data' => $res, 'total' => $res_total];
} }
public function getSquareCommentList($params){ public function getSquareCommentList($params)
{
// big_log(json_encode($params)); // big_log(json_encode($params));
$pageNo = empty($params['page_no']) ? 1 : $params['page_no']; $pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
...@@ -152,7 +155,7 @@ class SquareService ...@@ -152,7 +155,7 @@ class SquareService
$res_total = $this->m_coment->getSquareCommentListTotal($field, $get_params); $res_total = $this->m_coment->getSquareCommentListTotal($field, $get_params);
foreach ($res as $key => $val) { foreach ($res as $key => $val) {
$agent = $this->redis->getRedisCache(2, $val['agent_id']) ; $agent = $this->redis->getRedisCache(2, $val['agent_id']);
$res[$key]['name'] = $agent['name']; $res[$key]['name'] = $agent['name'];
$res[$key]['img'] = AGENTHEADERIMGURL . $agent['img']; $res[$key]['img'] = AGENTHEADERIMGURL . $agent['img'];
...@@ -161,23 +164,23 @@ class SquareService ...@@ -161,23 +164,23 @@ class SquareService
$get_params['CommentExt.comment_id'] = $val['id']; $get_params['CommentExt.comment_id'] = $val['id'];
$get_params['CommentExt.is_del'] = 0; $get_params['CommentExt.is_del'] = 0;
$res[$key]['comment_ext']['total']= $this->m_coment_ext->getSquareCommentExtListTotal($field,$get_params); $res[$key]['comment_ext']['total'] = $this->m_coment_ext->getSquareCommentExtListTotal($field, $get_params);
$list = $this->m_coment_ext->getSquareCommentExtList(1, 2, $field, $get_params); $list = $this->m_coment_ext->getSquareCommentExtList(1, 2, $field, $get_params);
if($list){ if ($list) {
foreach ($list as $key2 => $val2) { foreach ($list as $key2 => $val2) {
$agent_a = $this->redis->getRedisCache(2, $val2['agent_id_a']) ; $agent_a = $this->redis->getRedisCache(2, $val2['agent_id_a']);
$agent_b = $this->redis->getRedisCache(2, $val2['agent_id_b']) ; $agent_b = $this->redis->getRedisCache(2, $val2['agent_id_b']);
$list[$key2]['agent_name_a']=$agent_a['name']; $list[$key2]['agent_name_a'] = $agent_a['name'];
$list[$key2]['agent_name_b']=$agent_b['name']; $list[$key2]['agent_name_b'] = $agent_b['name'];
} }
} }
$res[$key]['comment_ext']['list']= $list; $res[$key]['comment_ext']['list'] = $list;
} }
return [ 'data' => $res, 'total' => $res_total ]; return ['data' => $res, 'total' => $res_total];
} }
/** /**
...@@ -186,7 +189,10 @@ class SquareService ...@@ -186,7 +189,10 @@ class SquareService
* @param $agent_id * @param $agent_id
* @return array|false|\PDOStatement|string|\think\Model * @return array|false|\PDOStatement|string|\think\Model
*/ */
public function getSquareInfo($params,$agent_id){ public function getSquareInfo($params, $agent_id)
{
$squareSort = new SquareSortService();
$squareSort->setCream($params["id"], $agent_id);
$field = 'Square.id,'; $field = 'Square.id,';
$field .= 'Square.title,'; $field .= 'Square.title,';
...@@ -214,11 +220,11 @@ class SquareService ...@@ -214,11 +220,11 @@ class SquareService
// $get_params['house.status'] = 1;//上架的商铺 // $get_params['house.status'] = 1;//上架的商铺
$get_params['Square.id'] = $params['id']; $get_params['Square.id'] = $params['id'];
$res = $this->m_square->getSquareInfo($field,$get_params); $res = $this->m_square->getSquareInfo($field, $get_params);
$res['district_lable_name'] = $this->getDistrictLableName($res['district_lable_id']); $res['district_lable_name'] = $this->getDistrictLableName($res['district_lable_id']);
$agent = $this->redis->getRedisCache(2, $res['agent_id']) ; $agent = $this->redis->getRedisCache(2, $res['agent_id']);
$res['name'] = $agent['name']; $res['name'] = $agent['name'];
//用户置顶权限 //用户置顶权限
...@@ -233,15 +239,15 @@ class SquareService ...@@ -233,15 +239,15 @@ class SquareService
switch ($params['type']) { switch ($params['type']) {
case 0: case 0:
$update_params['is_del'] = 1; $update_params['is_del'] = 1;
$res = $this->m_coment->updateStatus($where_params,$update_params); $res = $this->m_coment->updateStatus($where_params, $update_params);
break; break;
case 1: case 1:
$update_params['is_del'] = 1; $update_params['is_del'] = 1;
$res = $this->m_coment_ext->updateStatus($where_params,$update_params); $res = $this->m_coment_ext->updateStatus($where_params, $update_params);
break; break;
default: default:
$update_params['status'] = 1; $update_params['status'] = 1;
$res = $this->m_square->updateStatus($where_params,$update_params); $res = $this->m_square->updateStatus($where_params, $update_params);
} }
return $res; return $res;
} }
...@@ -271,7 +277,7 @@ class SquareService ...@@ -271,7 +277,7 @@ class SquareService
if (!empty($params['house_id'])) { if (!empty($params['house_id'])) {
$update_params['house_id'] = $params['house_id']; $update_params['house_id'] = $params['house_id'];
} }
if(!$update_params){ if (!$update_params) {
return false; return false;
} }
...@@ -280,8 +286,7 @@ class SquareService ...@@ -280,8 +286,7 @@ class SquareService
} }
public function addBComment($square_id, $comment, $agent_id, $agent_b, $agent_name)
public function addBComment($square_id,$comment,$agent_id, $agent_b, $agent_name)
{ {
$insert["square_id"] = $square_id;//文章id $insert["square_id"] = $square_id;//文章id
$insert["comment"] = $comment;//评价内容 $insert["comment"] = $comment;//评价内容
...@@ -291,16 +296,16 @@ class SquareService ...@@ -291,16 +296,16 @@ class SquareService
// $insert["sort_time"] = $params["sort_time"];//置顶时间s // $insert["sort_time"] = $params["sort_time"];//置顶时间s
$res = $this->m_coment->saveComment($insert);//int(1) $res = $this->m_coment->saveComment($insert);//int(1)
if($res == 1){ if ($res == 1) {
$push_service = new PushMessageService(); $push_service = new PushMessageService();
$push_service->record(10, $square_id, [$agent_b], $agent_id, ['message'=>$agent_name .'评论了你的开盘']); $push_service->record(10, $square_id, [$agent_b], $agent_id, ['message' => $agent_name . '评论了你的开盘']);
return true; return true;
}else{ } else {
return false; return false;
} }
} }
public function addBCommentExt($comment_id,$agent_id_a,$agent_id_b,$comment,$level, $agent_name, $square_id) public function addBCommentExt($comment_id, $agent_id_a, $agent_id_b, $comment, $level, $agent_name, $square_id)
{ {
$insert["comment_id"] = $comment_id;//comment_id $insert["comment_id"] = $comment_id;//comment_id
$insert["agent_id_a"] = $agent_id_a;//经纪人a 回复人 $insert["agent_id_a"] = $agent_id_a;//经纪人a 回复人
...@@ -311,11 +316,11 @@ class SquareService ...@@ -311,11 +316,11 @@ class SquareService
$res = $this->m_coment_ext->saveCommentExt($insert);//int(1) $res = $this->m_coment_ext->saveCommentExt($insert);//int(1)
if($res == 1){ if ($res == 1) {
$push_service = new PushMessageService(); $push_service = new PushMessageService();
$push_service->record(11, $square_id, [$agent_id_a], $agent_id_b, ['message'=>$agent_name .'回复了你的开盘评论']); $push_service->record(11, $square_id, [$agent_id_a], $agent_id_b, ['message' => $agent_name . '回复了你的开盘评论']);
return true; return true;
}else{ } else {
return false; return false;
} }
} }
...@@ -326,12 +331,13 @@ class SquareService ...@@ -326,12 +331,13 @@ class SquareService
* @param $agent_id * @param $agent_id
* @return array|false|\PDOStatement|string|\think\Model * @return array|false|\PDOStatement|string|\think\Model
*/ */
public function getCommenInfo($params,$agent_id){ public function getCommenInfo($params, $agent_id)
{
$field = 'Comment.id,Comment.comment,Comment.create_time,Comment.agent_id';// $field = 'Comment.id,Comment.comment,Comment.create_time,Comment.agent_id';//
$get_params['Comment.id'] = $params['id']; $get_params['Comment.id'] = $params['id'];
$res = $this->m_coment->getCommenInfo($field,$get_params); $res = $this->m_coment->getCommenInfo($field, $get_params);
$agent = $this->redis->getRedisCache(2, $res['agent_id']) ; $agent = $this->redis->getRedisCache(2, $res['agent_id']);
$res['name'] = $agent['name']; $res['name'] = $agent['name'];
$res['image_path'] = AGENTHEADERIMGURL . $agent['img'];//'http://n.sinaimg.cn/ent/transform/20170921/FVGl-fymesmp0851702.jpg'; $res['image_path'] = AGENTHEADERIMGURL . $agent['img'];//'http://n.sinaimg.cn/ent/transform/20170921/FVGl-fymesmp0851702.jpg';
//用户置顶权限 //用户置顶权限
...@@ -346,7 +352,8 @@ class SquareService ...@@ -346,7 +352,8 @@ class SquareService
* @param $agent_id * @param $agent_id
* @return mixed * @return mixed
*/ */
public function userCompetence($agent_id){ public function userCompetence($agent_id)
{
$vip = new VipService();//0:有权限 1:无权限 $vip = new VipService();//0:有权限 1:无权限
$user_competence['set_top'] = $vip->vip($agent_id, 'SquareSetTop'); $user_competence['set_top'] = $vip->vip($agent_id, 'SquareSetTop');
return $user_competence; return $user_competence;
...@@ -370,7 +377,8 @@ class SquareService ...@@ -370,7 +377,8 @@ class SquareService
return $res; return $res;
} }
public function getSquareCommentExtList($params){ public function getSquareCommentExtList($params)
{
$pageNo = empty($params['page_no']) ? 1 : $params['page_no']; $pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size']; $pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
...@@ -382,18 +390,18 @@ class SquareService ...@@ -382,18 +390,18 @@ class SquareService
$res = $this->m_coment_ext->getSquareCommentExtList($pageNo, $pageSize, $field, $get_params); $res = $this->m_coment_ext->getSquareCommentExtList($pageNo, $pageSize, $field, $get_params);
$res_total = $this->m_coment_ext->getSquareCommentExtListTotal($field, $get_params); $res_total = $this->m_coment_ext->getSquareCommentExtListTotal($field, $get_params);
if($res){ if ($res) {
foreach ($res as $key2 => $val2) { foreach ($res as $key2 => $val2) {
$agent_a = $this->redis->getRedisCache(2, $val2['agent_id_a']) ; $agent_a = $this->redis->getRedisCache(2, $val2['agent_id_a']);
$agent_b = $this->redis->getRedisCache(2, $val2['agent_id_b']) ; $agent_b = $this->redis->getRedisCache(2, $val2['agent_id_b']);
$res[$key2]['agent_name_a']=$agent_a['name']; $res[$key2]['agent_name_a'] = $agent_a['name'];
$res[$key2]['agent_name_a_img'] = AGENTHEADERIMGURL . $agent_a['img']; $res[$key2]['agent_name_a_img'] = AGENTHEADERIMGURL . $agent_a['img'];
$res[$key2]['agent_name_b']=$agent_b['name']; $res[$key2]['agent_name_b'] = $agent_b['name'];
$res[$key2]['agent_name_b_img'] = AGENTHEADERIMGURL . $agent_b['img']; $res[$key2]['agent_name_b_img'] = AGENTHEADERIMGURL . $agent_b['img'];
} }
} }
return [ 'data' => $res, 'total' => $res_total ]; return ['data' => $res, 'total' => $res_total];
} }
/** /**
...@@ -401,7 +409,8 @@ class SquareService ...@@ -401,7 +409,8 @@ class SquareService
* @param $id * @param $id
* @return int|string * @return int|string
*/ */
public function getCommenNum($id){ public function getCommenNum($id)
{
$get_params['square_id'] = $id; $get_params['square_id'] = $id;
$get_params['is_del'] = 0; $get_params['is_del'] = 0;
$res = $this->m_coment->getCommenNum($get_params); $res = $this->m_coment->getCommenNum($get_params);
...@@ -414,9 +423,10 @@ class SquareService ...@@ -414,9 +423,10 @@ class SquareService
* @param $district_lable_id * @param $district_lable_id
* @return string * @return string
*/ */
public function getDistrictLableName($district_lable_id){ public function getDistrictLableName($district_lable_id)
{
foreach ($this->getDistrictLable() as $k => $v) { foreach ($this->getDistrictLable() as $k => $v) {
if($district_lable_id == $v['id']){ if ($district_lable_id == $v['id']) {
return $v['name']; return $v['name'];
continue; continue;
} }
......
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