Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
e78e9554
Commit
e78e9554
authored
May 08, 2019
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
a44b7af4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
64 deletions
+91
-64
Square.php
application/api_broker/controller/Square.php
+6
-3
SquareService.php
application/api_broker/service/SquareService.php
+83
-59
SquareSortService.php
application/api_broker/service/SquareSortService.php
+2
-2
No files found.
application/api_broker/controller/Square.php
View file @
e78e9554
...
...
@@ -63,6 +63,9 @@ class Square extends Basic
}
}
/**
* @return \think\Response
*/
public
function
getSquareSortList
()
{
$params
=
$this
->
params
;
...
...
@@ -136,13 +139,13 @@ class Square extends Basic
{
$params
=
$this
->
params
;
/*
$params = array(
/*
$params = array(
"level" => 1,//不传是主评论 1是主评论第一级回复 2是第一级回复的回复
"comment_id" => 1, //主评论ID
"agent_id_b" => 1, //被回复人的id
"square_id" => 1, // 开盘id
"square_id" => 5, // 开盘id
"comment" => "123123", // 开盘id
"author_id" => 1, // 主要做推送
"square_site_id" => 10001,
);*/
$square_id
=
$params
[
'square_id'
];
$comment
=
$params
[
'comment'
];
...
...
application/api_broker/service/SquareService.php
View file @
e78e9554
...
...
@@ -16,10 +16,10 @@ class SquareService
public
function
__construct
()
{
$this
->
m_square
=
new
BSquare
();
$this
->
m_coment
=
new
BComment
();
$this
->
m_square
=
new
BSquare
();
$this
->
m_coment
=
new
BComment
();
$this
->
m_coment_ext
=
new
BCommentExt
();
$this
->
redis
=
new
RedisCacheService
();
$this
->
redis
=
new
RedisCacheService
();
if
(
CURRENT_URL
==
'https://api.tonglianjituan.com/'
)
{
$this
->
internet_path
=
IMAGES_URL
.
'resource/lib/Attachments/images/'
;
...
...
@@ -61,14 +61,14 @@ class SquareService
*/
public
function
saveSquare
(
$agent_id
,
$title
,
$house_id
,
$content
,
$cover_img
,
$site_id
,
$district_id
)
{
$insert
[
"agent_id"
]
=
$agent_id
;
//经纪人id
$insert
[
"title"
]
=
$title
;
//标题
$insert
[
"house_id"
]
=
$house_id
;
//楼盘id
$insert
[
"content"
]
=
$content
;
//text
$insert
[
"cover_img"
]
=
$cover_img
;
//封面图
$insert
[
"site_id"
]
=
$site_id
;
//站点id
$insert
[
"agent_id"
]
=
$agent_id
;
//经纪人id
$insert
[
"title"
]
=
$title
;
//标题
$insert
[
"house_id"
]
=
$house_id
;
//楼盘id
$insert
[
"content"
]
=
$content
;
//text
$insert
[
"cover_img"
]
=
$cover_img
;
//封面图
$insert
[
"site_id"
]
=
$site_id
;
//站点id
$insert
[
"district_lable_id"
]
=
$district_id
;
//部门id
$insert
[
"status"
]
=
0
;
//状态: 0正常 1删除
$insert
[
"status"
]
=
0
;
//状态: 0正常 1删除
$res
=
$this
->
m_square
->
saveSquare
(
$insert
);
//int(1)
if
(
$res
==
1
)
{
...
...
@@ -85,7 +85,7 @@ class SquareService
*/
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'
];
//搜索 时间
...
...
@@ -115,12 +115,12 @@ class SquareService
$field
.=
'Square.create_time'
;
//发布时间
$get_params
[
'Square.status'
]
=
0
;
$res
=
$this
->
m_square
->
getSquareList
(
$pageNo
,
$pageSize
,
$field
,
$get_params
);
$res_total
=
$this
->
m_square
->
getSquareListTotal
(
$field
,
$get_params
);
$res
=
$this
->
m_square
->
getSquareList
(
$pageNo
,
$pageSize
,
$field
,
$get_params
);
$res_total
=
$this
->
m_square
->
getSquareListTotal
(
$field
,
$get_params
);
foreach
(
$res
as
$key
=>
$val
)
{
$agent
=
$this
->
redis
->
getRedisCache
(
2
,
$val
[
'agent_id'
]);
$res
[
$key
][
'name'
]
=
$agent
[
'name'
];
$agent
=
$this
->
redis
->
getRedisCache
(
2
,
$val
[
'agent_id'
]);
$res
[
$key
][
'name'
]
=
$agent
[
'name'
];
$res
[
$key
][
'image_path'
]
=
AGENTHEADERIMGURL
.
$agent
[
'img'
];
//部门标签
...
...
@@ -135,12 +135,36 @@ class SquareService
return
[
'data'
=>
$res
,
'total'
=>
$res_total
];
}
/**
* 热帖
* @param $list
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getSquareSortList
(
$list
)
{
dump
(
$list
);
$ids
=
""
;
foreach
(
$list
as
$key
=>
$item
)
{
$ids
.=
$key
.
","
;
}
$ids
=
rtrim
(
$ids
,
","
);
$field
=
'id,title,agent_id,district_lable_id,cover_img,create_time'
;
$get_params
[
'status'
]
=
0
;
$get_params
[
'id'
]
=
array
(
"in"
,
$ids
);
// $square_data = $this->m_square->getSquare('id,is_cream',['id'=>$v]);
// return $result;
$res
=
$this
->
m_square
->
getSquare
(
$field
,
$get_params
);
foreach
(
$res
as
$key
=>
$val
)
{
$agent
=
$this
->
redis
->
getRedisCache
(
2
,
$val
[
'agent_id'
]);
$res
[
$key
][
'name'
]
=
$agent
[
'name'
];
$res
[
$key
][
'image_path'
]
=
AGENTHEADERIMGURL
.
$agent
[
'img'
];
//部门标签
$res
[
$key
][
'district_lable_name'
]
=
$this
->
getDistrictLableName
(
$val
[
'district_lable_id'
]);
$res
[
$key
][
'cover_img_path'
]
=
$val
[
'cover_img'
]
?
$this
->
internet_path
.
$val
[
'cover_img'
]
:
''
;
}
return
$res
;
}
/**
...
...
@@ -152,7 +176,7 @@ class SquareService
{
// big_log(json_encode($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'
];
$field
=
'Comment.id,'
;
...
...
@@ -162,27 +186,27 @@ class SquareService
$field
.=
'Comment.create_time'
;
$get_params
[
'Comment.square_id'
]
=
$params
[
'square_id'
];
$get_params
[
'Comment.is_del'
]
=
0
;
$get_params
[
'Comment.is_del'
]
=
0
;
$res
=
$this
->
m_coment
->
getSquareCommentList
(
$pageNo
,
$pageSize
,
$field
,
$get_params
);
$res
=
$this
->
m_coment
->
getSquareCommentList
(
$pageNo
,
$pageSize
,
$field
,
$get_params
);
$res_total
=
$this
->
m_coment
->
getSquareCommentListTotal
(
$field
,
$get_params
);
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
][
'img'
]
=
AGENTHEADERIMGURL
.
$agent
[
'img'
];
$res
[
$key
][
'img'
]
=
AGENTHEADERIMGURL
.
$agent
[
'img'
];
$get_params
=
[];
$field
=
'CommentExt.id,CommentExt.level,CommentExt.comment,CommentExt.agent_id_a,CommentExt.agent_id_b'
;
//
$get_params
=
[];
$field
=
'CommentExt.id,CommentExt.level,CommentExt.comment,CommentExt.agent_id_a,CommentExt.agent_id_b'
;
//
$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
);
$list
=
$this
->
m_coment_ext
->
getSquareCommentExtList
(
1
,
2
,
$field
,
$get_params
);
$list
=
$this
->
m_coment_ext
->
getSquareCommentExtList
(
1
,
2
,
$field
,
$get_params
);
if
(
$list
)
{
foreach
(
$list
as
$key2
=>
$val2
)
{
$agent_a
=
$this
->
redis
->
getRedisCache
(
2
,
$val2
[
'agent_id_a'
]);
$agent_b
=
$this
->
redis
->
getRedisCache
(
2
,
$val2
[
'agent_id_b'
]);
$agent_a
=
$this
->
redis
->
getRedisCache
(
2
,
$val2
[
'agent_id_a'
]);
$agent_b
=
$this
->
redis
->
getRedisCache
(
2
,
$val2
[
'agent_id_b'
]);
$list
[
$key2
][
'agent_name_a'
]
=
$agent_a
[
'name'
];
$list
[
$key2
][
'agent_name_b'
]
=
$agent_b
[
'name'
];
}
...
...
@@ -233,16 +257,16 @@ class SquareService
// $get_params['house.status'] = 1;//上架的商铺
$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'
]);
$agent
=
$this
->
redis
->
getRedisCache
(
2
,
$res
[
'agent_id'
]);
$agent
=
$this
->
redis
->
getRedisCache
(
2
,
$res
[
'agent_id'
]);
$res
[
'name'
]
=
$agent
[
'name'
];
//用户置顶权限
$res
[
'user_competence'
]
=
$this
->
userCompetence
(
$agent_id
);
$res
[
'is_can_edit'
]
=
1
;
//兼容老版本 2019-04-22
$res
[
'is_can_edit'
]
=
1
;
//兼容老版本 2019-04-22
return
$res
;
}
...
...
@@ -257,15 +281,15 @@ class SquareService
switch
(
$params
[
'type'
])
{
case
0
:
$update_params
[
'is_del'
]
=
1
;
$res
=
$this
->
m_coment
->
updateStatus
(
$where_params
,
$update_params
);
$res
=
$this
->
m_coment
->
updateStatus
(
$where_params
,
$update_params
);
break
;
case
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
;
default
:
$update_params
[
'status'
]
=
1
;
$res
=
$this
->
m_square
->
updateStatus
(
$where_params
,
$update_params
);
$res
=
$this
->
m_square
->
updateStatus
(
$where_params
,
$update_params
);
}
return
$res
;
}
...
...
@@ -321,10 +345,10 @@ class SquareService
public
function
addBComment
(
$square_id
,
$comment
,
$agent_id
,
$agent_b
,
$agent_name
)
{
$insert
[
"square_id"
]
=
$square_id
;
//文章id
$insert
[
"comment"
]
=
$comment
;
//评价内容
$insert
[
"agent_id"
]
=
$agent_id
;
//评论人
$insert
[
"sort"
]
=
0
;
//排序 0没排序 大于0表示置顶数值越大排行越高
$insert
[
"is_del"
]
=
0
;
//是否删除 0正常 1删除
$insert
[
"comment"
]
=
$comment
;
//评价内容
$insert
[
"agent_id"
]
=
$agent_id
;
//评论人
$insert
[
"sort"
]
=
0
;
//排序 0没排序 大于0表示置顶数值越大排行越高
$insert
[
"is_del"
]
=
0
;
//是否删除 0正常 1删除
// $insert["sort_time"] = $params["sort_time"];//置顶时间s
$res
=
$this
->
m_coment
->
saveComment
(
$insert
);
//int(1)
...
...
@@ -353,9 +377,9 @@ class SquareService
$insert
[
"comment_id"
]
=
$comment_id
;
//comment_id
$insert
[
"agent_id_a"
]
=
$agent_id_a
;
//经纪人a 回复人
$insert
[
"agent_id_b"
]
=
$agent_id_b
;
//经纪人b被回复人
$insert
[
"comment"
]
=
$comment
;
//回复内容
$insert
[
"level"
]
=
$level
;
//评论级别 1直接评论 2回复评论
$insert
[
"is_del"
]
=
0
;
//是否删除 0正常 1删除
$insert
[
"comment"
]
=
$comment
;
//回复内容
$insert
[
"level"
]
=
$level
;
//评论级别 1直接评论 2回复评论
$insert
[
"is_del"
]
=
0
;
//是否删除 0正常 1删除
$res
=
$this
->
m_coment_ext
->
saveCommentExt
(
$insert
);
//int(1)
...
...
@@ -376,16 +400,16 @@ class SquareService
*/
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'
];
$res
=
$this
->
m_coment
->
getCommenInfo
(
$field
,
$get_params
);
$res
=
$this
->
m_coment
->
getCommenInfo
(
$field
,
$get_params
);
$agent
=
$this
->
redis
->
getRedisCache
(
2
,
$res
[
'agent_id'
]);
$res
[
'name'
]
=
$agent
[
'name'
];
$agent
=
$this
->
redis
->
getRedisCache
(
2
,
$res
[
'agent_id'
]);
$res
[
'name'
]
=
$agent
[
'name'
];
$res
[
'image_path'
]
=
AGENTHEADERIMGURL
.
$agent
[
'img'
];
//用户置顶权限
$res
[
'user_competence'
]
=
$this
->
userCompetence
(
$agent_id
);
$res
[
'is_can_edit'
]
=
1
;
//兼容老版本 2019-04-22
$res
[
'is_can_edit'
]
=
1
;
//兼容老版本 2019-04-22
return
$res
;
}
...
...
@@ -397,7 +421,7 @@ class SquareService
*/
public
function
userCompetence
(
$agent_id
)
{
$vip
=
new
VipService
();
//0:有权限 1:无权限
$vip
=
new
VipService
();
//0:有权限 1:无权限
$user_competence
[
'set_top'
]
=
$vip
->
vip
(
$agent_id
,
'SquareSetTop'
);
return
$user_competence
;
}
...
...
@@ -410,13 +434,13 @@ class SquareService
public
function
editCommenSort
(
$params
)
{
$where_params
[
'id'
]
=
$params
[
'id'
];
$update_params
=
[];
$update_params
=
[];
if
(
!
isset
(
$params
[
'sort'
]))
{
return
false
;
}
$update_params
[
'sort'
]
=
$params
[
'sort'
];
$res
=
$this
->
m_coment
->
updateStatus
(
$where_params
,
$update_params
);
$res
=
$this
->
m_coment
->
updateStatus
(
$where_params
,
$update_params
);
return
$res
;
}
...
...
@@ -427,24 +451,24 @@ class SquareService
*/
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'
];
$field
=
'CommentExt.id,CommentExt.comment,CommentExt.level,CommentExt.create_time,CommentExt.agent_id_a,CommentExt.agent_id_b'
;
$get_params
[
'CommentExt.comment_id'
]
=
$params
[
'id'
];
$get_params
[
'CommentExt.is_del'
]
=
0
;
$get_params
[
'CommentExt.is_del'
]
=
0
;
$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
);
if
(
$res
)
{
foreach
(
$res
as
$key2
=>
$val2
)
{
$agent_a
=
$this
->
redis
->
getRedisCache
(
2
,
$val2
[
'agent_id_a'
]);
$agent_b
=
$this
->
redis
->
getRedisCache
(
2
,
$val2
[
'agent_id_b'
]);
$res
[
$key2
][
'agent_name_a'
]
=
$agent_a
[
'name'
];
$agent_a
=
$this
->
redis
->
getRedisCache
(
2
,
$val2
[
'agent_id_a'
]);
$agent_b
=
$this
->
redis
->
getRedisCache
(
2
,
$val2
[
'agent_id_b'
]);
$res
[
$key2
][
'agent_name_a'
]
=
$agent_a
[
'name'
];
$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'
];
}
}
...
...
@@ -460,8 +484,8 @@ class SquareService
public
function
getCommenNum
(
$id
)
{
$get_params
[
'square_id'
]
=
$id
;
$get_params
[
'is_del'
]
=
0
;
$res
=
$this
->
m_coment
->
getCommenNum
(
$get_params
);
$get_params
[
'is_del'
]
=
0
;
$res
=
$this
->
m_coment
->
getCommenNum
(
$get_params
);
return
$res
;
}
...
...
application/api_broker/service/SquareSortService.php
View file @
e78e9554
...
...
@@ -137,7 +137,7 @@ class SquareSortService
if
(
$total
<=
$page_size
)
{
$cream_list
=
$this
->
redis
->
zRange
(
self
::
SORT_KEY_CREAM
.
$site_id
,
0
,
-
1
,
true
);
$list
=
$this
->
redis
->
zRange
(
self
::
SORT_KEY
.
$site_id
,
0
,
-
1
,
true
);
$result
=
array_merge
(
$cream_list
,
$list
)
;
$result
=
$cream_list
+
$list
;
}
elseif
(
$index_min
<=
$cream_num
&&
$index_max
<=
$cream_num
)
{
$cream_list
=
$this
->
redis
->
zRange
(
self
::
SORT_KEY_CREAM
.
$site_id
,
$index_min
,
$page_size
,
true
);
$result
=
$cream_list
;
...
...
@@ -145,7 +145,7 @@ class SquareSortService
$residue
=
$index_max
-
$cream_num
;
$cream_list
=
$this
->
redis
->
zRange
(
self
::
SORT_KEY_CREAM
.
$site_id
,
$index_min
,
-
1
,
true
);
$list
=
$this
->
redis
->
zRange
(
self
::
SORT_KEY
.
$site_id
,
0
,
$residue
,
true
);
$result
=
array_merge
(
$cream_list
,
$list
)
;
$result
=
$cream_list
+
$list
;
}
elseif
(
$index_min
>
$cream_num
)
{
$index_
=
$index_min
-
$cream_num
;
$list
=
$this
->
redis
->
zRange
(
self
::
SORT_KEY
.
$site_id
,
$index_
,
$page_size
,
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment