mirror of
https://github.com/Hello-hao/Tbed.git
synced 2024-04-21 12:32:10 +00:00
2019-7-21更新 支持自定义图片url格式
This commit is contained in:
+12
-10
@@ -11,7 +11,7 @@
|
||||
Target Server Version : 50720
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 21/07/2019 21:53:02
|
||||
Date: 23/07/2019 20:23:29
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@@ -35,13 +35,14 @@ CREATE TABLE `config` (
|
||||
`domain` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点域名',
|
||||
`background1` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '首页背景图',
|
||||
`background2` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '上传页面背景图',
|
||||
`sett` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of config
|
||||
-- ----------------------------
|
||||
INSERT INTO `config` VALUES (1, 5, 1, 'Hellohao图床', '网站由JAVA语言编写应用SpringBoot框架开发,前端全部组件由BootStrap/Layui框架编写。由作者个人更新维护,后期会加入更全面的功能供大家使用,如有BUG请与我反馈。', 'https://hellohao.nos-eastchina1.126.net/%E7%BD%91%E7%AB%99%E7%B4%A0%E6%9D%90/logo2.png', 'Hellohao 切勿上传违反中华人民共和国互联网法律条约资源', '<li><a href=\"http://www.hellohao.cn/\" rel=\"nofollow\" target=\"_blank\">作者博客</a></li><li><a href=\"http://bz.hellohao.cn/\" rel=\"nofollow\" target=\"_blank\">高清壁纸</a></li><li><a href=\"http://json.hellohao.cn/\" rel=\"nofollow\" target=\"_blank\">json格式化</a></li>', '也许...|这将是最好用的图床', 'console.log(\'百度统计JS代码\');', 'http://tc.hellohao.cn', 'https://hellohao.oss-cn-beijing.aliyuncs.com/Hellohao/eb83a0714030248.jpg', 'https://hellohao.oss-cn-beijing.aliyuncs.com/Hellohao/086650714030248.jpg');
|
||||
INSERT INTO `config` VALUES (1, 5, 1, 'Hellohao', '网站由JAVA语言编写应用SpringBoot框架开发,前端全部组件由BootStrap/Layui框架编写。由作者个人更新维护,后期会加入更全面的功能供大家使用,如有BUG请与我反馈。', 'https://hellohao.nos-eastchina1.126.net/%E7%BD%91%E7%AB%99%E7%B4%A0%E6%9D%90/logo2.png', 'Hellohao 切勿上传违反中华人民共和国互联网法律条约资源', '<li><a href=\"http://www.hellohao.cn/\" rel=\"nofollow\" target=\"_blank\">作者博客</a></li><li><a href=\"http://bz.hellohao.cn/\" rel=\"nofollow\" target=\"_blank\">高清壁纸</a></li><li><a href=\"http://json.hellohao.cn/\" rel=\"nofollow\" target=\"_blank\">json格式化</a></li>', '也许...|这将是最好用的图床', 'console.log(\'百度统计JS代码\');', 'http://tc.hellohao.cn', 'https://hellohao.oss-cn-beijing.aliyuncs.com/Hellohao/eb83a0714030248.jpg', 'https://hellohao.oss-cn-beijing.aliyuncs.com/Hellohao/086650714030248.jpg', NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for emailconfig
|
||||
@@ -77,7 +78,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 = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for imgreview
|
||||
@@ -103,13 +104,13 @@ INSERT INTO `imgreview` VALUES (1, NULL, NULL, NULL, 0, 0);
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `keys`;
|
||||
CREATE TABLE `keys` (
|
||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`AccessKey` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`AccessSecret` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`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) NOT NULL COMMENT '1网易2阿里3又拍4七牛5本地6腾讯',
|
||||
`storageType` int(11) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
@@ -147,13 +148,14 @@ CREATE TABLE `uploadconfig` (
|
||||
`imgcounttourists` int(10) NULL DEFAULT NULL COMMENT '游客文件总数量, 超出则不允许加入队列',
|
||||
`imgcountuser` int(10) NULL DEFAULT NULL COMMENT '用户文件总数量, 超出则不允许加入队列',
|
||||
`suffix` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '支持后缀',
|
||||
`urltype` int(2) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of uploadconfig
|
||||
-- ----------------------------
|
||||
INSERT INTO `uploadconfig` VALUES (1, 3, 5, 1, 5, 'gif,jpg,jpeg,bmp,png');
|
||||
INSERT INTO `uploadconfig` VALUES (1, 3, 5, 1, 5, 'gif,jpg,jpeg,bmp,png', 1);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for user
|
||||
@@ -164,8 +166,8 @@ CREATE TABLE `user` (
|
||||
`username` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
|
||||
`password` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
|
||||
`email` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '邮箱',
|
||||
`birthder` date NOT NULL COMMENT '注册时间',
|
||||
`level` int(10) NOT NULL COMMENT '等级',
|
||||
`birthder` datetime(0) NULL DEFAULT NULL COMMENT '注册时间',
|
||||
`level` int(10) NULL DEFAULT NULL COMMENT '等级',
|
||||
`uid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户唯一标识',
|
||||
`isok` int(2) NOT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
@@ -174,6 +176,6 @@ CREATE TABLE `user` (
|
||||
-- ----------------------------
|
||||
-- Records of user
|
||||
-- ----------------------------
|
||||
INSERT INTO `user` VALUES (1, 'admin', 'admin', 'admin', '2019-06-12', 2, 'admin', 1);
|
||||
INSERT INTO `user` VALUES (1, 'admin', 'admin', 'admin', '2019-06-12 00:00:00', 2, 'admin', 1);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
package cn.hellohao.controller;
|
||||
|
||||
import cn.hellohao.pojo.*;
|
||||
import cn.hellohao.service.ConfigService;
|
||||
import cn.hellohao.service.KeysService;
|
||||
import cn.hellohao.service.UploadConfigService;
|
||||
import cn.hellohao.service.UserService;
|
||||
import cn.hellohao.service.impl.KODOImageupload;
|
||||
import cn.hellohao.service.impl.NOSImageupload;
|
||||
import cn.hellohao.service.impl.OSSImageupload;
|
||||
import cn.hellohao.service.impl.USSImageupload;
|
||||
import cn.hellohao.utils.*;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Hellohao
|
||||
* @version 1.0
|
||||
* @date 2019-07-18 17:22
|
||||
*/
|
||||
@RestController
|
||||
public class ClientController {
|
||||
@Autowired
|
||||
private NOSImageupload nOSImageupload;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private KeysService keysService;
|
||||
@Autowired
|
||||
private OSSImageupload ossImageupload;
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
@Autowired
|
||||
private USSImageupload ussImageupload;
|
||||
@Autowired
|
||||
private KODOImageupload kodoImageupload;
|
||||
@Autowired
|
||||
private UploadConfigService uploadConfigService;
|
||||
|
||||
//@PostMapping(value = "/clientupimg")
|
||||
@ResponseBody
|
||||
public String clientupimg(@RequestParam("file") List<MultipartFile> file, String email,String pass) throws Exception {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
|
||||
|
||||
if(email!=null && pass!=null){
|
||||
Integer ret = userService.login(email, pass);
|
||||
if (ret > 0) {
|
||||
User user = userService.getUsers(email);
|
||||
if (user.getIsok() == 1) {
|
||||
User u = userService.getUsers(email);
|
||||
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
|
||||
Keys key = keysService.selectKeys(config.getSourcekey());
|
||||
|
||||
if(key.getStorageType()!=0 && key.getStorageType()!=null){
|
||||
if(key.getStorageType()==1){
|
||||
nOSImageupload.Initialize(key);//实例化网易
|
||||
}else if (key.getStorageType()==2){
|
||||
OSSImageupload.Initialize(key);
|
||||
}else if(key.getStorageType()==3){
|
||||
USSImageupload.Initialize(key);
|
||||
}else if(key.getStorageType()==4){
|
||||
KODOImageupload.Initialize(key);
|
||||
}else{
|
||||
System.err.println("客户端:未获取到对象存储参数,初始化失败。");
|
||||
}
|
||||
}
|
||||
Print.Normal("客户端:初始化上传。");
|
||||
Boolean b = StringUtils.doNull(key);//判断对象是否有空值
|
||||
if(b){
|
||||
long stime = System.currentTimeMillis();
|
||||
|
||||
String userpath = "tourist";
|
||||
if(uploadConfig.getUrltype()==2){
|
||||
java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy/MM/dd");
|
||||
userpath = dateFormat.format(new Date());
|
||||
}else{
|
||||
if (u != null) {
|
||||
userpath = u.getUsername();
|
||||
}
|
||||
}
|
||||
Map<String, MultipartFile> map = new HashMap<>();
|
||||
for (MultipartFile multipartFile : file) {
|
||||
//获取文件名
|
||||
System.out.println(multipartFile.toString());
|
||||
String fileName = multipartFile.getOriginalFilename();
|
||||
String lastname = fileName.substring(fileName.lastIndexOf(".") + 1);//获取文件后缀
|
||||
if (!multipartFile.isEmpty()) { //判断文件是否为空
|
||||
map.put(lastname, multipartFile);
|
||||
}
|
||||
}
|
||||
Map<String, Integer> m = null;
|
||||
Map<ReturnImage, Integer> m2 = null;
|
||||
if(key.getStorageType()==1){
|
||||
m = nOSImageupload.clientuploadNOS(map, userpath);
|
||||
}else if (key.getStorageType()==2){
|
||||
m = ossImageupload.clientuploadOSS(map, userpath);
|
||||
}else if(key.getStorageType()==3){
|
||||
m = ussImageupload.clientuploadUSS(map, userpath);
|
||||
}else if(key.getStorageType()==4){
|
||||
m = kodoImageupload.clientuploadKODO(map, userpath);
|
||||
}else if(key.getStorageType()==5){
|
||||
m2 = LocUpdateImg.ImageuploadLOC(map, userpath,null);
|
||||
}else{
|
||||
System.err.println("未获取到对象存储参数,上传失败。");
|
||||
}
|
||||
Images img = new Images();
|
||||
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
|
||||
String times = df.format(new Date());
|
||||
System.out.println("上传图片的时间是:"+times);
|
||||
if(key.getStorageType()==5){
|
||||
for (Map.Entry<ReturnImage, Integer> entry : m2.entrySet()) {
|
||||
if(key.getStorageType()==5){
|
||||
if(config.getDomain()!=null){
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
|
||||
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
|
||||
}else{
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
|
||||
img.setImgurl("http://"+ IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
|
||||
}
|
||||
}else{
|
||||
jsonArray.add(entry.getKey().getImgurl());
|
||||
img.setImgurl(entry.getKey().getImgurl());//图片链接
|
||||
}
|
||||
img.setUpdatetime(times);
|
||||
img.setSource(key.getStorageType());
|
||||
if (u == null) {
|
||||
img.setUserid(0);//用户id
|
||||
} else {
|
||||
img.setUserid(u.getId());//用户id
|
||||
}
|
||||
img.setSizes((entry.getValue()));
|
||||
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
|
||||
img.setAbnormal(0);
|
||||
userService.insertimg(img);
|
||||
long etime = System.currentTimeMillis();
|
||||
System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
|
||||
}
|
||||
}else{
|
||||
for (Map.Entry<String, Integer> entry : m.entrySet()) {
|
||||
if(key.getStorageType()==5){
|
||||
if(config.getDomain()!=null){
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey());
|
||||
img.setImgurl(config.getDomain()+"/links/"+entry.getKey());//图片链接
|
||||
}else{
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey());
|
||||
img.setImgurl("http://"+ IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey());//图片链接
|
||||
}
|
||||
}else{
|
||||
jsonArray.add(entry.getKey());
|
||||
img.setImgurl(entry.getKey());//图片链接
|
||||
}
|
||||
img.setUpdatetime(times);
|
||||
img.setSource(key.getStorageType());
|
||||
if (u == null) {
|
||||
img.setUserid(0);//用户id
|
||||
} else {
|
||||
img.setUserid(u.getId());//用户id
|
||||
}
|
||||
img.setSizes((entry.getValue()));
|
||||
img.setImgname(SetText.getSubString(entry.getKey(), key.getRequestAddress() + "/", ""));
|
||||
img.setAbnormal(0);
|
||||
userService.insertimg(img);
|
||||
long etime = System.currentTimeMillis();
|
||||
System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
jsonArray.add(-1);
|
||||
}
|
||||
Print.Normal(jsonArray.toString());
|
||||
}
|
||||
|
||||
}else{
|
||||
//邮箱或密码不正确,登录失败
|
||||
jsonArray.add(-2);
|
||||
}
|
||||
}else{
|
||||
//邮箱、密码为空
|
||||
jsonArray.add(-3);
|
||||
}
|
||||
return jsonArray.toString();
|
||||
}
|
||||
|
||||
@GetMapping (value = "/notices")
|
||||
@ResponseBody
|
||||
public String notices() throws Exception {
|
||||
|
||||
return "-1";//-1就是没有公告,客户端不显示
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class UpdateImgController {
|
||||
@RequestMapping({"/", "/index"})
|
||||
public String indexImg(Model model, HttpSession httpSession) {
|
||||
Print.Normal("欢迎使用Hellohao图床源码。者也许是最好用的java图床项目。");
|
||||
Print.warning("当前项目路径:"+System.getProperty("user.dir"));
|
||||
Print.Normal("当前项目路径:"+System.getProperty("user.dir"));
|
||||
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
|
||||
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
|
||||
Integer filesizetourists = 0;
|
||||
@@ -123,15 +123,23 @@ public class UpdateImgController {
|
||||
public String upimg( HttpSession session
|
||||
, @RequestParam(value = "file", required = false) MultipartFile[] file) throws Exception {
|
||||
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
|
||||
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
Keys key = keysService.selectKeys(config.getSourcekey());
|
||||
Boolean b = StringUtils.doNull(key);//判断对象是否有空值
|
||||
|
||||
if(b){
|
||||
long stime = System.currentTimeMillis();
|
||||
User u = (User) session.getAttribute("user");
|
||||
String username = "tourist";
|
||||
if (u != null) {
|
||||
username = u.getUsername();
|
||||
String userpath = "tourist";
|
||||
if(uploadConfig.getUrltype()==2){
|
||||
java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy/MM/dd");
|
||||
userpath = dateFormat.format(new Date());
|
||||
}else{
|
||||
if (u != null) {
|
||||
userpath = u.getUsername();
|
||||
}
|
||||
}
|
||||
Map<String, MultipartFile> map = new HashMap<>();
|
||||
for (MultipartFile multipartFile : file) {
|
||||
@@ -145,19 +153,19 @@ public class UpdateImgController {
|
||||
//multipartFile.getSize(); //文件大小
|
||||
}
|
||||
}
|
||||
Map<String, Integer> m = null;
|
||||
Map<ReturnImage, Integer> m = null;
|
||||
if(key.getStorageType()==1){
|
||||
m = nOSImageupload.Imageupload(map, username,null);
|
||||
m = nOSImageupload.Imageupload(map, userpath,null);
|
||||
}else if (key.getStorageType()==2){
|
||||
m = ossImageupload.ImageuploadOSS(map, username,null);
|
||||
m = ossImageupload.ImageuploadOSS(map, userpath,null);
|
||||
}else if(key.getStorageType()==3){
|
||||
m = ussImageupload.ImageuploadUSS(map, username,null);
|
||||
m = ussImageupload.ImageuploadUSS(map, userpath,null);
|
||||
}else if(key.getStorageType()==4){
|
||||
m = kodoImageupload.ImageuploadKODO(map, username,null);
|
||||
m = kodoImageupload.ImageuploadKODO(map, userpath,null);
|
||||
}else if(key.getStorageType()==5){
|
||||
m = LocUpdateImg.ImageuploadLOC(map, username,null);
|
||||
m = LocUpdateImg.ImageuploadLOC(map, userpath,null);
|
||||
}else if(key.getStorageType()==6){
|
||||
m = cosImageupload.ImageuploadCOS(map, username,null);
|
||||
m = cosImageupload.ImageuploadCOS(map, userpath,null);
|
||||
}
|
||||
else{
|
||||
System.err.println("未获取到对象存储参数,上传失败。");
|
||||
@@ -166,20 +174,26 @@ public class UpdateImgController {
|
||||
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
|
||||
String times = df.format(new Date());
|
||||
System.out.println("上传图片的时间是:"+times);
|
||||
for (Map.Entry<String, Integer> entry : m.entrySet()) {
|
||||
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
|
||||
if(key.getStorageType()==5){
|
||||
if(config.getDomain()!=null){
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey());
|
||||
img.setImgurl(config.getDomain()+"/links/"+entry.getKey());//图片链接
|
||||
jsonObject.put("imgurls",config.getDomain()+"/links/"+entry.getKey().getImgurl());
|
||||
jsonObject.put("imgnames",entry.getKey().getImgname());
|
||||
//jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
|
||||
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
|
||||
}else{
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey());
|
||||
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey());//图片链接
|
||||
jsonObject.put("imgurls",config.getDomain()+"/links/"+entry.getKey().getImgurl());
|
||||
jsonObject.put("imgnames",entry.getKey().getImgname());
|
||||
//jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
|
||||
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
|
||||
}
|
||||
}else{
|
||||
jsonArray.add(entry.getKey());
|
||||
img.setImgurl(entry.getKey());//图片链接
|
||||
jsonObject.put("imgurls",entry.getKey().getImgurl());
|
||||
jsonObject.put("imgnames",entry.getKey().getImgname());
|
||||
//jsonArray.add(entry.getKey());
|
||||
img.setImgurl(entry.getKey().getImgurl());//图片链接
|
||||
}
|
||||
|
||||
jsonArray.add(jsonObject);
|
||||
img.setUpdatetime(times);
|
||||
img.setSource(key.getStorageType());
|
||||
if (u == null) {
|
||||
@@ -188,15 +202,18 @@ public class UpdateImgController {
|
||||
img.setUserid(u.getId());//用户id
|
||||
}
|
||||
img.setSizes((entry.getValue()) / 1024);
|
||||
img.setImgname(SetText.getSubString(entry.getKey(), key.getRequestAddress() + "/", ""));
|
||||
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
|
||||
img.setAbnormal(0);
|
||||
userService.insertimg(img);
|
||||
long etime = System.currentTimeMillis();
|
||||
System.out.println("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
|
||||
}
|
||||
|
||||
}else{
|
||||
jsonArray.add(-1);
|
||||
//jsonArray.add(-1);
|
||||
jsonObject.put("imgurls",-1);
|
||||
}
|
||||
|
||||
//开辟新进程鉴黄。现在已经改成定时器
|
||||
//查询鉴黄功能是否启动,1为启用
|
||||
// Imgreview imgreview = imgreviewService.selectByPrimaryKey(1);
|
||||
@@ -205,9 +222,9 @@ public class UpdateImgController {
|
||||
// JianHuangThread thread = new JianHuangThread(imgreviewService, key, u, m);
|
||||
// thread.start();
|
||||
// }
|
||||
Print.Normal(jsonArray.toString());
|
||||
System.out.println(jsonArray.toString());
|
||||
|
||||
return jsonArray.toString();
|
||||
return jsonObject.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -216,17 +233,20 @@ public class UpdateImgController {
|
||||
@PostMapping(value = "/upurlimg")
|
||||
@ResponseBody
|
||||
public String upurlimg(HttpSession session, String imgurl, HttpServletRequest request) throws Exception {
|
||||
|
||||
User u = (User) session.getAttribute("user");
|
||||
String username = "tourist";
|
||||
|
||||
if (u != null) {
|
||||
username = u.getUsername();
|
||||
}
|
||||
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
|
||||
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
|
||||
User u = (User) session.getAttribute("user");
|
||||
String userpath = "tourist";
|
||||
if(uploadConfig.getUrltype()==2){
|
||||
java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy/MM/dd");
|
||||
userpath = dateFormat.format(new Date());
|
||||
}else{
|
||||
if (u != null) {
|
||||
userpath = u.getUsername();
|
||||
}
|
||||
}
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
Keys key = keysService.selectKeys(config.getSourcekey());
|
||||
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
|
||||
long imgsize = ImgUrlUtil.getFileLength(imgurl);
|
||||
Integer youke = uploadConfig.getFilesizetourists();
|
||||
Integer yonghu = uploadConfig.getFilesizeuser();
|
||||
@@ -259,19 +279,19 @@ public class UpdateImgController {
|
||||
if(!ooo.equals("0000")){
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
|
||||
Map<String, Integer> m = null;
|
||||
Map<ReturnImage, Integer> m = null;
|
||||
if(key.getStorageType()==1){
|
||||
m = nOSImageupload.Imageupload(null, username,map);
|
||||
m = nOSImageupload.Imageupload(null, userpath,map);
|
||||
}else if (key.getStorageType()==2){
|
||||
m = ossImageupload.ImageuploadOSS(null, username,map);
|
||||
m = ossImageupload.ImageuploadOSS(null, userpath,map);
|
||||
}else if(key.getStorageType()==3){
|
||||
m = ussImageupload.ImageuploadUSS(null, username,map);
|
||||
m = ussImageupload.ImageuploadUSS(null, userpath,map);
|
||||
}else if(key.getStorageType()==4){
|
||||
m = kodoImageupload.ImageuploadKODO(null, username,map);
|
||||
m = kodoImageupload.ImageuploadKODO(null, userpath,map);
|
||||
}else if(key.getStorageType()==5){
|
||||
m = LocUpdateImg.ImageuploadLOC(null,username,map);
|
||||
m = LocUpdateImg.ImageuploadLOC(null,userpath,map);
|
||||
}else if(key.getStorageType()==6){
|
||||
m = cosImageupload.ImageuploadCOS(null,username,map);
|
||||
m = cosImageupload.ImageuploadCOS(null,userpath,map);
|
||||
}
|
||||
else{
|
||||
System.err.println("未获取到对象存储参数,上传失败。");
|
||||
@@ -280,17 +300,17 @@ public class UpdateImgController {
|
||||
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
|
||||
String times = df.format(new Date());
|
||||
System.out.println("上传图片的时间是:"+times);
|
||||
for (Map.Entry<String, Integer> entry : m.entrySet()) {
|
||||
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
|
||||
if(key.getStorageType()==5){
|
||||
if(config.getDomain()!=null){
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey());
|
||||
img.setImgurl(config.getDomain()+"/links/"+entry.getKey());//图片链接
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
|
||||
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
|
||||
}else{
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey());
|
||||
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey());//图片链接
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
|
||||
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
|
||||
}
|
||||
}else{
|
||||
jsonArray.add(entry.getKey());
|
||||
jsonArray.add(entry.getKey().getImgurl());
|
||||
}
|
||||
//img.setImgurl(entry.getKey());//图片链接
|
||||
img.setUpdatetime(times);
|
||||
@@ -301,7 +321,7 @@ public class UpdateImgController {
|
||||
img.setUserid(u.getId());//用户id
|
||||
}
|
||||
img.setSizes((entry.getValue()));
|
||||
img.setImgname(SetText.getSubString(entry.getKey(), key.getRequestAddress() + "/", ""));
|
||||
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
|
||||
img.setAbnormal(0);
|
||||
userService.insertimg(img);
|
||||
long etime = System.currentTimeMillis();
|
||||
@@ -341,19 +361,19 @@ public class UpdateImgController {
|
||||
if(!xxx.equals("0000")){
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put(ooo, request.getSession().getServletContext().getRealPath("/")+"/hellohaotmp/"+uuid);
|
||||
Map<String, Integer> m = null;
|
||||
Map<ReturnImage, Integer> m = null;
|
||||
if(key.getStorageType()==1){
|
||||
m = nOSImageupload.Imageupload(null, username,map);
|
||||
m = nOSImageupload.Imageupload(null, userpath,map);
|
||||
}else if (key.getStorageType()==2){
|
||||
m = ossImageupload.ImageuploadOSS(null, username,map);
|
||||
m = ossImageupload.ImageuploadOSS(null, userpath,map);
|
||||
}else if(key.getStorageType()==3){
|
||||
m = ussImageupload.ImageuploadUSS(null, username,map);
|
||||
m = ussImageupload.ImageuploadUSS(null, userpath,map);
|
||||
}else if(key.getStorageType()==4){
|
||||
m = kodoImageupload.ImageuploadKODO(null, username,map);
|
||||
m = kodoImageupload.ImageuploadKODO(null, userpath,map);
|
||||
}else if(key.getStorageType()==5){
|
||||
m =LocUpdateImg.ImageuploadLOC(null,username, map);
|
||||
m =LocUpdateImg.ImageuploadLOC(null,userpath, map);
|
||||
}else if(key.getStorageType()==6){
|
||||
m =cosImageupload.ImageuploadCOS(null,username, map);
|
||||
m =cosImageupload.ImageuploadCOS(null,userpath, map);
|
||||
}
|
||||
else{
|
||||
System.err.println("未获取到对象存储参数,上传失败。");
|
||||
@@ -362,17 +382,17 @@ public class UpdateImgController {
|
||||
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
|
||||
String times = df.format(new Date());
|
||||
System.out.println("上传图片的时间是:"+times);
|
||||
for (Map.Entry<String, Integer> entry : m.entrySet()) {
|
||||
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
|
||||
if(key.getStorageType()==5){
|
||||
if(config.getDomain()!=null){
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey());
|
||||
img.setImgurl(config.getDomain()+"/links/"+entry.getKey());//图片链接
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
|
||||
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());//图片链接
|
||||
}else{
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey());
|
||||
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey());//图片链接
|
||||
jsonArray.add(config.getDomain()+"/links/"+entry.getKey().getImgurl());
|
||||
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
|
||||
}
|
||||
}else{
|
||||
jsonArray.add(entry.getKey());
|
||||
jsonArray.add(entry.getKey().getImgurl());
|
||||
}
|
||||
//img.setImgurl(entry.getKey());//图片链接
|
||||
img.setUpdatetime(times);
|
||||
@@ -383,7 +403,7 @@ public class UpdateImgController {
|
||||
img.setUserid(u.getId());//用户id
|
||||
}
|
||||
img.setSizes((entry.getValue()));
|
||||
img.setImgname(SetText.getSubString(entry.getKey(), key.getRequestAddress() + "/", ""));
|
||||
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
|
||||
img.setAbnormal(0);
|
||||
userService.insertimg(img);
|
||||
long etime = System.currentTimeMillis();
|
||||
|
||||
@@ -14,12 +14,13 @@ public class Config {
|
||||
private String domain;
|
||||
private String background1;
|
||||
private String background2;
|
||||
private String sett;
|
||||
|
||||
|
||||
public Config() {
|
||||
}
|
||||
|
||||
public Config(Integer id, Integer sourcekey, Integer emails, String webname, String explain, String logos, String footed, String links, String notice, String baidu, String domain, String background1, String background2) {
|
||||
public Config(Integer id, Integer sourcekey, Integer emails, String webname, String explain, String logos, String footed, String links, String notice, String baidu, String domain, String background1, String background2, String sett) {
|
||||
this.id = id;
|
||||
this.sourcekey = sourcekey;
|
||||
this.emails = emails;
|
||||
@@ -33,6 +34,7 @@ public class Config {
|
||||
this.domain = domain;
|
||||
this.background1 = background1;
|
||||
this.background2 = background2;
|
||||
this.sett = sett;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@@ -138,4 +140,12 @@ public class Config {
|
||||
public void setBackground2(String background2) {
|
||||
this.background2 = background2;
|
||||
}
|
||||
|
||||
public String getSett() {
|
||||
return sett;
|
||||
}
|
||||
|
||||
public void setSett(String sett) {
|
||||
this.sett = sett;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.hellohao.pojo;
|
||||
|
||||
/**
|
||||
* @author Hellohao
|
||||
* @version 1.0
|
||||
* @date 2019-07-22 11:35
|
||||
*/
|
||||
public class ReturnImage {
|
||||
private String imgurl;
|
||||
private String imgname;
|
||||
|
||||
public ReturnImage() {
|
||||
}
|
||||
|
||||
public ReturnImage(String imgurl, String imgname) {
|
||||
this.imgurl = imgurl;
|
||||
this.imgname = imgname;
|
||||
}
|
||||
|
||||
public String getImgurl() {
|
||||
return imgurl;
|
||||
}
|
||||
|
||||
public void setImgurl(String imgurl) {
|
||||
this.imgurl = imgurl;
|
||||
}
|
||||
|
||||
public String getImgname() {
|
||||
return imgname;
|
||||
}
|
||||
|
||||
public void setImgname(String imgname) {
|
||||
this.imgname = imgname;
|
||||
}
|
||||
}
|
||||
@@ -6,16 +6,18 @@ public class UploadConfig {
|
||||
private Integer filesizeuser;
|
||||
private Integer imgcounttourists;
|
||||
private Integer imgcountuser;
|
||||
private Integer urltype;
|
||||
|
||||
public UploadConfig() {
|
||||
}
|
||||
|
||||
public UploadConfig(String suffix, Integer filesizetourists, Integer filesizeuser, Integer imgcounttourists, Integer imgcountuser) {
|
||||
public UploadConfig(String suffix, Integer filesizetourists, Integer filesizeuser, Integer imgcounttourists, Integer imgcountuser, Integer urltype) {
|
||||
this.suffix = suffix;
|
||||
this.filesizetourists = filesizetourists;
|
||||
this.filesizeuser = filesizeuser;
|
||||
this.imgcounttourists = imgcounttourists;
|
||||
this.imgcountuser = imgcountuser;
|
||||
this.urltype = urltype;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
@@ -57,4 +59,12 @@ public class UploadConfig {
|
||||
public void setImgcountuser(Integer imgcountuser) {
|
||||
this.imgcountuser = imgcountuser;
|
||||
}
|
||||
|
||||
public Integer getUrltype() {
|
||||
return urltype;
|
||||
}
|
||||
|
||||
public void setUrltype(Integer urltype) {
|
||||
this.urltype = urltype;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.hellohao.quartz;
|
||||
|
||||
import org.quartz.Trigger;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
|
||||
@@ -12,6 +13,10 @@ import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
|
||||
@Configuration
|
||||
public class QuartzConfigration {
|
||||
//直接读取properties文件的值
|
||||
@Value("${Expression}")
|
||||
private String Expression;
|
||||
|
||||
@Bean(name = "jobDetail")
|
||||
public MethodInvokingJobDetailFactoryBean detailFactoryBean(SchedulerTask task) {
|
||||
// ScheduleTask为需要执行的任务
|
||||
@@ -59,7 +64,8 @@ public class QuartzConfigration {
|
||||
public CronTriggerFactoryBean cronJobTrigger(MethodInvokingJobDetailFactoryBean jobDetail) {
|
||||
CronTriggerFactoryBean tigger = new CronTriggerFactoryBean();
|
||||
tigger.setJobDetail(jobDetail.getObject());
|
||||
tigger.setCronExpression("0 30 04 * * ?");// 表示每天七点半执行
|
||||
tigger.setCronExpression((Expression));
|
||||
//tigger.setCronExpression("0 30 04 * * ?");// 表示每天七点半执行
|
||||
//tigger.setCronExpression(("0 0/3 * * * ?"));//每三分钟
|
||||
//tigger.setCronExpression("*/5 * * * * ?");//每五秒执行一次
|
||||
//tigger.set
|
||||
|
||||
@@ -103,14 +103,10 @@ public class SchedulerTask {
|
||||
System.err.println("存在色情图片,删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.hellohao.service.impl;
|
||||
|
||||
import cn.hellohao.pojo.Keys;
|
||||
import cn.hellohao.pojo.ReturnImage;
|
||||
import cn.hellohao.utils.ImgUrlUtil;
|
||||
import cn.hellohao.utils.Print;
|
||||
import com.netease.cloud.auth.BasicCredentials;
|
||||
@@ -31,11 +32,11 @@ public class COSImageupload {
|
||||
static COSClient cosClient;
|
||||
static Keys key;
|
||||
|
||||
public Map<String, Integer> ImageuploadCOS(Map<String, MultipartFile> fileMap, String username,Map<String, String> fileMap2) throws Exception {
|
||||
public Map<ReturnImage, 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<>();
|
||||
Map<ReturnImage, 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");
|
||||
@@ -48,7 +49,11 @@ public class COSImageupload {
|
||||
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()));
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
returnImage.setImgname(entry.getValue().getOriginalFilename());
|
||||
returnImage.setImgurl(key.getRequestAddress() + "/" + userkey);
|
||||
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
|
||||
|
||||
} catch (CosServiceException serverException) {
|
||||
serverException.printStackTrace();
|
||||
} catch (CosClientException clientException) {
|
||||
@@ -57,7 +62,7 @@ public class COSImageupload {
|
||||
}
|
||||
return ImgUrl;
|
||||
}else{
|
||||
Map<String, Integer> ImgUrl = new HashMap<>();
|
||||
Map<ReturnImage, Integer> ImgUrl = new HashMap<>();
|
||||
//设置Header
|
||||
ObjectMetadata meta = new ObjectMetadata();
|
||||
meta.setHeader("Content-Disposition", "inline");
|
||||
@@ -73,7 +78,10 @@ public class COSImageupload {
|
||||
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)));
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
returnImage.setImgurl(key.getRequestAddress() + "/" + userkey);
|
||||
|
||||
ImgUrl.put(returnImage, ImgUrlUtil.getFileSize2(new File(imgurl)));
|
||||
boolean bb= new File(imgurl).getAbsoluteFile().delete();
|
||||
Print.Normal("删除情况"+bb);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.hellohao.service.impl;
|
||||
|
||||
import cn.hellohao.pojo.Keys;
|
||||
import cn.hellohao.pojo.ReturnImage;
|
||||
import cn.hellohao.utils.ImgUrlUtil;
|
||||
import com.aliyun.oss.OSSClient;
|
||||
import com.aliyun.oss.model.ObjectMetadata;
|
||||
@@ -28,11 +29,11 @@ public class KODOImageupload {
|
||||
static UploadManager uploadManager;
|
||||
static Keys key;
|
||||
|
||||
public Map<String, Integer> ImageuploadKODO(Map<String, MultipartFile> fileMap, String username,Map<String, String> fileMap2) throws Exception {
|
||||
public Map<ReturnImage, Integer> ImageuploadKODO(Map<String, MultipartFile> fileMap, String username, Map<String, String> fileMap2) throws Exception {
|
||||
// 要上传文件的路径
|
||||
if(fileMap2==null){
|
||||
File file = null;
|
||||
Map<String, Integer> ImgUrl = new HashMap<>();
|
||||
Map<ReturnImage, Integer> ImgUrl = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
|
||||
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
|
||||
@@ -46,7 +47,10 @@ public class KODOImageupload {
|
||||
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()));
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
returnImage.setImgname(entry.getValue().getOriginalFilename());
|
||||
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
|
||||
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
|
||||
//System.out.println(putRet.hash);
|
||||
} catch (QiniuException ex) {
|
||||
Response r = ex.response;
|
||||
@@ -60,7 +64,7 @@ public class KODOImageupload {
|
||||
}
|
||||
return ImgUrl;
|
||||
}else{
|
||||
Map<String, Integer> ImgUrl = new HashMap<>();
|
||||
Map<ReturnImage, Integer> ImgUrl = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, String> entry : fileMap2.entrySet()) {
|
||||
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
|
||||
@@ -73,7 +77,9 @@ public class KODOImageupload {
|
||||
Response response = uploadManager.put(new File(imgurl),username + "/" + uuid+times + "." + entry.getKey(),upToken);
|
||||
//解析上传成功的结果
|
||||
DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
|
||||
ImgUrl.put(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey(), ImgUrlUtil.getFileSize2(new File(imgurl)));
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
|
||||
ImgUrl.put(returnImage, ImgUrlUtil.getFileSize2(new File(imgurl)));
|
||||
//System.out.println(putRet.hash);
|
||||
new File(imgurl).delete();
|
||||
} catch (QiniuException ex) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import cn.hellohao.pojo.ReturnImage;
|
||||
import cn.hellohao.utils.ImgUrlUtil;
|
||||
import cn.hellohao.utils.Print;
|
||||
import com.netease.cloud.services.nos.model.ObjectMetadata;
|
||||
@@ -39,11 +40,11 @@ public class NOSImageupload {
|
||||
static NosClient nosClient;
|
||||
static Keys key;
|
||||
|
||||
public Map<String, Integer> Imageupload(Map<String, MultipartFile> fileMap, String username,Map<String, String> fileMap2) throws Exception {
|
||||
public Map<ReturnImage, Integer> Imageupload(Map<String, MultipartFile> fileMap, String username,Map<String, String> fileMap2) throws Exception {
|
||||
// 要上传文件的路径
|
||||
if(fileMap2==null){
|
||||
File file = null;
|
||||
Map<String, Integer> ImgUrl = new HashMap<>();
|
||||
Map<ReturnImage, 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");
|
||||
@@ -51,15 +52,17 @@ public class NOSImageupload {
|
||||
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()));
|
||||
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
returnImage.setImgname(entry.getValue().getOriginalFilename());
|
||||
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
|
||||
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
|
||||
} catch (Exception e) {
|
||||
System.out.println("上传报错:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
return ImgUrl;
|
||||
}else{
|
||||
Map<String, Integer> ImgUrl = new HashMap<>();
|
||||
Map<ReturnImage, Integer> ImgUrl = new HashMap<>();
|
||||
//设置Header
|
||||
ObjectMetadata meta = new ObjectMetadata();
|
||||
meta.setHeader("Content-Disposition", "inline");
|
||||
@@ -88,7 +91,10 @@ public class NOSImageupload {
|
||||
//nosClient.putObject(BarrelName, username + "/" + uuid+times + "." + entry.getKey(), new File(imgurl));
|
||||
//new FileInputStream(file)
|
||||
nosClient.putObject(BarrelName, username + "/" + uuid+times + "." + entry.getKey(), fileInputStream,meta);
|
||||
ImgUrl.put(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey(), ImgUrlUtil.getFileSize2(new File(imgurl)));
|
||||
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
|
||||
ImgUrl.put(returnImage, ImgUrlUtil.getFileSize2(new File(imgurl)));
|
||||
|
||||
boolean bb= new File(imgurl).getAbsoluteFile().delete();
|
||||
Print.Normal("删除情况"+bb);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.hellohao.service.impl;
|
||||
|
||||
import cn.hellohao.pojo.Keys;
|
||||
import cn.hellohao.pojo.ReturnImage;
|
||||
import cn.hellohao.utils.ImgUrlUtil;
|
||||
import cn.hellohao.utils.Print;
|
||||
import com.aliyun.oss.OSSClient;
|
||||
@@ -20,10 +21,10 @@ public class OSSImageupload {
|
||||
static OSSClient ossClient;
|
||||
static Keys key;
|
||||
|
||||
public Map<String, Integer> ImageuploadOSS(Map<String, MultipartFile> fileMap, String username,Map<String, String> fileMap2) throws Exception {
|
||||
public Map<ReturnImage, 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<>();
|
||||
Map<ReturnImage, Integer> ImgUrl = new HashMap<>();
|
||||
//设置Header
|
||||
ObjectMetadata meta = new ObjectMetadata();
|
||||
meta.setHeader("Content-Disposition", "inline");
|
||||
@@ -49,14 +50,17 @@ public class OSSImageupload {
|
||||
// 上传文件流。
|
||||
System.out.println("待上传的图片:"+username + "/" + uuid+times + "." + entry.getKey());
|
||||
ossClient.putObject(key.getBucketname(), username + "/" + uuid+times + "." + entry.getKey(),file,meta);
|
||||
// 关闭OSSClient。
|
||||
//ossClient.shutdown();
|
||||
ImgUrl.put(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey(), (int) (entry.getValue().getSize()));
|
||||
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
returnImage.setImgname(entry.getValue().getOriginalFilename());
|
||||
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
|
||||
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
|
||||
|
||||
}
|
||||
//ossClient.shutdown();
|
||||
return ImgUrl;
|
||||
}else{
|
||||
Map<String, Integer> ImgUrl = new HashMap<>();
|
||||
Map<ReturnImage, Integer> ImgUrl = new HashMap<>();
|
||||
//设置Header
|
||||
ObjectMetadata meta = new ObjectMetadata();
|
||||
meta.setHeader("Content-Disposition", "inline");
|
||||
@@ -82,9 +86,13 @@ public class OSSImageupload {
|
||||
// 上传文件流。
|
||||
System.out.println("待上传的图片:"+username + "/" + uuid+times + "." + entry.getKey());
|
||||
ossClient.putObject(key.getBucketname(), username + "/" + uuid+times + "." + entry.getKey(),new File(imgurl),meta);
|
||||
ImgUrl.put(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey(), ImgUrlUtil.getFileSize2(new File(imgurl)));
|
||||
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
|
||||
ImgUrl.put(returnImage, ImgUrlUtil.getFileSize2(new File(imgurl)));
|
||||
new File(imgurl).delete();
|
||||
}
|
||||
//ossClient.shutdown();
|
||||
return ImgUrl;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.hellohao.service.impl;
|
||||
|
||||
import cn.hellohao.pojo.Keys;
|
||||
import cn.hellohao.pojo.ReturnImage;
|
||||
import cn.hellohao.utils.ImgUrlUtil;
|
||||
import com.UpYun;
|
||||
import com.aliyun.oss.OSSClient;
|
||||
@@ -19,10 +20,10 @@ public class USSImageupload {
|
||||
static UpYun upyun;
|
||||
static Keys key;
|
||||
|
||||
public Map<String, Integer> ImageuploadUSS(Map<String, MultipartFile> fileMap, String username,Map<String, String> fileMap2) throws Exception {
|
||||
public Map<ReturnImage, Integer> ImageuploadUSS(Map<String, MultipartFile> fileMap, String username,Map<String, String> fileMap2) throws Exception {
|
||||
if(fileMap2==null){
|
||||
File file = null;
|
||||
Map<String, Integer> ImgUrl = new HashMap<>();
|
||||
Map<ReturnImage, Integer> ImgUrl = new HashMap<>();
|
||||
//设置Header
|
||||
ObjectMetadata meta = new ObjectMetadata();
|
||||
meta.setHeader("Content-Disposition", "inline");
|
||||
@@ -31,16 +32,16 @@ public class USSImageupload {
|
||||
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()));
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
returnImage.setImgname(entry.getValue().getOriginalFilename());
|
||||
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
|
||||
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
|
||||
}else{
|
||||
System.err.println("上传失败");
|
||||
}
|
||||
@@ -48,7 +49,7 @@ public class USSImageupload {
|
||||
}
|
||||
return ImgUrl;
|
||||
}else{
|
||||
Map<String, Integer> ImgUrl = new HashMap<>();
|
||||
Map<ReturnImage, Integer> ImgUrl = new HashMap<>();
|
||||
//设置Header
|
||||
ObjectMetadata meta = new ObjectMetadata();
|
||||
meta.setHeader("Content-Disposition", "inline");
|
||||
@@ -57,16 +58,15 @@ public class USSImageupload {
|
||||
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
|
||||
String times = format1.format(new Date());
|
||||
String imgurl = entry.getValue();
|
||||
|
||||
|
||||
// 上传文件流。
|
||||
System.out.println("待上传的图片:"+username + "/" + uuid+times + "." + entry.getKey());
|
||||
|
||||
// 例2:采用数据流模式上传文件(节省内存),自动创建父级目录
|
||||
upyun.setContentMD5(UpYun.md5(new File(imgurl)));
|
||||
boolean result = upyun.writeFile(username + "/" + uuid+times + "." + entry.getKey(), new File(imgurl), true);
|
||||
if(result){
|
||||
ImgUrl.put(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey(), ImgUrlUtil.getFileSize2(new File(imgurl)));
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
|
||||
ImgUrl.put(returnImage, ImgUrlUtil.getFileSize2(new File(imgurl)));
|
||||
}else{
|
||||
System.err.println("上传失败");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.hellohao.utils;
|
||||
|
||||
import cn.hellohao.pojo.ReturnImage;
|
||||
import com.google.gson.Gson;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.io.File;
|
||||
@@ -18,11 +19,11 @@ public class LocUpdateImg {
|
||||
|
||||
|
||||
|
||||
public static Map<String, Integer> ImageuploadLOC(Map<String, MultipartFile> fileMap, String username, Map<String, String> fileMap2) throws Exception {
|
||||
public static Map<ReturnImage, Integer> ImageuploadLOC(Map<String, MultipartFile> fileMap, String username, Map<String, String> fileMap2) throws Exception {
|
||||
String filePath =File.separator + "HellohaoData" + File.separator;
|
||||
if(fileMap2==null){
|
||||
File file = null;
|
||||
Map<String, Integer> ImgUrl = new HashMap<>();
|
||||
Map<ReturnImage, 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");
|
||||
@@ -36,7 +37,10 @@ public class LocUpdateImg {
|
||||
}
|
||||
try {
|
||||
entry.getValue().transferTo(dest);
|
||||
ImgUrl.put(username + "/" + uuid+times + "." + entry.getKey(), (int) (entry.getValue().getSize()));
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
returnImage.setImgname(entry.getValue().getOriginalFilename());
|
||||
returnImage.setImgurl(username + "/" + uuid+times + "." + entry.getKey());
|
||||
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.err.println("上传失败");
|
||||
@@ -44,7 +48,7 @@ public class LocUpdateImg {
|
||||
}
|
||||
return ImgUrl;
|
||||
}else{
|
||||
Map<String, Integer> ImgUrl = new HashMap<>();
|
||||
Map<ReturnImage, Integer> ImgUrl = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, String> entry : fileMap2.entrySet()) {
|
||||
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
|
||||
@@ -62,8 +66,9 @@ public class LocUpdateImg {
|
||||
file.renameTo(new File(newfilePath));//只移动,源目录不存在文件
|
||||
// 例2:采用数据流模式上传文件(节省内存),自动创建父级目录
|
||||
//upyun.setContentMD5(UpYun.md5(new File(imgurl)));
|
||||
// boolean result = upyun.writeFile(username + "/" + uuid+times + "." + entry.getKey(), new File(imgurl), true);
|
||||
ImgUrl.put( username + "/" + uuid+times + "." + entry.getKey(), ImgUrlUtil.getFileSize2(new File(newfilePath)));
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
returnImage.setImgurl(username + "/" + uuid+times + "." + entry.getKey());
|
||||
ImgUrl.put( returnImage, ImgUrlUtil.getFileSize2(new File(newfilePath)));
|
||||
}
|
||||
//new File(imgurl).delete();
|
||||
return ImgUrl;
|
||||
|
||||
@@ -35,14 +35,9 @@ public class Sentence {
|
||||
// }
|
||||
// return str;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String result = "";
|
||||
String urlName = "https://v1.hitokoto.cn/";
|
||||
//String urlName = "https://v1.hitokoto.cn/";
|
||||
String urlName = "http://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1";
|
||||
try {
|
||||
URL realURL = new URL(urlName);
|
||||
URLConnection conn = realURL.openConnection();
|
||||
@@ -66,5 +61,4 @@ public class Sentence {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,10 @@ spring.datasource.password=root
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/picturebed?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
|
||||
#端口
|
||||
server.port=8088
|
||||
#鉴黄周期表达式 下方表达式为每天七点半执行
|
||||
#不懂请勿乱修改。具体可以参考官方文档http://doc.wwery.com
|
||||
Expression=0 30 04 * * ?
|
||||
|
||||
|
||||
#下边的配置项不需要修改。
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
@@ -20,12 +24,6 @@ multipart.maxFileSize=10240KB
|
||||
multipart.maxRequestSize=10240KB
|
||||
spring.thymeleaf.mode = LEGACYHTML5
|
||||
spring.http.multipart.location=/data/upload_tmp
|
||||
#表示只有与服务器重新验证后,才能重用缓存的响应。
|
||||
#spring.resources.cache.cachecontrol.no-cache=true
|
||||
#表示在任何情况下都不缓存响应。
|
||||
#spring.resources.cache.cachecontrol.no-store=true
|
||||
#spring.resources.cache.cachecontrol.max-age=0
|
||||
#spring.profiles.active=dev
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@
|
||||
<if test="background2 != null">
|
||||
`background2` = #{background2},
|
||||
</if>
|
||||
<if test="sett != null">
|
||||
`sett` = #{sett},
|
||||
</if>
|
||||
|
||||
</set>
|
||||
where id=1
|
||||
|
||||
@@ -22,7 +22,10 @@
|
||||
`imgcountuser` = #{imgcountuser},
|
||||
</if>
|
||||
<if test="suffix != null">
|
||||
`suffix` = #{suffix}
|
||||
`suffix` = #{suffix},
|
||||
</if>
|
||||
<if test="urltype != null">
|
||||
`urltype` = #{urltype}
|
||||
</if>
|
||||
|
||||
</set>
|
||||
|
||||
@@ -196,34 +196,24 @@
|
||||
|
||||
uploader.on( 'uploadSuccess', function(file,response) {
|
||||
//alert(response.length);
|
||||
for(var i=0;i<response.length;i++){
|
||||
//console.log(response);
|
||||
$("#address").css('display', 'block');
|
||||
if(response[i]==-1){
|
||||
arr_url += '未配置存储源,请先后台配置存储源\r\n';
|
||||
arr_markdown += '未配置存储源,请先后台配置存储源\r\n';
|
||||
arr_html += '未配置存储源,请先后台配置存储源\r\n';
|
||||
}else{
|
||||
arr_url += response[i] + '\r\n';
|
||||
arr_markdown += '\r\n';
|
||||
arr_html += '<img src="' + response[i] + '" alt="Image" title="Image" /> \r\n';
|
||||
}
|
||||
// $("#urls").text(arr_url);
|
||||
// $("#markdowns").text(arr_markdown);
|
||||
// $("#htmls").text(arr_html);
|
||||
//urls = arr_url;
|
||||
if(urltypes==1){
|
||||
$("#urls").text(arr_url);
|
||||
}else if(urltypes==2){
|
||||
$("#urls").text(arr_markdown);
|
||||
}else{
|
||||
$("#urls").text(arr_html);
|
||||
}
|
||||
//console.log(response.imgurls)
|
||||
$("#address").css('display', 'block');
|
||||
if(response==-1){
|
||||
arr_url += '未配置存储源,请先后台配置存储源\r\n';
|
||||
arr_markdown += '未配置存储源,请先后台配置存储源\r\n';
|
||||
arr_html += '未配置存储源,请先后台配置存储源\r\n';
|
||||
}else{
|
||||
arr_url += response.imgurls + '\r\n';
|
||||
arr_markdown += '\r\n';
|
||||
arr_html += '<img src="' + response.imgurls + '" alt="'+response.imgnames+'" title="'+response.imgnames+'" /> \r\n';
|
||||
}
|
||||
if(urltypes==1){
|
||||
$("#urls").text(arr_url);
|
||||
}else if(urltypes==2){
|
||||
$("#urls").text(arr_markdown);
|
||||
}else{
|
||||
$("#urls").text(arr_html);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 文件上传失败,显示上传出错
|
||||
|
||||
@@ -181,7 +181,6 @@
|
||||
, layer = layui.layer
|
||||
|
||||
});
|
||||
|
||||
function exit() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
<!-- th:value="${config.getFooted()}"/>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">首页背景一</label>
|
||||
<div class="layui-input-block">
|
||||
@@ -86,6 +87,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">每日随机图</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <input id="open" type="checkbox" name="close" lay-skin="switch" lay-filter="switchTest"-->
|
||||
<!-- lay-text="ON|OFF">-->
|
||||
<!-- <span style="color: #DAA5A6;"> 采集必应每日壁纸,开启随机背景后,手动设置的首页背景将会失效</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <br />-->
|
||||
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">友情链接</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
@@ -111,7 +122,10 @@
|
||||
</form>
|
||||
</div>
|
||||
<!--分组3-->
|
||||
|
||||
|
||||
<div class="layui-tab-item">
|
||||
|
||||
<h3>游客上传配置</h3>
|
||||
<hr />
|
||||
<div class="layui-inline">
|
||||
@@ -151,10 +165,19 @@
|
||||
<span style="color: #DAA5A6;">配个类型用“ , ”隔开</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 style="margin-top: 50px;">图片链接格式</h3>
|
||||
<hr />
|
||||
<form class="layui-form " >
|
||||
<div class="laydfdaui-form-item">
|
||||
<label class="layui-form-label">链接格式</label>
|
||||
<div class="layui-input-block" id="imgurltype">
|
||||
<input type="radio" name="urltype" value="1" title="用户名格式:/user/">
|
||||
<input type="radio" name="urltype" value="2" title="日期格式:/YY/mm/dd/" checked>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<a class="layui-btn" lay-filter="demo2" onclick="scconfig()">保存</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -168,6 +191,14 @@
|
||||
var table = layui.table;
|
||||
var element = layui.element;
|
||||
});
|
||||
$(function () {
|
||||
var usertype = [[${updateConfig.getUrltype()!=null?updateConfig.getUrltype():1}]];
|
||||
if(usertype==2){
|
||||
$('input:radio:input:radio:last').attr('checked', 'true');
|
||||
}else{
|
||||
$('input:radio:first').attr('checked', 'true');
|
||||
}
|
||||
});
|
||||
function updateconfig() {
|
||||
var webname = $("#webname").val();
|
||||
var explain = $("#explain").val();
|
||||
@@ -222,12 +253,13 @@
|
||||
var imgcounttourists = $("#imgcounttourists").val();
|
||||
var imgcountuser = $("#imgcountuser").val();
|
||||
var suffix = $("#suffix").val();
|
||||
var imgurltype = $('#imgurltype input[name="urltype"]:checked ').val();
|
||||
if(filesizetourists!=""&&filesizeuser!=""&&imgcounttourists!=""&&imgcountuser!=""&&suffix!=""){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/admin/root/scconfig",
|
||||
dataType: "json",
|
||||
data: {filesizetourists: filesizetourists,filesizeuser:filesizeuser,imgcounttourists:imgcounttourists,imgcountuser:imgcountuser,suffix:suffix},
|
||||
data: {filesizetourists: filesizetourists,filesizeuser:filesizeuser,imgcounttourists:imgcounttourists,imgcountuser:imgcountuser,suffix:suffix,urltype:imgurltype},
|
||||
success: function (data) {
|
||||
var vals = Number(data);
|
||||
if (vals > 0) {
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
<!-- >GitHub<i class="fa fa-github"></i></a></li>-->
|
||||
<!-- <li><a href="javascript:;" class="md-trigger" data-modal="modal-2">赞助商 <i class="fa fa-share-alt"></i></a></li>-->
|
||||
|
||||
<!-- <li><a class="menu-link" onclick="tanchuang('亲爱的开发者','全新的响应式图床站,如果你也喜欢,希望给我一个Star。\n Hellohao开发者交流群:864800972','success');"-->
|
||||
<!-- <li><a class="menu-link" onclick="tanchuang('亲爱的开发者','全新的响应式图床站,如果你也喜欢,希望给我一个Star。\n Hellohao开发者交流群:864800972','success');"-->
|
||||
<!-- >关于<i class="fa fa-share-alt"></i></a></li>-->
|
||||
</ul>
|
||||
</div>
|
||||
@@ -264,63 +264,7 @@ Technology constantly updated, we will always move forward on the road ahead.
|
||||
<!-- end section container -->
|
||||
</div>
|
||||
|
||||
<!-- 登录注册框 -->
|
||||
<div class="modal fade login" id="loginModal">
|
||||
<div class="modal-dialog login animated" id = "tanchuang" >
|
||||
<div id="tanchuang2" class="modal-content" >
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">系统登录</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="box">
|
||||
<div class="content">
|
||||
<div class="social">
|
||||
<p id="biaoti" style="color: #4a4a4f;font-size: 1.5em;">
|
||||
账号登录
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="division">
|
||||
<div class="line l"></div>
|
||||
<span> </span>
|
||||
<div class="line r"></div>
|
||||
</div>
|
||||
<div class="error"></div>
|
||||
<!-- <div class="form loginBox">-->
|
||||
<!-- <form id="login" method="post" accept-charset="UTF-8">-->
|
||||
<!-- <input id="loginemail" class="form-control" type="text" placeholder="邮箱" name="email">-->
|
||||
<!-- <input id="loginpassword" class="form-control" type="password" placeholder="密码"-->
|
||||
<!-- name="password">-->
|
||||
<!-- <input id="login-btn" data-toggle="dropdown"-->
|
||||
<!-- class="btn btn-default btn-login dropdown-toggle" type="button" value="登录"-->
|
||||
<!-- onclick="loginAjax()">-->
|
||||
<!-- </form>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="content registerBox" style="display:none;">
|
||||
<div class="form">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="forgot login-footer">
|
||||
<span>你希望
|
||||
<a href="javascript: showRegisterForm();">创建一个帐户</a>
|
||||
?</span>
|
||||
</div>
|
||||
<div class="forgot register-footer" style="display:none">
|
||||
<span>已经有一个帐户吗?</span>
|
||||
<a href="javascript: showLoginForm();">登录</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="md-modal md-effect-3" id="modal-4">
|
||||
<div class="md-content" >
|
||||
|
||||
Reference in New Issue
Block a user