ApiController.java
4.05 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package com.genersoft.iot.vmp.web.gb28181;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.conf.SipConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* API兼容:系统接口
*/
@Controller
@RequestMapping(value = "/api/v1")
public class ApiController {
private final static Logger logger = LoggerFactory.getLogger(ApiController.class);
@Autowired
private SipConfig sipConfig;
@GetMapping("/getserverinfo")
private JSONObject getserverinfo(){
JSONObject result = new JSONObject();
result.put("Authorization","ceshi");
result.put("Hardware","");
result.put("InterfaceVersion","2.5.5");
result.put("IsDemo","");
result.put("Hardware","false");
result.put("APIAuth","false");
result.put("RemainDays","永久");
result.put("RunningTime","");
result.put("ServerTime","2020-09-02 17:11");
result.put("StartUpTime","2020-09-02 17:11");
result.put("Server","");
result.put("SIPSerial", sipConfig.getId());
result.put("SIPRealm", sipConfig.getDomain());
result.put("SIPHost", sipConfig.getIp());
result.put("SIPPort", sipConfig.getPort());
result.put("ChannelCount","1000");
result.put("VersionType","");
result.put("LogoMiniText","");
result.put("LogoText","");
result.put("CopyrightText","");
return result;
}
@GetMapping(value = "/userinfo")
private JSONObject userinfo(){
// JSONObject result = new JSONObject();
// result.put("ID","ceshi");
// result.put("Hardware","");
// result.put("InterfaceVersion","2.5.5");
// result.put("IsDemo","");
// result.put("Hardware","false");
// result.put("APIAuth","false");
// result.put("RemainDays","永久");
// result.put("RunningTime","");
// result.put("ServerTime","2020-09-02 17:11");
// result.put("StartUpTime","2020-09-02 17:11");
// result.put("Server","");
// result.put("SIPSerial", sipConfig.getId());
// result.put("SIPRealm", sipConfig.getDomain());
// result.put("SIPHost", sipConfig.getIp());
// result.put("SIPPort", sipConfig.getPort());
// result.put("ChannelCount","1000");
// result.put("VersionType","");
// result.put("LogoMiniText","");
// result.put("LogoText","");
// result.put("CopyrightText","");
return null;
}
/**
* 系统接口 - 登录
* @param username 用户名
* @param password 密码(经过md5加密,32位长度,不带中划线,不区分大小写)
* @return
*/
@GetMapping(value = "/login")
@ResponseBody
private JSONObject login(String username,String password ){
if (logger.isDebugEnabled()) {
logger.debug(String.format("模拟接口> 登录 API调用,username:%s ,password:%s ",
username, password));
}
JSONObject result = new JSONObject();
result.put("CookieToken","ynBDDiKMg");
result.put("URLToken","MOBkORkqnrnoVGcKIAHXppgfkNWRdV7utZSkDrI448Q.oxNjAxNTM4NDk3LCJwIjoiZGJjODg5NzliNzVj" +
"Nzc2YmU5MzBjM2JjNjg1ZWFiNGI5ZjhhN2Y0N2RlZjg3NWUyOTJkY2VkYjkwYmEwMTA0NyIsInQiOjE2MDA5MzM2OTcsInUiOiI" +
"4ODlkZDYyM2ViIn0eyJlIj.GciOiJIUzI1NiIsInR5cCI6IkpXVCJ9eyJhb");
result.put("TokenTimeout",604800);
result.put("AuthToken","MOBkORkqnrnoVGcKIAHXppgfkNWRdV7utZSkDrI448Q.oxNjAxNTM4NDk3LCJwIjoiZGJjODg5NzliNzVj" +
"Nzc2YmU5MzBjM2JjNjg1ZWFiNGI5ZjhhN2Y0N2RlZjg3NWUyOTJkY2VkYjkwYmEwMTA0NyIsInQiOjE2MDA5MzM2OTcsInUiOiI" +
"4ODlkZDYyM2ViIn0eyJlIj.GciOiJIUzI1NiIsInR5cCI6IkpXVCJ9eyJhb");
result.put("Token","ynBDDiKMg");
return result;
}
}