1、当36壁纸爬虫正在执行时,不可修改配置

2、36壁纸新增接口权限验证
pull/254/head
xjs 4 years ago
parent add64ea618
commit 856166612a

@ -7,6 +7,7 @@
placeholder="请输入" placeholder="请输入"
clearable clearable
size="small" size="small"
@change="handleQuery"
style="width: 180px"> style="width: 180px">
<el-option <el-option
v-for="index in apiName" v-for="index in apiName"

@ -7,6 +7,7 @@
placeholder="请输入" placeholder="请输入"
clearable clearable
size="small" size="small"
@change="handleQuery"
style="width: 180px"> style="width: 180px">
<el-option <el-option
v-for="index in apiName" v-for="index in apiName"

@ -26,7 +26,7 @@
<include refid="selectApiRecordVo"/> <include refid="selectApiRecordVo"/>
<where> <where>
<if test="apiName != null and apiName != ''"> and api_name like concat('%', #{apiName}, '%')</if> <if test="apiName != null and apiName != ''"> and api_name like concat('%', #{apiName}, '%')</if>
<if test="status != null">status = #{status}</if> <if test="status != null">and status = #{status}</if>
</where> </where>
order by create_time desc order by create_time desc
</select> </select>

@ -75,10 +75,7 @@ public class _36wallpaperServiceImpl extends ServiceImpl<_36wallpaperMapper, _36
@Override @Override
public boolean updateSettings(String json) { public boolean updateSettings(String json) {
//判断爬虫是否正在执行,正在执行不可修改! this.checkRunning();
if(redisService.hasKey(REPTILE_COUNT)){
throw new BusinessException("爬虫正在执行中!暂时无法修改,请稍后再试");
}
//校验json格式是否正确 //校验json格式是否正确
try { try {
@ -116,6 +113,8 @@ public class _36wallpaperServiceImpl extends ServiceImpl<_36wallpaperMapper, _36
@Override @Override
public boolean resetSettings() { public boolean resetSettings() {
this.checkRunning();
//构建json //构建json
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("path",PATH); jsonObject.put("path",PATH);
@ -128,4 +127,15 @@ public class _36wallpaperServiceImpl extends ServiceImpl<_36wallpaperMapper, _36
} }
return false; return false;
} }
/**
*
*/
private void checkRunning() {
//判断爬虫是否正在执行,正在执行不可修改!
if(redisService.hasKey(REPTILE_COUNT)){
throw new BusinessException("爬虫正在执行中!暂时无法修改,请稍后再试");
}
}
} }

@ -67,23 +67,33 @@ public class CopyWritingNetworkServiceImpl extends ServiceImpl<CopyWritingNetwor
char index0 = oldStr.charAt(0); char index0 = oldStr.charAt(0);
char index1 = oldStr.charAt(1); char index1 = oldStr.charAt(1);
char index2 = oldStr.charAt(2); char index2 = oldStr.charAt(2);
char index3 = oldStr.charAt(3);
boolean matches0 = pattern.matcher(String.valueOf(index0)).matches(); boolean matches0 = pattern.matcher(String.valueOf(index0)).matches();
boolean matches1 = pattern.matcher(String.valueOf(index1)).matches(); boolean matches1 = pattern.matcher(String.valueOf(index1)).matches();
boolean matches2 = pattern.matcher(String.valueOf(index2)).matches();
// 1、 // 1、
if (matches0 && index1 == '、') { if (matches0 && index1 == '、') {
return oldStr.substring(2,oldStr.length()-2); return oldStr.substring(2);
} }
// 15、 // 15、
if (matches0 && matches1 && index2 == '、') { if (matches0 && matches1 && index2 == '、') {
return oldStr.substring(3,oldStr.length()-3); return oldStr.substring(3);
}
//100、
if (matches0 && matches1 && matches2 && index3 == '、') {
return oldStr.substring(4);
} }
//1. //1.
if (matches0 && index1 == '.') { if (matches0 && index1 == '.') {
return oldStr.substring(2,oldStr.length()-2); return oldStr.substring(2);
} }
//13. //13.
if (matches0 && matches1 && index2 == '.') { if (matches0 && matches1 && index2 == '.') {
return oldStr.substring(3,oldStr.length()-3); return oldStr.substring(3);
}
//100.
if (matches0 && matches1 && matches2 && index3 == '.') {
return oldStr.substring(4);
} }
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());

Loading…
Cancel
Save