mirror of
https://github.com/Hello-hao/Tbed.git
synced 2024-04-21 12:32:10 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb9f2a896e | ||
|
|
9ca8695cfd | ||
|
|
33d4990ded | ||
|
|
679ada60bc | ||
|
|
e2e723eb52 | ||
|
|
60db6036a5 | ||
|
|
790fded8ca | ||
|
|
fc53e4c8ac |
@@ -1,6 +0,0 @@
|
||||
*.js linguist-language=java
|
||||
|
||||
*.css linguist-language=java
|
||||
|
||||
*.html linguist-language=java
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
>:exclamation: 托管的所有开源代码可能存在作者修改/测试/调整等行为,均为实验性代码,故并不保证程序或功能的可用性,如果你想要部署程序,请下载我们提供的编译整合包进行安装部署。
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
### 引导
|
||||
|
||||
[官网](https://tbed.hellohao.cn) | [论坛](http://bbs.hellohao.cn) | [文档](https://doc.hellohao.cn) | [演示站](https://pic.hellohao.cn) | [桌面客户端](https://tbed.hellohao.cn/app) | [前端源码](https://github.com/Hello-hao/tbed-web)
|
||||
[官网](https://tbed.hellohao.cn) | [文档](https://doc.hellohao.cn) | [演示站](https://pic.hellohao.cn) | [桌面客户端](https://tbed.hellohao.cn/app) | [微信小程序](https://tbed.hellohao.cn/wechat) | [前端源码](https://github.com/Hello-hao/tbed-web)
|
||||
|
||||
|
||||
### 前言
|
||||
@@ -28,16 +28,17 @@
|
||||
[Core版](https://hellohao.cn):开源版的基础上增加`Backblaze(B2)` 并且可`同个对象存储商家`可开多个存储源(可添加至90+存储源)
|
||||
|
||||
|
||||
### 更新日志 `20230622`
|
||||
### 更新日志 `20240102`
|
||||
|
||||
- 修复首页批量复制窗点击复制报错
|
||||
- 优化画廊分享复制分享信息时网址和提示字符的分割,以防被encode
|
||||
- 修复选择筛选框表单内容后,不检索也会筛选的异常情况
|
||||
- 筛选条件添加时间倒序/顺序、文件大小倒序/顺序
|
||||
- 优化用户登录账号支持邮箱/用户名方式登录
|
||||
- 修复了移动端web页面首页退出按钮无反应问题
|
||||
- 优化默认的站点logo展示逻辑,解决进入页面瞬间显示默认logo的问题
|
||||
- 强化图像链接转存功能,支持防盗链地址转存
|
||||
- 重构:相册页面UI显示效果
|
||||
- 新增:相册页支持拖拽移动目录并支持了目录相互移动
|
||||
- 新增:删除功能新增了强制删除选项
|
||||
- 优化:大图片上传逻辑判断及展示效果
|
||||
- 调整:用户个人信息失效时间,提高用户体验
|
||||
- 调整:去除前端浏览器控制台输出Slogan
|
||||
- 优化:七牛云存储源兼容了新地区的对接
|
||||
- 优化:用户体验操作或提示
|
||||
- 优化:系统处理图片的逻辑
|
||||
|
||||
|
||||
[^_^]: 程序宣传视频:[自制宣传视频](https://www.bilibili.com/video/BV11r4y1y7mH/)
|
||||
@@ -110,6 +111,8 @@
|
||||
- /HellohaoData/:/HellohaoData/
|
||||
environment:
|
||||
MYSQL_URL: jdbc:mysql://hellohaodb/tbed?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
||||
# 数据库用户名(一般使用本镜像数据库无需修改,如果使用外部三方数据库自行修改自己的用户名)
|
||||
MYSQL_USERNAME: root
|
||||
# 自定设置一个MySQL的密码,请保证与下方 POSTGRES_PASSWORD 的变量值一致
|
||||
MYSQL_PASS: tIaNGg@SHa&hIo56
|
||||
# 前端域名(反代10089端口的域名)
|
||||
@@ -174,6 +177,7 @@
|
||||
[^_^]: 
|
||||
|
||||
### 桌面客户端(win/mac)
|
||||
> 获取地址:[官网获取](https://www.hellohao.cn/app)
|
||||
|
||||
> `开源版`/`Core版` 都可以使用
|
||||
> 
|
||||
@@ -214,6 +218,8 @@
|
||||
- Shiro
|
||||
|
||||
### 声明
|
||||
Hellohao图像托管已申请[**中国国家版权局计算机软件著作权**](https://register.ccopyright.com.cn/query.html)登记,受法律法规保护。
|
||||
> 登记号:2023SR1210640
|
||||
|
||||
本项目遵循[GNU Affero General Public License v3.0](https://choosealicense.com/licenses/agpl-3.0/#)开源协议,使用前请悉知。
|
||||
如果你想商用或程序定制,请先与我们联系,分享你的利益。
|
||||
|
||||
@@ -196,7 +196,7 @@
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>7.2.22</version>
|
||||
<version>7.14.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qcloud</groupId>
|
||||
|
||||
@@ -10,10 +10,12 @@ import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* @author Hellohao
|
||||
@@ -139,11 +141,16 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter {
|
||||
info = "用户未找到";
|
||||
}
|
||||
System.err.println("拦截器False-"+info);
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
final JSONObject jsonObject = new JSONObject();
|
||||
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
|
||||
httpServletResponse.setStatus(HttpServletResponse.SC_OK);
|
||||
httpServletResponse.setCharacterEncoding("UTF-8");
|
||||
httpServletResponse.setContentType("application/json");
|
||||
PrintWriter writer = httpServletResponse.getWriter();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("code",this.CODE);
|
||||
jsonObject.put("info",info);
|
||||
response.getWriter().write(jsonObject.toJSONString());
|
||||
writer.write(jsonObject.toJSONString());
|
||||
writer.flush();
|
||||
} catch (Exception e) {
|
||||
System.out.println("返回token验证失败403请求,报异常了");
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ public class ShiroConfig {
|
||||
filterMap.put("/verifyCode","anon");
|
||||
filterMap.put("/verifyCodeForRegister","anon");
|
||||
filterMap.put("/verifyCodeForRetrieve","anon");
|
||||
filterMap.put("/verifyCodeFortowSendEmail","anon");
|
||||
filterMap.put("/api/**","anon");
|
||||
filterMap.put("/user/**","anon");
|
||||
filterMap.put("/ota/**","anon");
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.auth0.jwt.algorithms.Algorithm;
|
||||
import com.auth0.jwt.exceptions.TokenExpiredException;
|
||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -24,7 +23,7 @@ public class JWTUtil {
|
||||
|
||||
public static String createToken(User user){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.SECOND,604800 );//单位秒,604800 为7天
|
||||
calendar.add(Calendar.SECOND,2592000 );//单位秒
|
||||
Algorithm algorithm = Algorithm.HMAC256(SECRET);
|
||||
String token = JWT.create()
|
||||
.withClaim("email", user.getEmail())
|
||||
|
||||
@@ -467,6 +467,7 @@ public class AdminController {
|
||||
JSONObject jsonObj = JSONObject.parseObject(data);
|
||||
String images = jsonObj.getString("images");
|
||||
String uuid = jsonObj.getString("uuid");
|
||||
Boolean forceDel = jsonObj.getBoolean("forceDel")==null?false:jsonObj.getBoolean("forceDel");
|
||||
if (images == null) {
|
||||
msg.setCode("404");
|
||||
msg.setInfo("为获取到图像信息");
|
||||
@@ -499,7 +500,7 @@ public class AdminController {
|
||||
if (imgIds.size() == 0) {
|
||||
msg.setCode("110404");
|
||||
} else {
|
||||
deleimages.dele(uuid, imgIds.stream().toArray(Long[]::new));
|
||||
deleimages.dele(forceDel,uuid, imgIds.stream().toArray(Long[]::new));
|
||||
msg.setCode("200");
|
||||
}
|
||||
return msg;
|
||||
|
||||
@@ -44,10 +44,11 @@ public class IndexController {
|
||||
@Autowired private IRedisService iRedisService;
|
||||
@Autowired private AppClientService appClientService;
|
||||
|
||||
public static String version = "20240102";
|
||||
@RequestMapping(value = "/")
|
||||
public String Welcome(Model model, HttpServletRequest httpServletRequest) {
|
||||
model.addAttribute("name", "服务端程序(开源版)");
|
||||
model.addAttribute("version", "20230622");
|
||||
model.addAttribute("version", version);
|
||||
model.addAttribute("ip", GetIPS.getIpAddr(httpServletRequest));
|
||||
model.addAttribute("links", "https://github.com/Hello-hao/tbed");
|
||||
return "welcome";
|
||||
@@ -64,6 +65,8 @@ public class IndexController {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
AppClient appClient = appClientService.getAppClientData("app");
|
||||
jsonObject.put("webname", cd.getString("webname"));
|
||||
jsonObject.put("systype","free");
|
||||
jsonObject.put("version",version);
|
||||
jsonObject.put("websubtitle", cd.getString("websubtitle"));
|
||||
jsonObject.put("keywords", cd.getString("keywords"));
|
||||
jsonObject.put("webms", cd.getString("webms"));
|
||||
@@ -79,10 +82,11 @@ public class IndexController {
|
||||
jsonObject.put("clientname", appClient.getAppname());
|
||||
jsonObject.put("clientlogo", appClient.getApplogo());
|
||||
jsonObject.put("appupdate", appClient.getAppupdate());
|
||||
jsonObject.put("serverVersion",version);
|
||||
msg.setData(jsonObject);
|
||||
return msg;
|
||||
}
|
||||
@PostMapping("/uploadChunkFile")
|
||||
@PostMapping(value = {"/uploadChunkFile","/client/uploadChunkFile"})
|
||||
@ResponseBody
|
||||
@CrossOrigin
|
||||
public Msg uploadChunk(HttpServletRequest request,Chunk chunk) {
|
||||
@@ -105,7 +109,7 @@ public class IndexController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/processFile")
|
||||
@PostMapping(value = {"/processFile","/client/processFile"})
|
||||
@ResponseBody
|
||||
@CrossOrigin
|
||||
public Msg processFile(HttpServletRequest request,@RequestParam(value = "data", defaultValue = "") String data){
|
||||
@@ -320,6 +324,29 @@ public class IndexController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = {"/verifyCodeFortowSendEmail","/wechat/verifyCodeFortowSendEmail"})
|
||||
@ResponseBody
|
||||
public Msg verifyCodeFortowSendEmail() {
|
||||
Msg msg = new Msg();
|
||||
try {
|
||||
ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(90, 35, 2, 2);
|
||||
// 自定义验证码内容为四则运算方式
|
||||
captcha.setGenerator(new MathGenerator(1));
|
||||
String code = getVerifyCodeOperator(captcha.getCode());
|
||||
String uid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
|
||||
iRedisService.setValue("verifyCodeFortowSendEmail_"+uid,code);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("codeKey",uid);
|
||||
jsonObject.put("codeImg",captcha.getImageBase64());
|
||||
msg.setData(jsonObject);
|
||||
return msg;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
msg.setCode("500");
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getVerifyCodeOperator(String str) {
|
||||
int a = Integer.valueOf(str.substring(0, 1));
|
||||
String yxf = str.substring(1, 2);
|
||||
@@ -357,7 +384,7 @@ public class IndexController {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
msg = deleimages.dele(null, image.getId());
|
||||
msg = deleimages.dele(false,null, image.getId());
|
||||
List<Long> Delids = (List<Long>) msg.getData();
|
||||
if (!Delids.contains(image.getId())) {
|
||||
msg.setCode("500");
|
||||
|
||||
@@ -16,6 +16,8 @@ import org.apache.shiro.authc.IncorrectCredentialsException;
|
||||
import org.apache.shiro.authc.UnknownAccountException;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
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.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -44,6 +46,7 @@ public class UserController {
|
||||
private SysConfigService sysConfigService;
|
||||
@Autowired
|
||||
IRedisService iRedisService;
|
||||
private Logger logger = LoggerFactory.getLogger(UserController.class);
|
||||
|
||||
@PostMapping("/register")
|
||||
@ResponseBody
|
||||
@@ -143,6 +146,57 @@ public class UserController {
|
||||
return msg;
|
||||
}
|
||||
|
||||
@PostMapping(value = {"/validateEmail","/wechat/validateEmail"})
|
||||
@ResponseBody
|
||||
public Msg validateEmail(HttpServletRequest httpServletRequest,@RequestParam(value = "data", defaultValue = "") String data) {
|
||||
Msg msg = new Msg();
|
||||
try {
|
||||
JSONObject jsonObj = JSONObject.parseObject(data);
|
||||
String email = jsonObj.getString("email");
|
||||
String towSendEmailCode = jsonObj.getString("towSendEmailCode");
|
||||
Object verifyCodeFortowSendEmail =iRedisService.getValue("verifyCodeFortowSendEmail_"+httpServletRequest.getHeader("verifyCodeFortowSendEmail"));
|
||||
User u = new User();
|
||||
u.setEmail(email);
|
||||
User user = userService.getUsers(u);
|
||||
if(user.getIsok()!=0){
|
||||
msg.setInfo("不知细叶谁裁出,二月春风似剪刀");
|
||||
return msg;
|
||||
}
|
||||
if(null==verifyCodeFortowSendEmail){
|
||||
msg.setCode("4035");
|
||||
msg.setInfo("验证码已失效,请重新弄获取。");
|
||||
return msg;
|
||||
}else if(null==towSendEmailCode){
|
||||
msg.setCode("4036");
|
||||
msg.setInfo("验证码不能为空。");
|
||||
return msg;
|
||||
}
|
||||
if((verifyCodeFortowSendEmail.toString().toLowerCase()).compareTo((towSendEmailCode.toLowerCase()))==0){
|
||||
//注册完发激活链接
|
||||
final Confdata dataJson = confdataService.selectConfdata("config");
|
||||
JSONObject confdata = JSONObject.parseObject(dataJson.getJsondata());
|
||||
EmailConfig emailConfig = emailConfigService.getemail();
|
||||
Thread thread = new Thread() {
|
||||
public void run() {
|
||||
Integer a = NewSendEmail.sendEmail(emailConfig,user.getUsername(), user.getUid(), user.getEmail(),confdata);
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
msg.setInfo("邮件已发送,请注意查收邮箱尽快激活账户(如果没收到,请检查垃圾邮件)");
|
||||
}else{
|
||||
msg.setCode("110408");
|
||||
msg.setInfo("验证码不正确");
|
||||
return msg;
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
logger.error("报错位置:/validateEmail",e);
|
||||
msg.setCode("500");
|
||||
msg.setInfo("邮件发送失败");
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
@PostMapping("/login")//new
|
||||
@ResponseBody
|
||||
public Msg login(HttpServletRequest httpServletRequest,@RequestParam(value = "data", defaultValue = "") String data) {
|
||||
@@ -184,7 +238,8 @@ public class UserController {
|
||||
User user = (User) SecurityUtils.getSubject().getPrincipal();
|
||||
if(user.getIsok()==0){
|
||||
msg.setInfo("你的账号暂未激活");
|
||||
msg.setCode("110403");
|
||||
msg.setData(user.getEmail());
|
||||
msg.setCode("110402");
|
||||
return msg;
|
||||
}
|
||||
if(user.getIsok()<0){
|
||||
|
||||
@@ -4,8 +4,6 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Images {
|
||||
// 默认的时间字符串格式
|
||||
|
||||
//id, imgname, imgurl, userid
|
||||
private Long id;
|
||||
private String imgname;
|
||||
@@ -42,326 +40,6 @@ public class Images {
|
||||
private Integer isRepeat;//如果没有开启查重的时候他是0,开启为1
|
||||
private String searchname;
|
||||
private String order;
|
||||
//
|
||||
// public Images() {
|
||||
// super();
|
||||
// }
|
||||
//
|
||||
// public Images(String imgurl, String sizes, String abnormal, String updatetime, String username, String md5key, String imguid) {
|
||||
// this.imgurl = imgurl;
|
||||
// this.sizes = sizes;
|
||||
// this.abnormal = abnormal;
|
||||
// this.updatetime = updatetime;
|
||||
// this.username = username;
|
||||
// this.md5key = md5key;
|
||||
// this.imguid = imguid;
|
||||
// }
|
||||
//
|
||||
// public Images(Long id, String imgname, String imgurl, Integer userid, String sizes, String abnormal, Integer source,
|
||||
// Integer imgtype, String updatetime, String username, Integer storageType, String starttime, String stoptime,
|
||||
// String explains, String md5key, String notes, String useridlist, String imguid, String albumtitle,
|
||||
// String password, Integer selecttype,Long countNum,Integer monthNum,String yyyy,
|
||||
// String format,String about,Integer great,String[] classifuidlist,String classificationuid,String violation,
|
||||
// String idname,Integer isRepeat,String searchname) {
|
||||
// this.id = id;
|
||||
// this.imgname = imgname;
|
||||
// this.imgurl = imgurl;
|
||||
// this.userid = userid;
|
||||
// this.sizes = sizes;
|
||||
// this.abnormal = abnormal;
|
||||
// this.source = source;
|
||||
// this.imgtype = imgtype;
|
||||
// this.updatetime = updatetime;
|
||||
// this.username = username;
|
||||
// this.storageType = storageType;
|
||||
// this.starttime = starttime;
|
||||
// this.stoptime = stoptime;
|
||||
// this.explains = explains;
|
||||
// this.md5key = md5key;
|
||||
// this.notes = notes;
|
||||
// this.useridlist = useridlist;
|
||||
// this.imguid = imguid;
|
||||
// this.albumtitle = albumtitle;
|
||||
// this.password = password;
|
||||
// this.selecttype = selecttype;
|
||||
// this.countNum = countNum;
|
||||
// this.monthNum = monthNum;
|
||||
// this.yyyy = yyyy;
|
||||
// this.format = format;
|
||||
// this.about = about;
|
||||
// this.great = great;
|
||||
// this.classifuidlist = classifuidlist;
|
||||
// this.classificationuid = classificationuid;
|
||||
// this.violation = violation;
|
||||
// this.idname = idname;
|
||||
// this.isRepeat = isRepeat;
|
||||
// this.searchname = searchname;
|
||||
// }
|
||||
//
|
||||
// public Long getId() {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// public void setId(Long id) {
|
||||
// this.id = id;
|
||||
// }
|
||||
//
|
||||
// public String getImgname() {
|
||||
// return imgname;
|
||||
// }
|
||||
//
|
||||
// public void setImgname(String imgname) {
|
||||
// this.imgname = imgname;
|
||||
// }
|
||||
//
|
||||
// public String getImgurl() {
|
||||
// return imgurl;
|
||||
// }
|
||||
//
|
||||
// public void setImgurl(String imgurl) {
|
||||
// this.imgurl = imgurl;
|
||||
// }
|
||||
//
|
||||
// public Integer getUserid() {
|
||||
// return userid;
|
||||
// }
|
||||
//
|
||||
// public void setUserid(Integer userid) {
|
||||
// this.userid = userid;
|
||||
// }
|
||||
//
|
||||
// public String getSizes() {
|
||||
// return sizes;
|
||||
// }
|
||||
//
|
||||
// public void setSizes(String sizes) {
|
||||
// this.sizes = sizes;
|
||||
// }
|
||||
//
|
||||
// public String getAbnormal() {
|
||||
// return abnormal;
|
||||
// }
|
||||
//
|
||||
// public void setAbnormal(String abnormal) {
|
||||
// this.abnormal = abnormal;
|
||||
// }
|
||||
//
|
||||
// public Integer getSource() {
|
||||
// return source;
|
||||
// }
|
||||
//
|
||||
// public void setSource(Integer source) {
|
||||
// this.source = source;
|
||||
// }
|
||||
//
|
||||
// public Integer getImgtype() {
|
||||
// return imgtype;
|
||||
// }
|
||||
//
|
||||
// public void setImgtype(Integer imgtype) {
|
||||
// this.imgtype = imgtype;
|
||||
// }
|
||||
//
|
||||
// public String getUpdatetime() {
|
||||
// return updatetime;
|
||||
// }
|
||||
//
|
||||
// public void setUpdatetime(String updatetime) {
|
||||
// this.updatetime = updatetime;
|
||||
// }
|
||||
//
|
||||
// public String getUsername() {
|
||||
// return username;
|
||||
// }
|
||||
//
|
||||
// public void setUsername(String username) {
|
||||
// this.username = username;
|
||||
// }
|
||||
//
|
||||
// public Integer getStorageType() {
|
||||
// return storageType;
|
||||
// }
|
||||
//
|
||||
// public void setStorageType(Integer storageType) {
|
||||
// this.storageType = storageType;
|
||||
// }
|
||||
//
|
||||
// public String getStarttime() {
|
||||
// return starttime;
|
||||
// }
|
||||
//
|
||||
// public void setStarttime(String starttime) {
|
||||
// this.starttime = starttime;
|
||||
// }
|
||||
//
|
||||
// public String getStoptime() {
|
||||
// return stoptime;
|
||||
// }
|
||||
//
|
||||
// public void setStoptime(String stoptime) {
|
||||
// this.stoptime = stoptime;
|
||||
// }
|
||||
//
|
||||
// public String getExplains() {
|
||||
// return explains;
|
||||
// }
|
||||
//
|
||||
// public void setExplains(String explains) {
|
||||
// this.explains = explains;
|
||||
// }
|
||||
//
|
||||
// public String getMd5key() {
|
||||
// return md5key;
|
||||
// }
|
||||
//
|
||||
// public void setMd5key(String md5key) {
|
||||
// this.md5key = md5key;
|
||||
// }
|
||||
//
|
||||
// public String getNotes() {
|
||||
// return notes;
|
||||
// }
|
||||
//
|
||||
// public void setNotes(String notes) {
|
||||
// this.notes = notes;
|
||||
// }
|
||||
//
|
||||
// public String getUseridlist() {
|
||||
// return useridlist;
|
||||
// }
|
||||
//
|
||||
// public void setUseridlist(String useridlist) {
|
||||
// this.useridlist = useridlist;
|
||||
// }
|
||||
//
|
||||
// public String getImguid() {
|
||||
// return imguid;
|
||||
// }
|
||||
//
|
||||
// public void setImguid(String imguid) {
|
||||
// this.imguid = imguid;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public String getAlbumtitle() {
|
||||
// return albumtitle;
|
||||
// }
|
||||
//
|
||||
// public void setAlbumtitle(String albumtitle) {
|
||||
// this.albumtitle = albumtitle;
|
||||
// }
|
||||
//
|
||||
// public String getPassword() {
|
||||
// return password;
|
||||
// }
|
||||
//
|
||||
// public void setPassword(String password) {
|
||||
// this.password = password;
|
||||
// }
|
||||
//
|
||||
// public Integer getSelecttype() {
|
||||
// return selecttype;
|
||||
// }
|
||||
//
|
||||
// public void setSelecttype(Integer selecttype) {
|
||||
// this.selecttype = selecttype;
|
||||
// }
|
||||
//
|
||||
// public Long getCountNum() {
|
||||
// return countNum;
|
||||
// }
|
||||
//
|
||||
// public void setCountNum(Long countNum) {
|
||||
// this.countNum = countNum;
|
||||
// }
|
||||
//
|
||||
// public Integer getMonthNum() {
|
||||
// return monthNum;
|
||||
// }
|
||||
//
|
||||
// public void setMonthNum(Integer monthNum) {
|
||||
// this.monthNum = monthNum;
|
||||
// }
|
||||
//
|
||||
// public String getYyyy() {
|
||||
// return yyyy;
|
||||
// }
|
||||
//
|
||||
// public void setYyyy(String yyyy) {
|
||||
// this.yyyy = yyyy;
|
||||
// }
|
||||
//
|
||||
// public String getFormat() {
|
||||
// return format;
|
||||
// }
|
||||
//
|
||||
// public void setFormat(String format) {
|
||||
// this.format = format;
|
||||
// }
|
||||
//
|
||||
// public String getAbout() {
|
||||
// return about;
|
||||
// }
|
||||
//
|
||||
// public void setAbout(String about) {
|
||||
// this.about = about;
|
||||
// }
|
||||
//
|
||||
// public Integer getGreat() {
|
||||
// return great;
|
||||
// }
|
||||
//
|
||||
// public void setGreat(Integer great) {
|
||||
// this.great = great;
|
||||
// }
|
||||
//
|
||||
// public String[] getClassifuidlist() {
|
||||
// return classifuidlist;
|
||||
// }
|
||||
//
|
||||
// public void setClassifuidlist(String[] classifuidlist ) {
|
||||
// this.classifuidlist = classifuidlist;
|
||||
// }
|
||||
//
|
||||
// public String getClassificationuid() {
|
||||
// return classificationuid;
|
||||
// }
|
||||
//
|
||||
// public void setClassificationuid(String classificationuid) {
|
||||
// this.classificationuid = classificationuid;
|
||||
// }
|
||||
//
|
||||
// public String getViolation() {
|
||||
// return violation;
|
||||
// }
|
||||
//
|
||||
// public void setViolation(String violation) {
|
||||
// this.violation = violation;
|
||||
// }
|
||||
//
|
||||
// public String getIdname() {
|
||||
// return idname;
|
||||
// }
|
||||
//
|
||||
// public void setIdname(String idname) {
|
||||
// this.idname = idname;
|
||||
// }
|
||||
//
|
||||
// public Integer getIsRepeat() {
|
||||
// return isRepeat;
|
||||
// }
|
||||
//
|
||||
// public void setIsRepeat(Integer isRepeat) {
|
||||
// this.isRepeat = isRepeat;
|
||||
// }
|
||||
//
|
||||
// public String getSearchname() {
|
||||
// return searchname;
|
||||
// }
|
||||
//
|
||||
// public void setSearchname(String searchname) {
|
||||
// this.searchname = searchname;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ import cn.hellohao.pojo.Keys;
|
||||
import cn.hellohao.pojo.ReturnImage;
|
||||
import com.google.gson.Gson;
|
||||
import com.qiniu.common.QiniuException;
|
||||
import com.qiniu.common.Zone;
|
||||
import com.qiniu.http.Response;
|
||||
import com.qiniu.storage.BucketManager;
|
||||
import com.qiniu.storage.Configuration;
|
||||
import com.qiniu.storage.Region;
|
||||
import com.qiniu.storage.UploadManager;
|
||||
import com.qiniu.storage.model.DefaultPutRet;
|
||||
import com.qiniu.storage.model.FileInfo;
|
||||
@@ -28,18 +28,7 @@ public class KODOImageupload {
|
||||
public ReturnImage ImageuploadKODO(
|
||||
Map<Map<String, String>, File> fileMap, String username, Integer keyID) {
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
Configuration cfg;
|
||||
if (key.getEndpoint().equals("1")) {
|
||||
cfg = new Configuration(Zone.zone0());
|
||||
} else if (key.getEndpoint().equals("2")) {
|
||||
cfg = new Configuration(Zone.zone1());
|
||||
} else if (key.getEndpoint().equals("3")) {
|
||||
cfg = new Configuration(Zone.zone2());
|
||||
} else if (key.getEndpoint().equals("4")) {
|
||||
cfg = new Configuration(Zone.zoneNa0());
|
||||
} else {
|
||||
cfg = new Configuration(Zone.zoneAs0());
|
||||
}
|
||||
Configuration cfg = new Configuration(Region.autoRegion());
|
||||
UploadManager uploadManager = new UploadManager(cfg);
|
||||
Auth auth = Auth.create(key.getAccessKey(), key.getAccessSecret());
|
||||
String upToken = auth.uploadToken(key.getBucketname(), null, 7200, null);
|
||||
@@ -76,41 +65,25 @@ public class KODOImageupload {
|
||||
|
||||
public static Integer Initialize(Keys k) {
|
||||
int ret = -1;
|
||||
if (org.apache.commons.lang3.StringUtils.isBlank(k.getAccessKey())
|
||||
|| org.apache.commons.lang3.StringUtils.isBlank(k.getAccessSecret())
|
||||
|| org.apache.commons.lang3.StringUtils.isBlank(k.getEndpoint())
|
||||
|| org.apache.commons.lang3.StringUtils.isBlank(k.getBucketname())
|
||||
if (StringUtils.isBlank(k.getAccessKey())
|
||||
|| StringUtils.isBlank(k.getAccessSecret())
|
||||
|| StringUtils.isBlank(k.getEndpoint())
|
||||
|| StringUtils.isBlank(k.getBucketname())
|
||||
|| StringUtils.isBlank(k.getRequestAddress())) {
|
||||
return -1;
|
||||
}
|
||||
Configuration cfg;
|
||||
if (k.getEndpoint().equals("1")) {
|
||||
cfg = new Configuration(Zone.zone0());
|
||||
} else if (k.getEndpoint().equals("2")) {
|
||||
cfg = new Configuration(Zone.zone1());
|
||||
} else if (k.getEndpoint().equals("3")) {
|
||||
cfg = new Configuration(Zone.zone2());
|
||||
} else if (k.getEndpoint().equals("4")) {
|
||||
cfg = new Configuration(Zone.zoneNa0());
|
||||
} else {
|
||||
cfg = new Configuration(Zone.zoneAs0());
|
||||
}
|
||||
Configuration cfg = new Configuration(Region.autoRegion());
|
||||
UploadManager uploadManager = new UploadManager(cfg);
|
||||
Auth auth = Auth.create(k.getAccessKey(), k.getAccessSecret());
|
||||
String upToken =
|
||||
auth.uploadToken(
|
||||
k.getBucketname(),
|
||||
null,
|
||||
7200,
|
||||
null); // auth.uploadToken(k.getBucketname());
|
||||
BucketManager bmObj = new BucketManager(auth, cfg);
|
||||
String upToken = auth.uploadToken(k.getBucketname(), null, 7200, null);
|
||||
BucketManager BM = new BucketManager(auth, cfg);
|
||||
BucketManager.FileListIterator fileListIterator = null;
|
||||
try {
|
||||
fileListIterator = bmObj.createFileListIterator(k.getBucketname(), "", 1, "/");
|
||||
fileListIterator = BM.createFileListIterator(k.getBucketname(), "", 1, "/");
|
||||
FileInfo[] items = fileListIterator.next();
|
||||
if (items != null) {
|
||||
ret = 1;
|
||||
bucketManager = bmObj;
|
||||
bucketManager = BM;
|
||||
key = k;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class deleImages {
|
||||
@Autowired private KeysServiceImpl keysService;
|
||||
@Autowired private IRedisService iRedisService;
|
||||
|
||||
public Msg dele(String uuid, Long... imgIds) {
|
||||
public Msg dele(boolean forceDel,String uuid, Long... imgIds) {
|
||||
Msg msg = new Msg();
|
||||
MyProgress myProgress = new MyProgress();
|
||||
myProgress.InitializeDelImg();
|
||||
@@ -44,6 +44,20 @@ public class deleImages {
|
||||
boolean isDele = false;
|
||||
try {
|
||||
Images image = imgService.selectByPrimaryKey(imgIds[i]);
|
||||
if (forceDel) {
|
||||
try {
|
||||
imgAndAlbumService.deleteImgAndAlbum(image.getImgurl());
|
||||
imgTempService.delImgAndExp(image.getImguid());
|
||||
imgService.deleimg(image.getId());
|
||||
ids.add(image.getId());
|
||||
successCount++;
|
||||
System.out.println("删除成功加一个" + image.getId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.err.println(image.getImgname() + ":图片数据库记录时发生错误");
|
||||
errorIds.add(image.getImgurl());
|
||||
}
|
||||
}
|
||||
Keys key = keysService.selectKeys(image.getSource());
|
||||
if (key.getStorageType() == 1) {
|
||||
isDele = nosImageupload.delNOS(key.getId(), image);
|
||||
@@ -64,20 +78,21 @@ public class deleImages {
|
||||
} else {
|
||||
System.err.println("未获取到对象存储参数,删除失败。");
|
||||
}
|
||||
// if (isDele) {
|
||||
try {
|
||||
imgAndAlbumService.deleteImgAndAlbum(image.getImgurl());
|
||||
imgTempService.delImgAndExp(image.getImguid());
|
||||
imgService.deleimg(image.getId());
|
||||
ids.add(image.getId());
|
||||
successCount++;
|
||||
System.out.println("删除成功加一个" + image.getId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.err.println(image.getImgname() + ":图片数据库记录时发生错误");
|
||||
errorIds.add(image.getImgurl());
|
||||
if (!forceDel) {
|
||||
try {
|
||||
imgAndAlbumService.deleteImgAndAlbum(image.getImgurl());
|
||||
imgTempService.delImgAndExp(image.getImguid());
|
||||
imgService.deleimg(image.getId());
|
||||
ids.add(image.getId());
|
||||
successCount++;
|
||||
System.out.println("删除成功加一个" + image.getId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.err.println(image.getImgname() + ":图片数据库记录时发生错误");
|
||||
errorIds.add(image.getImgurl());
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
if(uuid!=null){
|
||||
myProgress.setDelSuccessCount(successCount);
|
||||
myProgress.setDelSuccessImgList(ids);
|
||||
|
||||
@@ -4,11 +4,11 @@ server.port=10088
|
||||
#前端域名需要带协议头http(s)://
|
||||
CROS_ALLOWED_ORIGINS=${HELLOHAO_WEB_HOST:http://127.0.0.1:8080}
|
||||
#数据库账号
|
||||
spring.datasource.username=root
|
||||
spring.datasource.username=${MYSQL_NAME:root}
|
||||
#数据库密码test
|
||||
spring.datasource.password=${MYSQL_PASS:root}
|
||||
#数据库链接地址
|
||||
spring.datasource.url=${MYSQL_URL:jdbc:mysql://127.0.0.1:3306/tbed?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8}
|
||||
spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost:3306/tbed?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8}
|
||||
#MySQL Driver 无需修改
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
|
||||
@@ -51,7 +51,7 @@ spring.datasource.druid.web-stat-filter.exclusions=false
|
||||
#log4j.logger.cn.hellohao.dao=DEBUG
|
||||
log4j2.formatMsgNoLookups=True
|
||||
logging.level.cn.hellohao=DEBUG
|
||||
logging.file.name=/HellohaoData/tbedlog/tbed_core.log
|
||||
logging.file.name=/HellohaoData/tbedlog/tbed.log
|
||||
logging.pattern.console=%blue(%d{yyyy-MM-dd HH:mm:ss,SSS}) [%cyan(%t)] [%yellow(%c)]-[%highlight(%p)] %msg%n
|
||||
logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
|
||||
logging.logback.rollingpolicy.clean-history-on-start=true
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
FROM
|
||||
`album`
|
||||
<where>
|
||||
1=1
|
||||
<if test="albumkey != null">
|
||||
`albumkey` = #{albumkey}
|
||||
and `albumkey` = #{albumkey}
|
||||
</if>
|
||||
<if test="userid != null">
|
||||
`userid` = #{userid}
|
||||
and `userid` = #{userid}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
@@ -38,14 +39,15 @@
|
||||
u.username
|
||||
FROM `album` a LEFT JOIN user u on a.userid = u.id
|
||||
<where>
|
||||
1=1
|
||||
<if test="albumkey != null">
|
||||
`albumkey` like '%${albumkey}%'
|
||||
and `albumkey` like '%${albumkey}%'
|
||||
</if>
|
||||
<if test="username != null">
|
||||
`username` like '%${username}%'
|
||||
and `username` like '%${username}%'
|
||||
</if>
|
||||
<if test="userid != null">
|
||||
a.userid = #{userid}
|
||||
and a.userid = #{userid}
|
||||
</if>
|
||||
</where>
|
||||
order by a.createdate
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
FROM
|
||||
`imgandalbum`
|
||||
<where>
|
||||
1=1
|
||||
<if test="albumkey != null">
|
||||
`albumkey` = #{albumkey}
|
||||
</if>
|
||||
@@ -21,6 +22,7 @@
|
||||
FROM
|
||||
`imgandalbum`
|
||||
<where>
|
||||
1=1
|
||||
<if test="imgname != null">
|
||||
`imgname` = #{imgname}
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user