mirror of
https://github.com/Hello-hao/Tbed.git
synced 2024-04-21 12:32:10 +00:00
update:调整了百度鉴别接口升级了依赖,新增了key的相关字段信息
This commit is contained in:
@@ -134,7 +134,7 @@
|
||||
<dependency>
|
||||
<groupId>com.baidu.aip</groupId>
|
||||
<artifactId>java-sdk</artifactId>
|
||||
<version>4.11.0</version>
|
||||
<version>4.16.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.coobird</groupId>
|
||||
|
||||
@@ -41,17 +41,22 @@ public static void main(String[] args) {
|
||||
@Bean
|
||||
public static BeanFactoryPostProcessor dependsOnPostProcessor() {
|
||||
return bf -> {
|
||||
// Let beans that need the database depend on the DatabaseStartupValidator
|
||||
// like the JPA EntityManagerFactory or Flyway
|
||||
String[] flyway = bf.getBeanNamesForType(FirstRun.class);
|
||||
Stream.of(flyway)
|
||||
.map(bf::getBeanDefinition)
|
||||
.forEach(it -> it.setDependsOn("databaseStartupValidator"));
|
||||
try{
|
||||
// Let beans that need the database depend on the DatabaseStartupValidator
|
||||
// like the JPA EntityManagerFactory or Flyway
|
||||
String[] flyway = bf.getBeanNamesForType(FirstRun.class);
|
||||
Stream.of(flyway)
|
||||
.map(bf::getBeanDefinition)
|
||||
.forEach(it -> it.setDependsOn("databaseStartupValidator"));
|
||||
|
||||
String[] jpa = bf.getBeanNamesForType(KeysMapper.class);
|
||||
Stream.of(jpa)
|
||||
.map(bf::getBeanDefinition)
|
||||
.forEach(it -> it.setDependsOn("databaseStartupValidator"));
|
||||
}catch (Exception e){
|
||||
System.out.println("错错错");
|
||||
}
|
||||
|
||||
String[] jpa = bf.getBeanNamesForType(KeysMapper.class);
|
||||
Stream.of(jpa)
|
||||
.map(bf::getBeanDefinition)
|
||||
.forEach(it -> it.setDependsOn("databaseStartupValidator"));
|
||||
};
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -43,9 +43,9 @@ public class IndexController {
|
||||
@RequestMapping(value = "/")
|
||||
public String Welcome(Model model, HttpServletRequest httpServletRequest) {
|
||||
model.addAttribute("name", "服务端程序");
|
||||
model.addAttribute("version", "20230101");
|
||||
model.addAttribute("version", "20230316");
|
||||
model.addAttribute("ip", GetIPS.getIpAddr(httpServletRequest));
|
||||
model.addAttribute("links", "tbed.hellohao.cn");
|
||||
model.addAttribute("links", "www.hellohao.cn");
|
||||
return "welcome";
|
||||
}
|
||||
|
||||
|
||||
@@ -198,6 +198,7 @@ public class ClientService {
|
||||
})
|
||||
.start();
|
||||
} else {
|
||||
imgMapper.deleimgForImgUid(imgObj.getImguid());
|
||||
msg.setCode("5001");
|
||||
msg.setInfo("上传服务内部错误");
|
||||
return msg;
|
||||
@@ -292,8 +293,8 @@ public class ClientService {
|
||||
imgreview.getSecretKey());
|
||||
client.setConnectionTimeoutInMillis(5000);
|
||||
client.setSocketTimeoutInMillis(30000);
|
||||
org.json.JSONObject res = client.antiPorn(images.getImgurl());
|
||||
res = client.imageCensorUserDefined(images.getImgurl(), EImgType.URL, null);
|
||||
// org.json.JSONObject res = client.antiPorn(images.getImgurl());
|
||||
org.json.JSONObject res = client.imageCensorUserDefined(images.getImgurl(), EImgType.URL, null);
|
||||
com.alibaba.fastjson.JSONArray jsonArray =
|
||||
JSON.parseArray("[" + res.toString() + "]");
|
||||
for (Object o : jsonArray) {
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.baidu.aip.contentcensor.EImgType;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -28,6 +30,8 @@ import java.util.*;
|
||||
*/
|
||||
@Service
|
||||
public class UploadServicel {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(UploadServicel.class);
|
||||
@Autowired private UploadConfigMapper uploadConfigMapper;
|
||||
@Autowired private KeysMapper keysMapper;
|
||||
@Autowired private ImgMapper imgMapper;
|
||||
@@ -200,6 +204,7 @@ public class UploadServicel {
|
||||
})
|
||||
.start();
|
||||
} else {
|
||||
imgMapper.deleimgForImgUid(imgObj.getImguid());
|
||||
msg.setCode("5001");
|
||||
msg.setInfo("上传服务内部错误");
|
||||
return msg;
|
||||
@@ -333,9 +338,9 @@ public class UploadServicel {
|
||||
imgreview.getSecretKey());
|
||||
client.setConnectionTimeoutInMillis(5000);
|
||||
client.setSocketTimeoutInMillis(30000);
|
||||
org.json.JSONObject res = client.antiPorn(images.getImgurl());
|
||||
res = client.imageCensorUserDefined(images.getImgurl(), EImgType.URL, null);
|
||||
System.err.println("返回的鉴黄json:" + res.toString());
|
||||
// org.json.JSONObject res = client.antiPorn(images.getImgurl());
|
||||
org.json.JSONObject res = client.imageCensorUserDefined(images.getImgurl(), EImgType.URL, null);
|
||||
logger.info("百度图像审核返回的JSON:"+res.toString());
|
||||
com.alibaba.fastjson.JSONArray jsonArray =
|
||||
JSON.parseArray("[" + res.toString() + "]");
|
||||
for (Object o : jsonArray) {
|
||||
|
||||
-5
@@ -1,11 +1,6 @@
|
||||
package cn.hellohao.utils;
|
||||
|
||||
import org.apache.ibatis.io.Resources;
|
||||
import org.apache.ibatis.jdbc.ScriptRunner;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.*;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
final class RunSqlScript {
|
||||
@@ -27,7 +27,7 @@
|
||||
WHEN storageType=5 THEN '本地'
|
||||
WHEN storageType=6 THEN '腾讯云'
|
||||
WHEN storageType=7 THEN 'FTP'
|
||||
WHEN storageType=8 THEN 'UFile'
|
||||
WHEN storageType=8 THEN 'S3协议'
|
||||
ELSE '未知' END AS storageName,
|
||||
keyname
|
||||
FROM `keys` GROUP BY storageType,id,storageName,keyname
|
||||
@@ -49,7 +49,9 @@
|
||||
Endpoint = #{Endpoint},
|
||||
Bucketname = #{Bucketname},
|
||||
RequestAddress = #{RequestAddress},
|
||||
keyname = #{keyname}
|
||||
keyname = #{keyname},
|
||||
Region = #{Region},
|
||||
RootPath = #{RootPath}
|
||||
WHERE
|
||||
storageType = #{storageType}
|
||||
</update>
|
||||
|
||||
Reference in New Issue
Block a user