2019-7-21更新 增加腾讯COS

This commit is contained in:
Hellohao
2019-07-21 21:56:42 +08:00
parent 291c3964dc
commit 92c630328a
21 changed files with 1041 additions and 168 deletions
-8
View File
@@ -1,8 +0,0 @@
{
"id": 192,
"hitokoto": "不要,我现在暂时留在他身边,直到那转瞬即逝的日子到来。",
"type": "a",
"from": "夏目友人帐",
"creator": "Sai",
"created_at": "1468605911"
}
+6
View File
@@ -76,6 +76,12 @@
<artifactId>qiniu-java-sdk</artifactId>
<version>7.2.22</version>
</dependency>
<!-- 腾讯-->
<dependency>
<groupId>com.qcloud</groupId>
<artifactId>cos_api</artifactId>
<version>5.5.7</version>
</dependency>
<!-- 定时器依赖-->
<dependency>
+12 -7
View File
@@ -11,7 +11,7 @@
Target Server Version : 50720
File Encoding : 65001
Date: 16/07/2019 18:22:50
Date: 21/07/2019 21:53:02
*/
SET NAMES utf8mb4;
@@ -77,7 +77,7 @@ CREATE TABLE `imgdata` (
`abnormal` int(2) NULL DEFAULT NULL COMMENT '异常',
`source` int(2) NULL DEFAULT NULL COMMENT '存储源',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for imgreview
@@ -109,18 +109,23 @@ CREATE TABLE `keys` (
`Endpoint` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`Bucketname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`RequestAddress` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`storageType` int(10) NULL DEFAULT NULL,
`storageType` int(10) NOT NULL COMMENT '1网易2阿里3又拍4七牛5本地6腾讯',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of keys
-- ----------------------------
INSERT INTO `keys` VALUES (1, '', '', '', '', '', 1);
INSERT INTO `keys` VALUES (2, '11111111', '222222222222', '444444444444', '555555555', 'http://1.1.1', 2);
INSERT INTO `keys` VALUES (3, '', '', '0', '', '', 3);
INSERT INTO `keys` VALUES (4, '', '', '', '', '', 4);
INSERT INTO `keys` VALUES (3, '123', '123', '0', '123', '123', 3);
INSERT INTO `keys` VALUES (4, '123', '123', '4', '412', 'https://0.0', 4);
INSERT INTO `keys` VALUES (5, '0', '0', '0', '0', '0', 5);
INSERT INTO `keys` VALUES (6, '', '', '', '', '', 6);
INSERT INTO `keys` VALUES (7, '', '', '', '', '', 7);
INSERT INTO `keys` VALUES (8, '', '', '', '', '', 8);
INSERT INTO `keys` VALUES (9, '', '', '', '', '', 9);
INSERT INTO `keys` VALUES (10, '0', '', '0', '0', '0', 10);
-- ----------------------------
-- Table structure for notice
@@ -164,7 +169,7 @@ CREATE TABLE `user` (
`uid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户唯一标识',
`isok` int(2) NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of user
@@ -19,7 +19,11 @@ import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Hellohao
* @version 1.0
* @date 2019-07-17 14:22
*/
@Controller
@RequestMapping("/admin")
public class AdminController {
@@ -224,6 +228,8 @@ public class AdminController {
de.delectKODO(key, images.getImgname());
} else if (key.getStorageType() == 5) {
LocUpdateImg.deleteLOCImg(images.getImgname());
}else if (key.getStorageType() == 6) {
de.delectCOS(key, images.getImgname());
}else {
System.err.println("未获取到对象存储参数,删除失败。");
}
@@ -263,10 +269,11 @@ public class AdminController {
} else if (key.getStorageType() == 3) {
de.delectUSS(key, images.getImgname());
} else if (key.getStorageType() == 4) {
//初始化七牛云
de.delectKODO(key, images.getImgname());
} else if (key.getStorageType() == 5) {
LocUpdateImg.deleteLOCImg(images.getImgname());
}else if (key.getStorageType() == 6) {
de.delectCOS(key, images.getImgname());
}else {
System.err.println("未获取到对象存储参数,删除失败。");
}
@@ -18,18 +18,18 @@ class MainsiteErrorController implements ErrorController {
//获取statusCode:401,404,500
Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
if(statusCode == 401){
return "/401";
return "401";
}else if(statusCode == 404){
return "/404";
return "404";
}else if(statusCode == 403){
return "/403";
return "403";
}else{
return "/500";
return "500";
}
}
@Override
public String getErrorPath() {
return "/error";
return "error";
}
}
@@ -1,6 +1,5 @@
package cn.hellohao.controller;
import java.io.File;
import java.io.FileInputStream;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -9,9 +8,7 @@ import javax.servlet.http.HttpSession;
import cn.hellohao.pojo.*;
import cn.hellohao.service.*;
import cn.hellohao.service.impl.KODOImageupload;
import cn.hellohao.service.impl.OSSImageupload;
import cn.hellohao.service.impl.USSImageupload;
import cn.hellohao.service.impl.*;
import cn.hellohao.utils.IPPortUtil;
import cn.hellohao.utils.*;
import com.alibaba.fastjson.JSONObject;
@@ -24,7 +21,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONArray;
import cn.hellohao.service.impl.NOSImageupload;
@Controller
public class UpdateImgController {
@@ -44,6 +40,8 @@ public class UpdateImgController {
private USSImageupload ussImageupload;
@Autowired
private KODOImageupload kodoImageupload;
@Autowired
private COSImageupload cosImageupload;
@RequestMapping({"/", "/index"})
public String indexImg(Model model, HttpSession httpSession) {
@@ -67,7 +65,7 @@ public class UpdateImgController {
}
if(b)
{
if(key.getStorageType()!=0 || key.getStorageType()!=null){
if(key.getStorageType()!=0 && key.getStorageType()!=null){
if(key.getStorageType()==1){
nOSImageupload.Initialize(key);//实例化网易
System.out.println("NOS初始化成功。");
@@ -77,13 +75,15 @@ public class UpdateImgController {
}else if(key.getStorageType()==3){
USSImageupload.Initialize(key);
System.out.println("USS初始化成功。");
//初始化又拍云
}else if(key.getStorageType()==4){
//初始化七牛云
KODOImageupload.Initialize(key);
System.out.println("KODO初始化成功。");
}else{
System.err.println("未获取到对象存储参数,初始化失败。");
}else if(key.getStorageType()==6){
COSImageupload.Initialize(key);
System.out.println("COS初始化成功。");
}
else{
Print.Normal("为获取到存储参数,或者使用存储源是本地的。");
}
}
}
@@ -152,13 +152,14 @@ public class UpdateImgController {
m = ossImageupload.ImageuploadOSS(map, username,null);
}else if(key.getStorageType()==3){
m = ussImageupload.ImageuploadUSS(map, username,null);
//初始化腾讯云
}else if(key.getStorageType()==4){
//初始化七牛云
m = kodoImageupload.ImageuploadKODO(map, username,null);
}else if(key.getStorageType()==5){
m = LocUpdateImg.ImageuploadLOC(map, username,null);
}else{
}else if(key.getStorageType()==6){
m = cosImageupload.ImageuploadCOS(map, username,null);
}
else{
System.err.println("未获取到对象存储参数,上传失败。");
}
Images img = new Images();
@@ -255,7 +256,7 @@ public class UpdateImgController {
is.close();
}
//判断文件头是否是图片
if(!xxx.equals("0000")){
if(!ooo.equals("0000")){
Map<String, String> map = new HashMap<>();
map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
Map<String, Integer> m = null;
@@ -269,7 +270,10 @@ public class UpdateImgController {
m = kodoImageupload.ImageuploadKODO(null, username,map);
}else if(key.getStorageType()==5){
m = LocUpdateImg.ImageuploadLOC(null,username,map);
}else{
}else if(key.getStorageType()==6){
m = cosImageupload.ImageuploadCOS(null,username,map);
}
else{
System.err.println("未获取到对象存储参数,上传失败。");
}
Images img = new Images();
@@ -296,7 +300,7 @@ public class UpdateImgController {
} else {
img.setUserid(u.getId());//用户id
}
img.setSizes((entry.getValue()) / 1024);
img.setSizes((entry.getValue()));
img.setImgname(SetText.getSubString(entry.getKey(), key.getRequestAddress() + "/", ""));
img.setAbnormal(0);
userService.insertimg(img);
@@ -348,7 +352,10 @@ public class UpdateImgController {
m = kodoImageupload.ImageuploadKODO(null, username,map);
}else if(key.getStorageType()==5){
m =LocUpdateImg.ImageuploadLOC(null,username, map);
}else{
}else if(key.getStorageType()==6){
m =cosImageupload.ImageuploadCOS(null,username, map);
}
else{
System.err.println("未获取到对象存储参数,上传失败。");
}
Images img = new Images();
@@ -375,7 +382,7 @@ public class UpdateImgController {
} else {
img.setUserid(u.getId());//用户id
}
img.setSizes((entry.getValue()) / 1024);
img.setSizes((entry.getValue()));
img.setImgname(SetText.getSubString(entry.getKey(), key.getRequestAddress() + "/", ""));
img.setAbnormal(0);
userService.insertimg(img);
@@ -399,20 +406,15 @@ public class UpdateImgController {
}else{
jsonArray.add(-1);
}
return jsonArray.toString();
/**
* 错误返回值含义:
* -1 存储源key未配置
* -2 目标图片太大或者不存在
* -3 文件类型不符合要求
* */
return jsonArray.toString();
}
//刪除用戶
@RequestMapping("/sentence")
@ResponseBody
@@ -441,7 +443,6 @@ public class UpdateImgController {
return jsonObject.toString();
}
//ajax查询用户是否已经登录
@RequestMapping(value = "/getsentence")
@ResponseBody
public String getsentence(HttpSession session) {
@@ -60,6 +60,7 @@ public class QuartzConfigration {
CronTriggerFactoryBean tigger = new CronTriggerFactoryBean();
tigger.setJobDetail(jobDetail.getObject());
tigger.setCronExpression("0 30 04 * * ?");// 表示每天七点半执行
//tigger.setCronExpression(("0 0/3 * * * ?"));//每三分钟
//tigger.setCronExpression("*/5 * * * * ?");//每五秒执行一次
//tigger.set
tigger.setName("myTigger");// trigger的name
@@ -0,0 +1,165 @@
package cn.hellohao.service.impl;
import cn.hellohao.pojo.Keys;
import cn.hellohao.utils.ImgUrlUtil;
import cn.hellohao.utils.Print;
import com.netease.cloud.auth.BasicCredentials;
import com.netease.cloud.auth.Credentials;
import com.netease.cloud.services.nos.NosClient;
import com.netease.cloud.services.nos.model.ObjectMetadata;
import com.netease.cloud.services.nos.transfer.TransferManager;
import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.auth.BasicCOSCredentials;
import com.qcloud.cos.auth.COSCredentials;
import com.qcloud.cos.exception.CosClientException;
import com.qcloud.cos.exception.CosServiceException;
import com.qcloud.cos.model.Bucket;
import com.qcloud.cos.model.PutObjectRequest;
import com.qcloud.cos.model.PutObjectResult;
import com.qcloud.cos.region.Region;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.util.*;
@Service
public class COSImageupload {
static String BarrelName;
static COSClient cosClient;
static Keys key;
public Map<String, Integer> ImageuploadCOS(Map<String, MultipartFile> fileMap, String username,Map<String, String> fileMap2) throws Exception {
// 要上传文件的路径
if(fileMap2==null){
File file = null;
Map<String, Integer> ImgUrl = new HashMap<>();
for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
try {
// 指定要上传到的存储桶
String bucketName = BarrelName;
// 指定要上传到 COS 上对象键
String userkey =username + "/" + uuid+times + "." + entry.getKey();
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, userkey, file);
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
ImgUrl.put(key.getRequestAddress() + "/" + userkey, (int) (entry.getValue().getSize()));
} catch (CosServiceException serverException) {
serverException.printStackTrace();
} catch (CosClientException clientException) {
clientException.printStackTrace();
}
}
return ImgUrl;
}else{
Map<String, Integer> ImgUrl = new HashMap<>();
//设置Header
ObjectMetadata meta = new ObjectMetadata();
meta.setHeader("Content-Disposition", "inline");
for (Map.Entry<String, String> entry : fileMap2.entrySet()) {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
String imgurl = entry.getValue();
File file = new File(imgurl);
FileInputStream fileInputStream = new FileInputStream(file);
try {
// 指定要上传到 COS 上对象键
String userkey =username + "/" + uuid+times + "." + entry.getKey();
PutObjectRequest putObjectRequest = new PutObjectRequest(BarrelName, userkey, file);
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
ImgUrl.put(key.getRequestAddress() + "/" + userkey, ImgUrlUtil.getFileSize2(new File(imgurl)));
boolean bb= new File(imgurl).getAbsoluteFile().delete();
Print.Normal("删除情况"+bb);
} catch (Exception e) {
System.out.println("上传报错:" + e.getMessage());
}
if(fileInputStream!=null){
fileInputStream.close();
Print.Normal("流已经关闭");
}
}
cosClient.shutdown();
return ImgUrl;
}
}
// 转换文件方法
private File changeFile(MultipartFile multipartFile) throws Exception {
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String prefix = fileName.substring(fileName.lastIndexOf("."));
// todo 修改临时文件文件名
File file = File.createTempFile(fileName, prefix);
// MultipartFile to File
multipartFile.transferTo(file);
return file;
}
//初始化网易NOS对象存储
public static void Initialize(Keys k) {
// 1 初始化用户身份信息(secretId, secretKey)。
String secretId = k.getAccessKey();
String secretKey = k.getAccessSecret();
COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
// 2 设置 bucket 的区域, COS 地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
// clientConfig 中包含了设置 region, https(默认 http), 超时, 代理等 set 方法, 使用可参见源码或者常见问题 Java SDK 部分。
Region region = new Region(k.getEndpoint());
ClientConfig clientConfig = new ClientConfig(region);
// 3 生成 cos 客户端。
cosClient= new COSClient(cred, clientConfig);
//查询桶
try {
List<Bucket> buckets = cosClient.listBuckets();
for (Bucket bucket : buckets) {
if(bucket.getName().equals(k.getBucketname())){
Print.Normal("当前桶名称:"+bucket.getName());
BarrelName = bucket.getName();
}
}
} catch (CosServiceException serverException) {
serverException.printStackTrace();
} catch (CosClientException clientException) {
clientException.printStackTrace();
}
key = k;
}
/**
* 客户端接口
* */
public Map<String, Integer> clientuploadCOS(Map<String, MultipartFile> fileMap, String username) throws Exception {
File file = null;
Map<String, Integer> ImgUrl = new HashMap<>();
for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
try {
// 指定要上传到 COS 上对象键
String userkey =username + "/" + uuid+times + "." + entry.getKey();
PutObjectRequest putObjectRequest = new PutObjectRequest(BarrelName, userkey, file);
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
ImgUrl.put(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey(), (int) (entry.getValue().getSize()));
} catch (Exception e) {
System.out.println("上传报错:" + e.getMessage());
}
}
return ImgUrl;
}
}
@@ -6,6 +6,13 @@ import java.util.List;
import com.UpYun;
import com.aliyun.oss.OSSClient;
import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.auth.BasicCOSCredentials;
import com.qcloud.cos.auth.COSCredentials;
import com.qcloud.cos.exception.CosClientException;
import com.qcloud.cos.exception.CosServiceException;
import com.qcloud.cos.region.Region;
import com.qiniu.common.QiniuException;
import com.qiniu.common.Zone;
import com.qiniu.storage.BucketManager;
@@ -129,7 +136,24 @@ public class ImgServiceImpl implements ImgService {
System.err.println(ex.response.toString());
}
}
//删除COS对象存储的图片文件
public void delectCOS(Keys key, String fileName) {
COSCredentials cred = new BasicCOSCredentials(key.getAccessKey(), key.getAccessSecret());
Region region = new Region(key.getEndpoint());
ClientConfig clientConfig = new ClientConfig(region);
COSClient cosClient= new COSClient(cred, clientConfig);
try {
// 指定对象所在的存储桶
String bucketName = key.getBucketname();
// 指定对象在 COS 上的对象键
String userkey = fileName;
cosClient.deleteObject(key.getBucketname(), userkey);
} catch (CosServiceException serverException) {
serverException.printStackTrace();
} catch (CosClientException clientException) {
clientException.printStackTrace();
}
}
@Override
public Integer counts(Integer userid) {
// TODO Auto-generated method stub
@@ -121,5 +121,35 @@ public class KODOImageupload {
key = k;
}
/**
* 客户端接口
* */
public Map<String, Integer> clientuploadKODO(Map<String, MultipartFile> fileMap, String username) throws Exception {
File file = null;
Map<String, Integer> ImgUrl = new HashMap<>();
for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
System.out.println("待上传的图片:"+username + "/" + uuid+times + "." + entry.getKey());
try {
Response response = uploadManager.put(file,username + "/" + uuid+times + "." + entry.getKey(),upToken);
//解析上传成功的结果
DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
ImgUrl.put(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey(), (int) (entry.getValue().getSize()));
} catch (QiniuException ex) {
Response r = ex.response;
System.err.println(r.toString());
try {
System.err.println(r.bodyString());
} catch (QiniuException ex2) {
}
}
}
return ImgUrl;
}
}
@@ -142,5 +142,29 @@ public class NOSImageupload {
key = k;
}
/**
* 客户端接口
* */
public Map<String, Integer> clientuploadNOS(Map<String, MultipartFile> fileMap, String username) throws Exception {
File file = null;
Map<String, Integer> ImgUrl = new HashMap<>();
for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
try {
nosClient.putObject(BarrelName, username + "/" + uuid+times + "." + entry.getKey(), file);
ImgUrl.put(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey(), (int) (entry.getValue().getSize()));
} catch (Exception e) {
System.out.println("上传报错:" + e.getMessage());
}
}
return ImgUrl;
}
}
@@ -2,6 +2,7 @@ package cn.hellohao.service.impl;
import cn.hellohao.pojo.Keys;
import cn.hellohao.utils.ImgUrlUtil;
import cn.hellohao.utils.Print;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.ObjectMetadata;
import org.springframework.stereotype.Service;
@@ -20,7 +21,6 @@ public class OSSImageupload {
static Keys key;
public Map<String, Integer> ImageuploadOSS(Map<String, MultipartFile> fileMap, String username,Map<String, String> fileMap2) throws Exception {
if(fileMap2==null){
File file = null;
Map<String, Integer> ImgUrl = new HashMap<>();
@@ -113,4 +113,48 @@ public class OSSImageupload {
}
/**
* 客户端接口
* */
public Map<String, Integer> clientuploadOSS(Map<String, MultipartFile> fileMap, String username) throws Exception {
File file = null;
Map<String, Integer> ImgUrl = new HashMap<>();
//设置Header
ObjectMetadata meta = new ObjectMetadata();
meta.setHeader("Content-Disposition", "inline");
for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
String head = "";
if(entry.getKey().equals("jpg")||entry.getKey().equals("jpeg")){
head = "image/jpeg";
}else if(entry.getKey().equals("png")){
head = "image/png";
}else if(entry.getKey().equals("bmp")){
head = "image/bmp";
}else if(entry.getKey().equals("gif")){
head = "image/gif";
}else{
System.err.println("位置格式文件,无法定义header头。");
}
meta.setHeader("Content-Type", head);//image/jpeg
// 上传文件流。
System.out.println("待上传的图片:"+username + "/" + uuid+times + "." + entry.getKey());
ossClient.putObject(key.getBucketname(), username + "/" + uuid+times + "." + entry.getKey(),file,meta);
// 关闭OSSClient。
//ossClient.shutdown();
Print.Normal(entry.getValue().getSize());
ImgUrl.put(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey(), (int) (entry.getValue().getSize()/1024));
}
return ImgUrl;
}
}
@@ -99,4 +99,33 @@ public class USSImageupload {
}
/**
* 客户端接口
* */
public Map<String, Integer> clientuploadUSS(Map<String, MultipartFile> fileMap, String username) throws Exception {
File file = null;
Map<String, Integer> ImgUrl = new HashMap<>();
//设置Header
ObjectMetadata meta = new ObjectMetadata();
meta.setHeader("Content-Disposition", "inline");
for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
// 上传文件流。
System.out.println("客户端:待上传的图片:"+username + "/" + uuid+times + "." + entry.getKey());
// 例2:采用数据流模式上传文件(节省内存),自动创建父级目录
upyun.setContentMD5(UpYun.md5(file));
boolean result = upyun.writeFile(username + "/" + uuid+times + "." + entry.getKey(), file, true);
if(result){
ImgUrl.put(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey(), (int) (entry.getValue().getSize()));
}else{
System.err.println("上传失败");
}
}
return ImgUrl;
}
}
+10 -1
View File
@@ -22,7 +22,16 @@ public class test1 {
public static void main(String[] args) {
Print.warning(System.getProperty("user.dir"));
// Print.warning(System.getProperty("user.dir"));
String str = "[FCAF03D4FDFC22D354FD]";
str = str.replace("[", "");
str = str.replace("]", "");
System.out.println(str);
String[] arr = str.split("&");
for (int i = 0; i < arr.length; i++) {
System.out.println(arr[i]);
}
}
}
@@ -1,5 +1,6 @@
package cn.hellohao.utils;
import com.google.gson.Gson;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
@@ -69,4 +70,33 @@ public class LocUpdateImg {
}
}
/**
* 客户端接口
* */
public Map<String, Integer> clientuploadKODO(Map<String, MultipartFile> fileMap, String username) throws Exception {
String filePath =File.separator + "HellohaoData" + File.separator;
File file = null;
Map<String, Integer> ImgUrl = new HashMap<>();
for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
//file = SetFiles.changeFile(entry.getValue());
// 上传文件流。
System.out.println("待上传的图片:"+username + "/" + uuid+times + "." + entry.getKey());
File dest = new File(filePath + username + File.separator+ uuid+times + "." + entry.getKey());
if (!dest.getParentFile().exists()) {
dest.getParentFile().mkdirs();
}
try {
entry.getValue().transferTo(dest);
ImgUrl.put(username + "/" + uuid+times + "." + entry.getKey(), (int) (entry.getValue().getSize()));
} catch (IOException e) {
e.printStackTrace();
System.err.println("上传失败");
}
}
return ImgUrl;
}
}
+456
View File
@@ -0,0 +1,456 @@
/*!
* Viewer.js v1.3.5
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-07-04T11:00:13.705Z
*/
.viewer-zoom-in::before,
.viewer-zoom-out::before,
.viewer-one-to-one::before,
.viewer-reset::before,
.viewer-prev::before,
.viewer-play::before,
.viewer-next::before,
.viewer-rotate-left::before,
.viewer-rotate-right::before,
.viewer-flip-horizontal::before,
.viewer-flip-vertical::before,
.viewer-fullscreen::before,
.viewer-fullscreen-exit::before,
.viewer-close::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAAUCAYAAABWOyJDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAQPSURBVHic7Zs/iFxVFMa/0U2UaJGksUgnIVhYxVhpjDbZCBmLdAYECxsRFBTUamcXUiSNncgKQbSxsxH8gzAP3FU2jY0kKKJNiiiIghFlccnP4p3nPCdv3p9778vsLOcHB2bfveeb7955c3jvvNkBIMdxnD64a94GHMfZu3iBcRynN7zAOI7TG15gHCeeNUkr8zaxG2lbYDYsdgMbktBsP03jdQwljSXdtBhLOmtjowC9Mg9L+knSlcD8TNKpSA9lBpK2JF2VdDSR5n5J64m0qli399hNFMUlpshQii5jbXTbHGviB0nLNeNDSd9VO4A2UdB2fp+x0eCnaXxWXGA2X0au/3HgN9P4LFCjIANOJdrLr0zzZ+BEpNYDwKbpnQMeAw4m8HjQtM6Z9qa917zPQwFr3M5KgA6J5rTJCdFZJj9/lyvGhsDvwFNVuV2MhhjrK6b9bFiE+j1r87eBl4HDwCF7/U/k+ofAX5b/EXBv5JoLMuILzf3Ap6Z3EzgdqHMCuF7hcQf4HDgeoHnccncqdK/TvSDWffFXI/exICY/xZyqc6XLWF1UFZna4gJ7q8BsRvgd2/xXpo6P+D9dfT7PpECtA3cnWPM0GXGFZh/wgWltA+cDNC7X+AP4GzjZQe+k5dRxuYPeiuXU7e1qwLpDz7dFjXKRaSwuMLvAlG8zZlG+YmiK1HoFqT7wP2z+4Q45TfEGcMt01xLoNZEBTwRqD4BLpnMLeC1A41UmVxsXgXeBayV/Wx20rpTyrpnWRft7p6O/FdqzGrDukPNtkaMoMo3FBdBSQMOnYBCReyf05s126fU9ytfX98+mY54Kxnp7S9K3kj6U9KYdG0h6UdLbkh7poFXMfUnSOyVvL0h6VtIXHbS6nOP+s/Zm9mvyXW1uuC9ohZ72E9uDmXWLJOB1GxsH+DxPftsB8B6wlGDN02TAkxG6+4D3TWsbeC5CS8CDFce+AW500LhhOW2020TRjK3b21HEmgti9m0RonxbdMZeVzV+/4tF3cBpP7E9mKHNL5q8h5g0eYsCMQz0epq8gQrwMXAgcs0FGXGFRcB9wCemF9PkbYqM/Bas7fxLwNeJPdTdpo4itQti8lPMqTpXuozVRVXPpbHI3KkNTB1NfkL81j2mvhDp91HgV9MKuRIqrykj3WPq4rHyL+axj8/qGPmTqi6F9YDlHOvJU6oYcTsh/TYSzWmTE6JT19CtLTJt32D6CmHe0eQn1O8z5AXgT4sx4Vcu0/EQecMydB8z0hUWkTd2t4CrwNEePqMBcAR4mrBbwyXLPWJa8zrXmmLEhNBmfpkuY2102xxrih+pb+ieAb6vGhuA97UcJ5KR8gZ77K+99xxeYBzH6Q3/Z0fHcXrDC4zjOL3hBcZxnN74F+zlvXFWXF9PAAAAAElFTkSuQmCC');
background-repeat: no-repeat;
background-size: 280px;
color: transparent;
display: block;
font-size: 0;
height: 20px;
line-height: 0;
width: 20px;
}
.viewer-zoom-in::before {
background-position: 0 0;
content: 'Zoom In';
}
.viewer-zoom-out::before {
background-position: -20px 0;
content: 'Zoom Out';
}
.viewer-one-to-one::before {
background-position: -40px 0;
content: 'One to One';
}
.viewer-reset::before {
background-position: -60px 0;
content: 'Reset';
}
.viewer-prev::before {
background-position: -80px 0;
content: 'Previous';
}
.viewer-play::before {
background-position: -100px 0;
content: 'Play';
}
.viewer-next::before {
background-position: -120px 0;
content: 'Next';
}
.viewer-rotate-left::before {
background-position: -140px 0;
content: 'Rotate Left';
}
.viewer-rotate-right::before {
background-position: -160px 0;
content: 'Rotate Right';
}
.viewer-flip-horizontal::before {
background-position: -180px 0;
content: 'Flip Horizontal';
}
.viewer-flip-vertical::before {
background-position: -200px 0;
content: 'Flip Vertical';
}
.viewer-fullscreen::before {
background-position: -220px 0;
content: 'Enter Full Screen';
}
.viewer-fullscreen-exit::before {
background-position: -240px 0;
content: 'Exit Full Screen';
}
.viewer-close::before {
background-position: -260px 0;
content: 'Close';
}
.viewer-container {
bottom: 0;
direction: ltr;
font-size: 0;
left: 0;
line-height: 0;
overflow: hidden;
position: absolute;
right: 0;
-webkit-tap-highlight-color: transparent;
top: 0;
-ms-touch-action: none;
touch-action: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.viewer-container::-moz-selection,
.viewer-container *::-moz-selection {
background-color: transparent;
}
.viewer-container::selection,
.viewer-container *::selection {
background-color: transparent;
}
.viewer-container img {
display: block;
height: auto;
max-height: none !important;
max-width: none !important;
min-height: 0 !important;
min-width: 0 !important;
width: 100%;
}
.viewer-canvas {
bottom: 0;
left: 0;
overflow: hidden;
position: absolute;
right: 0;
top: 0;
}
.viewer-canvas > img {
height: auto;
margin: 15px auto;
max-width: 90% !important;
width: auto;
}
.viewer-footer {
bottom: 0;
left: 0;
overflow: hidden;
position: absolute;
right: 0;
text-align: center;
}
.viewer-navbar {
background-color: rgba(0, 0, 0, 0.5);
overflow: hidden;
}
.viewer-list {
-webkit-box-sizing: content-box;
box-sizing: content-box;
height: 50px;
margin: 0;
overflow: hidden;
padding: 1px 0;
}
.viewer-list > li {
color: transparent;
cursor: pointer;
float: left;
font-size: 0;
height: 50px;
line-height: 0;
opacity: 0.5;
overflow: hidden;
-webkit-transition: opacity 0.15s;
transition: opacity 0.15s;
width: 30px;
}
.viewer-list > li:hover {
opacity: 0.75;
}
.viewer-list > li + li {
margin-left: 1px;
}
.viewer-list > .viewer-loading {
position: relative;
}
.viewer-list > .viewer-loading::after {
border-width: 2px;
height: 20px;
margin-left: -10px;
margin-top: -10px;
width: 20px;
}
.viewer-list > .viewer-active,
.viewer-list > .viewer-active:hover {
opacity: 1;
}
.viewer-player {
background-color: #000;
bottom: 0;
cursor: none;
display: none;
left: 0;
position: absolute;
right: 0;
top: 0;
}
.viewer-player > img {
left: 0;
position: absolute;
top: 0;
}
.viewer-toolbar > ul {
display: inline-block;
margin: 0 auto 5px;
overflow: hidden;
padding: 3px 0;
}
.viewer-toolbar > ul > li {
background-color: rgba(0, 0, 0, 0.5);
border-radius: 50%;
cursor: pointer;
float: left;
height: 24px;
overflow: hidden;
-webkit-transition: background-color 0.15s;
transition: background-color 0.15s;
width: 24px;
}
.viewer-toolbar > ul > li:hover {
background-color: rgba(0, 0, 0, 0.8);
}
.viewer-toolbar > ul > li::before {
margin: 2px;
}
.viewer-toolbar > ul > li + li {
margin-left: 1px;
}
.viewer-toolbar > ul > .viewer-small {
height: 18px;
margin-bottom: 3px;
margin-top: 3px;
width: 18px;
}
.viewer-toolbar > ul > .viewer-small::before {
margin: -1px;
}
.viewer-toolbar > ul > .viewer-large {
height: 30px;
margin-bottom: -3px;
margin-top: -3px;
width: 30px;
}
.viewer-toolbar > ul > .viewer-large::before {
margin: 5px;
}
.viewer-tooltip {
background-color: rgba(0, 0, 0, 0.8);
border-radius: 10px;
color: #fff;
display: none;
font-size: 12px;
height: 20px;
left: 50%;
line-height: 20px;
margin-left: -25px;
margin-top: -10px;
position: absolute;
text-align: center;
top: 50%;
width: 50px;
}
.viewer-title {
color: #ccc;
display: inline-block;
font-size: 12px;
line-height: 1;
margin: 0 5% 5px;
max-width: 90%;
opacity: 0.8;
overflow: hidden;
text-overflow: ellipsis;
-webkit-transition: opacity 0.15s;
transition: opacity 0.15s;
white-space: nowrap;
}
.viewer-title:hover {
opacity: 1;
}
.viewer-button {
background-color: rgba(0, 0, 0, 0.5);
border-radius: 50%;
cursor: pointer;
height: 80px;
overflow: hidden;
position: absolute;
right: -40px;
top: -40px;
-webkit-transition: background-color 0.15s;
transition: background-color 0.15s;
width: 80px;
}
.viewer-button:focus,
.viewer-button:hover {
background-color: rgba(0, 0, 0, 0.8);
}
.viewer-button::before {
bottom: 15px;
left: 15px;
position: absolute;
}
.viewer-fixed {
position: fixed;
}
.viewer-open {
overflow: hidden;
}
.viewer-show {
display: block;
}
.viewer-hide {
display: none;
}
.viewer-backdrop {
background-color: rgba(0, 0, 0, 0.5);
}
.viewer-invisible {
visibility: hidden;
}
.viewer-move {
cursor: move;
cursor: -webkit-grab;
cursor: grab;
}
.viewer-fade {
opacity: 0;
}
.viewer-in {
opacity: 1;
}
.viewer-transition {
-webkit-transition: all 0.3s;
transition: all 0.3s;
}
@-webkit-keyframes viewer-spinner {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes viewer-spinner {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
.viewer-loading::after {
-webkit-animation: viewer-spinner 1s linear infinite;
animation: viewer-spinner 1s linear infinite;
border: 4px solid rgba(255, 255, 255, 0.1);
border-left-color: rgba(255, 255, 255, 0.5);
border-radius: 50%;
content: '';
display: inline-block;
height: 40px;
left: 50%;
margin-left: -20px;
margin-top: -20px;
position: absolute;
top: 50%;
width: 40px;
z-index: 1;
}
@media (max-width: 767px) {
.viewer-hide-xs-down {
display: none;
}
}
@media (max-width: 991px) {
.viewer-hide-sm-down {
display: none;
}
}
@media (max-width: 1199px) {
.viewer-hide-md-down {
display: none;
}
}
@@ -27,8 +27,8 @@ perspective effects (not including the modals and the overlay).
top: 50%;
left: 50%;
width: 50%;
max-width: 551px;
min-width: 321px;
max-width: 550px;
min-width: 320px;
height: auto;
z-index: 9999999;
visibility: hidden;
@@ -24,6 +24,7 @@
<option value="2">阿里OSS</option>
<option value="3">又拍USS</option>
<option value="4">七牛云KODO</option>
<option value="6">腾讯COS</option>
</select>
</div>
</div>
@@ -48,11 +49,11 @@
</div>
<div class="layui-form-item" id="c3">
<label class="layui-form-label" id="keyusername">Endpoint</label>
<label class="layui-form-label" >Endpoint</label>
<div class="layui-input-block">
<input id="Endpoint" type="text" name="title" autocomplete="off"
class="layui-input" th:value="${Endpoint}"/>
<span style="color: #DAA5A6;">需带有http://或https://</span>
<span id="ysm" style="color: #DAA5A6;">需带有http://或https://</span>
</div>
</div>
@@ -97,7 +98,6 @@
<script>
layui.use(['form', 'layedit', 'laydate'], function () {
var form = layui.form;
//监听提交
form.on('submit(formDemo)', function (data) {
layer.msg(JSON.stringify(data.field));
@@ -105,7 +105,6 @@
});
//select选中事件
form.on('select(business)', function(data){
//alert(data.value)//获取选中的值
$("#AccessKey").val('');
$("#AccessSecret").val('');
$("#Endpoint").val('');
@@ -121,22 +120,39 @@
$("#c5").css('display','block');
$("#c6").css('display','none');
if(data.value==3){
if(data.value==1){
$("#c3").css('display','block');
$("#c3-1").css('display','none');
$("#keyusername").text('AccessKey');
$("#keypass").text('AccessSecret');
$("#c3 label").text('Endpoint');
}else if(data.value==2){
$("#c3").css('display','block');
$("#c3-1").css('display','none');
$("#keyusername").text('AccessKey');
$("#keypass").text('AccessSecret');
$("#c3 label").text('Endpoint');
}else if(data.value==3){
$("#c3").css('display','none');
$("#keyusername").text('操作员名称');
$("#keypass").text('操作员密码');
$("#c3-1").css('display','none');
}else if(data.value==4){
$("#c3").css('display','none');
$("#c3-1").css('display','block');
$("#keyusername").text('AccessKey');
$("#keypass").text('SecretKey');
}
else{
}else if(data.value=6){
$("#c3-1").css('display','none');
$("#c3 label").text('地区代码');
$("#keyusername").text('SecretId');
$("#keypass").text('SecretKey');
}else{
$("#c3").css('display','block');
$("#c3-1").css('display','none');
$("#keyusername").text('AccessKey');
$("#keypass").text('AccessSecret');
$("#c3 label").text('Endpoint');
}
}else{
$("#c1").css('display','none');
@@ -148,6 +164,12 @@
$("#c6").css('display','block');
}
if(data.value==6){
$("#ysm").text("北京地区就写ap-beijing");
}else{
$("#ysm").text("需带有http://或https:");
}
$.ajax({
type: "POST",
url: "/admin/root/getkey",
@@ -163,15 +185,6 @@
$("#RequestAddress").val(data[0].requestAddress);
}
});
// if(data.value==2){
// //阿里oss
// $("#AccessKey").val('');
// $("#AccessSecret").val('');
// $("#Endpoint").val('');
// $("#Bucketname").val('');
// $("#RequestAddress").val('');
// }
});
});
@@ -179,10 +192,24 @@
var types = [[${StorageType!=null?StorageType:0}]];
var Endpoint2=null;
$("#StorageType").find("option[value='" + types + "']").attr("selected", true);
if(types==3){
if(types==1){
$("#c3").css('display','block');
$("#c3-1").css('display','none');
$("#keyusername").text('AccessKey');
$("#keypass").text('AccessSecret');
$("#c3 label").text('Endpoint');
}else if(types==2){
$("#c3").css('display','block');
$("#c3-1").css('display','none');
$("#keyusername").text('AccessKey');
$("#keypass").text('AccessSecret');
$("#c3 label").text('Endpoint');
}else if(types==3){
$("#c3").css('display','none');
$("#c3-1").css('display','none');
$("#keyusername").text('操作员名称');
$("#keypass").text('操作员密码');
$("#c3 label").text('Endpoint');
}else if(types==4){
Endpoint2 = [[${Endpoint2}]];
@@ -190,11 +217,12 @@
$("#c3-1").css('display','block');
$("#keyusername").text('AccessKey');
$("#keypass").text('SecretKey');
$("#Endpoint2").find("option[value='" + Endpoint + "']").attr("selected", true);
$("#c3 label").text('Endpoint');
$("#Endpoint2").find("option[value='" + Endpoint2 + "']").attr("selected", true);
}else if(types==5){
Endpoint2 = [[${Endpoint2}]];
$("#keyusername").text('none');
$("#keypass").text('none');
$("#keyusername").text('AccessKey');
$("#keypass").text('SecretKey');
$("#c1").css('display','none');
$("#c2").css('display','none');
$("#c3").css('display','none');
@@ -202,13 +230,25 @@
$("#c4").css('display','none');
$("#c5").css('display','none');
$("#c6").css('display','block');
//$("#Endpoint2").find("option[value='" + Endpoint + "']").attr("selected", true);
}else if(types==6){
$("#c3").css('display','block');
$("#c3-1").css('display','none');
$("#c3 label").text('地区代码');
$("#keyusername").text('SecretId');
$("#keypass").text('SecretKey');
}
else{
$("#c3").css('display','block');
$("#c3-1").css('display','none');
$("#keyusername").text('AccessKey');
$("#keypass").text('AccessSecret');
$("#c3 label").text('Endpoint');
}
if(types==6){
$("#ysm").text("如:北京地区就写ap-beijing");
}else{
$("#ysm").text("需带有http://或https:");
}
});
@@ -222,7 +262,7 @@
var StorageType = $("#StorageType").val();
if(StorageType==3){Endpoint="0";}
else{
if(StorageType==4){Endpoint = $("#Endpoint2").val();}else{Endpoint = $("#Endpoint").val();}
if(StorageType==4){Endpoint = $("#Endpoint2").val();alert(Endpoint);}else{Endpoint = $("#Endpoint").val();}
}
if($("#StorageType").val()==5){
$.ajax({
+10 -8
View File
@@ -184,20 +184,22 @@
str = '七牛KODO';
} else if (data.source == 5) {
str = '本地存储';
}else if (data.source == 6) {
str = '腾云COS';
}else {
str = '未知';
}
$("#source").text(str);
}
});
$.ajax({
type: "GET",
url: "/getsentence",
dataType: "json",
success: function (data) {
$("#ly").text(data.hitokoto);
}
});
// $.ajax({
// type: "GET",
// url: "/getsentence",
// dataType: "json",
// success: function (data) {
// $("#ly").text(data.hitokoto);
// }
// });
})
+32 -77
View File
@@ -15,6 +15,8 @@
<link th:href="@{/static/css/sweetalert.min.css}" media="all" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" media="all" th:href="@{/static/css/daterangepicker-bs3.css}" />
<link rel="stylesheet" th:href="@{/layui/layui/css/layui.css}">
<link rel="stylesheet" th:href="@{/css/viewer.css}">
<script th:src="@{/static/js/jquery-3.4.1.min.js}" type="text/javascript"></script>
<script th:src="@{/static/js/bootstrap.min.js}" type="text/javascript"></script>
<script th:src="@{/static/js/toastr.min.js}" type="text/javascript"></script>
@@ -29,6 +31,7 @@
<script th:src="@{/static/js/moment.js}"></script>
<script th:src="@{/static/js/daterangepicker.js}"></script>
<script th:src="@{/js/viewer.min.js}"></script>
<!-- 样式 -->
<style type="text/css">
@@ -49,58 +52,8 @@
<body>
<div class="container kv-main">
<!--
<p id="" style="font-weight: bold;">本站概况</p>
<hr/>
<section class="content">
<div class="row" style="margin-bottom:5px;">
<div class="col-md-3">
<div class="sm-st clearfix">
<span class="sm-st-icon st-blue"><i class="fa fa-image"></i></span>
<div style="font-weight:500;font-family:黑体" class="sm-st-info">
<span id="counts" ></span>
本站图片总数
</div>
</div>
</div>
<div class="col-md-3">
<div class="sm-st clearfix">
<span class="sm-st-icon st-violet"><i class="fa fa-user"></i></span>
<div style="font-weight:500;font-family:黑体" class="sm-st-info">
<span id="getusertotal" >0</span>
本站用户总数
</div>
</div>
</div>
<div class="col-md-3">
<div class="sm-st clearfix">
<span class="sm-st-icon st-red"><i class="glyphicon glyphicon-ban-circle"></i></span>
<div style="font-weight:500;font-family:黑体" class="sm-st-info">
<span id="imgreviewcount" >0</span>
本站拦截非法图片
</div>
</div>
</div>
<div class="col-md-3">
<div class="sm-st clearfix">
<span class="sm-st-icon st-green"><i class="fa fa-paperclip"></i></span>
<div style="font-weight:500;font-family:黑体" class="sm-st-info">
<span id="source"></span>
系统储源源
</div>
</div>
</div>
</div>
</section>
-->
<div id="isimgs">
<!--分页 -->
<!-- <div id="mytext" style="font-weight: bold;">我的图片:-->
<!-- <span id="usercount" class="label label-info" style="font-weight: bold;font-size: 18px;">0</span>-->
<!-- </div>-->
<table class="table table-bordered ft-table table-hover" id="table_server">
<hr/>
@@ -134,6 +87,7 @@
<option value="2">阿里OSS</option>
<option value="3">又拍USS</option>
<option value="4">七牛云KODO</option>
<option value="6">腾讯COS</option>
</select>
</div>
<div class="btn-group">
@@ -227,8 +181,6 @@
// $("#source").text(str);
// }
// });
});
function screening(){
$("#table_server").bootstrapTable('destroy');
@@ -253,8 +205,6 @@
confirmButtonColor: "#A5DC86",
confirmButtonText: "确定",
cancelButtonText: "取消",
//closeOnConfirm: true,
//closeOnCancel: false
},
function (isConfirm) {
if (isConfirm) {
@@ -269,7 +219,6 @@
});
deleallimg(ids);
}
} else {//swal("取消", "你的虚拟文件是安全的:)","error");
//return;
}
@@ -384,28 +333,31 @@
}
function lookimgs(urls) {
layer.load(1);
var w = 0;
var h = 0;
var dw = document.body.clientWidth;
var dh = document.body.clientHeight;
$("#linshi").attr('src', urls);
$("#linshi").off("load");
$("#linshi").on("load", function () {
w = $(this).width();
h = $(this).height();
layer.closeAll('loading');
layer.open({
type: 1,
title: false,
closeBtn: 0,
area: 'auto',
skin: 'layui-layer-nobg', //没有背景色
shadeClose: true,
content: '<div style="width:'+ dw * 0.7 + 'px;height:auto;text-align:center;float:none;margin-left:auto;margin-right:auto;"></div><img style="height: 100%;width: 100%;max-width:' + dw * 0.7 + 'px;max-height: ' + dh * 0.7 + 'px" src="' + urls + '">'
var index=urls.lastIndexOf("\.");
var str =urls.substring(index+1,urls.length);
if(str=='png' || str=='jpg' || str=='GIF' || str=='bmp' || str=='jpeg'){
layer.load(1);
var w = 0;
var h = 0;
var dw = document.body.clientWidth;
var dh = document.body.clientHeight;
$("#linshi").attr('src', urls);
$("#linshi").off("load");
$("#linshi").on("load", function () {
w = $(this).width();
h = $(this).height();
layer.closeAll('loading');
layer.open({
type: 1,
title: false,
closeBtn: 0,
area: 'auto',
skin: 'layui-layer-nobg', //没有背景色
shadeClose: true,
content: '<div style="width:'+ dw * 0.7 + 'px;height:auto;text-align:center;float:none;margin-left:auto;margin-right:auto;"></div><img style="height: 100%;width: 100%;max-width:' + dw * 0.7 + 'px;max-height: ' + dh * 0.7 + 'px" src="' + urls + '">'
});
});
});
}
}
function fenye(url, selecttype,StorageType,starttime,stoptime) {
@@ -495,7 +447,10 @@
source = '七牛KODO';
} else if (rows.source == 5) {
source = '本地存储';
}else {
}else if (rows.source == 6) {
source = '腾讯COS';
}
else {
source = '未知';
}
return source;
+61 -8
View File
@@ -4,11 +4,11 @@
<!-- meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="Creative Coming Soon Template">
<meta name="author" content="Hitesh Jariwala">
<meta name="keywords" content="">
<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="${config.getWebname()}"></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">
@@ -53,6 +53,20 @@
-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{}
</style>
@@ -85,8 +99,10 @@
<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" onclick="tanchuang('亲爱的开发者','全新的响应式图床站如果你也喜欢希望给我一个Star\n Hellohao开发者交流群864800972','success');"
>关于<i class="fa fa-share-alt"></i></a></li>
<li><a href="javascript:;" class="md-trigger" data-modal="modal-2">赞助商&nbsp;<i class="fa fa-share-alt"></i></a></li>
<!-- <li><a class="menu-link" onclick="tanchuang('亲爱的开发者','全新的响应式图床站如果你也喜欢希望给我一个Star\n Hellohao开发者交流群864800972','success');"-->
<!-- >关于<i class="fa fa-share-alt"></i></a></li>-->
</ul>
</div>
<div class="cls">
@@ -108,7 +124,9 @@
<!-- 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"
data-section-posy="0">立即上传</a>
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>
<div class="sub-title" id="wordsrotator">
<h4>纯粹免费的图片驿站</h4>
@@ -361,8 +379,26 @@ Technology constantly updated, we will always move forward on the road ahead.
</div>
</div>
</div>
<!-- 赞助商-->
<div class="md-modal md-effect-3" id="modal-2">
<div class="md-content">
<h3>服务赞助商</h3>
<div>
<p></p>
<div class="form loginBox">
<a href="https://www.maoyuncloud.com/" target="_blank">
<img style="max-width: 33.3%;" src="http://cdn.wwery.com/tourist/4c7810718014927.png" />
</a>
</div>
</div>
</div>
</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>
@@ -740,6 +776,24 @@ Technology constantly updated, we will always move forward on the road ahead.
$("#fen").html(min);
$("#miao").html(sec);
}
function xiazai(){
swal({
title: "即将下载客户端",
text: "客户端目前支持支Windows系统Mac后期可能会推出",
icon: "success",
buttons: true,
buttons: ["取消", "下载"],
dangerMode: false,
})
.then((value) => {
if (value) {
window.open("https://hellohao.nos-eastchina1.126.net/TbedClient/Hellohao.7z");
} else {
}
});
}
//回车登录
function keyLogin(){
if (event.keyCode==13) //回车键的键值为13
@@ -748,7 +802,6 @@ Technology constantly updated, we will always move forward on the road ahead.
}
//页面模板效果
(function ($) {
"use strict";
$.bg_type = 3;