From 04f09e52ffd4681bdfd85e51acd3da0d1280c3d3 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 16 四月 2022 16:07:10 +0800
Subject: [PATCH] bug修复

---
 src/main/java/com/yeshi/buwan/controller/admin/api/CommonController.java |   93 +++++++++++++++++++++++++++-------------------
 1 files changed, 54 insertions(+), 39 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/controller/admin/api/CommonController.java b/src/main/java/com/yeshi/buwan/controller/admin/api/CommonController.java
index b294a13..b6172e5 100644
--- a/src/main/java/com/yeshi/buwan/controller/admin/api/CommonController.java
+++ b/src/main/java/com/yeshi/buwan/controller/admin/api/CommonController.java
@@ -6,6 +6,9 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpSession;
 
+import com.google.gson.Gson;
+import com.yeshi.buwan.domain.VideoResource;
+import com.yeshi.buwan.service.imp.VideoResourceService;
 import com.yeshi.buwan.util.SystemUtil;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -23,47 +26,59 @@
 @RequestMapping("admin/new/api/common")
 public class CommonController {
 
-	@Resource
-	private VideoService videoService;
-	@Resource
-	private SystemService systemService;
+    @Resource
+    private VideoService videoService;
+    @Resource
+    private SystemService systemService;
 
-	@RequestMapping(value = "/searchvideo", method = RequestMethod.POST)
-	public void searchVideo(String key, PrintWriter out) {
+    @Resource
+    private VideoResourceService videoResourceService;
 
-		List<VideoInfo> list = videoService.searchVideoUsedByAdmin(key);
-		JSONArray array = new JSONArray();
-		if (list != null)
-			for (VideoInfo info : list) {
-				JSONObject obj = new JSONObject();
-				obj.put("id", info.getId());
-				obj.put("name", info.getName());
-				obj.put("picture", info.getPicture());
-				obj.put("show", info.getShow());
-				array.add(obj);
-			}
-		JSONObject object = new JSONObject();
-		object.put("code", 0);
-		object.put("data", array);
-		out.print(object);
-	}
+    @RequestMapping(value = "/searchvideo", method = RequestMethod.POST)
+    public void searchVideo(String key, PrintWriter out) {
 
-	@RequestMapping(value = "/detailsystemlist", method = RequestMethod.POST)
-	public void detailSystemList(String key, HttpSession session, PrintWriter out) {
-		List<DetailSystem> list = systemService.getDetailSystemList(SystemUtil.getAdminSelectedSystem(session).getId());
-		JSONArray array = new JSONArray();
-		if (list != null)
-			for (DetailSystem system : list) {
-				JSONObject obj = new JSONObject();
-				obj.put("id", system.getId());
-				obj.put("name", system.getAppName());
-				obj.put("platform", system.getPlatform());
-				array.add(obj);
-			}
-		JSONObject object = new JSONObject();
-		object.put("code", 0);
-		object.put("data", array);
-		out.print(object);
-	}
+        List<VideoInfo> list = videoService.searchVideoUsedByAdmin(key);
+        JSONArray array = new JSONArray();
+        if (list != null)
+            for (VideoInfo info : list) {
+                JSONObject obj = new JSONObject();
+                obj.put("id", info.getId());
+                obj.put("name", info.getName());
+                obj.put("picture", info.getPicture());
+                obj.put("show", info.getShow());
+                array.add(obj);
+            }
+        JSONObject object = new JSONObject();
+        object.put("code", 0);
+        object.put("data", array);
+        out.print(object);
+    }
+
+    @RequestMapping(value = "/detailsystemlist", method = RequestMethod.POST)
+    public void detailSystemList(String key, HttpSession session, PrintWriter out) {
+        List<DetailSystem> list = systemService.getDetailSystemList(SystemUtil.getAdminSelectedSystem(session).getId());
+        JSONArray array = new JSONArray();
+        if (list != null)
+            for (DetailSystem system : list) {
+                JSONObject obj = new JSONObject();
+                obj.put("id", system.getId());
+                obj.put("name", system.getAppName());
+                obj.put("platform", system.getPlatform());
+                array.add(obj);
+            }
+        JSONObject object = new JSONObject();
+        object.put("code", 0);
+        object.put("data", array);
+        out.print(object);
+    }
+
+    @RequestMapping(value = "/resourceList", method = RequestMethod.POST)
+    public void resourceList(String key, HttpSession session, PrintWriter out) {
+        List<VideoResource> videoResources = videoResourceService.getResourceList();
+        JSONObject object = new JSONObject();
+        object.put("code", 0);
+        object.put("data", new Gson().toJson(videoResources));
+        out.print(object);
+    }
 
 }

--
Gitblit v1.8.0