2019-11-7更新

This commit is contained in:
Hellohao
2019-11-07 21:47:53 +08:00
parent 1ca1913938
commit f1dc16feb6
26 changed files with 912 additions and 486 deletions
+25
View File
@@ -81,6 +81,12 @@
<version>5.5.7</version>
</dependency>
<dependency>
<groupId>cn.ucloud.ufile</groupId>
<artifactId>ufile-client-java</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
@@ -163,6 +169,25 @@
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.10</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.1.9.RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
@@ -81,8 +81,6 @@ public class AdminRootController {
model.addAttribute("StorageType", 5);//切换到本地
model.addAttribute("Endpoint2", 0);
}
return "admin/storageconfig";
}
@@ -203,10 +201,7 @@ public class AdminRootController {
//修改站点配置
@PostMapping("/updateconfig")
@ResponseBody
// public Integer updateconfig(String webname,String explain, String video,
// Integer backtype, String links, String notice,String baidu,
// String domain,String background1,String background2 ) {
public Integer updateconfig(Config config ) {
public Integer updateconfig(Config config ) {
Integer ret = configService.setSourceype(config);
return ret;
@@ -284,7 +279,7 @@ public class AdminRootController {
String urls ="http://tc.hellohao.cn/systemupdate";
paramMap.put("dates",dates);
String result= HttpUtil.post(urls, paramMap);
System.out.println(Integer.parseInt( result ));
// System.out.println(Integer.parseInt( result ));
return Integer.parseInt( result );
}
@@ -12,11 +12,10 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.FileInputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author Hellohao
@@ -49,6 +48,8 @@ public class ClientController {
private FTPImageupload ftpImageupload;
@Autowired
private DomainService domainService;
@Autowired
private ImgService imgService;
@Value("${systemupdate}")
private String systemupdate;
@@ -164,7 +165,13 @@ public class ClientController {
}
img.setSizes((entry.getValue()));
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
img.setAbnormal(0);
//img.setAbnormal(Sentence.getIPs());
//多线程插入ip值
GetIPS getIPS = new GetIPS();
getIPS.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
Thread thread = new Thread(getIPS);
thread.start();
img.setImgtype(0);
//-1证明超出大小,
if (entry.getValue() != -1) {
userService.insertimg(img);
@@ -198,7 +205,13 @@ public class ClientController {
}
img.setSizes((entry.getValue())/1024);
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
img.setAbnormal(0);
//img.setAbnormal(Sentence.getIPs());
//多线程插入ip值
GetIPS getIPS = new GetIPS();
getIPS.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
Thread thread = new Thread(getIPS);
thread.start();
img.setImgtype(0);
//-1证明超出大小,
if (entry.getValue() != -1) {
userService.insertimg(img);
@@ -220,6 +233,290 @@ public class ClientController {
return resultBean;
}
@PostMapping(value = "/clientupurlimg")
@ResponseBody
public ResultBean clientupurlimg( String imgurl, HttpServletRequest request, Integer setday,
String email,String pass) throws Exception {
ResultBean resultBean = null;
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
if (uploadConfig.getApi() == 1) {
if (email != null && pass != null) {
Integer ret = userService.login(email, Base64Encryption.encryptBASE64(pass.getBytes()));
if (ret > 0) {
User u = userService.getUsers(email);
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
Integer usermemory =0;
Integer memory =0;
Integer Sourcekey=0;
if(u==null){
Sourcekey = GetCurrentSource.GetSource(null);
memory = uploadConfig.getVisitormemory();
usermemory= imgService.getusermemory(0);
if(usermemory==null){usermemory = 0;}
}else{
Sourcekey = GetCurrentSource.GetSource(u.getId());
memory = userService.getUsers(u.getEmail()).getMemory();
usermemory= imgService.getusermemory(u.getId());
if(usermemory==null){usermemory = 0;}
}
String userpath = "tourist";
if(uploadConfig.getUrltype()==2){
java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy/MM/dd");
userpath = dateFormat.format(new Date());
}else{if (u != null) { userpath = u.getUsername();}}
JSONArray jsonArray = new JSONArray();
Keys key = keysService.selectKeys(Sourcekey);
long imgsize = ImgUrlUtil.getFileLength(imgurl);
Integer youke = uploadConfig.getFilesizetourists();
Integer yonghu = uploadConfig.getFilesizeuser();
String uuid= UUID.randomUUID().toString().replace("-", "");
Boolean bo =false;
if(Sourcekey==5){
bo =true;
}else{bo = StringUtils.doNull(Sourcekey,key);//判断对象是否有空值
}
// //容量判断
if(u==null){
memory = uploadConfig.getVisitormemory();
usermemory= imgService.getusermemory(0);
if(usermemory==null){usermemory = 0;}
}else{
memory = userService.getUsers(u.getEmail()).getMemory();
usermemory= imgService.getusermemory(u.getId());
if(usermemory==null){usermemory = 0;}
}
//先判断对象存储key是不是null
Print.warning("上传地址是:"+request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
if(bo){
if(usermemory/1024<memory){
long stime = System.currentTimeMillis();
//判断是会员还是游客
if(u!=null){
//判断文件大小
if(imgsize>0 && imgsize<=(yonghu*1024*1024)){
try{
boolean bl =ImgUrlUtil.downLoadFromUrl(imgurl,
uuid, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
if(bl==true){
FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
byte[] b = new byte[3];
is.read(b, 0, b.length);
String xxx = ImgUrlUtil.bytesToHexString(b);
xxx = xxx.toUpperCase();
System.out.println("头文件是:" + xxx);
String ooo = TypeDict.checkType(xxx);
System.out.println("后缀名是:" + ooo);
if(is!=null){
is.close();
}
//判断文件头是否是图片
if(!ooo.equals("0000")){
Map<String, String> map = new HashMap<>();
map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
Map<ReturnImage, Integer> m = null;
if(key.getStorageType()==1){
m = nOSImageupload.Imageupload(null, userpath,map,setday);
}else if (key.getStorageType()==2){
m = ossImageupload.ImageuploadOSS(null, userpath,map,setday);
}else if(key.getStorageType()==3){
m = ussImageupload.ImageuploadUSS(null, userpath,map,setday);
}else if(key.getStorageType()==4){
m = kodoImageupload.ImageuploadKODO(null, userpath,map,setday);
}else if(key.getStorageType()==5){
m = LocUpdateImg.ImageuploadLOC(null,userpath,map,setday);
}else if(key.getStorageType()==6){
m = cosImageupload.ImageuploadCOS(null,userpath,map,setday);
}else if(key.getStorageType()==7){
m = ftpImageupload.ImageuploadFTP(null,userpath,map,setday);
}
else{
System.err.println("未获取到对象存储参数,上传失败。");
}
Images img = new Images();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
String times = df.format(new Date());
System.out.println("上传图片的时间是:"+times);
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
if(key.getStorageType()==5){
if(config.getDomain()!=null){
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
}else{
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
}
}else{
jsonArray.add(entry.getKey().getImgurl());
img.setImgurl(entry.getKey().getImgurl());
}
img.setUpdatetime(times);
img.setSource(key.getStorageType());
if (u == null) {
img.setUserid(0);//用户id
} else {
img.setUserid(u.getId());//用户id
}
img.setSizes((entry.getValue()));
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
//img.setAbnormal(Sentence.getIPs());
//多线程插入ip值
GetIPS getIPS = new GetIPS();
getIPS.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
Thread thread = new Thread(getIPS);
thread.start();
img.setImgtype(0);
userService.insertimg(img);
long etime = System.currentTimeMillis();
System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
}
resultBean = ResultBean.success(jsonArray);
}else{
resultBean = ResultBean.error(-3,"文件类型不符合要求");
}
}
}catch (Exception e) {
// TODO: handle exception
Print.warning(e.toString());
resultBean = ResultBean.error(-4,"该文件不支持上传");
}
}else{
//文件过大
resultBean = ResultBean.error(-2,"文件过大");
}
}else{
if(imgsize>0 && imgsize<=(youke*1024*1024)){
try{
boolean bl = ImgUrlUtil.downLoadFromUrl(imgurl,
uuid, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
if(bl==true){
FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
byte[] b = new byte[3];
is.read(b, 0, b.length);
String xxx = ImgUrlUtil.bytesToHexString(b);
xxx = xxx.toUpperCase();
//System.out.println("头文件是:" + xxx);
String ooo = TypeDict.checkType(xxx);
//System.out.println("后缀名是:" + ooo);
if(is!=null){
is.close();
}
//判断文件头是否是图片
if(!xxx.equals("0000")){
Map<String, String> map = new HashMap<>();
map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
Map<ReturnImage, Integer> m = null;
if(key.getStorageType()==1){
m = nOSImageupload.Imageupload(null, userpath,map,setday);
}else if (key.getStorageType()==2){
m = ossImageupload.ImageuploadOSS(null, userpath,map,setday);
}else if(key.getStorageType()==3){
m = ussImageupload.ImageuploadUSS(null, userpath,map,setday);
}else if(key.getStorageType()==4){
m = kodoImageupload.ImageuploadKODO(null, userpath,map,setday);
}else if(key.getStorageType()==5){
m =LocUpdateImg.ImageuploadLOC(null,userpath, map,setday);
}else if(key.getStorageType()==6){
m =cosImageupload.ImageuploadCOS(null,userpath, map,setday);
}else if(key.getStorageType()==7){
m = ftpImageupload.ImageuploadFTP(null,userpath,map,setday);
}
else{
System.err.println("未获取到对象存储参数,上传失败。");
}
Images img = new Images();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
String times = df.format(new Date());
System.out.println("上传图片的时间是:"+times);
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
if(key.getStorageType()==5){
if(config.getDomain()!=null){
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
}else{
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
}
}else{
jsonArray.add(entry.getKey().getImgurl());
img.setImgurl(entry.getKey().getImgurl());//图片链接
}
img.setUpdatetime(times);
img.setSource(key.getStorageType());
if (u == null) {
img.setUserid(0);//用户id
} else {
img.setUserid(u.getId());//用户id
}
img.setSizes((entry.getValue()));
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
//img.setAbnormal(Sentence.getIPs());
//多线程插入ip值
GetIPS getIPS = new GetIPS();
getIPS.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
Thread thread = new Thread(getIPS);
thread.start();
img.setImgtype(0);
userService.insertimg(img);
long etime = System.currentTimeMillis();
System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
}
//上传成功
resultBean = ResultBean.success(jsonArray);
}else{
resultBean = ResultBean.error(-3,"文件类型不符合要求");
}
}
}catch (Exception e) {
// TODO: handle exception
Print.warning(e.toString());
resultBean = ResultBean.error(-4,"文件类型不符合要求");
}
}else{
//文件过大
resultBean = ResultBean.error(-2,"图片太大或不存在");
}
}
}else{
resultBean = ResultBean.error(-5,"可用空间不足");
}
}else{
resultBean = ResultBean.error(-1,"未配置存储源");
}
}else {resultBean = ResultBean.error(-2, "此用户信息不正确。");}
}else {resultBean = ResultBean.error(-3, "邮箱或密码为空");}
}else{resultBean = ResultBean.error(-4, "管理员关闭了API接口");}
Print.Normal(resultBean.toString());
return resultBean;
/**
* 错误返回值含义:
* -1 存储源key未配置
* -2 目标图片太大或者不存在
* -3 文件类型不符合要求
* */
}
@RequestMapping("/clientlogin")
@ResponseBody
public String login( HttpSession httpSession, String email, String password) {
JSONArray jsonArray = new JSONArray();
String basepass = Base64Encryption.encryptBASE64(password.getBytes());
Integer ret = userService.login(email, basepass);
if (ret > 0) {
User user = userService.getUsers(email);
if (user.getIsok() == 1) {
jsonArray.add(1);
} else if(ret==-1){
jsonArray.add(-1);
}else {
jsonArray.add(-2);
}
} else {
jsonArray.add(0);
}
return jsonArray.toString();
}
@GetMapping (value = "/notices")
@ResponseBody
public String notices() throws Exception {
@@ -51,6 +51,7 @@ public class UpdateImgController {
@Autowired
private ImgService imgService;
private Integer updatekey;
@RequestMapping({"/", "/index"})
public String indexImg(Model model, HttpSession httpSession) {
@@ -104,6 +105,9 @@ public class UpdateImgController {
}else{
return "index";
}
Random random = new Random();
updatekey = random.nextInt(10000);
model.addAttribute("updatekey", updatekey);
return "index";
}
@@ -111,7 +115,8 @@ public class UpdateImgController {
@RequestMapping(value = "/upimg")
@ResponseBody
public String upimg( HttpSession session
, @RequestParam(value = "file", required = false) MultipartFile[] file,Integer setday) throws Exception {
, @RequestParam(value = "file", required = false) MultipartFile multipartFile,Integer setday,String upurlk) throws Exception {
java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy/MM/dd");
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
Config config = configService.getSourceype();
@@ -120,363 +125,283 @@ public class UpdateImgController {
Integer usermemory =0;
Integer memory =0;
Integer Sourcekey=0;
Integer maxsize = 0;
String userpath = "tourist";
Boolean b =false;
if(Integer.parseInt(Base64Encryption.decryptBASE64(upurlk))!=updatekey){
jsonObject.put("imgurls",403);//非法调用
return jsonObject.toString();
}
if(u==null){
Sourcekey = GetCurrentSource.GetSource(null);
memory = uploadConfig.getVisitormemory();
maxsize = uploadConfig.getFilesizetourists();
usermemory= imgService.getusermemory(0);
if(usermemory==null){usermemory = 0;}
}else{
userpath = u.getUsername();
Sourcekey = GetCurrentSource.GetSource(u.getId());
memory = userService.getUsers(u.getEmail()).getMemory();
maxsize = uploadConfig.getFilesizeuser();
usermemory= imgService.getusermemory(u.getId());
if(usermemory==null){usermemory = 0;}
}
Keys key = keysService.selectKeys(Sourcekey);//config.getSourcekey()
Boolean b =false;
if(Sourcekey==5){
b =true;
}else{
b = StringUtils.doNull(Sourcekey,key);//判断对象是否有空值
//查询到如果使用目录格式是日期,就重新给userpath赋值
if(uploadConfig.getUrltype()==2){
userpath = dateFormat.format(new Date());
}
if(b){
int tmp = usermemory/1024;
if(memory==-1){//证明未做限制
tmp = -2;
}
if(tmp<memory){
long stime = System.currentTimeMillis();
String userpath = "tourist";
if(uploadConfig.getUrltype()==2){
java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy/MM/dd");
userpath = dateFormat.format(new Date());
Keys key = keysService.selectKeys(Sourcekey);
if(Sourcekey==5){b =true;}
else{b = StringUtils.doNull(Sourcekey,key);}//判断对象是否有空值
if(!b){
jsonObject.put("imgurls",-1);//存储源不完整
return jsonObject.toString();
}
//如果memory为-1说明无限制给值-2就行,
int tmp =memory==-1? -2:(usermemory/1024);
if(tmp>=memory){
jsonObject.put("imgurls",-5);//可用空间不足
return jsonObject.toString();
}
long stime = System.currentTimeMillis();
Map<String, MultipartFile> map = new HashMap<>();
//for (MultipartFile multipartFile : file) {
Print.Normal("文件大小:"+multipartFile.getSize());
if(multipartFile.getSize()>maxsize*1024*1024){
jsonObject.put("imgurls",-6);//超出设定大小
return jsonObject.toString();
}
// 获取ImageReader对象的迭代器
String fileName = multipartFile.getOriginalFilename();
String lastname = fileName.substring(fileName.lastIndexOf(".") + 1);//获取文件后缀
if (!multipartFile.isEmpty()) { //判断文件是否为空
map.put(lastname, multipartFile);
}
//}
Map<ReturnImage, Integer> m = null;
m = GetSource.storageSource(key.getStorageType(),map, userpath,null,setday);
//开始存数据
Images img = new Images();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
Print.Normal("上传图片的时间是:"+df.format(new Date()));
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
if(key.getStorageType()==5){
if(config.getDomain()!=null){
jsonObject.put("imgurls",config.getDomain()+"/links/"+entry.getKey().getImgurl());
jsonObject.put("imgnames",entry.getKey().getImgname());
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
}else{
if (u != null) {
userpath = u.getUsername();
}
}
Map<String, MultipartFile> map = new HashMap<>();
for (MultipartFile multipartFile : file) {
// 获取ImageReader对象的迭代器
//获取文件名
String fileName = multipartFile.getOriginalFilename();
String lastname = fileName.substring(fileName.lastIndexOf(".") + 1);//获取文件后缀
if (!multipartFile.isEmpty()) { //判断文件是否为空
map.put(lastname, multipartFile);
System.out.println("===name==="+multipartFile.getOriginalFilename()); //文件名
//multipartFile.getSize(); //文件大小
}
}
Map<ReturnImage, Integer> m = null;
if(key.getStorageType()==1){
m = nOSImageupload.Imageupload(map, userpath,null,setday);
}else if (key.getStorageType()==2){
m = ossImageupload.ImageuploadOSS(map, userpath,null,setday);
}else if(key.getStorageType()==3){
m = ussImageupload.ImageuploadUSS(map, userpath,null,setday);
}else if(key.getStorageType()==4){
m = kodoImageupload.ImageuploadKODO(map, userpath,null,setday);
}else if(key.getStorageType()==5){
m = LocUpdateImg.ImageuploadLOC(map, userpath,null,setday);
}else if(key.getStorageType()==6){
m = cosImageupload.ImageuploadCOS(map, userpath,null,setday);
}else if(key.getStorageType()==7){
m = ftpImageupload.ImageuploadFTP(map, userpath,null,setday);
}
else{
System.err.println("未获取到对象存储参数,上传失败。");
}
Images img = new Images();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
String times = df.format(new Date());
System.out.println("上传图片的时间是:"+times);
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
if(key.getStorageType()==5){
if(config.getDomain()!=null){
jsonObject.put("imgurls",config.getDomain()+"/links/"+entry.getKey().getImgurl());
jsonObject.put("imgnames",entry.getKey().getImgname());
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
}else{
jsonObject.put("imgurls",config.getDomain()+"/links/"+entry.getKey().getImgurl());
jsonObject.put("imgnames",entry.getKey().getImgname());
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
}
}else{
jsonObject.put("imgurls",entry.getKey().getImgurl());
jsonObject.put("imgnames",entry.getKey().getImgname());
img.setImgurl(entry.getKey().getImgurl());//图片链接
}
jsonArray.add(jsonObject);
img.setUpdatetime(times);
img.setSource(key.getStorageType());
if (u == null) {
img.setUserid(0);
} else {
img.setUserid(u.getId());//用户id
}
img.setSizes((entry.getValue()) / 1024);
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
img.setAbnormal(0);
userService.insertimg(img);
long etime = System.currentTimeMillis();
System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
}
}else{
jsonObject.put("imgurls",-5);//可用空间不足
jsonObject.put("imgurls",config.getDomain()+"/links/"+entry.getKey().getImgurl());
jsonObject.put("imgnames",entry.getKey().getImgname());
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
}
}else{
jsonObject.put("imgurls",-1);
jsonObject.put("imgurls",entry.getKey().getImgurl());
jsonObject.put("imgnames",entry.getKey().getImgname());
img.setImgurl(entry.getKey().getImgurl());//图片链接
}
//开辟新进程鉴黄。现在已经改成定时器
//查询鉴黄功能是否启动,1为启用
// Imgreview imgreview = imgreviewService.selectByPrimaryKey(1);
// if (imgreview.getUsing() == 1) {
// //上传完成后开辟新的线程进行图片鉴黄。
// JianHuangThread thread = new JianHuangThread(imgreviewService, key, u, m);
// thread.start();
// }
System.out.println(jsonArray.toString());
jsonArray.add(jsonObject);
img.setUpdatetime(df.format(new Date()));
img.setSource(key.getStorageType());
img.setUserid(u == null?0:u.getId());
img.setSizes((entry.getValue()) / 1024);
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
img.setImgtype(setday>0?1:0);
userService.insertimg(img);
long etime = System.currentTimeMillis();
Print.Normal("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
//多线程插入ip值
GetIPS getIPS = new GetIPS();
getIPS.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
Thread thread = new Thread(getIPS);
thread.start();
}
return jsonObject.toString();
}
//根据网络图片url上传
@PostMapping(value = "/upurlimg")
@ResponseBody
public String upurlimg(HttpSession session, String imgurl, HttpServletRequest request,Integer setday) throws Exception {
public String upurlimg(HttpSession session, String imgurl, HttpServletRequest request,Integer setday,String upurlk) throws Exception {
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
User u = (User) session.getAttribute("user");
Integer usermemory =0;
Integer memory =0;
Integer Sourcekey=0;
String userpath = "tourist";
if(u==null){
Sourcekey = GetCurrentSource.GetSource(null);
memory = uploadConfig.getVisitormemory();
usermemory= imgService.getusermemory(0);
if(usermemory==null){usermemory = 0;}
}else{
userpath = u.getUsername();
Sourcekey = GetCurrentSource.GetSource(u.getId());
memory = userService.getUsers(u.getEmail()).getMemory();
usermemory= imgService.getusermemory(u.getId());
if(usermemory==null){usermemory = 0;}
}
//Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
String userpath = "tourist";
if(uploadConfig.getUrltype()==2){
java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy/MM/dd");
userpath = dateFormat.format(new Date());
}else{if (u != null) { userpath = u.getUsername();}}
}
JSONArray jsonArray = new JSONArray();
//判断非法调用
if(Integer.parseInt(Base64Encryption.decryptBASE64(upurlk))!=updatekey){
jsonArray.add(-403);//非法调用
return jsonArray.toString();
}
Keys key = keysService.selectKeys(Sourcekey);
long imgsize = ImgUrlUtil.getFileLength(imgurl);
Integer youke = uploadConfig.getFilesizetourists();
Integer yonghu = uploadConfig.getFilesizeuser();
String uuid= UUID.randomUUID().toString().replace("-", "");
Boolean bo =false;
if(Sourcekey==5){
bo =true;
}else{bo = StringUtils.doNull(Sourcekey,key);//判断对象是否有空值
}
// //容量判断
// Integer usermemory =0;
// Integer memory =0;
if(u==null){
memory = uploadConfig.getVisitormemory();
usermemory= imgService.getusermemory(0);
if(usermemory==null){usermemory = 0;}
}else{
memory = userService.getUsers(u.getEmail()).getMemory();
usermemory= imgService.getusermemory(u.getId());
if(usermemory==null){usermemory = 0;}
bo = Sourcekey==5?true:StringUtils.doNull(Sourcekey,key);
if(!bo){
jsonArray.add(-1);//存储源不完整
return jsonArray.toString();
}
//先判断对象存储key是不是null
Print.warning("上传地址是:"+request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
if(bo){
if(usermemory/1024<memory){
if(usermemory/1024>=memory) {
jsonArray.add(-5);
return jsonArray.toString();
}
long stime = System.currentTimeMillis();
//判断是会员还是游客
if(u!=null){
//判断文件大小
if(imgsize>0 && imgsize<=(yonghu*1024*1024)){
try{
boolean bl =ImgUrlUtil.downLoadFromUrl(imgurl,
uuid, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
if(bl==true){
FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
byte[] b = new byte[3];
is.read(b, 0, b.length);
String xxx = ImgUrlUtil.bytesToHexString(b);
xxx = xxx.toUpperCase();
System.out.println("头文件是:" + xxx);
String ooo = TypeDict.checkType(xxx);
System.out.println("后缀名是:" + ooo);
if(is!=null){
is.close();
}
//判断文件头是否是图片
if(!ooo.equals("0000")){
Map<String, String> map = new HashMap<>();
map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
Map<ReturnImage, Integer> m = null;
if(key.getStorageType()==1){
m = nOSImageupload.Imageupload(null, userpath,map,setday);
}else if (key.getStorageType()==2){
m = ossImageupload.ImageuploadOSS(null, userpath,map,setday);
}else if(key.getStorageType()==3){
m = ussImageupload.ImageuploadUSS(null, userpath,map,setday);
}else if(key.getStorageType()==4){
m = kodoImageupload.ImageuploadKODO(null, userpath,map,setday);
}else if(key.getStorageType()==5){
m = LocUpdateImg.ImageuploadLOC(null,userpath,map,setday);
}else if(key.getStorageType()==6){
m = cosImageupload.ImageuploadCOS(null,userpath,map,setday);
}else if(key.getStorageType()==7){
m = ftpImageupload.ImageuploadFTP(null,userpath,map,setday);
}
else{
System.err.println("未获取到对象存储参数,上传失败。");
}
Images img = new Images();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
String times = df.format(new Date());
System.out.println("上传图片的时间是:"+times);
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
if(key.getStorageType()==5){
if(config.getDomain()!=null){
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
}else{
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
}
}else{
jsonArray.add(entry.getKey().getImgurl());
img.setImgurl(entry.getKey().getImgurl());
}
img.setUpdatetime(times);
img.setSource(key.getStorageType());
if (u == null) {
img.setUserid(0);//用户id
} else {
img.setUserid(u.getId());//用户id
}
img.setSizes((entry.getValue()));
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
img.setAbnormal(0);
userService.insertimg(img);
long etime = System.currentTimeMillis();
System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
}
}else{
jsonArray.add(-3);
}
}
}catch (Exception e) {
// TODO: handle exception
Print.warning(e.toString());
jsonArray.add(-4);
}
}else{
if(imgsize>0 && imgsize>=(yonghu*1024*1024)) {
//文件过大
jsonArray.add(-2);
return jsonArray.toString();
}
try{
boolean bl =ImgUrlUtil.downLoadFromUrl(imgurl,
uuid, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
if(bl==true){
FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
byte[] b = new byte[3];
is.read(b, 0, b.length);
String xxx = ImgUrlUtil.bytesToHexString(b);
xxx = xxx.toUpperCase();
if(is!=null){is.close();}
//判断文件头是否是图片
if(TypeDict.checkType(xxx).equals("0000")) {
jsonArray.add(-3);//不是图片格式
return jsonArray.toString();
}
Map<String, String> map = new HashMap<>();
map.put(TypeDict.checkType(xxx), request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
Map<ReturnImage, Integer> m = null;
m = GetSource.storageSource(key.getStorageType(), null, userpath,map,setday);
Images img = new Images();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
String times = df.format(new Date());
System.out.println("上传图片的时间是:"+times);
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
if(key.getStorageType()==5){
if(config.getDomain()!=null){
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
}else{
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
}
}else{
jsonArray.add(entry.getKey().getImgurl());
img.setImgurl(entry.getKey().getImgurl());
}
img.setUpdatetime(times);
img.setSource(key.getStorageType());
img.setUserid(u == null?0:u.getId());
img.setSizes((entry.getValue()));
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
//img.setAbnormal(Sentence.getIPs());
//多线程插入ip值
GetIPS getIPS = new GetIPS();
getIPS.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
Thread thread = new Thread(getIPS);
thread.start();
if(setday>0){img.setImgtype(1);}
else{img.setImgtype(0);}
userService.insertimg(img);
long etime = System.currentTimeMillis();
System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
}
}
}catch (Exception e) {
Print.warning(e.toString());
jsonArray.add(-4);
}
}else{
if(imgsize>0 && imgsize<=(youke*1024*1024)){
try{
boolean bl = ImgUrlUtil.downLoadFromUrl(imgurl,
uuid, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
if(bl==true){
FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
byte[] b = new byte[3];
is.read(b, 0, b.length);
String xxx = ImgUrlUtil.bytesToHexString(b);
xxx = xxx.toUpperCase();
//System.out.println("头文件是:" + xxx);
String ooo = TypeDict.checkType(xxx);
//System.out.println("后缀名是:" + ooo);
if(is!=null){
is.close();
}
//判断文件头是否是图片
if(!xxx.equals("0000")){
Map<String, String> map = new HashMap<>();
map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
Map<ReturnImage, Integer> m = null;
if(key.getStorageType()==1){
m = nOSImageupload.Imageupload(null, userpath,map,setday);
}else if (key.getStorageType()==2){
m = ossImageupload.ImageuploadOSS(null, userpath,map,setday);
}else if(key.getStorageType()==3){
m = ussImageupload.ImageuploadUSS(null, userpath,map,setday);
}else if(key.getStorageType()==4){
m = kodoImageupload.ImageuploadKODO(null, userpath,map,setday);
}else if(key.getStorageType()==5){
m =LocUpdateImg.ImageuploadLOC(null,userpath, map,setday);
}else if(key.getStorageType()==6){
m =cosImageupload.ImageuploadCOS(null,userpath, map,setday);
}else if(key.getStorageType()==7){
m = ftpImageupload.ImageuploadFTP(null,userpath,map,setday);
}
else{
System.err.println("未获取到对象存储参数,上传失败。");
}
Images img = new Images();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
String times = df.format(new Date());
System.out.println("上传图片的时间是:"+times);
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
if(key.getStorageType()==5){
if(config.getDomain()!=null){
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
}else{
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
}
}else{
jsonArray.add(entry.getKey().getImgurl());
}
//img.setImgurl(entry.getKey());//图片链接
img.setUpdatetime(times);
img.setSource(key.getStorageType());
if (u == null) {
img.setUserid(0);//用户id
} else {
img.setUserid(u.getId());//用户id
}
img.setSizes((entry.getValue()));
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
img.setAbnormal(0);
userService.insertimg(img);
long etime = System.currentTimeMillis();
System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
}
}else{
jsonArray.add(-3);
}
}
}catch (Exception e) {
// TODO: handle exception
Print.warning(e.toString());
jsonArray.add(-4);
}
}else{
if(imgsize>0 && imgsize>=(youke*1024*1024)){
//文件过大
jsonArray.add(-2);
return jsonArray.toString();
}
try{
boolean bl = ImgUrlUtil.downLoadFromUrl(imgurl,
uuid, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/");
if(bl==true){
FileInputStream is = new FileInputStream(request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
byte[] b = new byte[3];
is.read(b, 0, b.length);
String xxx = ImgUrlUtil.bytesToHexString(b);
xxx = xxx.toUpperCase();
if(is!=null){is.close(); }
//判断文件头是否是图片
if(xxx.equals("0000")) {
jsonArray.add(-3);
return jsonArray.toString();
}
Map<String, String> map = new HashMap<>();
map.put(TypeDict.checkType(xxx), request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
Map<ReturnImage, Integer> m = null;
m = GetSource.storageSource(key.getStorageType(), null, userpath,map,setday);
Images img = new Images();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
String times = df.format(new Date());
System.out.println("上传图片的时间是:"+times);
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
if(key.getStorageType()==5){
if(config.getDomain()!=null){
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
}else{
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
}
}else{
jsonArray.add(entry.getKey().getImgurl());
img.setImgurl(entry.getKey().getImgurl());//图片链接
}
img.setUpdatetime(times);
img.setSource(key.getStorageType());
img.setUserid(u == null?0:u.getId());
img.setSizes((entry.getValue()));
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
img.setImgtype(setday>0?1:0);
userService.insertimg(img);
long etime = System.currentTimeMillis();
System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
//多线程插入ip值
GetIPS getIPS = new GetIPS();
getIPS.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
Thread thread = new Thread(getIPS);
thread.start();
}
}
}catch (Exception e) {
Print.warning(e.toString());
jsonArray.add(-4);
}
}
}else{
jsonArray.add(-5);
}
}else{
jsonArray.add(-1);
}
return jsonArray.toString();
/**
* 错误返回值含义:
+1 -1
View File
@@ -20,7 +20,7 @@ public interface ImgMapper {
Integer counts(@Param("userid") Integer userid);
Integer setabnormal(@Param("imgname") String imgname);
Integer setabnormal(@Param("imgname") String imgname,@Param("abnormal") String abnormal);
Integer deleimgname(@Param("imgname") String imgname);
Integer deleall(@Param("id") Integer id);
+31 -3
View File
@@ -15,12 +15,13 @@ public class Config {
private String background1;
private String background2;
private String sett;
private String webms;
private String webkeywords;
private String webfavicons;
public Config() {
}
public Config(Integer id, Integer sourcekey, Integer emails, String webname, String explain, String video, Integer backtype, String links, String notice, String baidu, String domain, String background1, String background2, String sett) {
public Config(Integer id, Integer sourcekey, Integer emails, String webname, String explain, String video, Integer backtype, String links, String notice, String baidu, String domain, String background1, String background2, String sett, String webms, String webkeywords, String webfavicons) {
this.id = id;
this.sourcekey = sourcekey;
this.emails = emails;
@@ -35,6 +36,9 @@ public class Config {
this.background1 = background1;
this.background2 = background2;
this.sett = sett;
this.webms = webms;
this.webkeywords = webkeywords;
this.webfavicons = webfavicons;
}
public Integer getId() {
@@ -148,4 +152,28 @@ public class Config {
public void setSett(String sett) {
this.sett = sett;
}
public String getWebms() {
return webms;
}
public void setWebms(String webms) {
this.webms = webms;
}
public String getWebkeywords() {
return webkeywords;
}
public void setWebkeywords(String webkeywords) {
this.webkeywords = webkeywords;
}
public String getWebfavicons() {
return webfavicons;
}
public void setWebfavicons(String webfavicons) {
this.webfavicons = webfavicons;
}
}
+14 -9
View File
@@ -12,8 +12,9 @@ public class Images {
private String imgurl;
private Integer userid;
private Integer sizes = 0;
private Integer abnormal;
private String abnormal;
private Integer source;
private Integer imgtype;
private String updatetime;
private String username;
private Integer storageType;
@@ -25,7 +26,7 @@ public class Images {
super();
}
public Images(Integer id, String imgname, String imgurl, Integer userid, Integer sizes, Integer abnormal, Integer source, String updatetime, String username, Integer storageType, String starttime, String stoptime) {
public Images(Integer id, String imgname, String imgurl, Integer userid, Integer sizes, String abnormal, Integer source, Integer imgtype, String updatetime, String username, Integer storageType, String starttime, String stoptime) {
this.id = id;
this.imgname = imgname;
this.imgurl = imgurl;
@@ -33,6 +34,7 @@ public class Images {
this.sizes = sizes;
this.abnormal = abnormal;
this.source = source;
this.imgtype = imgtype;
this.updatetime = updatetime;
this.username = username;
this.storageType = storageType;
@@ -80,11 +82,11 @@ public class Images {
this.sizes = sizes;
}
public Integer getAbnormal() {
public String getAbnormal() {
return abnormal;
}
public void setAbnormal(Integer abnormal) {
public void setAbnormal(String abnormal) {
this.abnormal = abnormal;
}
@@ -96,6 +98,14 @@ public class Images {
this.source = source;
}
public Integer getImgtype() {
return imgtype;
}
public void setImgtype(Integer imgtype) {
this.imgtype = imgtype;
}
public String getUpdatetime() {
return updatetime;
}
@@ -135,11 +145,6 @@ public class Images {
public void setStoptime(String stoptime) {
this.stoptime = stoptime;
}
// @Mapper
// public static interface ConfigMapper {
// Config getSourceype();
// Integer setSourceype(@Param("sourcekey") Integer sourcekey);
// }
}
@@ -18,7 +18,7 @@ public interface ImgService {
Integer counts(Integer userid);
Integer setabnormal(String imgname);
Integer setabnormal(String imgname,String abnormal);
Integer deleimgname(String imgname);
@@ -186,8 +186,8 @@ public class ImgServiceImpl implements ImgService {
}
@Override
public Integer setabnormal(String imgname) {
return imgMapper.setabnormal(imgname);
public Integer setabnormal(String imgname,String abnormal) {
return imgMapper.setabnormal(imgname,abnormal);
}
@Override
@@ -49,7 +49,6 @@ public class KODOImageupload {
//ossClient.putObject(key.getBucketname(), username + "/" + uuid+times + "." + entry.getKey(),file,meta);
try {
Response response = uploadManager.put(file,username + "/" + uuid+times + "." + entry.getKey(),upToken);
System.out.println(response);
//解析上传成功的结果
DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
ReturnImage returnImage = new ReturnImage();
@@ -1,5 +1,6 @@
package cn.hellohao.utils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
@@ -12,6 +13,12 @@ public class AfterServiceStarted implements ApplicationRunner {
/**
* 会在服务启动完成后立即执行
*/
@Value("${spring.datasource.url}")
private String url;
@Value("${spring.datasource.username}")
private String userName;
@Value("${spring.datasource.password}")
private String userPassword;
@Override
public void run(ApplicationArguments args) throws Exception {
Print.Normal("______________________________________________");
@@ -20,7 +27,8 @@ public class AfterServiceStarted implements ApplicationRunner {
// Print.Normal(" is OK! Open http://your ip:port ");
// Print.Normal("______________________________________________");
//getLinuxLocalIp();
//System.out.println("开始执行数据库~~");
// JDBCTool.caozuo(url,userName,userPassword);
}
@@ -5,7 +5,7 @@ import java.util.Calendar;
import java.util.Date;
/**
* @author Tiansh
* @author Hellohao
* @version 1.0
* @date 2019/9/20 16:27
*/
@@ -0,0 +1,31 @@
package cn.hellohao.utils;
import cn.hellohao.service.impl.ImgServiceImpl;
import cn.hellohao.service.impl.ImgreviewServiceImpl;
/**
* @author Hellohao
* @version 1.0
* @date 2019/11/6 17:35
*/
public class GetIPS implements Runnable {
private String imgname ;
public void setImgname(String imgname) {
this.imgname = imgname;
}
@Override
public void run() {
ImgServiceImpl imgService = SpringContextHolder.getBean(ImgServiceImpl.class);
imgService.setabnormal(imgname,Sentence.getIPs());
}
public static void runxc(String imgnames){
GetIPS getIPS = new GetIPS();
getIPS.setImgname(imgnames);
Thread thread = new Thread(getIPS);
thread.start();
}
}
@@ -0,0 +1,54 @@
package cn.hellohao.utils;
import cn.hellohao.exception.StorageSourceInitException;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.service.impl.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
/**
* @author Hellohao
* @version 1.0
* @date 2019/11/7 17:12
*/
//通过type判断是哪一个存储源
public class GetSource {
public static Map<ReturnImage, Integer> storageSource(Integer type, Map<String, MultipartFile> fileMap, String userpath,
Map<String, String> filename,Integer setday){
NOSImageupload nosImageupload = SpringContextHolder.getBean(NOSImageupload.class);
OSSImageupload ossImageupload = SpringContextHolder.getBean(OSSImageupload.class);
USSImageupload ussImageupload = SpringContextHolder.getBean(USSImageupload.class);
KODOImageupload kodoImageupload = SpringContextHolder.getBean(KODOImageupload.class);
COSImageupload cosImageupload = SpringContextHolder.getBean(COSImageupload.class);
FTPImageupload ftpImageupload = SpringContextHolder.getBean(FTPImageupload.class);
Map<ReturnImage, Integer> m = null;
try {
if(type==1){
m = nosImageupload.Imageupload(fileMap, userpath,filename,setday);
}else if (type==2){
m = ossImageupload.ImageuploadOSS(fileMap, userpath,filename,setday);
}else if(type==3){
m = ussImageupload.ImageuploadUSS(fileMap, userpath,filename,setday);
}else if(type==4){
m = kodoImageupload.ImageuploadKODO(fileMap, userpath,filename,setday);
}else if(type==5){
m = LocUpdateImg.ImageuploadLOC(fileMap, userpath,filename,setday);
}else if(type==6){
m = cosImageupload.ImageuploadCOS(fileMap, userpath,filename,setday);
}else if(type==7){
m = ftpImageupload.ImageuploadFTP(fileMap, userpath,filename,setday);
}
else{
new StorageSourceInitException("GetSource类捕捉异常:未找到存储源");
}
} catch (Exception e) {
new StorageSourceInitException("GetSource类捕捉异常:",e);
e.printStackTrace();
}
return m;
}
}
@@ -26,9 +26,6 @@ public class ImageReview {
client.setSocketTimeoutInMillis(60000);
}
public static void main(String[] args) {
}
//开始调用鉴黄。
public static void imgJB(Map<String, Integer> imgmap, String requestAddress, Keys key, Imgreview imgreview) {
ImgServiceImpl imgService = SpringContextHolder.getBean(ImgServiceImpl.class);
+24 -16
View File
@@ -1,5 +1,7 @@
package cn.hellohao.utils;
import com.alibaba.fastjson.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -19,22 +21,6 @@ public class Sentence {
*/
public static String getURLContent() {
// String str = "";
// try {
// URL url = new URL("https://v1.hitokoto.cn/");
// BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
// String line;
// while ((line = reader.readLine()) != null) {
// str += line;
// }
// reader.close();
// } catch (MalformedURLException e) {
// e.printStackTrace();
// } catch (IOException e) {
// e.printStackTrace();
// }
// return str;
String result = "";
//String urlName = "https://v1.hitokoto.cn/";
String urlName = "http://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1";
@@ -61,4 +47,26 @@ public class Sentence {
return result;
}
//获取真实ip
public static String getIPs(){
String str = "";
try {
URL url = new URL("https://api.asilu.com/geo/");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = reader.readLine()) != null) {
str += line;
}
reader.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
//所有数据在str
JSONObject ips = JSONObject.parseObject(str);
return ips.get("ip").toString();
}
}
+2 -2
View File
@@ -3,7 +3,7 @@ spring.datasource.username=root
#数据库密码test
spring.datasource.password=root
#数据库链接地址
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/picturebed?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.url=jdbc:mysql://localhost:3306/picturebed?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
#端口
server.port=8088
#鉴黄周期表达式 下方表达式为每天七点半执行
@@ -24,7 +24,7 @@ multipart.maxFileSize=10240KB
multipart.maxRequestSize=10240KB
spring.thymeleaf.mode = LEGACYHTML5
spring.http.multipart.location=/data/upload_tmp
systemupdate=2019-10-08
systemupdate=2019-11-08
@@ -48,6 +48,15 @@
<if test="sett != null">
`sett` = #{sett},
</if>
<if test="webms != null">
`webms` = #{webms},
</if>
<if test="webkeywords != null">
`webkeywords` = #{webkeywords},
</if>
<if test="webfavicons != null">
`webfavicons` = #{webfavicons},
</if>
</set>
where id=1
+4 -3
View File
@@ -12,7 +12,8 @@
a.updatetime,
a.sizes,
a.abnormal,
a.source
a.source,
a.imgtype
FROM
imgdata a
LEFT JOIN user b ON a.userid = b.id
@@ -58,9 +59,9 @@
</if>
</select>
<!-- 根据图片名字标记非法提示 -->
<!-- 根据图片名字标记IP -->
<update id="setabnormal" parameterType="string">
UPDATE imgdata set abnormal=1 where imgname=#{imgname}
UPDATE imgdata set abnormal=#{abnormal} where imgname=#{imgname}
</update>
<!-- 非法图片删除他 根据名称-->
<delete id="deleimgname" parameterType="string">
+2 -2
View File
@@ -81,8 +81,8 @@
<!-- 插入图片信息 -->
<insert id="insertimg" parameterType="cn.hellohao.pojo.Images">
INSERT INTO imgdata (id, imgname, imgurl, userid, updatetime,sizes,abnormal,source)
VALUES (NULL, #{imgname}, #{imgurl}, #{userid}, #{updatetime},#{sizes},null,#{source})
INSERT INTO imgdata (id, imgname, imgurl, userid, updatetime,sizes,abnormal,source,imgtype)
VALUES (NULL, #{imgname}, #{imgurl}, #{userid}, #{updatetime},#{sizes},#{abnormal},#{source},#{imgtype})
</insert>
<!-- 修改资料 -->
Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

@@ -148,7 +148,8 @@
label: '点击选择文件'
},
formData: {
setday:isday
setday:isday,
upurlk:qq
},
dnd: '#wrapper',
paste: '#wrapper',
@@ -219,7 +220,17 @@
layer = layui.layer;
layer.msg("上传失败,可用空间不足", {icon: 2});
});
} else{
} else if(response.imgurls==403){
layui.use('layer', function () {
layer = layui.layer;
layer.msg("非法调用,请刷新页面后重试", {icon: 2});
});
}else if(response.imgurls==-6){
layui.use('layer', function () {
layer = layui.layer;
layer.msg("图片超出大小。", {icon: 2});
});
}else{
arr_url += response.imgurls + '\r\n';
arr_markdown += '!['+response.imgnames+'](' + response.imgurls + ')\r\n';
arr_html += '<img src="' + response.imgurls + '" alt="'+response.imgnames+'" title="'+response.imgnames+'" /> \r\n';
@@ -25,15 +25,16 @@
<hr />
<h3><i class="layui-icon layui-icon-star">&nbsp;</i>Guthub开源:<a href="https://github.com/Hello-hao/Tbed" target="_blank">https://github.com/Hello-hao/Tbed</a></h3>
<hr />
<h3><i class="layui-icon layui-icon-login-qq">&nbsp;</i>开发者交流群:32452345342</h3>
<h3><i class="layui-icon layui-icon-login-qq">&nbsp;</i>开发者交流群:864800972</h3>
<hr />
<h3><i class="layui-icon layui-icon-auz">&nbsp;</i><span id="dates" th:text="${systemupdate}"></span> &nbsp;&nbsp;&nbsp;<a onclick="sysupdate();" class="layui-btn layui-btn-normal layui-btn-sm">检查更新</a></h3>
<hr />
<h3 style="font-weight: bold;"><i class="layui-icon layui-icon-rmb">&nbsp;</i>支持一下作者吧:</h3>
<br />
<h3>
<img src="http://cdn.wwery.com/Hellohao/df2710722111702.jpg"
<img th:src="@{/img/ds.jpg}"
style="border-radius :5px;max-width: 80%;-moz-box-shadow: 2px 2px 10px #909090;-webkit-box-shadow: 2px 2px 10px #909090;box-shadow:2px 2px 10px #909090;" />
<!-- src="http://cdn.wwery.com/Hellohao/df2710722111702.jpg"-->
</h3>
</div>
+26 -5
View File
@@ -36,6 +36,9 @@
<!-- 样式 -->
<style type="text/css">
#table_server{
height: inherit;
}
.kv-main {
padding: 13px;
}
@@ -134,7 +137,7 @@
</head>
<body>
<div class="container kv-main">
<div class="container kv-main" style="max-width: 1200px;">
<div id="isimgs">
<table class="table ft-table table-hover" id="table_server">
<hr/>
@@ -293,6 +296,7 @@
fenye('/admin/selecttable',1);
}
function deleall() {
console.log("批量删除");
swal({
title: "确认删除选中图片",
text: "删除后将无法恢复请谨慎操作",
@@ -322,6 +326,7 @@
}
function deleallimg(ids) {
console.log("单个删除");
layer.load(1);
$.ajax({
type: "POST",
@@ -477,8 +482,8 @@
showColumns: "true",//是否显示 内容列下拉框
pageNumber: 1,//如果设置了分页,首页页码
// showPaginationSwitch:true,//是否显示 数据条数选择框
pageSize: 10,//如果设置了分页,页面数据条数
pageList: [5, 10, 20, 40], //如果设置了分页,设置可供选择的页面数据条数。设置为All 则显示所有记录。
pageSize: 20,//如果设置了分页,页面数据条数
pageList: [20, 40, 80, 160], //如果设置了分页,设置可供选择的页面数据条数。设置为All 则显示所有记录。
paginationPreText: '',//指定分页条中上一页按钮的图标或文字,这里是<
paginationNextText: '',//指定分页条中下一页按钮的图标或文字,这里是>
// singleSelect: false,//设置True 将禁止多选
@@ -541,7 +546,7 @@
},
{
//EMAIL
title: '存储源',
title: 'IP地址',
formatter: function (value, rows, index) {
var source = '';
if (rows.source == 1) {
@@ -561,7 +566,8 @@
}else {
source = '未知';
}
return source;
//return source;
return rows.abnormal;
},
align: 'center'
},
@@ -579,6 +585,21 @@
},
align: 'center'
},
{
//EMAIL
title: '性质',
formatter: function (value, rows, index) {
var type = "";
console.log(rows.imgtype)
if (rows.imgtype == 1) {
type = "临时";
} else {
type = "永久";
}
return type;
},
align: 'center'
},
{
//部门名字
title: '操作',
@@ -4,6 +4,12 @@
<meta charset="UTF-8">
<title>系统配置</title>
<link rel="stylesheet" th:href="@{/layui/layui/css/layui.css}">
<style>
.layui-tab {
max-width: 1000px;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="layui-main">
@@ -241,18 +247,35 @@
</div>
</div>
</form>
<!-- <form class="layui-form">-->
<!-- <label class="layui-form-label">默认群组</label>-->
<!-- <div class="layui-input-inline" style="width: 250px;">-->
<!-- <select id="group" name="quiz1" style="max-height: 360px;" lay-filter="group">-->
<!-- </select>-->
<!-- </div>-->
<!-- </form>-->
<h3>更多功能陆续开放...</h3>
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<label class="layui-form-label">站点关键词</label>
<div class="layui-input-block">
<input id="webkeywords" th:value="${config.getWebkeywords()}" type="text" name="title" required lay-verify="required" placeholder="配置站点关键词" autocomplete="off" class="layui-input">
<span style="color: #DAA5A6;">多个关键词用(英文)“ , ”隔开</span>
</div>
</div>
</form>
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<label class="layui-form-label">站点图标</label>
<div class="layui-input-block">
<input id="webfavicons" th:value="${config.getWebfavicons()}" type="text" name="title" required lay-verify="required" placeholder="站点(favicon)图标链接URL" autocomplete="off" class="layui-input">
<span style="color: #DAA5A6;">填写站点(favicon)图标的,大小控制在64×64以内,需是.ico格式的链接</span>
</div>
</div>
</form>
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<label class="layui-form-label">站点描述</label>
<div class="layui-input-block">
<textarea id="webms" name="webms" placeholder="请输入站点标描述这样有利于搜索引擎" class="layui-textarea" th:text="${config.getWebms()}"></textarea>
<span style="color: #DAA5A6;"><xmp>添加网站统计的JS代码,不需要要添加<script>标签</script></xmp></span>
</div>
</div>
</form>
<br />
<!-- <a class="layui-btn" lay-filter="demo2" style="float: right;margin-right: 50px;" onclick="webset()">保存</a>-->
<a class="layui-btn" lay-filter="demo2" style="float: right;margin-right: 50px;" onclick="updateconfig()">保存</a>
</div>
</div>
</div>
@@ -363,12 +386,16 @@
var background1 = $("#background1").val();
var background2 = $("#background2").val();
var sett = $('#sett input[name="settweb"]:checked ').val();
var webms = $("#webms").val();
var webkeywords = $("#webkeywords").val();
var webfavicons = $("#webfavicons").val();
if (webname != "" && domain!="" ) {
$.ajax({
type: "POST",
url: "/admin/root/updateconfig",
dataType: "json",
data: {webname: webname, explain: explain, video: video,backtype:backtype,links:links,notice:notice,domain:domain,background1:background1,background2:background2,sett:sett},
data: {webname: webname, explain: explain, video: video,backtype:backtype,links:links,notice:notice,
domain:domain,background1:background1,background2:background2,sett:sett,webms:webms,webkeywords:webkeywords,webfavicons:webfavicons},
success: function (data) {
var vals = Number(data);
if (vals > 0) {
+97 -113
View File
@@ -1,19 +1,15 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<!-- meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<!-- <meta name="description" content="Hellohao图床是一个基于JAVA-SpringBoot开发的,免费纯粹的图片存放驿站">-->
<!-- <meta name="author" content="tc.hellohao.cn">-->
<!-- <meta name="keywords" content="图床,图片上传,hellohao图床,开源图床,hellohao">-->
<!-- title -->
<title th:text="${config.getWebname()}"></title>
<!-- <title th:text="Hellohao图床"></title>-->
<link rel="shortcut icon" href="https://hellohao.nos-eastchina1.126.net/BlogImg/favicon.ico" type="image/x-icon"/>
<link rel="icon" type="image/ico" href="https://hellohao.nos-eastchina1.126.net/BlogImg/favicon.ico">
<!-- CSS IMPORT -->
<meta name="keywords" th:content="${config.getWebkeywords()}" />
<meta name="description" th:content="${config.getWebms()}" />
<meta name="author" content="Hellohao" />
<!-- <title th:text="${config.getWebname()}"></title>-->
<title th:text="Hellohao图床"></title>
<link rel="shortcut icon" th:href="${config.getWebfavicons()}" type="image/x-icon"/>
<link rel="icon" type="image/ico" th:href="${config.getWebfavicons()}" />
<link rel="stylesheet" th:href="@{css/style.css}" type="text/css" />
<link th:href="@{/webuploade/css/webuploader.css}" media="all" rel="stylesheet" type="text/css"/>
<link th:href="@{/webuploade/css/style.css}" media="all" rel="stylesheet" type="text/css"/>
@@ -32,45 +28,51 @@
<script th:src="@{/static/js/login-register.js}"></script>
<script th:src="@{/static/js/clipboard.min.js}"></script>
<script th:src="@{/static/js/bootbox.min.js}"></script>
<!-- <script th:src="@{/static/js/sweetalert.min.js}"></script>-->
<!-- <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>-->
<script th:src="@{/static/js/sweetalert2.min.js}"></script>
<!-- <script th:src="@{/static/js/popover.min.js}"></script>-->
<script th:src="@{/layui/layui/layui.js}"></script>
<style type="text/css">
a{transition: all 0.6s;}
a:hover{
a{
text-decoration: none;
transform: scale(1.4);}
#goupdate{
width:120px;
}
a:hover {
text-decoration: none;
}
#usersrc a{
transition: all 0.6s;
}
#usersrc a:hover{
transform: scale(1.4);
}
.goupdate {
text-decoration: none;
background: none;
border: 0;
box-shadow: inset 0 0 0 2px white;
box-sizing: border-box;
margin: 1em;
padding: 1em 2em;
font-size: inherit;
position: relative;
vertical-align: middle;
}
.goupdate::before, .goupdate::after {
box-sizing: inherit;
content: '';
position: absolute;
width: 100%;
height: 100%;
}
.goupdate{
isolation: isolate;
width:140px;
height:50px;
margin-right: 6%;
font-size:1.5em;
line-height:50px;
font-size:15px;
text-align:center;
float: right;
color:#FFF;
border:2px solid;
border-radius:5px;
-moz-border-radius:5px;
cursor:pointer;
}
#goupdate2{
width:120px;
height:50px;
margin-right: 6%;
font-size:1.5em;
line-height:50px;
text-align:center;
float: right;
color:#FFF;
border:2px solid;
border-radius:5px;
-moz-border-radius:5px;
cursor:pointer;
}
#goupdate:hover{}
#beian a{
color: #fff;
}
@@ -81,26 +83,53 @@
font-family: 黑体;
text-shadow: 5px 2px 6px #000;
}
.goupdate {
transition: color 0.25s;
}
.goupdate::before, .goupdate::after {
border: 2px solid transparent;
width: 0;
height: 0;
}
.goupdate::before {
top: 0;
left: 0;
}
.goupdate::after {
bottom: 0;
right: 0;
}
.goupdate:hover {
color: #60daaa;
}
.goupdate:hover::before, .goupdate:hover::after {
width: 100%;
height: 100%;
}
.goupdate:hover::before {
border-top-color: #60daaa;
border-right-color: #60daaa;
transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
}
.goupdate:hover::after {
border-bottom-color: #60daaa;
border-left-color: #60daaa;
transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
}
</style>
</head>
<body class="simple">
<div class="text-center w-mian" id="videohtml">
</div>
<!-- preloader -->
<div class="preloader-container">
<div class="content-container">
<!-- preloader -->
<span class="spinner-section-far"></span>
<!-- end preloader -->
<h6 class="preloader-text">
LOADING</h6>
</div>
</div>
<!-- end preloader -->
<!-- logo -->
<img class="img-logo menu-link" data-section="home" data-nav-title="home" alt="logo" th:src="@{img/logo_white.png}" />
<!-- end logo -->
<!-- menu -->
<div class="open">
<div class="cls">
</div>
@@ -111,10 +140,10 @@
</a></li>
<li><a href="javascript:;" class="md-trigger" data-modal="modal-3">登录&nbsp;<span class="glyphicon glyphicon-user" aria-hidden="true"></span></a></li>
<li><a href="javascript:;" class="md-trigger" data-modal="modal-4">注册&nbsp;<span class="glyphicon glyphicon-education" aria-hidden="true"></span></a></li>
<!-- <li><a class="menu-link" href="https://github.com/Hello-hao/Tbed" target="_blank"-->
<!-- >GitHub<i class="fa fa-github"></i></a></li>-->
<!-- <li><a class="menu-link" href="http://www.hellohao.cn" target="_blank"-->
<!-- >作者<i class="fa fa-github"></i></a></li>-->
<li><a class="menu-link" href="https://github.com/Hello-hao/Tbed" target="_blank"
>GitHub<i class="fa fa-github"></i></a></li>
<li><a class="menu-link" href="http://www.hellohao.cn" target="_blank"
>作者<i class="fa fa-github"></i></a></li>
<!-- <li><a href="javascript:;" class="md-trigger" data-modal="modal-2">赞助商&nbsp;<i class="fa fa-share-alt"></i></a></li>-->
@@ -125,38 +154,24 @@
<div class="cls">
</div>
</div>
<!-- end menu -->
<!-- page container -->
<div class="page-container">
<!-- section container -->
<div class="section-container">
<!-- home section -->
<section id="diyi" class="home-section">
<!-- section background -->
<div class="bg-container"></div>
<!-- end section background -->
<!-- content -->
<div class="content col-lg-8 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-12 col-xs-rlt no-pad centering-y">
<div class="col-md-12 col-sm-12">
<!-- headline -->
<h1 style="font-size: 4.5em;" th:text="${config.getWebname()}"></h1>
<a id="goupdate" class="menu-link" data-section="contact" data-nav-title="contact" data-section-pos="-100"
<a id="goupdate" class="menu-link goupdate" data-section="contact" data-nav-title="contact" data-section-pos="-100"
data-section-posy="0"><span class="glyphicon glyphicon-open" aria-hidden="true"></span>立即上传</a>
<!-- <a id="goupdate2" onclick="xiazai()">-->
<!-- <span class="glyphicon glyphicon-th-large" aria-hidden="true"></span>客户端</a>-->
<a id="goupdate2" onclick="xiazai()" class="goupdate">
<span class="glyphicon glyphicon-th-large" aria-hidden="true"></span>客户端</a>
<div class="sub-title" id="wordsrotator">
<h4>纯粹免费的图片驿站</h4>
</div>
<!-- end headline -->
<!-- short description -->
<p class="desc" th:text="${config.getExplain()}">
Hellohao Figure bedsupport several mainstream object storage, CDN acceleration is more stable.
Technology constantly updated, we will always move forward on the road ahead.
</p>
<!-- end short description -->
<!-- countdown container -->
<div id="countdown" class="countdown-container">
<!-- days left -->
<div class="dash days_dash" style="max-width: 172px;">
@@ -165,32 +180,25 @@
<div id="ri" style="margin-top: 26%;font-size: 2.5em;color: #FFFFFF;font-weight: bold;">0</div>
</div>
</div>
<!-- end days left -->
<!-- hours left -->
<div class="dash hours_dash" style="max-width: 172px;">
<div class="counter">
<div class="dash_title">hours</div>
<div id="shi" style="margin-top: 26%;font-size: 2.5em;color: #FFFFFF;font-weight: bold;">0</div>
</div>
</div>
<!-- end hours left -->
<!-- minutes left -->
<div class="dash minutes_dash" style="max-width: 172px;">
<div class="counter">
<div class="dash_title">mins</div>
<div id="fen" style="margin-top: 26%;font-size: 2.5em;color: #FFFFFF;font-weight: bold;">0</div>
</div>
</div>
<!-- minutes left -->
<div class="dash seconds_dash" style="max-width: 172px;">
<div class="counter">
<div class="dash_title">secs</div>
<div id="miao" style="margin-top: 26%;font-size: 2.5em;color: #FFFFFF;font-weight: bold;">0</div>
</div>
</div>
<!-- end minutes left -->
</div>
<!-- end countdown container -->
</div>
<div id="beian" style="text-align: center;">
@@ -204,11 +212,8 @@
</div>
</div>
<!-- end content -->
</section>
<!-- end home section -->
<div class="tlinks">Collect from <a href="/" >网站建设</a></div>
<!-- contact section -->
<section id="dier" class="contact-section" >
<ul style=" position: absolute;right: 63px;top: 24px;z-index: 9999;">
<li class="active">
@@ -217,15 +222,10 @@
</a>
</li>
</ul>
<!-- section background -->
<div class="bg-container-static"></div>
<!-- end section background -->
<!-- content -->
<div class="content col-md-10 col-md-offset-1 col-sm-12 col-xs-12 no-pad centering-y col-sm-rlt" >
<div class="col-md-12 col-sm-12">
<form enctype="multipart/form-data">
<!-- <div class="form-group">-->
<!--图片上传模板-->
<div id="wrapper">
<div id="container">
@@ -255,17 +255,14 @@
</div>
</div>
</div>
<!-- </div>-->
</form>
<form class="contact-form" action="contact.php" method="post" enctype="multipart/form-data">
<!-- full width -->
<div class="col-xs-12 text-center no-pad">
<div class="input-container no-mrg" id="urlstext">
<textarea id="urls" name="message" style="padding:20px;font-weight: 600; border: 1px solid #838383;border-radius: 5px;"></textarea>
<div class="input-border-bottom"></div>
</div>
<!-- notification container -->
<div class="col-xs-12 notif-container no-pad">
<div class="form-notif"></div>
@@ -285,15 +282,11 @@
</div>
<!-- contact form container -->
</div>
<!-- end content -->
</section>
</div>
<!-- end section container -->
</div>
<!--登录弹窗-->
<div class="md-modal md-effect-3" id="modal-4">
<div class="md-content" >
<h3>账号注册</h3>
@@ -367,11 +360,11 @@
<div>
<p></p>
<div class="form loginBox">
<a href="https://www.maoyuncloud.com/" target="_blank">
<a href="#" target="_blank">
<img style="max-width: 33.3%;" src="" />
<!-- https://hellohao-cloud.oss-cn-beijing.aliyuncs.com/%E5%AF%B9%E8%B1%A1%E5%AD%98%E5%82%A8%E8%B5%9E%E5%8A%A9logo/WechatIMG172L.png-->
</a>
<a href="https://www.upyun.com" target="_blank">
<a href="#" target="_blank">
<img style="max-width: 33.3%;" src="" />
<!-- https://hellohao-cloud.oss-cn-beijing.aliyuncs.com/%E5%AF%B9%E8%B1%A1%E5%AD%98%E5%82%A8%E8%B5%9E%E5%8A%A9logo/%E5%8F%88%E6%8B%8D%E4%BA%91_logo2.png-->
</a>
@@ -381,9 +374,6 @@
</div>
<div class="md-overlay"></div>
<!-- http://cdn.wwery.com/tourist/4c7810718014927.png
-->
<script th:src="@{/webuploade/js/webuploader.js}"></script>
<script th:src="@{/webuploade/js/upload.js}" ></script>
<script type="text/javascript" th:src="@{js/jquery.js}"></script>
@@ -396,6 +386,7 @@
<script type="text/javascript" th:src="@{js/plugins.min.js}"></script>
<script type="text/javascript" th:src="@{js/main_constellation.js}"></script>
<script th:src="@{/js/verify.js}"></script>
<script th:src="@{/js/base64.min.js}"></script>
<script th:inline="javascript">
var isday = 0;
@@ -411,7 +402,7 @@
var filesize = [[${filesize}]];
var imgcount = [[${imgcount}]];
var suffix= [[${suffix}]];
var qq =$.base64.encode([[${updatekey}]]);
$(document).ready(function () {
$(".jb").fadeToggle();
//$("#page-header").fadeToggle("slow");
@@ -440,7 +431,6 @@
if(backtype==1){
$(".bg-container-static").css('background', 'url('+[[${config.getBackground2()}]]+') no-repeat');
$(".bg-container-static").css({'background-position':'50% 50%','height':'100%','width':'100%','overflow':'hidden','background-size':'cover'});
}
//设置页面资料
var webname = [[${config.getWebname()}]];
@@ -452,7 +442,6 @@
$("#explain").text(explain);
$("#links").html(links);
$("#whts").attr("title",'图片大小不得超过'+[[${uploadConfig.getFilesizetourists()}]]+' MB,登录本站可上传'+[[${uploadConfig.getFilesizeuser()}]]+' M图片以及查看历史图片记录等更多操作。');
$.ajax({
type: "POST",
@@ -489,7 +478,6 @@
//toastr.info("欢迎使用Hellohao图床");
});
function zhuce(mail, registerusername, registerpassword) {
if(zcverification){
//验证成功
@@ -581,10 +569,7 @@
again(2);
}
});
}else{
}
}else{ }
}
//登录
@@ -657,7 +642,7 @@
content: "input",
//buttons: true
})
.then((value) => {
.then((value) => {
var result =value;
if(result!=null && result!="" ){
urlimg(result);
@@ -709,12 +694,12 @@
if(result) {
var rx=/^https?:\/\//i;
if(rx.test(result)==true){
$('#loadingModal').modal({backdrop: 'static', keyboard: false});
$('#loadingModal').modal({backdrop: 'static', keyboard: false,upurlk:qq});
$.ajax({
type: "POST",
url: "/upurlimg",
dataType: "json",
data: {imgurl: result,setday:isday},
data: {imgurl: result,setday:isday,upurlk:qq},
success: function (data) {
for(var i=0;i<data.length;i++){
@@ -722,11 +707,10 @@
$('#loadingModal').modal('hide');
//tanchuang('上传失败','未配置存储源,请先后台配置存储源','error');
swal('上传失败', '未配置存储源,请先后台配置存储源');
}
else if(data[i]==-2){
$('#loadingModal').modal('hide');
swal('上传失败', '图片不存在或太大');
swal('上传失败', '图片太大或不存在');
}
else if(data[i]==-3){
$('#loadingModal').modal('hide');
@@ -738,8 +722,10 @@
}else if(data[i]==-5){
$('#loadingModal').modal('hide');
swal('上传失败,可用空间不足');
}
else{
}else if(data[i]==403){
$('#loadingModal').modal('hide');
swal('非法调用,请刷新页面后重试');
}else{
$('#loadingModal').modal('hide');
swal('上传成功', '该图片链接已成功上传');
$("#address").css('display', 'block');
@@ -830,7 +816,6 @@
} else {
}
});
}
//回车登录
function keyLogin(){
@@ -981,8 +966,8 @@
error : function() {}
});
}
}
function setday() {
swal("输入图片期限,到期自动销毁图片,最高365天\n(输入0为永久保存)", {
content: "input",
@@ -1008,7 +993,6 @@ function setday() {
}else{
$('#setday').text('图片期限');
}
});
}
</script>