张延森 hace 4 años
padre
commit
4d94ada48a

+ 31
- 0
README.md Ver fichero

@@ -0,0 +1,31 @@
1
+# 十公里民宿
2
+
3
+## 网页抓取说明
4
+
5
+### 网页抓屏解决方案
6
+
7
+#### 安装 chrome
8
+```bash
9
+# yum install google-chrome-stable 方式二选一
10
+curl https://intoli.com/install-google-chrome.sh | sh
11
+```
12
+
13
+#### 下载 chrome 驱动
14
+[https://npm.taobao.org/mirrors/chromedriver/](https://npm.taobao.org/mirrors/chromedriver/)
15
+
16
+驱动最好跟安装的 `chrome` 版本对应。服务器上是 87.0.4280.88 的 linux 版本
17
+
18
+下载完成之后,上传到 服务器某个目录,并设置执行权限
19
+
20
+```bash
21
+chmod +x chromedriver
22
+```
23
+
24
+### 解决网页抓取中文乱码问题
25
+```bash
26
+yum -y groupinstall "X Window System"
27
+yum -y groupinstall chinese-support
28
+yum -y groupinstall Fonts
29
+cd /usr/share/fonts
30
+fc-cache -fv
31
+```

+ 2
- 2
src/main/java/com/shigongli/common/JWTUtils.java Ver fichero

@@ -23,8 +23,8 @@ import java.util.Map;
23 23
 @Slf4j
24 24
 public class JWTUtils {
25 25
 
26
-    // 过期时间 5 分钟
27
-    static final long EXPIRE_TIME = 30 * 60;
26
+    // 过期时间 12 小时
27
+    static final long EXPIRE_TIME = 60 * 60 * 12;
28 28
 
29 29
     // 私钥
30 30
     static final SecretKey SECRET_KEY = Keys.hmacShaKeyFor(Base64.getEncoder().encode("Yansen is so handsome. He is a good man. Everyone like him !!!".getBytes()));

+ 1
- 0
src/main/java/com/shigongli/common/ScreenShotUtil.java Ver fichero

@@ -32,6 +32,7 @@ public class ScreenShotUtil {
32 32
         options.addArguments("--no-sandbox");
33 33
         options.addArguments("--disable-dev-shm-usage");
34 34
         options.addArguments("--start-maximized");
35
+        options.addArguments("--lang=zh");
35 36
         options.addArguments(String.format("--window-size=%s,%s", config.getWidth(), config.getHeight()));
36 37
         //启动一个 chrome 实例
37 38
         webDriver = new ChromeDriver(options);

+ 1
- 1
src/main/java/com/shigongli/controller/TaMetaImageTagController.java Ver fichero

@@ -53,7 +53,7 @@ public class TaMetaImageTagController extends BaseController {
53 53
      */
54 54
     @RequestMapping(value="/{client}/taMetaImageTag",method= RequestMethod.GET)
55 55
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
56
-    public ResponseBean taMetaImageTagList(@ApiParam(value = "客户端", allowableValues = "ma,mp") @RequestParam(value ="client") String client,
56
+    public ResponseBean taMetaImageTagList(@ApiParam(value = "客户端", allowableValues = "ma,mp") @PathVariable(value ="client") String client,
57 57
                                            @ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
58 58
                                            @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
59 59
                                            @ApiParam("标签ID") @RequestParam(value ="tagIds") String tagIds) throws Exception{