mirror of
https://github.com/Hello-hao/Tbed.git
synced 2024-04-21 12:32:10 +00:00
重构版功能实现
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package cn.hellohao.controller;
|
||||
|
||||
import cn.hellohao.pojo.*;
|
||||
import cn.hellohao.pojo.vo.PageResultBean;
|
||||
import cn.hellohao.service.*;
|
||||
import cn.hellohao.service.impl.AlbumServiceImpl;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@@ -39,7 +40,7 @@ public class AlbumController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@PostMapping("/admin/getGalleryList") //new 获取画廊地址
|
||||
@PostMapping("/admin/getGalleryList") //new
|
||||
@ResponseBody
|
||||
public Map<String, Object> getGalleryList (@RequestParam(value = "data", defaultValue = "") String data){
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
@@ -177,8 +178,82 @@ public class AlbumController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/checkPass")//new
|
||||
@ResponseBody
|
||||
public Msg checkPass(@RequestParam(value = "data", defaultValue = "") String data) {
|
||||
Msg msg = new Msg();
|
||||
JSONObject json = new JSONObject();
|
||||
JSONObject jsonObject = null;
|
||||
try {
|
||||
jsonObject = JSONObject.parseObject(data);
|
||||
String key = jsonObject.getString("key");
|
||||
Album album = new Album();
|
||||
album.setAlbumkey(key);
|
||||
Album a = albumServiceImpl.selectAlbum(album);
|
||||
if(a!=null){
|
||||
json.put("album",a);
|
||||
json.put("exist",true);
|
||||
if(a.getPassword()!=null && !a.getPassword().equals("")){
|
||||
json.put("passType",true);
|
||||
}else{
|
||||
json.put("passType",false);
|
||||
}
|
||||
msg.setData(json);
|
||||
}else{
|
||||
json.put("exist",false);
|
||||
msg.setData(json);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
msg.setCode("110500");
|
||||
msg.setInfo("操作失败");
|
||||
msg.setData(json);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getAlbumList") //new
|
||||
@ResponseBody
|
||||
public Msg getAlbumList(@RequestParam(value = "data", defaultValue = "") String data){
|
||||
Msg msg = new Msg();
|
||||
JSONObject json = new JSONObject();
|
||||
JSONObject jsonObject = JSONObject.parseObject(data);
|
||||
Integer pageNum = jsonObject.getInteger("pageNum");
|
||||
Integer pageSize = jsonObject.getInteger("pageSize");
|
||||
String albumkey = jsonObject.getString("albumkey");
|
||||
String password = jsonObject.getString("password");
|
||||
if(null!=password){
|
||||
password = password.replace(" ", "");
|
||||
}
|
||||
Album album = new Album();
|
||||
album.setAlbumkey(albumkey);
|
||||
Album a = albumServiceImpl.selectAlbum(album);
|
||||
if(a==null){
|
||||
msg.setCode("110404");
|
||||
msg.setInfo("画廊地址不存在");
|
||||
}else{
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
if(a.getPassword()==null || (a.getPassword().replace(" ", "")).equals("")){
|
||||
List<Images> imagesList = imgAndAlbumService.selectImgForAlbumkey(albumkey);
|
||||
PageInfo<Images> rolePageInfo = new PageInfo<>(imagesList);
|
||||
PageResultBean<Images> pageResultBean = new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
|
||||
json.put("imagesList",pageResultBean);
|
||||
}else{
|
||||
if(a.getPassword().equals(password)){
|
||||
List<Images> imagesList = imgAndAlbumService.selectImgForAlbumkey(albumkey);
|
||||
PageInfo<Images> rolePageInfo = new PageInfo<>(imagesList);
|
||||
PageResultBean<Images> pageResultBean = new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
|
||||
json.put("imagesList",pageResultBean);
|
||||
}else{
|
||||
msg.setCode("110403");
|
||||
msg.setInfo("画廊密码错误");
|
||||
}
|
||||
}
|
||||
json.put("titlename",a.getAlbumtitle());
|
||||
msg.setData(json);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user