admin
2020-09-12 2778cf2a16823f9b1153a0549b47f7b503176a17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.yeshi.buwan.controller.admin.api;
 
import java.io.PrintWriter;
import java.util.List;
 
import javax.annotation.Resource;
 
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
 
import com.yeshi.buwan.domain.DetailSystem;
import com.yeshi.buwan.domain.VideoInfo;
import com.yeshi.buwan.service.imp.SystemService;
import com.yeshi.buwan.service.imp.VideoService;
 
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
 
@Controller
@RequestMapping("admin/new/api/common")
public class CommonController {
 
    @Resource
    private VideoService videoService;
    @Resource
    private SystemService systemService;
 
    @RequestMapping(value = "/searchvideo", method = RequestMethod.POST)
    public void searchVideo(String key, PrintWriter out) {
 
        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, PrintWriter out) {
        List<DetailSystem> list = systemService.getDetailSystemList();
        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);
    }
 
}