Commit e78e9554 authored by zw's avatar zw

1

parent a44b7af4
......@@ -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'];
......
......@@ -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);
$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']);
// $square_data = $this->m_square->getSquare('id,is_cream',['id'=>$v]);
// return $result;
$res[$key]['cover_img_path'] = $val['cover_img'] ? $this->internet_path . $val['cover_img'] : '';
}
return $res;
}
/**
......
......@@ -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);
......
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