DNSWebCtrl.java
2.5 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
package com.ui.ctrl;
import com.ui.contants.HttpUriContants;
import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
import com.ui.model.domain.OutRecod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping(value = "dnspod")
public class DNSWebCtrl {
private Logger log = LoggerFactory.getLogger(DNSWebCtrl.class);
@Autowired
HttpRestClient httpRestClient;
/**
* 获取域名列表
*
* @return 2016年5月12日下午1:49:48
*/
@RequestMapping(value = "toDns")
public ModelAndView getLocalRecords() {
ModelAndView mdv = new ModelAndView("switch/dnsSwitch");
BaseResponse<List<OutRecod>> response = httpRestClient.exchangeForget(HttpUriContants.VIEW_DNSPOD, new ParameterizedTypeReference<BaseResponse<List<OutRecod>>>() {
}, null);
mdv.addObject("code",response.getCode());
mdv.addObject("orders", response.getData());
return mdv;
}
/**
* 发送验证码
*
* @return 2016年5月12日下午1:49:48
*/
@RequestMapping(value = "initSwitch")
@ResponseBody
public BaseResponse switchbefore(String id) {
Map map = new HashMap<>();
map.put("id",id);
return httpRestClient.defaultGet(HttpUriContants.DNS_SWITCH_BEFORE, BaseResponse.class, map);
}
/**
* 切换
*
* @return 2016年5月12日下午1:49:48
*/
@RequestMapping(value = "doSwitch")
@ResponseBody
public BaseResponse doswitch(String token, String ticket) {
Map map = new HashMap<>();
map.put("token",token);
map.put("ticket",ticket);
return httpRestClient.defaultGet(HttpUriContants.SWITCH_DNS, BaseResponse.class, map);
}
/**
* 获取token
*
* @return 2016年5月18日上午10:22:44
*/
@RequestMapping(value = "validateAPIToken")
@ResponseBody
public BaseResponse getApiToken(String gcode) {
Map map = new HashMap<>();
map.put("gcode",gcode);
return httpRestClient.defaultGet(HttpUriContants.VALIDE_TOKEN, BaseResponse.class, map);
}
}