Showing
4 changed files
with
28 additions
and
3 deletions
@@ -14,6 +14,9 @@ public class JavaApiInfoReq extends PageRequest { | @@ -14,6 +14,9 @@ public class JavaApiInfoReq extends PageRequest { | ||
14 | 14 | ||
15 | private String apiName; | 15 | private String apiName; |
16 | 16 | ||
17 | + //请求类型 http ,tcp | ||
18 | + private String requestType; | ||
19 | + | ||
17 | private String apiUrl; | 20 | private String apiUrl; |
18 | 21 | ||
19 | private String apiData; | 22 | private String apiData; |
@@ -66,6 +66,15 @@ public class JavaAPICtrl { | @@ -66,6 +66,15 @@ public class JavaAPICtrl { | ||
66 | @RequestMapping("/save") | 66 | @RequestMapping("/save") |
67 | @ResponseBody | 67 | @ResponseBody |
68 | public BaseResponse saveApiInfo(JavaApiInfoReq req) { | 68 | public BaseResponse saveApiInfo(JavaApiInfoReq req) { |
69 | + if("http".equals(req.getRequestType())){ | ||
70 | + if(StringUtils.isBlank(req.getApiUrl())){ | ||
71 | + return new BaseResponse(201,"url不能为空"); | ||
72 | + } | ||
73 | + }else if("tcp".equals(req.getRequestType())){ | ||
74 | + if(StringUtils.isBlank(req.getApiUrl())&&req.getApiUrlCustom()==1){ | ||
75 | + return new BaseResponse(201,"url不能为空"); | ||
76 | + } | ||
77 | + } | ||
69 | BaseResponse rep = httpClient.defaultPost(HttpUriContants.JAVA_API_SAVE, req, BaseResponse.class); | 78 | BaseResponse rep = httpClient.defaultPost(HttpUriContants.JAVA_API_SAVE, req, BaseResponse.class); |
70 | return rep; | 79 | return rep; |
71 | } | 80 | } |
@@ -12,7 +12,18 @@ | @@ -12,7 +12,18 @@ | ||
12 | </div> | 12 | </div> |
13 | 13 | ||
14 | <div class="form-group"> | 14 | <div class="form-group"> |
15 | - <label class="col-sm-2 control-label"> <span style="color:red">*</span>url:</label> | 15 | + <label class="col-sm-2 control-label"> <span style="color:red">*</span>请求类型:</label> |
16 | + | ||
17 | + <div class="col-sm-7"> | ||
18 | + <select id="requestType" name="requestType" class="form-control"> | ||
19 | + <option value="http">http</option> | ||
20 | + <option value="tcp">tcp</option> | ||
21 | + </select> | ||
22 | + </div> | ||
23 | + </div> | ||
24 | + | ||
25 | + <div class="form-group"> | ||
26 | + <label class="col-sm-2 control-label"> url:</label> | ||
16 | 27 | ||
17 | <div class="col-sm-8"> | 28 | <div class="col-sm-8"> |
18 | <input type="text" class="form-control" id="apiUrl" name="apiUrl" placeholder="输入url" | 29 | <input type="text" class="form-control" id="apiUrl" name="apiUrl" placeholder="输入url" |
@@ -28,7 +39,7 @@ | @@ -28,7 +39,7 @@ | ||
28 | </select> | 39 | </select> |
29 | </div> | 40 | </div> |
30 | 41 | ||
31 | - <label class="col-sm-2 control-label"> <span style="color:red">*</span>请求:</label> | 42 | + <label class="col-sm-2 control-label"> <span style="color:red">*</span>请求方式:</label> |
32 | 43 | ||
33 | <div class="col-sm-2"> | 44 | <div class="col-sm-2"> |
34 | <select id="apiReqMethod" name="apiReqMethod" class="form-control"> | 45 | <select id="apiReqMethod" name="apiReqMethod" class="form-control"> |
@@ -600,6 +600,7 @@ | @@ -600,6 +600,7 @@ | ||
600 | onLoadSuccess: function (data) { | 600 | onLoadSuccess: function (data) { |
601 | if (serviceId == 0) { | 601 | if (serviceId == 0) { |
602 | $("#javaInfoForm #apiName").val(""); | 602 | $("#javaInfoForm #apiName").val(""); |
603 | + $("#javaInfoForm #requestType").val("http"); | ||
603 | $("#javaInfoForm #apiUrl").val(""); | 604 | $("#javaInfoForm #apiUrl").val(""); |
604 | $("#javaInfoForm #apiData").val(""); | 605 | $("#javaInfoForm #apiData").val(""); |
605 | $("#javaInfoForm #apiToggle").prop("checked", true) | 606 | $("#javaInfoForm #apiToggle").prop("checked", true) |
@@ -611,6 +612,7 @@ | @@ -611,6 +612,7 @@ | ||
611 | } else { | 612 | } else { |
612 | $("#javaInfoForm #serviceType").val(rowData.serviceType); | 613 | $("#javaInfoForm #serviceType").val(rowData.serviceType); |
613 | $("#javaInfoForm #apiName").val(rowData.apiName); | 614 | $("#javaInfoForm #apiName").val(rowData.apiName); |
615 | + $("#javaInfoForm #requestType").val(rowData.requestType); | ||
614 | $("#javaInfoForm #apiUrl").val(rowData.apiUrl); | 616 | $("#javaInfoForm #apiUrl").val(rowData.apiUrl); |
615 | $("#javaInfoForm #apiData").val(rowData.apiData); | 617 | $("#javaInfoForm #apiData").val(rowData.apiData); |
616 | $("#javaInfoForm #apiToggle").prop("checked", (rowData.apiToggle == 1) ? true : false); | 618 | $("#javaInfoForm #apiToggle").prop("checked", (rowData.apiToggle == 1) ? true : false); |
@@ -641,6 +643,7 @@ | @@ -641,6 +643,7 @@ | ||
641 | 'serviceId': serviceId, | 643 | 'serviceId': serviceId, |
642 | 'serviceType': $("#javaInfoForm #serviceType").val(), | 644 | 'serviceType': $("#javaInfoForm #serviceType").val(), |
643 | 'apiName': $("#javaInfoForm #apiName").val(), | 645 | 'apiName': $("#javaInfoForm #apiName").val(), |
646 | + 'requestType': $("#javaInfoForm #requestType").find("option:selected").val(), | ||
644 | 'apiUrl': $("#javaInfoForm #apiUrl").val(), | 647 | 'apiUrl': $("#javaInfoForm #apiUrl").val(), |
645 | 'apiData': $("#javaInfoForm #apiData").val(), | 648 | 'apiData': $("#javaInfoForm #apiData").val(), |
646 | 'apiToggle': $("#javaInfoForm #apiToggle").prop("checked") == true ? 1 : 0, | 649 | 'apiToggle': $("#javaInfoForm #apiToggle").prop("checked") == true ? 1 : 0, |
@@ -650,7 +653,6 @@ | @@ -650,7 +653,6 @@ | ||
650 | 'apiUrlCustom': $("#javaInfoForm #apiUrlCustom").prop("checked") == true ? 1 : 0 | 653 | 'apiUrlCustom': $("#javaInfoForm #apiUrlCustom").prop("checked") == true ? 1 : 0 |
651 | }, | 654 | }, |
652 | success: function (data) { | 655 | success: function (data) { |
653 | - console.log("fffuck 1"); | ||
654 | if (!data || data.code != 200) { | 656 | if (!data || data.code != 200) { |
655 | btn.removeAttr("disabled"); | 657 | btn.removeAttr("disabled"); |
656 | $("#javaInfoForm #messageAlert").alerts({ | 658 | $("#javaInfoForm #messageAlert").alerts({ |
-
Please register or login to post a comment