mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
智能爬虫优化
This commit is contained in:
parent
9c76320d8e
commit
d8bddd9161
@ -9,6 +9,7 @@ import org.apache.commons.configuration.Configuration;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.PropertiesConfiguration;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@ -108,7 +109,7 @@ public class BookCrawlController {
|
||||
@ResponseBody
|
||||
@RequestMapping("/update")
|
||||
public R update(CrawlConfig config) {
|
||||
crawlConfig = config;
|
||||
BeanUtils.copyProperties(config,crawlConfig);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
@ -923,8 +923,7 @@ public class BookCrawlServiceImpl implements BookCrawlService {
|
||||
}
|
||||
|
||||
private Long generateVisiteCount(Float score) {
|
||||
int baseNum = (int) (Math.pow(score * 10, (int) (score - 5)) / 2);
|
||||
return Long.parseLong(baseNum + new Random().nextInt(1000) + "");
|
||||
return Long.parseLong((int)(score*10000) + new Random().nextInt(1000) + "");
|
||||
}
|
||||
|
||||
private String getByHttpClient(String catBookListUrl) {
|
||||
|
@ -36,8 +36,8 @@ spring:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/books?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
|
||||
username: books
|
||||
password: books
|
||||
username: root
|
||||
password: test123456
|
||||
#password:
|
||||
initialSize: 1
|
||||
minIdle: 3
|
||||
|
Loading…
x
Reference in New Issue
Block a user