fix:修复修改rss时无bgmid的问题
This commit is contained in:
parent
fefcfe6c35
commit
96b2ba371f
@ -28,18 +28,18 @@ public class AnimationController {
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/anim/rss/data.do", method = RequestMethod.GET)
|
||||
public String getAnimList(String key,String type,String team, int page) {
|
||||
public String getAnimList(String key, String type, String team, int page) {
|
||||
boolean isNull = key.length() == 0;
|
||||
if(!StringUtils.isEmpty(type)&&type.length()>2) {
|
||||
type=type.substring(2);
|
||||
if (!StringUtils.isEmpty(type) && type.length() > 2) {
|
||||
type = type.substring(2);
|
||||
}
|
||||
if(!StringUtils.isEmpty(team)&&team.length()>2) {
|
||||
team=team.substring(2);
|
||||
if (!StringUtils.isEmpty(team) && team.length() > 2) {
|
||||
team = team.substring(2);
|
||||
}
|
||||
String[] keys = key.split(" ");
|
||||
JSONArray items = null;
|
||||
if (!isNull) {
|
||||
items = new AnimationData().bangumiList(page,type,team, keys);
|
||||
items = new AnimationData().bangumiList(page, type, team, keys);
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("data", Objects.requireNonNullElseGet(items, JSONArray::new));
|
||||
@ -71,11 +71,12 @@ public class AnimationController {
|
||||
json.put("data", JSON.toJSON(bangumiService.getAllBangumiList()));
|
||||
return json.toJSONString();
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/anim/type/del.do", method = RequestMethod.POST)
|
||||
public String delType(int id){
|
||||
int i=bangumiService.removeBangumiType(id);
|
||||
JSONObject json=new JSONObject();
|
||||
public String delType(int id) {
|
||||
int i = bangumiService.removeBangumiType(id);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", 0);
|
||||
json.put("msg", i == 0 ? "删除失败" : "删除成功");
|
||||
return json.toJSONString();
|
||||
@ -83,12 +84,13 @@ public class AnimationController {
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/anim/rss/add.do", method = RequestMethod.POST)
|
||||
public String addAnimationRss(String bgmId,String title, String author, String categories, String titleKey, String bid) {
|
||||
int id=0;
|
||||
if(!StringUtils.isEmpty(bgmId)){
|
||||
public String addAnimationRss(String bgmId, String title, String author, String categories, String titleKey, String bid) {
|
||||
int id = 0;
|
||||
if (!StringUtils.isEmpty(bgmId)) {
|
||||
try {
|
||||
id=Integer.parseInt(bgmId.trim());
|
||||
}catch (Exception ignored){}
|
||||
id = Integer.parseInt(bgmId.trim());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
BangumiItem item = new BangumiItem();
|
||||
item.setBgmid(id);
|
||||
@ -114,62 +116,70 @@ public class AnimationController {
|
||||
json.put("data", JSON.toJSON(bangumiService.getBangumiItemList(type)));
|
||||
return json.toJSONString();
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/anim/rss/del.do", method = RequestMethod.POST)
|
||||
public String delAnimation(int id){
|
||||
int i=bangumiService.removeBangumiItem(id);
|
||||
JSONObject json=new JSONObject();
|
||||
public String delAnimation(int id) {
|
||||
int i = bangumiService.removeBangumiItem(id);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", 0);
|
||||
json.put("msg", i == 0 ? "删除失败" : "删除成功");
|
||||
return json.toJSONString();
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/anim/rss/edit.do",method = RequestMethod.POST)
|
||||
public JSONObject editAnimation(int id,int bgmId,String title, String author, String categories, String titleKey,String enable){
|
||||
JSONObject json=new JSONObject();
|
||||
BangumiItem item =bangumiService.getBangumiItem(id);
|
||||
if(bgmId!=0){
|
||||
item.setBgmid(bgmId);
|
||||
@RequestMapping(value = "/anim/rss/edit.do", method = RequestMethod.POST)
|
||||
public JSONObject editAnimation(int id, String bgmId, String title, String author, String categories, String titleKey, String enable) {
|
||||
JSONObject json = new JSONObject();
|
||||
BangumiItem item = bangumiService.getBangumiItem(id);
|
||||
if (!StringUtils.isEmpty(bgmId)) {
|
||||
try {
|
||||
item.setBgmid(Integer.parseInt(bgmId));
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
if(!StringUtils.isEmpty(title)){
|
||||
}
|
||||
if (!StringUtils.isEmpty(title)) {
|
||||
item.setTitle(title);
|
||||
}
|
||||
if(!StringUtils.isEmpty(author)){
|
||||
if (!StringUtils.isEmpty(author)) {
|
||||
item.setAuthor(author);
|
||||
}
|
||||
if(!StringUtils.isEmpty(categories)){
|
||||
if (!StringUtils.isEmpty(categories)) {
|
||||
item.setCategories(categories);
|
||||
}
|
||||
if(!StringUtils.isEmpty(titleKey)){
|
||||
if (!StringUtils.isEmpty(titleKey)) {
|
||||
item.setTitlekey(titleKey);
|
||||
}
|
||||
if(!StringUtils.isEmpty(enable)){
|
||||
if (!StringUtils.isEmpty(enable)) {
|
||||
item.setEnable(Integer.parseInt(enable));
|
||||
}
|
||||
int i=bangumiService.updateBangumiItem(item);
|
||||
if(i>0){
|
||||
json.put("msg","操作成功");
|
||||
}else{
|
||||
json.put("msg","操作失败");
|
||||
int i = bangumiService.updateBangumiItem(item);
|
||||
if (i > 0) {
|
||||
json.put("msg", "操作成功");
|
||||
} else {
|
||||
json.put("msg", "操作失败");
|
||||
}
|
||||
json.put("code",1);
|
||||
json.put("code", 1);
|
||||
return json;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/anim/client/get.do", method = RequestMethod.GET)
|
||||
public String clientApi(){
|
||||
AnimationData animationData=new AnimationData();
|
||||
List<BangumiItem> list=bangumiService.getAllBangumiItemList();
|
||||
public String clientApi() {
|
||||
AnimationData animationData = new AnimationData();
|
||||
List<BangumiItem> list = bangumiService.getAllBangumiItemList();
|
||||
for (BangumiItem item : list) {
|
||||
item.setCategories(animationData.nameToValue(item.getCategories(),false)+"");
|
||||
item.setAuthor(animationData.nameToValue(item.getAuthor(),true)+"");
|
||||
item.setCategories(animationData.nameToValue(item.getCategories(), false) + "");
|
||||
item.setAuthor(animationData.nameToValue(item.getAuthor(), true) + "");
|
||||
}
|
||||
JSONArray array= (JSONArray) JSON.toJSON(list);
|
||||
JSONArray array = (JSONArray) JSON.toJSON(list);
|
||||
return array.toJSONString();
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/anim/getToDay.do", method = RequestMethod.GET)
|
||||
public JSONObject getToDayAnim(){
|
||||
public JSONObject getToDayAnim() {
|
||||
return BangumiTools.getBangumi(0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user