主页完善
This commit is contained in:
parent
51a6773135
commit
0a527e83a9
|
|
@ -2,10 +2,13 @@ package com.xjs.business.webmagic;
|
||||||
|
|
||||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.xjs.business.webmagic.domain.CopyWritingNetworkDTO;
|
||||||
import com.xjs.business.webmagic.factory.RemoteWebmagicCopyWritingNetworkFactory;
|
import com.xjs.business.webmagic.factory.RemoteWebmagicCopyWritingNetworkFactory;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内部 调用 文案网 爬虫定时任务
|
* 内部 调用 文案网 爬虫定时任务
|
||||||
*
|
*
|
||||||
|
|
@ -19,4 +22,7 @@ public interface RemoteWebmagicCopyWritingNetworkFeign {
|
||||||
|
|
||||||
@GetMapping("copyWritingNetwork/taskForPRC")
|
@GetMapping("copyWritingNetwork/taskForPRC")
|
||||||
R copyWritingNetworkTaskForPRC();
|
R copyWritingNetworkTaskForPRC();
|
||||||
|
|
||||||
|
@GetMapping("copyWritingNetwork/showCopyWriting")
|
||||||
|
public R<List<CopyWritingNetworkDTO>> showCopyWriting();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.xjs.business.webmagic.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文案网数据实体DTO
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-02-16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CopyWritingNetworkDTO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 文案标签 */
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 文案主题 */
|
||||||
|
private String theme;
|
||||||
|
|
||||||
|
/** 文案内容 */
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,10 +2,13 @@ package com.xjs.business.webmagic.factory;
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.xjs.business.webmagic.RemoteWebmagicCopyWritingNetworkFeign;
|
import com.xjs.business.webmagic.RemoteWebmagicCopyWritingNetworkFeign;
|
||||||
|
import com.xjs.business.webmagic.domain.CopyWritingNetworkDTO;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内部 调用 文案网 爬虫定时任务 降级
|
* 内部 调用 文案网 爬虫定时任务 降级
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
|
|
@ -22,6 +25,12 @@ public class RemoteWebmagicCopyWritingNetworkFactory implements FallbackFactory<
|
||||||
log.error("文案网 爬虫定时任务 降级------服务可能正在运行");
|
log.error("文案网 爬虫定时任务 降级------服务可能正在运行");
|
||||||
return R.fail("降级处理------服务可能正在运行");
|
return R.fail("降级处理------服务可能正在运行");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<List<CopyWritingNetworkDTO>> showCopyWriting() {
|
||||||
|
log.error("文案网 展示文案数据 降级------服务可能正在运行");
|
||||||
|
return R.fail("降级处理------服务可能正在运行");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,18 @@
|
||||||
|
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function showWbSearch() {
|
||||||
|
return request({
|
||||||
|
url: '/openapi/index/showWbSearch',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function showCopyWriting() {
|
||||||
|
return request({
|
||||||
|
url: '/openapi/index/showCopyWriting',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,238 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<div>
|
||||||
|
<el-card shadow="hover" class="card" ref="renderersChart">
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<div>
|
||||||
|
<el-card shadow="hover" class="card">
|
||||||
|
<!--logo -->
|
||||||
|
<div style="width: 500px;margin: 0 auto;margin-top: 20px">
|
||||||
|
<el-image
|
||||||
|
style="width: 272px; height: 72px;margin-left: 120px"
|
||||||
|
:src="baiduLogo"
|
||||||
|
></el-image>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--输入框 -->
|
||||||
|
<div style="margin-top: 30px">
|
||||||
|
<el-autocomplete
|
||||||
|
style="width: 92%"
|
||||||
|
v-model="searchContent"
|
||||||
|
@input="getAssociation()"
|
||||||
|
@keydown.enter.n.native="toRescue"
|
||||||
|
clearable
|
||||||
|
@select="handleSelect"
|
||||||
|
:fetch-suggestions="querySearchAsync"
|
||||||
|
placeholder="请输入你想要搜索的内容"></el-autocomplete>
|
||||||
|
<el-button
|
||||||
|
style="width: 8%"
|
||||||
|
|
||||||
|
type="primary" icon="el-icon-search" @click="toRescue"></el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<div>
|
||||||
|
<el-card shadow="hover" class="card">
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<div>
|
||||||
|
<el-card shadow="hover" class="card">
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
// 引入echarts
|
||||||
|
var echarts = require('echarts/lib/echarts');
|
||||||
|
require('echarts/lib/component/tooltip');
|
||||||
|
require('echarts/lib/chart/gauge');
|
||||||
|
require('echarts/lib/component/title');
|
||||||
|
|
||||||
|
import baiduLogo from "@/assets/images/baidu_logo.png"
|
||||||
|
import {getAssociation} from "@/api/business/openapi/ai";
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Serach",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
baiduLogo,
|
||||||
|
|
||||||
|
//百度输入框内容
|
||||||
|
searchContent: '',
|
||||||
|
|
||||||
|
//联想词汇
|
||||||
|
associationList: [],
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.initRenderers();
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
//获取echarts图
|
||||||
|
initRenderers() {
|
||||||
|
var myDate = new Date();
|
||||||
|
var s = myDate.getSeconds();
|
||||||
|
let time = myDate.toLocaleTimeString();
|
||||||
|
let renderersChart = echarts.init(this.$refs.renderersChart.$el)
|
||||||
|
renderersChart.setOption({
|
||||||
|
tooltip: {
|
||||||
|
formatter: '单位:{a} <br/>当前 : {c}s'
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: time,
|
||||||
|
textStyle: {
|
||||||
|
color: '#541264',
|
||||||
|
fontWeight: '1000',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
left: "center",
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '秒',
|
||||||
|
type: 'gauge',
|
||||||
|
progress: {
|
||||||
|
show: true
|
||||||
|
},
|
||||||
|
detail: {
|
||||||
|
valueAnimation: true,
|
||||||
|
formatter: '{value}'
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
value: s,
|
||||||
|
name: '单位:秒',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
min: 0,
|
||||||
|
max: 60,
|
||||||
|
splitNumber: 6,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
//定时获取秒数定时执行
|
||||||
|
setInterval(function () {
|
||||||
|
let myDate = new Date();
|
||||||
|
let s = myDate.getSeconds();
|
||||||
|
let time = myDate.toLocaleTimeString();
|
||||||
|
renderersChart.setOption({
|
||||||
|
title: {
|
||||||
|
text: time,
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
value: s,
|
||||||
|
name: '单位:秒',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
//获取联想词汇
|
||||||
|
getAssociation() {
|
||||||
|
if (this.searchContent === '' || this.searchContent === null || this.searchContent === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let data = {
|
||||||
|
content: this.searchContent,
|
||||||
|
};
|
||||||
|
getAssociation(data).then(res => {
|
||||||
|
this.associationList = res.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
querySearchAsync(queryString, cb) {
|
||||||
|
|
||||||
|
let list = this.handleAssociationList(this.associationList);
|
||||||
|
|
||||||
|
cb(list);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理返回的list
|
||||||
|
* @param restaurants
|
||||||
|
*/
|
||||||
|
handleAssociationList(restaurants) {
|
||||||
|
|
||||||
|
let list = []
|
||||||
|
|
||||||
|
if (restaurants === null || restaurants === undefined || restaurants === []) {
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
|
||||||
|
restaurants.forEach(s => {
|
||||||
|
let obj = {};
|
||||||
|
let key = "value"
|
||||||
|
var value = s
|
||||||
|
obj[key] = value
|
||||||
|
list.push(obj)
|
||||||
|
});
|
||||||
|
|
||||||
|
return list;
|
||||||
|
},
|
||||||
|
|
||||||
|
//跳转到外部链接
|
||||||
|
toRescue() {
|
||||||
|
//当前页面跳转
|
||||||
|
// window.location.href = 'https://www.baidu.com/s?wd=' + this.searchContent
|
||||||
|
//打开新标签跳转
|
||||||
|
window.open('https://www.baidu.com/s?wd='+ this.searchContent)
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSelect(item) {
|
||||||
|
console.log(item);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.card {
|
||||||
|
width: 100%;
|
||||||
|
height: 410px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
@ -1,61 +1,47 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="app-container">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="5">
|
||||||
<el-col :span="12">
|
<el-col :span="8">
|
||||||
<div>
|
<div class="grid-content bg-purple">
|
||||||
<el-card shadow="hover" class="card" ref="renderersChart">
|
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
||||||
|
<div slot="header" style="font-size: 18px;color: #3A71A8;font-weight: 800;padding: 0">
|
||||||
|
<span>最新微博热搜</span>
|
||||||
|
</div>
|
||||||
|
<div v-for="wb in WbDataList" :key="wb.id" style="color: #8492a6;">
|
||||||
|
{{ wb.hotword }}
|
||||||
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="16">
|
||||||
<div>
|
<div class="grid-content bg-purple">
|
||||||
<el-card shadow="hover" class="card">
|
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
||||||
<!--logo -->
|
<div slot="header" style="font-size: 18px;color: #00BCD4;font-weight: 800;padding: 0">
|
||||||
<div style="width: 500px;margin: 0 auto;margin-top: 20px">
|
<span>文案</span>
|
||||||
<el-image
|
|
||||||
style="width: 272px; height: 72px;margin-left: 120px"
|
|
||||||
:src="baiduLogo"
|
|
||||||
></el-image>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div v-for="copyWriting in copyWritingList" :key="copyWriting.id" class="top_content"
|
||||||
<!--输入框 -->
|
style="color: #bfcbd9;">
|
||||||
<div style="margin-top: 30px">
|
<el-tooltip effect="light" :content="copyWriting.content+' ——— '+copyWriting.type" placement="top">
|
||||||
<el-autocomplete
|
<span>{{ copyWriting.content }} ——— <span style="color: #bfcbc5">{{ copyWriting.type }}</span></span>
|
||||||
style="width: 92%"
|
</el-tooltip>
|
||||||
v-model="searchContent"
|
|
||||||
@input="getAssociation()"
|
|
||||||
@keydown.enter.n.native="toRescue"
|
|
||||||
clearable
|
|
||||||
@select="handleSelect"
|
|
||||||
:fetch-suggestions="querySearchAsync"
|
|
||||||
placeholder="请输入你想要搜索的内容"></el-autocomplete>
|
|
||||||
<el-button
|
|
||||||
style="width: 8%"
|
|
||||||
|
|
||||||
type="primary" icon="el-icon-search" @click="toRescue"></el-button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-row :gutter="5">
|
||||||
<el-row :gutter="20">
|
<el-col :span="24">
|
||||||
<el-col :span="12">
|
<div class="grid-content bg-purple"></div>
|
||||||
<div>
|
|
||||||
<el-card shadow="hover" class="card">
|
|
||||||
|
|
||||||
</el-card>
|
|
||||||
</div>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
</el-row>
|
||||||
<div>
|
<el-row :gutter="5">
|
||||||
<el-card shadow="hover" class="card">
|
<el-col :span="24">
|
||||||
|
<div class="grid-content bg-purple"></div>
|
||||||
</el-card>
|
</el-col>
|
||||||
</div>
|
</el-row>
|
||||||
|
<el-row :gutter="5">
|
||||||
|
<el-col :span="24">
|
||||||
|
<div class="grid-content bg-purple"></div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -63,162 +49,39 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
// 引入echarts
|
|
||||||
var echarts = require('echarts/lib/echarts');
|
|
||||||
require('echarts/lib/component/tooltip');
|
|
||||||
require('echarts/lib/chart/gauge');
|
|
||||||
require('echarts/lib/component/title');
|
|
||||||
|
|
||||||
import baiduLogo from "@/assets/images/baidu_logo.png"
|
|
||||||
import {getAssociation} from "@/api/business/openapi/ai";
|
|
||||||
|
|
||||||
|
import {showCopyWriting, showWbSearch} from "@/api";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Index",
|
name: "Index",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
baiduLogo,
|
WbDataList: {},
|
||||||
|
copyWritingList: {},
|
||||||
//百度输入框内容
|
|
||||||
searchContent: '',
|
|
||||||
|
|
||||||
//联想词汇
|
|
||||||
associationList: [],
|
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
|
this.showWbSearch()
|
||||||
|
this.showCopyWriting()
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initRenderers();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
//获取echarts图
|
showWbSearch() {
|
||||||
initRenderers() {
|
showWbSearch().then(res => {
|
||||||
var myDate = new Date();
|
this.WbDataList = res.data
|
||||||
var s = myDate.getSeconds();
|
|
||||||
let time = myDate.toLocaleTimeString();
|
|
||||||
let renderersChart = echarts.init(this.$refs.renderersChart.$el)
|
|
||||||
renderersChart.setOption({
|
|
||||||
tooltip: {
|
|
||||||
formatter: '单位:{a} <br/>当前 : {c}s'
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
text: time,
|
|
||||||
textStyle: {
|
|
||||||
color: '#541264',
|
|
||||||
fontWeight: '1000',
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
left: "center",
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: '秒',
|
|
||||||
type: 'gauge',
|
|
||||||
progress: {
|
|
||||||
show: true
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
valueAnimation: true,
|
|
||||||
formatter: '{value}'
|
|
||||||
},
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
value: s,
|
|
||||||
name: '单位:秒',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
min: 0,
|
|
||||||
max: 60,
|
|
||||||
splitNumber: 6,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
//定时获取秒数定时执行
|
|
||||||
setInterval(function () {
|
|
||||||
let myDate = new Date();
|
|
||||||
let s = myDate.getSeconds();
|
|
||||||
let time = myDate.toLocaleTimeString();
|
|
||||||
renderersChart.setOption({
|
|
||||||
title: {
|
|
||||||
text: time,
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
value: s,
|
|
||||||
name: '单位:秒',
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
//获取联想词汇
|
|
||||||
getAssociation() {
|
|
||||||
if (this.searchContent === '' || this.searchContent === null || this.searchContent === undefined) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let data = {
|
|
||||||
content: this.searchContent,
|
|
||||||
};
|
|
||||||
getAssociation(data).then(res => {
|
|
||||||
this.associationList = res.data
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
querySearchAsync(queryString, cb) {
|
showCopyWriting() {
|
||||||
|
showCopyWriting().then(res => {
|
||||||
let list = this.handleAssociationList(this.associationList);
|
this.copyWritingList = res.data
|
||||||
|
})
|
||||||
cb(list);
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理返回的list
|
|
||||||
* @param restaurants
|
|
||||||
*/
|
|
||||||
handleAssociationList(restaurants) {
|
|
||||||
|
|
||||||
let list = []
|
|
||||||
|
|
||||||
if (restaurants === null || restaurants === undefined || restaurants === []) {
|
|
||||||
return list
|
|
||||||
}
|
|
||||||
|
|
||||||
restaurants.forEach(s => {
|
|
||||||
let obj = {};
|
|
||||||
let key = "value"
|
|
||||||
var value = s
|
|
||||||
obj[key] = value
|
|
||||||
list.push(obj)
|
|
||||||
});
|
|
||||||
|
|
||||||
return list;
|
|
||||||
},
|
|
||||||
|
|
||||||
//跳转到外部链接
|
|
||||||
toRescue() {
|
|
||||||
//当前页面跳转
|
|
||||||
// window.location.href = 'https://www.baidu.com/s?wd=' + this.searchContent
|
|
||||||
//打开新标签跳转
|
|
||||||
window.open('https://www.baidu.com/s?wd='+ this.searchContent)
|
|
||||||
},
|
|
||||||
|
|
||||||
handleSelect(item) {
|
|
||||||
console.log(item);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -227,12 +90,41 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.card {
|
|
||||||
width: 100%;
|
.top_content {
|
||||||
height: 410px;
|
white-space: nowrap; /*把文本强制显示在一行*/
|
||||||
margin: 0 auto;
|
overflow: hidden; /*隐藏超出部分的文字*/
|
||||||
|
text-overflow: ellipsis; /*超出显示省略号*/
|
||||||
|
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.el-col {
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-purple-dark {
|
||||||
|
background: #99a9bf;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-purple {
|
||||||
|
background: #d3dce6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-purple-light {
|
||||||
|
background: #e5e9f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-content {
|
||||||
|
border-radius: 4px;
|
||||||
|
min-height: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-bg {
|
||||||
|
padding: 10px 0;
|
||||||
|
background-color: #f9fafc;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.xjs.common.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.xjs.business.webmagic.RemoteWebmagicCopyWritingNetworkFeign;
|
||||||
|
import com.xjs.business.webmagic.domain.CopyWritingNetworkDTO;
|
||||||
|
import com.xjs.topsearch.domain.ApiTopsearchWeibo;
|
||||||
|
import com.xjs.topsearch.service.ApiTopsearchWeiboService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主页控制器
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-06-14
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("index")
|
||||||
|
@Api(tags = "业务模块-主页")
|
||||||
|
@Log4j2
|
||||||
|
public class IndexController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiTopsearchWeiboService apiTopsearchWeiboService;
|
||||||
|
@Resource
|
||||||
|
private RemoteWebmagicCopyWritingNetworkFeign remoteWebmagicCopyWritingNetworkFeign;
|
||||||
|
|
||||||
|
@GetMapping("showWbSearch")
|
||||||
|
@ApiOperation("展示微博热搜")
|
||||||
|
public AjaxResult showWbSearch() {
|
||||||
|
List<ApiTopsearchWeibo> weiboList = apiTopsearchWeiboService.showWbSearch();
|
||||||
|
return AjaxResult.success(weiboList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("showCopyWriting")
|
||||||
|
@ApiOperation("首页展示文案")
|
||||||
|
public AjaxResult showCopyWriting() {
|
||||||
|
R<List<CopyWritingNetworkDTO>> data = remoteWebmagicCopyWritingNetworkFeign.showCopyWriting();
|
||||||
|
return AjaxResult.success(data.getData());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
|
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
|
||||||
|
|
@ -50,7 +52,13 @@ public class TianXingTopsearchWeiboFactory implements TopserachFactory<ApiTopsea
|
||||||
ApiTopsearchWeibo apiTopsearchWeibo = new ApiTopsearchWeibo();
|
ApiTopsearchWeibo apiTopsearchWeibo = new ApiTopsearchWeibo();
|
||||||
JSONObject json = (JSONObject) arrayJson;
|
JSONObject json = (JSONObject) arrayJson;
|
||||||
apiTopsearchWeibo.setHotword(json.getString("hotword"));
|
apiTopsearchWeibo.setHotword(json.getString("hotword"));
|
||||||
apiTopsearchWeibo.setHotnum(json.getString("hotwordnum"));
|
|
||||||
|
//提取热度中的数字
|
||||||
|
String hotwordnum = json.getString("hotwordnum");
|
||||||
|
String regEx="[^0-9]";
|
||||||
|
Pattern p = Pattern.compile(regEx);
|
||||||
|
Matcher m = p.matcher(hotwordnum);
|
||||||
|
apiTopsearchWeibo.setHotnum(m.replaceAll("").trim());
|
||||||
apiTopsearchWeibo.setHottag(json.getString("hottag"));
|
apiTopsearchWeibo.setHottag(json.getString("hottag"));
|
||||||
return apiTopsearchWeibo;
|
return apiTopsearchWeibo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.xjs.topsearch.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.xjs.topsearch.domain.ApiTopsearchWeibo;
|
import com.xjs.topsearch.domain.ApiTopsearchWeibo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @since 2022-01-12
|
* @since 2022-01-12
|
||||||
|
|
@ -13,4 +15,11 @@ public interface ApiTopsearchWeiboService extends IService<ApiTopsearchWeibo> {
|
||||||
* @return Integer
|
* @return Integer
|
||||||
*/
|
*/
|
||||||
Integer deleteRepeatData();
|
Integer deleteRepeatData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展示最新的微博热搜
|
||||||
|
* @return ApiTopsearchWeibo
|
||||||
|
*/
|
||||||
|
List<ApiTopsearchWeibo> showWbSearch();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.xjs.topsearch.service.impl;
|
package com.xjs.topsearch.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.xjs.topsearch.domain.ApiTopsearchWeibo;
|
import com.xjs.topsearch.domain.ApiTopsearchWeibo;
|
||||||
import com.xjs.topsearch.mapper.ApiTopsearchWeiboMapper;
|
import com.xjs.topsearch.mapper.ApiTopsearchWeiboMapper;
|
||||||
|
|
@ -7,6 +8,7 @@ import com.xjs.topsearch.service.ApiTopsearchWeiboService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
|
|
@ -21,4 +23,15 @@ public class ApiTopsearchWeiboServiceImpl extends ServiceImpl<ApiTopsearchWeiboM
|
||||||
public Integer deleteRepeatData() {
|
public Integer deleteRepeatData() {
|
||||||
return apiTopsearchWeiboMapper.deleteRepeatData();
|
return apiTopsearchWeiboMapper.deleteRepeatData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ApiTopsearchWeibo> showWbSearch() {
|
||||||
|
LambdaQueryWrapper<ApiTopsearchWeibo> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.select(ApiTopsearchWeibo::getHotword,ApiTopsearchWeibo::getId);
|
||||||
|
wrapper.orderByDesc(ApiTopsearchWeibo::getCreateTime);
|
||||||
|
wrapper.orderByDesc(ApiTopsearchWeibo::getHotnum);
|
||||||
|
wrapper.last("limit 5");
|
||||||
|
|
||||||
|
return apiTopsearchWeiboMapper.selectList(wrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
import com.ruoyi.common.log.annotation.Log;
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.xjs.business.webmagic.domain.CopyWritingNetworkDTO;
|
||||||
import com.xjs.copywritingNetwork.pojo.CopyWritingNetwork;
|
import com.xjs.copywritingNetwork.pojo.CopyWritingNetwork;
|
||||||
import com.xjs.copywritingNetwork.service.CopyWritingNetworkService;
|
import com.xjs.copywritingNetwork.service.CopyWritingNetworkService;
|
||||||
import com.xjs.copywritingNetwork.task.CopyWritingNetworkTask;
|
import com.xjs.copywritingNetwork.task.CopyWritingNetworkTask;
|
||||||
|
|
@ -14,12 +15,14 @@ import com.xjs.validation.group.SelectGroup;
|
||||||
import com.xjs.web.MyBaseController;
|
import com.xjs.web.MyBaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文案网controller
|
* 文案网controller
|
||||||
|
|
@ -30,7 +33,7 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("copyWritingNetwork")
|
@RequestMapping("copyWritingNetwork")
|
||||||
@Api(tags = "爬虫模块-文案网")
|
@Api(tags = "爬虫模块-文案网")
|
||||||
public class CopyWritingNetworkController extends MyBaseController {
|
public class CopyWritingNetworkController extends MyBaseController<CopyWritingNetwork> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CopyWritingNetworkService copyWritingNetworkService;
|
private CopyWritingNetworkService copyWritingNetworkService;
|
||||||
|
|
@ -55,6 +58,18 @@ public class CopyWritingNetworkController extends MyBaseController {
|
||||||
return R.ok(count);
|
return R.ok(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("showCopyWriting")
|
||||||
|
@ApiOperation("首页展示文案")
|
||||||
|
public R<List<CopyWritingNetworkDTO>> showCopyWriting() {
|
||||||
|
List<CopyWritingNetwork> data = copyWritingNetworkService.showCopyWriting();
|
||||||
|
List<CopyWritingNetworkDTO> collect = data.stream().map(d -> {
|
||||||
|
CopyWritingNetworkDTO dto = new CopyWritingNetworkDTO();
|
||||||
|
BeanUtils.copyProperties(d, dto);
|
||||||
|
return dto;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
return R.ok(collect);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------代码生成-----------------------------
|
//----------------------------代码生成-----------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,4 +50,10 @@ public interface CopyWritingNetworkMapper extends BaseMapper<CopyWritingNetwork>
|
||||||
* @return list
|
* @return list
|
||||||
*/
|
*/
|
||||||
List<String> getType();
|
List<String> getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展示文案
|
||||||
|
* @return List
|
||||||
|
*/
|
||||||
|
List<CopyWritingNetwork> showCopyWriting();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,5 +52,10 @@ public interface CopyWritingNetworkService extends IService<CopyWritingNetwork>
|
||||||
int deleteCopyWritingNetworkById(Long id);
|
int deleteCopyWritingNetworkById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展示文案
|
||||||
|
* @return List
|
||||||
|
*/
|
||||||
|
List<CopyWritingNetwork> showCopyWriting();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,10 @@ public class CopyWritingNetworkServiceImpl extends ServiceImpl<CopyWritingNetwor
|
||||||
return this.listObjs(wrapper);
|
return this.listObjs(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CopyWritingNetwork> showCopyWriting() {
|
||||||
|
return copyWritingNetworkMapper.showCopyWriting();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 过滤数据
|
* 过滤数据
|
||||||
|
|
@ -128,4 +132,6 @@ public class CopyWritingNetworkServiceImpl extends ServiceImpl<CopyWritingNetwor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,11 @@ public class CopyWritingNetworkTask {
|
||||||
String content = copyWritingNetwork.getContent();
|
String content = copyWritingNetwork.getContent();
|
||||||
boolean matches = pattern.matcher(content).matches();
|
boolean matches = pattern.matcher(content).matches();
|
||||||
if (StringUtils.isNotEmpty(content) && !matches) {
|
if (StringUtils.isNotEmpty(content) && !matches) {
|
||||||
|
|
||||||
|
//过滤数据
|
||||||
|
String cont = filterContent(content);
|
||||||
|
copyWritingNetwork.setContent(cont);
|
||||||
|
|
||||||
copyWritingNetworks.add(copyWritingNetwork);
|
copyWritingNetworks.add(copyWritingNetwork);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,5 +144,50 @@ public class CopyWritingNetworkTask {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过滤数据
|
||||||
|
*
|
||||||
|
* @param oldStr 原始数据
|
||||||
|
* @return newStr
|
||||||
|
*/
|
||||||
|
private String filterContent(String oldStr) {
|
||||||
|
try {
|
||||||
|
char index0 = oldStr.charAt(0);
|
||||||
|
char index1 = oldStr.charAt(1);
|
||||||
|
char index2 = oldStr.charAt(2);
|
||||||
|
char index3 = oldStr.charAt(3);
|
||||||
|
boolean matches0 = pattern.matcher(String.valueOf(index0)).matches();
|
||||||
|
boolean matches1 = pattern.matcher(String.valueOf(index1)).matches();
|
||||||
|
boolean matches2 = pattern.matcher(String.valueOf(index2)).matches();
|
||||||
|
// 1、
|
||||||
|
if (matches0 && index1 == '、') {
|
||||||
|
return oldStr.substring(2);
|
||||||
|
}
|
||||||
|
// 15、
|
||||||
|
if (matches0 && matches1 && index2 == '、') {
|
||||||
|
return oldStr.substring(3);
|
||||||
|
}
|
||||||
|
//100、
|
||||||
|
if (matches0 && matches1 && matches2 && index3 == '、') {
|
||||||
|
return oldStr.substring(4);
|
||||||
|
}
|
||||||
|
//1.
|
||||||
|
if (matches0 && index1 == '.') {
|
||||||
|
return oldStr.substring(2);
|
||||||
|
}
|
||||||
|
//13.
|
||||||
|
if (matches0 && matches1 && index2 == '.') {
|
||||||
|
return oldStr.substring(3);
|
||||||
|
}
|
||||||
|
//100.
|
||||||
|
if (matches0 && matches1 && matches2 && index3 == '.') {
|
||||||
|
return oldStr.substring(4);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage()+"===="+oldStr);
|
||||||
|
return oldStr;
|
||||||
|
}
|
||||||
|
return oldStr;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ public class OfficialAccountsProcessor implements PageProcessor {
|
||||||
|
|
||||||
String js = page.getHtml().get();
|
String js = page.getHtml().get();
|
||||||
|
|
||||||
|
//解析js中的url地址以及拼接
|
||||||
if (js.contains("window.location.replace(url)")) {
|
if (js.contains("window.location.replace(url)")) {
|
||||||
String function = js.substring(js.indexOf("{") + 1, js.indexOf("}"));
|
String function = js.substring(js.indexOf("{") + 1, js.indexOf("}"));
|
||||||
//System.out.println("function="+function);
|
//System.out.println("function="+function);
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,9 @@
|
||||||
GROUP BY
|
GROUP BY
|
||||||
type
|
type
|
||||||
</select>
|
</select>
|
||||||
|
<select id="showCopyWriting" resultType="com.xjs.copywritingNetwork.pojo.CopyWritingNetwork">
|
||||||
|
SELECT id,type,content FROM webmagic_copywriting_network ORDER BY RAND() LIMIT 5
|
||||||
|
</select>
|
||||||
|
|
||||||
<delete id="deleteRepeatData">
|
<delete id="deleteRepeatData">
|
||||||
delete from webmagic_copywriting_network where id not in (
|
delete from webmagic_copywriting_network where id not in (
|
||||||
|
|
@ -58,4 +61,4 @@
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue