Commit 8d698605 authored by clone's avatar clone

Merge branch '0428-v3.2.8' of https://gitee.com/zwyjjc/tl_estate into 0428-v3.2.8

parents 99ec1201 e84fe180
......@@ -79,8 +79,9 @@ class Square extends Basic
$siteId = empty($params['site_id']) ? 10001 : $params['site_id'];
$squareSort = new SquareSortService();
$list = $squareSort->getCommentByPage($pageNo, $pageSize, $siteId);
$result["data"] = [];
if (count($list) <= 0) {
return $this->response("200", "request null");
return $this->response("200", "request null",$result);
}
$res = $this->s_square->getSquareSortList($list);
$result["data"] = $res;
......
......@@ -29,6 +29,7 @@ class RedisCacheService
private $group_key = 'cache_group_';
private $rule_key = 'cache_rule_';
private $site_city_key = 'cache_site_city_';
private $site_city_all_key = 'cache_site_city_all';
private $label_call_key = 'cache_label_call';
private $group_site_key = 'cache_group_site_';
private $time;
......@@ -246,7 +247,7 @@ class RedisCacheService
}
/**
* 缓存城市
* 根据id缓存城市
*
* @param $id
* @return false|\PDOStatement|string|\think\Collection
......@@ -261,6 +262,27 @@ class RedisCacheService
return $name;
}
/**
* 缓存所有城市站点
*
* @return bool|false|mixed|\PDOStatement|string|\think\Collection
* User HuJun
* Date 19-5-9 上午10:00
*/
public function siteAllCityCache()
{
$result = $this->redis_ext->get($this->site_city_all_key);
if (empty($result)) {
$m_auth_rule = new ASite();
$result = $m_auth_rule->getSiteList();
$this->setRedisCache($this->site_city_all_key, $result);
} else {
$result = json_decode($result, true);
}
return $result;
}
/**
* 缓存电话标签
*
......
......@@ -40,7 +40,7 @@ class SquareSortService
//todo 设置排序按评论时间,每次薪的评论进来,先删除掉存在的,插入新的
//删除不管key存不存在
$look_num = $this->redis->zScore(self::LOOK_NUM_KEY . $site_id, $s_id);
$look_num = $this->redis->zScore(self::LOOK_NUM_KEY, $s_id);
$this->redis->zRem(self::SORT_KEY . $site_id, $s_id);
$this->redis->zRem(self::SORT_KEY_CREAM . $site_id, $s_id);
if ($look_num > 3) {
......@@ -110,13 +110,14 @@ class SquareSortService
/**
* 每个开盘最后评论时间
*
* @param $site_id
* @return array
* User HuJun
* Date 19-5-7 下午4:38
* Date 19-5-9 上午9:37
*/
public function getCommentData()
public function getCommentData($site_id)
{
$comment_time = $this->redis->zRange(self::SORT_KEY, 0, -1, true);
$comment_time = $this->redis->zRange(self::SORT_KEY.$site_id, 0, -1, true);
return $comment_time;
}
......@@ -137,7 +138,7 @@ class SquareSortService
$index_min = ($page_no - 1) * $page_size;
$index_max = $page_no * $page_size;
$result = [];
if ($total <= $page_size) {
if ($total <= $page_size && $page_no == 1) {
$cream_list = $this->redis->zRevRange(self::SORT_KEY_CREAM . $site_id, 0, -1, true);
$list = $this->redis->zRevRange(self::SORT_KEY . $site_id, 0, -1, true);
$result = $cream_list + $list;
......
......@@ -1116,7 +1116,7 @@
<!-- 客户编辑日志 -->
<div class="modal fade" id="modal-customerEditLog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-content" style="width: 750px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
&times;
......
......@@ -94,4 +94,24 @@ class ASite extends BaseModel
return $return;
}
/**
* @param string $fields
* @param array $where
* @return bool|false|\PDOStatement|string|\think\Collection
* User HuJun
* Date 19-5-9 上午10:00
*/
public function getSiteList($fields = 'id,name,city', $where = [])
{
if (!isset($where['is_del'])) {
$where['is_del'] = 0;
}
try {
$result = $this->field($fields)->where($where)->select();
} catch (\Exception $e) {
$result = false;
}
return $result;
}
}
......@@ -4,6 +4,7 @@
namespace app\task\controller;
use app\api_broker\service\RedisCacheService;
use app\api_broker\service\SquareSortService;
use app\model\BSquare;
use app\model\BSquareSort;
......@@ -26,9 +27,17 @@ class SquareTask
* Date 19-5-8 上午10:09
*/
public function squareBackUp() {
$save_data = $square_id = [];
$square_id = $comment_array = [];
$sort_service = new SquareSortService();
$redis_service = new RedisCacheService();
$site_data = $redis_service->siteAllCityCache();
if (empty($site_data)) {
Log::write('获取城市站点失败', 'redis_backUp_square_task'); //记录日志
return ;
}
$look_num = $sort_service->getLookData(); //看盘数量
if ($look_num) {
foreach ($look_num as $k=>$v) {
......@@ -36,13 +45,29 @@ class SquareTask
}
}
$comment = $sort_service->getCommentData();//最后评论时间
if ($comment) {
foreach ($comment as $k=>$v) {
$square_id[] = $k;
foreach ($site_data as $k=>$v) {
$comment = $sort_service->getCommentData($v['id']);//最后评论时间
foreach ($comment as $kk=>$vv) {
$comment_array[$kk]['time'] = $vv;
$comment_array[$kk]['site_id'] = $v['id'];
$square_id[] = $kk;
}
}
$this->saveData($square_id, $look_num, $comment_array);
}
/**
* 保存数据
*
* @param $square_id
* @param array $look_num
* @param array $comment_array
* User HuJun
* Date 19-5-9 上午10:39
*/
private function saveData($square_id, $look_num = [], $comment_array = [])
{
if (empty($square_id)) {
return ;
}
......@@ -51,10 +76,12 @@ class SquareTask
sort($square_id);
try {
foreach ($square_id as $k=>$v) {
$save_data = [];
if (isset($look_num[$v])) {
$save_data['browse_number'] = $look_num[$v];
if ($look_num[$v] >= 500) {
// if ($look_num[$v] >= 500) {
if ($look_num[$v] >= 3) {
$square_data = $this->m_square->getSquare('id,is_cream',['id'=>$v]);
//是否是精华帖 0普通 1精华
if ($square_data[0]['is_cream'] == 0) {
......@@ -62,11 +89,14 @@ class SquareTask
}
}
}
if (isset($comment[$v])) {
$save_data['last_reply_time'] = date('Y-m-d H:i:s', $comment[$v]);
if (isset($comment_array[$v])) {
$save_data['last_reply_time'] = date('Y-m-d H:i:s', $comment_array[$v]['time']);
$save_data['site_id'] = $comment_array[$v]['site_id'];
}
$num = $this->m_sort->getList(1, 1, '', 'id',['square_id'=>$v, 'is_del'=>0]);
$where['square_id'] = $v;
$where['is_del'] = 0;
$num = $this->m_sort->getList(1, 1, '', 'id', $where);
if ($num) {
$this->m_sort->updateData($save_data, $num[0]['id']);
} else {
......
......@@ -2002,18 +2002,20 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
//客户编辑日志
customerEditLog: function(id) {
$.ajax({
url: '/index/userHistoryLog',
url: '/index/userDetail',
type: 'GET',
async: true,
data: {
"user_id": id
"user_id": id,
"AuthToken": user_info_obj.AuthToken,
"agent_id": user_info_obj.id
},
dataType: 'json',
success: function(data) {
if(data.code == 200) {
var temp = document.getElementById('customer_edit_log_list').innerHTML;
var doTtmpl = doT.template(temp);
$("#customerEditLog").html(doTtmpl(data.data.data));
$("#customerEditLog").html(doTtmpl(data.data.user_history_log.user_name_history.concat(data.data.user_history_log.user_site_history)));
} else {
}
......
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