mirror of
https://github.com/Hello-hao/Tbed.git
synced 2024-04-21 12:32:10 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f02d865389 | ||
|
|
48b0e1c5ca | ||
|
|
a04bbc1ea6 | ||
|
|
31b4426c10 | ||
|
|
766c125673 | ||
|
|
0de7e0e0fc | ||
|
|
f24a2d5557 | ||
|
|
87394258ad | ||
|
|
89a66a17b3 | ||
|
|
3e4c90c8d9 | ||
|
|
fb9f2a896e | ||
|
|
9ca8695cfd | ||
|
|
33d4990ded | ||
|
|
679ada60bc | ||
|
|
e2e723eb52 | ||
|
|
60db6036a5 | ||
|
|
790fded8ca |
@@ -1,6 +0,0 @@
|
||||
*.js linguist-language=java
|
||||
|
||||
*.css linguist-language=java
|
||||
|
||||
*.html linguist-language=java
|
||||
|
||||
@@ -1,18 +1,29 @@
|
||||
# Hellohao图像托管程序 - 也许这会是最优秀的图床程序
|
||||
|
||||

|
||||
# Hellohao图像托管 - 也许这会是最优秀的图像托管程序
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.hellohao.cn/" target="_blank">
|
||||
<img width="1920px" src="https://upload.cc/i1/2022/02/11/HSg5tX.png">
|
||||
</a>
|
||||
</p>
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
<h3 align="center">赞助商</h3>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.eltyun.com/" target="_blank">
|
||||
<img width="350px" src="https://t.tdo.ink/hellohao/s9ugmihq.png">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
>:exclamation: 托管的所有开源代码可能存在作者修改/测试/调整等行为,均为实验性代码,故并不保证程序或功能的可用性,如果你想要部署程序,请下载我们提供的编译整合包进行安装部署。
|
||||
|
||||
|
||||
### 引导
|
||||
|
||||
[官网](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)
|
||||
|
||||
|
||||
### 前言
|
||||
@@ -27,19 +38,12 @@
|
||||
|
||||
[Core版](https://hellohao.cn):开源版的基础上增加`Backblaze(B2)` 并且可`同个对象存储商家`可开多个存储源(可添加至90+存储源)
|
||||
|
||||
|
||||
### 更新日志 `20230918`
|
||||
|
||||
- 修复首页批量复制窗点击复制报错
|
||||
- 调整菜单个人相册名字为相册空间
|
||||
- 调整首页UI宽度
|
||||
- 优化代码未激活账号登录时提示重新激活
|
||||
- docker-compose方式部署添加数据库用户名配置项
|
||||
- 修改拦截器写入响应数据时逻辑
|
||||
- 优化图像链接转存功能
|
||||
### 更新日志 `20240111`
|
||||
|
||||
|
||||
[^_^]: 程序宣传视频:[自制宣传视频](https://www.bilibili.com/video/BV11r4y1y7mH/)
|
||||
- 修复本地存储源上传失败的情况
|
||||
- 修复某些存储源目录创建不正确的问题
|
||||
- 优化页面部分提示
|
||||
|
||||
|
||||
### 主要功能
|
||||
@@ -109,6 +113,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端口的域名)
|
||||
@@ -166,12 +172,6 @@
|
||||
|
||||

|
||||
|
||||
[^_^]: 
|
||||
[^_^]: 
|
||||
[^_^]: 
|
||||
[^_^]: 
|
||||
[^_^]: 
|
||||
|
||||
### 桌面客户端(win/mac)
|
||||
> 获取地址:[官网获取](https://www.hellohao.cn/app)
|
||||
|
||||
@@ -214,6 +214,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/#)开源协议,使用前请悉知。
|
||||
如果你想商用或程序定制,请先与我们联系,分享你的利益。
|
||||
|
||||
@@ -130,7 +130,17 @@
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
<version>2.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- webdav-->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.lookfirst</groupId>
|
||||
<artifactId>sardine</artifactId>
|
||||
<version>5.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baidu.aip</groupId>
|
||||
<artifactId>java-sdk</artifactId>
|
||||
@@ -196,7 +206,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>
|
||||
|
||||
@@ -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 = "20240111";
|
||||
@RequestMapping(value = "/")
|
||||
public String Welcome(Model model, HttpServletRequest httpServletRequest) {
|
||||
model.addAttribute("name", "服务端程序(开源版)");
|
||||
model.addAttribute("version", "20230918");
|
||||
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){
|
||||
@@ -380,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");
|
||||
|
||||
@@ -22,6 +22,10 @@ public interface ImgMapper {
|
||||
|
||||
Images selectByPrimaryKey(@Param("id") Long id);
|
||||
|
||||
Images selectImgByBrieflink(@Param("brieflink") String brieflink);
|
||||
|
||||
Images selectImgByShortlink(@Param("shortlink") String shortlink);
|
||||
|
||||
Integer counts(@Param("userid") Integer userid);
|
||||
|
||||
Integer setImg(Images images);
|
||||
|
||||
@@ -39,6 +39,8 @@ public class Images {
|
||||
private String idname;
|
||||
private Integer isRepeat;//如果没有开启查重的时候他是0,开启为1
|
||||
private String searchname;
|
||||
private String brieflink;
|
||||
private String shortlink;
|
||||
private String order;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,5 +14,6 @@ public class Keys {
|
||||
private Integer storageType;
|
||||
private String keyname;
|
||||
private String RootPath;//存入的目录
|
||||
private Boolean SysTransmit;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package cn.hellohao.service;
|
||||
|
||||
import cn.hellohao.pojo.Images;
|
||||
import cn.hellohao.pojo.User;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -21,6 +22,10 @@ public interface ImgService {
|
||||
|
||||
Images selectByPrimaryKey(Long id);
|
||||
|
||||
Images selectImgByBrieflink(String brieflink);
|
||||
|
||||
Images selectImgByShortlink(String shortlink);
|
||||
|
||||
Integer counts(Integer userid);
|
||||
|
||||
Integer setImg(Images images);
|
||||
|
||||
@@ -132,9 +132,10 @@ public class ClientService {
|
||||
Images imgObj = new Images();
|
||||
String imgnameEd = null;
|
||||
Map<Map<String, String>, File> map = new HashMap<>();
|
||||
String shortUuid_y = SetText.getShortUuid();
|
||||
String shortUuid_s = SetText.getShortUuid();
|
||||
if (file.exists()) {
|
||||
Map<String, String> m1 = new HashMap<>();
|
||||
String shortUuid_y = SetText.getShortUuid();
|
||||
m1.put("prefix", prefix);
|
||||
m1.put("name", shortUuid_y);
|
||||
map.put(m1, file);
|
||||
@@ -167,6 +168,8 @@ public class ClientService {
|
||||
imgObj.setMd5key(md5key);
|
||||
imgObj.setImguid(imguid);
|
||||
imgObj.setFormat(fileMiME.getData().toString());
|
||||
imgObj.setShortlink(shortUuid_y);
|
||||
imgObj.setBrieflink(shortUuid_s);
|
||||
imgObj.setIdname(imageFileName);
|
||||
Msg insertRet = imgServiceImpl.insertImgDataForCheck(imgObj,u,confdata,file.getName());
|
||||
if (insertRet.getCode().equals("000")) {
|
||||
|
||||
@@ -46,6 +46,16 @@ public class ImgServiceImpl implements ImgService {
|
||||
return imgMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Images selectImgByBrieflink(String brieflink) {
|
||||
return imgMapper.selectImgByBrieflink(brieflink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Images selectImgByShortlink(String shortlink) {
|
||||
return imgMapper.selectImgByShortlink(shortlink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer counts(Integer userid) {
|
||||
// TODO Auto-generated method stub
|
||||
@@ -131,10 +141,9 @@ public class ImgServiceImpl implements ImgService {
|
||||
if(sysConfig.getCheckduplicate().equals("1")){
|
||||
//查重
|
||||
Images img = new Images();
|
||||
img.setUserid(user.getId());
|
||||
img.setUserid(user==null?0:user.getId());
|
||||
img.setMd5key(images.getMd5key());
|
||||
List<Images> list = imgMapper.selectImgUrlByMD5(img);
|
||||
jsonObject.put("url", list.get(0).getImgurl());
|
||||
if (list.size() > 0) {
|
||||
jsonObject.put("url", list.get(0).getImgurl());
|
||||
jsonObject.put("name", flilename);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
package cn.hellohao.service.impl;
|
||||
|
||||
import cn.hellohao.pojo.Images;
|
||||
import cn.hellohao.pojo.Keys;
|
||||
import cn.hellohao.pojo.Msg;
|
||||
import cn.hellohao.pojo.ReturnImage;
|
||||
import cn.hellohao.utils.SetText;
|
||||
import cn.hellohao.utils.TypeDict;
|
||||
import com.UpYun;
|
||||
import com.aliyun.oss.model.ObjectMetadata;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class UFileImageupload1 {
|
||||
static UpYun uFile;
|
||||
static Keys key;
|
||||
|
||||
/*
|
||||
* 废弃方法待补位
|
||||
* */
|
||||
|
||||
public ReturnImage ImageuploadUFile(
|
||||
Map<Map<String, String>, File> fileMap, String username, Integer keyID) {
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
File file = null;
|
||||
ObjectMetadata meta = new ObjectMetadata();
|
||||
meta.setHeader("Content-Disposition", "inline");
|
||||
try {
|
||||
for (Map.Entry<Map<String, String>, File> entry : fileMap.entrySet()) {
|
||||
String ShortUID = SetText.getShortUuid();
|
||||
file = entry.getValue();
|
||||
Msg fileMiME = TypeDict.FileMiME(file);
|
||||
meta.setHeader("content-type", fileMiME.getData().toString());
|
||||
uFile.setContentMD5(UpYun.md5(file));
|
||||
boolean result =
|
||||
uFile.writeFile(
|
||||
username + "/" + ShortUID + "." + entry.getKey(), file, true);
|
||||
if (result) {
|
||||
returnImage.setImgname(username + "/" + ShortUID + "." + entry.getKey());
|
||||
returnImage.setImgurl(
|
||||
key.getRequestAddress()
|
||||
+ "/"
|
||||
+ username
|
||||
+ "/"
|
||||
+ ShortUID
|
||||
+ "."
|
||||
+ entry.getKey());
|
||||
returnImage.setImgSize(entry.getValue().length());
|
||||
returnImage.setCode("200");
|
||||
} else {
|
||||
returnImage.setCode("400");
|
||||
System.err.println("上传失败");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
returnImage.setCode("500");
|
||||
}
|
||||
returnImage.setCode("500");
|
||||
return returnImage;
|
||||
}
|
||||
|
||||
public static Integer Initialize(Keys k) {
|
||||
int ret = -1;
|
||||
if (k.getAccessSecret() != null
|
||||
&& k.getAccessKey() != null
|
||||
&& k.getBucketname() != null
|
||||
&& k.getRequestAddress() != null) {
|
||||
if (!k.getAccessSecret().equals("")
|
||||
&& !k.getAccessKey().equals("")
|
||||
&& !k.getBucketname().equals("")
|
||||
&& !k.getRequestAddress().equals("")) {
|
||||
UpYun ufObj = new UpYun(k.getBucketname(), k.getAccessKey(), k.getAccessSecret());
|
||||
List<UpYun.FolderItem> items = null;
|
||||
try {
|
||||
items = ufObj.readDir("/", null);
|
||||
ret = 1;
|
||||
uFile = ufObj;
|
||||
key = k;
|
||||
} catch (Exception e) {
|
||||
System.out.println("UFile Object Is null");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Boolean delUFile(Integer keyID, Images images) {
|
||||
boolean b = true;
|
||||
try {
|
||||
boolean result = uFile.deleteFile(images.getImgname(), null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
b = false;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
}
|
||||
@@ -129,13 +129,19 @@ public class UploadServicel {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 判断路径格式 处理一下,去掉最前面的/
|
||||
String RootPath = key.getRootPath().replace(" ", "");
|
||||
if (!RootPath.equals("/")) {
|
||||
updatePath = RootPath.substring(1) + "/" + updatePath;
|
||||
}
|
||||
// 先存数据库
|
||||
Images imgObj = new Images();
|
||||
String imgnameEd = null;
|
||||
Map<Map<String, String>, File> map = new HashMap<>();
|
||||
String shortUuid_y = SetText.getShortUuid();
|
||||
String shortUuid_s = SetText.getShortUuid();
|
||||
if (file.exists()) {
|
||||
Map<String, String> m1 = new HashMap<>();
|
||||
String shortUuid_y = SetText.getShortUuid();
|
||||
m1.put("prefix", prefix);
|
||||
m1.put("name", shortUuid_y);
|
||||
map.put(m1, file);
|
||||
@@ -168,6 +174,8 @@ public class UploadServicel {
|
||||
imgObj.setMd5key(md5key);
|
||||
imgObj.setImguid(imguid);
|
||||
imgObj.setFormat(fileMiME.getData().toString());
|
||||
imgObj.setShortlink(shortUuid_y);
|
||||
imgObj.setBrieflink(shortUuid_s);
|
||||
imgObj.setIdname(imgName);
|
||||
// Integer insertRet = imgMapper.insertImgData(imgObj);
|
||||
Msg insertRet = imgServiceImpl.insertImgDataForCheck(imgObj,u,confdata,file.getName());
|
||||
@@ -176,6 +184,7 @@ public class UploadServicel {
|
||||
}
|
||||
|
||||
long stime = System.currentTimeMillis();
|
||||
System.out.println("上传前地址:"+updatePath);
|
||||
ReturnImage returnImage = getSource.storageSource(key.getStorageType(), map, updatePath, key.getId());
|
||||
if (returnImage.getCode().equals("200")) {
|
||||
long etime = System.currentTimeMillis();
|
||||
@@ -215,7 +224,6 @@ public class UploadServicel {
|
||||
String md5 = jsonObj.getString("md5");
|
||||
String classifications = jsonObj.getString("classifications");
|
||||
Integer day = jsonObj.getInteger("day");
|
||||
String source = jsonObj.getString("source");
|
||||
String imgIdentifier = jsonObj.getString("imgIdentifier");
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
classifications = classifications==null?"":classifications;
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
package cn.hellohao.service.impl;
|
||||
|
||||
import cn.hellohao.config.GlobalConstant;
|
||||
import cn.hellohao.pojo.Images;
|
||||
import cn.hellohao.pojo.Keys;
|
||||
import cn.hellohao.pojo.Msg;
|
||||
import cn.hellohao.pojo.ReturnImage;
|
||||
import cn.hellohao.service.ImgService;
|
||||
import cn.hellohao.service.KeysService;
|
||||
import cn.hellohao.utils.TypeDict;
|
||||
import com.github.sardine.impl.methods.HttpMkCol;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.auth.AuthScope;
|
||||
import org.apache.http.auth.UsernamePasswordCredentials;
|
||||
import org.apache.http.client.CredentialsProvider;
|
||||
import org.apache.http.client.methods.*;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.FileEntity;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.BasicCredentialsProvider;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class WebDAVImageupload {
|
||||
|
||||
static CloseableHttpClient httpClient;
|
||||
static Keys key;
|
||||
|
||||
@Autowired
|
||||
private ImgService imgService;
|
||||
@Autowired
|
||||
private KeysService keysService;
|
||||
private static Logger logger = LoggerFactory.getLogger(WebDAVImageupload.class);
|
||||
public ReturnImage ImageuploadWebDAV(Map<Map<String, String>, File> fileMap, String username,Integer keyID) {
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
CloseableHttpClient httpClient =null;
|
||||
Keys key = null;
|
||||
try {
|
||||
if(null==httpClient || null==key){
|
||||
System.out.println("WebDAV = 存储源对象为空");
|
||||
returnImage.setCode("500");
|
||||
return returnImage;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("ImageuploadWebDAV:61异常",e);
|
||||
System.out.println("WebDAV = 存储源对象为空");
|
||||
returnImage.setCode("500");
|
||||
return returnImage;
|
||||
}
|
||||
File file = null;
|
||||
try {
|
||||
for (Map.Entry<Map<String, String>, File> entry : fileMap.entrySet()) {
|
||||
String prefix = entry.getKey().get("prefix");
|
||||
String ShortUIDName = entry.getKey().get("name");
|
||||
file = entry.getValue();
|
||||
Msg fileMiME = TypeDict.FileMiME(file);
|
||||
//webdav不能自动创建目录,上传件先创建目录
|
||||
createDirectories(httpClient, key.getEndpoint(), "/" + username);
|
||||
//上传文件
|
||||
System.out.println("WebDAV地址:"+key.getEndpoint() + "/" + username + "/" + ShortUIDName + "." + prefix);
|
||||
HttpPut httpPut = new HttpPut(key.getEndpoint() + "/" + username + "/" + ShortUIDName + "." + prefix);
|
||||
FileEntity fileEntity = new FileEntity(file, ContentType.DEFAULT_BINARY);
|
||||
httpPut.setEntity(fileEntity);
|
||||
HttpResponse response = httpClient.execute(httpPut);
|
||||
final int statusCode = response.getStatusLine().getStatusCode();
|
||||
logger.info("WebDav上传响应代码:"+statusCode);
|
||||
// System.out.println(response.getStatusLine().getStatusCode());//正常成功201 已经存在204(有可能204还代表其他意思)
|
||||
// System.out.println("File upload response for " + file.getName() + ": " + response.getStatusLine());
|
||||
EntityUtils.consume(response.getEntity());
|
||||
// System.out.println(EntityUtils.toString(response.getEntity(),"UTF-8"));
|
||||
if(statusCode >= 200 && statusCode < 300){
|
||||
returnImage.setCode("200");
|
||||
}else{
|
||||
returnImage.setCode(Integer.toString(statusCode));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("ImageuploadWebDAV:92异常",e);
|
||||
returnImage.setCode("500");
|
||||
}
|
||||
return returnImage;
|
||||
}
|
||||
|
||||
//webdav初始化
|
||||
public static Integer Initialize(Keys k) {
|
||||
int ret = -1;
|
||||
if(k.getSysTransmit()==false){
|
||||
if (StringUtils.isBlank(k.getAccessKey())
|
||||
|| StringUtils.isBlank(k.getAccessSecret())
|
||||
|| StringUtils.isBlank(k.getEndpoint())
|
||||
|| StringUtils.isBlank(k.getRequestAddress())) {
|
||||
return -1;
|
||||
}
|
||||
}else{
|
||||
if (StringUtils.isBlank(k.getAccessKey())
|
||||
|| StringUtils.isBlank(k.getAccessSecret())
|
||||
|| StringUtils.isBlank(k.getEndpoint())) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
String endpoint = k.getEndpoint();
|
||||
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
|
||||
credentialsProvider.setCredentials(
|
||||
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
|
||||
new UsernamePasswordCredentials(k.getAccessKey(), k.getAccessSecret()));
|
||||
CloseableHttpClient httpClientObj = HttpClients.custom()
|
||||
.setDefaultCredentialsProvider(credentialsProvider)
|
||||
.build();
|
||||
try {
|
||||
HttpUriRequest request = RequestBuilder.create("PROPFIND")
|
||||
.setUri(endpoint +"/"+ k.getRootPath())
|
||||
.addHeader("Depth", "1")
|
||||
.setEntity(new StringEntity(
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" +
|
||||
"<D:propfind xmlns:D=\"DAV:\">\n" +
|
||||
" <D:allprop/>\n" +
|
||||
"</D:propfind>",
|
||||
ContentType.create("text/xml", "UTF-8")))
|
||||
.build();
|
||||
HttpResponse response = httpClientObj.execute(request);
|
||||
System.out.println("=====>"+response.getStatusLine().getStatusCode());
|
||||
if(response.getStatusLine().getStatusCode()==207 || response.getStatusLine().getStatusCode()==404){
|
||||
ret = 1;
|
||||
httpClient = httpClientObj;
|
||||
key = k;
|
||||
}else {
|
||||
return -1;
|
||||
}
|
||||
EntityUtils.consume(response.getEntity());
|
||||
} catch (Exception e) {
|
||||
logger.error("WebDAV初始化失败", e);
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Boolean delWebDAV(Integer keyID, Images images) {
|
||||
boolean b = true;
|
||||
try {
|
||||
Keys keys = keysService.selectKeys(images.getSource());
|
||||
String rootPath = keys.getRootPath().equals("/")?"":keys.getRootPath();
|
||||
String fileUrl = keys.getEndpoint()+"/"+images.getImgname();
|
||||
System.err.println("删除缩yuan图:"+fileUrl);
|
||||
HttpDelete httpDelete = new HttpDelete(fileUrl);
|
||||
HttpResponse response = httpClient.execute(httpDelete);
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
if (statusCode == 204) {
|
||||
logger.info("File deleted: " + fileUrl);
|
||||
// checkAndDeleteEmptyParentDirectories(httpClient,fileUrl);
|
||||
} else {
|
||||
logger.error("Failed to delete file: " + fileUrl);
|
||||
}
|
||||
EntityUtils.consume(response.getEntity());
|
||||
} catch (Exception e) {
|
||||
logger.error("WebDav删除异常:",e);
|
||||
b = false;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
public ResponseEntity<InputStreamResource> getWebDAV(String shortUuid) {
|
||||
boolean b = true;
|
||||
try {
|
||||
Images images = null;
|
||||
images = imgService.selectImgByShortlink(shortUuid);
|
||||
Keys keys = keysService.selectKeys(images.getSource());
|
||||
String rootPath = keys.getRootPath().equals("/")?"":keys.getRootPath();
|
||||
String fileUrl = keys.getEndpoint()+"/"+images.getImgname();
|
||||
HttpGet httpGet = new HttpGet(fileUrl);
|
||||
HttpResponse response = httpClient.execute(httpGet);
|
||||
// if (sardine.exists(keys.getEndpoint() + images.getImgname())) {
|
||||
// InputStream inputStream = sardine.get(keys.getEndpoint() + images.getImgname());
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Content-Type", "image/jpeg");
|
||||
// headers.add("Content-disposition", "attachment; filename=wallhaven-5g6yr3.jpg");
|
||||
return ResponseEntity.ok()
|
||||
.headers(headers)
|
||||
//.header("Content-disposition", "attachment; filename=Nextcloud.png")
|
||||
// .header("Content-Type", "image/jpg")
|
||||
.body(new InputStreamResource(response.getEntity().getContent()));
|
||||
// } else {
|
||||
// return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
|
||||
// }
|
||||
} catch (IOException e) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
||||
}
|
||||
}
|
||||
|
||||
private static void createDirectories(CloseableHttpClient httpClient, String baseUrl, String directoryPath) throws Exception {
|
||||
String[] directories = directoryPath.split("/");
|
||||
String currentPath = baseUrl;
|
||||
for (String directory : directories) {
|
||||
currentPath += directory + "/";
|
||||
HttpMkCol httpMkCol = new HttpMkCol(currentPath);
|
||||
HttpResponse response = httpClient.execute(httpMkCol);
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
if (statusCode == 201) {
|
||||
System.out.println("Directory created: " + currentPath);
|
||||
} else if (statusCode == 405) {
|
||||
System.out.println("Directory already exists: " + currentPath);
|
||||
} else {
|
||||
System.err.println("Failed to create directory: " + currentPath);
|
||||
}
|
||||
EntityUtils.consume(response.getEntity());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -111,6 +111,30 @@ public class FirstRun implements InitializingBean {
|
||||
RunSqlScript.RunInsert(instartConfdata);
|
||||
Print.Normal("Add table.confdata");
|
||||
}
|
||||
Integer ret7 =
|
||||
RunSqlScript.RunSelectCount(judgeTable + " 'keys' and column_name = 'SysTransmit'");
|
||||
if (ret7 == 0) {
|
||||
RunSqlScript.RunInsert(sql7);
|
||||
Print.Normal("Add keys.SysTransmit");
|
||||
}
|
||||
Integer ret8 =
|
||||
RunSqlScript.RunSelectCount(judgeTable + " 'imgdata' and column_name = 'brieflink'");
|
||||
if (ret8 == 0) {
|
||||
RunSqlScript.RunInsert(sql8);
|
||||
Print.Normal("Add imgdata.brieflink");
|
||||
}
|
||||
Integer ret9 =
|
||||
RunSqlScript.RunSelectCount(judgeTable + " 'imgdata' and column_name = 'shortlink'");
|
||||
if (ret9 == 0) {
|
||||
RunSqlScript.RunInsert(sql9);
|
||||
Print.Normal("Add imgdata.shortlink");
|
||||
}
|
||||
Integer ret10 =
|
||||
RunSqlScript.RunSelectCount(" select count(*) from tbed.keys where storageType='9'");
|
||||
if (ret10 == 0) {
|
||||
RunSqlScript.RunInsert(sql10);
|
||||
Print.Normal("Add Webdav Config");
|
||||
}
|
||||
RunSqlScript.RunInsert(index_imgdata);
|
||||
RunSqlScript.RunInsert("ALTER TABLE tbed.`user` MODIFY id int auto_increment;");
|
||||
Print.Normal("Stage success");
|
||||
@@ -130,12 +154,12 @@ public class FirstRun implements InitializingBean {
|
||||
private String sql3 ="CREATE TABLE `imgandalbum` (`imgname` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,`albumkey` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic";
|
||||
private String sql4 ="CREATE TABLE `album` (`albumkey` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,`albumtitle` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,`createdate` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `password` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic";
|
||||
private String sql6 = "alter table imgdata add explains varchar(5000)";
|
||||
//添加album表字段userid
|
||||
private String sql7 = "alter table album add userid int(10)";
|
||||
//添加imgdata表字段md5key
|
||||
private String sql8 = "alter table imgdata add md5key varchar(5000)";
|
||||
private String sql7 =
|
||||
"alter table `keys` add SysTransmit varchar(50) DEFAULT NULL ;";
|
||||
private String sql8 = "alter table `imgdata` add brieflink varchar(100) DEFAULT null ;";
|
||||
private String sql9 = "alter table `imgdata` add shortlink varchar(100) DEFAULT null ;";
|
||||
// 图片标识名字段
|
||||
private String sql11 = "alter table `imgdata` add idname varchar(255) DEFAULT '未命名' ;";
|
||||
private String sql10 = "INSERT INTO `tbed`.`keys`(`id`, `AccessKey`, `AccessSecret`, `Endpoint`, `Bucketname`, `RequestAddress`, `storageType`, `keyname`, `Region`, `RootPath`, `SysTransmit`) VALUES (null, '账号', '密码', '连接', '', '存储源请求域名', 9, 'WebDAV', NULL, '/', NULL);";
|
||||
|
||||
private String sql12 = "alter table tbed.user add `token` varchar(255)";
|
||||
//创建客户端程序相关表
|
||||
|
||||
@@ -39,8 +39,6 @@ public class GetCurrentSource {
|
||||
userService = userServiceImpl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Group GetSource(Integer userid) {
|
||||
//UserType 0-未分配 1-游客 2-用户 3-管理员
|
||||
User user =null;
|
||||
|
||||
@@ -51,6 +51,8 @@ public class GetSource {
|
||||
returnImage = ftpService.FtpUploadFile(fileMap, userpath,keyID);
|
||||
}else if(type==8){
|
||||
returnImage = s3Imageupload.ImageuploadS3(fileMap, userpath,keyID);
|
||||
}else if(type==9){
|
||||
returnImage = s3Imageupload.ImageuploadS3(fileMap, userpath,keyID);
|
||||
}
|
||||
else{
|
||||
new StorageSourceInitException("GetSource类捕捉异常:未找到存储源");
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -126,13 +126,14 @@
|
||||
`format`,
|
||||
about,
|
||||
violation,
|
||||
idname
|
||||
idname,
|
||||
brieflink,
|
||||
shortlink
|
||||
)
|
||||
VALUES (null, #{imgname}, #{imgurl}, #{userid}, #{updatetime},#{sizes},#{abnormal},#{source},#{imgtype},
|
||||
#{explains},#{md5key},#{imguid},#{format},#{about},null,#{idname})
|
||||
#{explains},#{md5key},#{imguid},#{format},#{about},null,#{idname},#{brieflink},#{shortlink})
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- 此用户下总数 -->
|
||||
<select id="countimg" parameterType="integer" resultType="integer">
|
||||
select count(*) from imgdata where userid = #{userid}
|
||||
@@ -150,6 +151,14 @@
|
||||
select * from imgdata where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectImgByBrieflink" parameterType="string" resultType="cn.hellohao.pojo.Images">
|
||||
select * from imgdata where binary brieflink = #{brieflink}
|
||||
</select>
|
||||
|
||||
<select id="selectImgByShortlink" parameterType="string" resultType="cn.hellohao.pojo.Images">
|
||||
select * from imgdata where binary shortlink = #{shortlink}
|
||||
</select>
|
||||
|
||||
<select id="counts" resultType="integer">
|
||||
select count(*) from imgdata where 1=1
|
||||
<if test="userid != null">
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
WHEN storageType=6 THEN '腾讯云'
|
||||
WHEN storageType=7 THEN 'FTP'
|
||||
WHEN storageType=8 THEN 'S3协议'
|
||||
WHEN storageType=9 THEN 'WebDAV'
|
||||
ELSE '未知' END AS storageName,
|
||||
keyname
|
||||
FROM `keys` GROUP BY storageType,id,storageName,keyname
|
||||
@@ -51,7 +52,8 @@
|
||||
RequestAddress = #{RequestAddress},
|
||||
keyname = #{keyname},
|
||||
Region = #{Region},
|
||||
RootPath = #{RootPath}
|
||||
RootPath = #{RootPath},
|
||||
SysTransmit=#{SysTransmit}
|
||||
WHERE
|
||||
storageType = #{storageType}
|
||||
</update>
|
||||
|
||||
Reference in New Issue
Block a user