Authored by xuhui

Merge branch 'master' into qcloudOnly

... ... @@ -209,6 +209,8 @@ public class HttpUriContants {
public static final String CENTERSWITCH_SWITCH_CHECK = "/centerSwitch/doExeAndCheck";
public static final String CENTERSWITCH_SWITCH_BEFORE = "/centerSwitch/doExeAndCheckBefore";
public static final String CENTERSWITCH_SWITCH_SMS_CHECK = "/centerSwitch/checkSmsCode";
//只是查看状态
public static final String CENTERSWITCH_STATUS = "/centerSwitch/checkStatus";
//java监控信息
public static final String JAVA_MONITOR_GET = "/newJavaApiInfo/queryByServiceType";
... ...
... ... @@ -48,11 +48,8 @@ public class CenterSwitchCtrl {
public BaseResponse doExe(CenterSwitchModel centerSwitchModel){
BaseResponse baseResponse = httpClient.defaultPost(HttpUriContants.CENTERSWITCH_SWITCH, centerSwitchModel, BaseResponse.class);
return baseResponse;
}
@RequestMapping("/toCenterSwitchNew")
public ModelAndView toCenterSwitchNew(){
... ... @@ -63,7 +60,6 @@ public class CenterSwitchCtrl {
public BaseResponse doExeAndCheck(CenterSwitchModel centerSwitchModel){
BaseResponse baseResponse = httpClient.defaultPost(HttpUriContants.CENTERSWITCH_SWITCH_CHECK, centerSwitchModel, BaseResponse.class);
return baseResponse;
}
@RequestMapping("/doExeAndCheckBefore")
... ... @@ -78,4 +74,9 @@ public class CenterSwitchCtrl {
return httpClient.defaultPost(HttpUriContants.CENTERSWITCH_SWITCH_SMS_CHECK+"?code="+code, null, BaseResponse.class);
}
}
@RequestMapping("/checkStatus")
public BaseResponse checkStatus(CenterSwitchModel centerSwitchModel){
BaseResponse baseResponse = httpClient.defaultPost(HttpUriContants.CENTERSWITCH_STATUS, centerSwitchModel, BaseResponse.class);
return baseResponse;
}
}
\ No newline at end of file
... ...
... ... @@ -77,6 +77,9 @@
<h4 style="display: inline">切换操作</h4>
</div>
<div class="panel-body">
<button class="btn btn-large btn-primary" style="background-color: green" id="status-btn" onclick="checkStatus()">
查看状态(可以随时查看)
</button>
<button class="btn btn-large btn-primary" id="toaws-btn" onclick="toDoExe('toAws')">
所有流量切向aws
</button>
... ... @@ -156,6 +159,15 @@
</html>
<script>
var array = new Array();
$(document).ready(function () {
array.push("switch_redis");
array.push("switch_internel_dns");
array.push("switch_cobar");
array.push("switch_lua");
array.push("switch_dnspod");
});
//执行切换
function toDoExe(toCloud) {
$("input[name='cloud_name']").val(toCloud);
... ... @@ -186,12 +198,6 @@
if(resp.code == 200){
$('#confirmSubmitDivId').modal('hide');
$("#detail-div").empty();
var array = new Array();
array.push("switch_redis");
array.push("switch_internel_dns");
array.push("switch_cobar");
array.push("switch_lua");
array.push("switch_dnspod");
for (var i = 0; i < array.length; i++) {
$("#" + array[i] + "-btn").removeClass("btn-success");
}
... ... @@ -218,6 +224,7 @@
'exe': commond
},
dataType: 'json',
async: false,
success: function (resp) {
$("#"+name+"-btn").removeClass("btn-warning");
$("#"+name+"-btn").addClass("btn-success");
... ... @@ -234,4 +241,35 @@
}
});
}
function checkStatus(){
$("#detail-div").empty();
for (var i = 0; i < array.length; i++) {
$.ajax({
type: 'post',
url: contextPath + "/centerSwitch/checkStatus",
data: {
'name': array[i],
'exe': 'status'
},
dataType: 'json',
async: false,
success: function (data) {
if (!data || data.code != 200) {
var div = "<h4 class=\"alert-heading\">"+data.message+"</h4>";
$("#detail-div").append(div);
return;
}
var div = "<div class=\"alert alert-info alert-block\">";
div = div + "<h4 class=\"alert-heading\">" + array[i] + "</h4>";
div = div + data.data + "</div>";
$("#detail-div").append(div);
},
error: function () {
var div = "<div>查看状态请求异常</div>";
$("#detail-div").append(div);
}
});
}
}
</script>
\ No newline at end of file
... ...