This commit is contained in:
landaiqing 2023-12-29 10:09:18 +08:00
parent 7df28913bf
commit 7aa266cd86
3 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,7 @@
package com.lovenav.controller;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.lovenav.entity.UrlList;
import com.lovenav.filter.SensitiveFilter;
@ -101,10 +103,11 @@ public class SearchController {
@RequestMapping("/getHotList")
public String getHotList(String searchKey){
List<String> stringList = redisService.getHotList(searchKey);
JSONArray array= JSONArray.parseArray(JSON.toJSONString(stringList));
HashMap<String, Object> result = new HashMap<>();
result.put("code", 200);
result.put("msg", "查询结果");
result.put("data",stringList);
result.put("data",array);
String jsonString = JSONObject.toJSONString(result);
return jsonString;

View File

@ -27,11 +27,11 @@ public class QRCServiceImpl implements QRCService{
String logoPath = "src/main/resources/static/logo/NAV.png";
String destPath = "src/main/resources/static/qr";
UrlList urlList = urlListDao.selectByPrimaryKey(Long.valueOf(url_id));
CollectIconList collectIconList = new CollectIconList();
String url = urlList.getUrl();
collectIconList.setUrl_id(url_id);
String list = collectIconListDao.selectByUrlid(url_id);
if (list == null) {
String qr_list = collectIconListDao.selectByUrlid(url_id);
if (qr_list==null) {
CollectIconList collectIconList = new CollectIconList();
collectIconList.setUrl_id(url_id);
String base64 = QRCodeUtil.ImageToBase64(QRCodeUtil.encode(url, logoPath, destPath, true));
collectIconList.setQr_url(base64);
collectIconListDao.insertSelective(collectIconList);

View File

@ -26,7 +26,7 @@ public class RedisServiceImpl implements RedisService {
/**
* 多少时间内的搜索记录胃热搜
*/
private static final Long HOT_SEARCH_TIME = 30 * 24 * 60 * 60L;
private static final Long HOT_SEARCH_TIME = 30 * 24 * 60 * 60 * 60L;
@Resource
private StringRedisTemplate stringRedisTemplate;