소스 검색

支持在线激活

AE86 7 달 전
부모
커밋
93090cafa2

+ 11 - 14
dbsyncer-web/src/main/java/org/dbsyncer/web/controller/license/LicenseController.java

@@ -62,11 +62,10 @@ public class LicenseController extends BaseController {
     @Resource
     private UserConfigService userConfigService;
 
-    public static final Integer SUCCESS_TAG = 200;
-    public static final String STATUS_TAG = "status";
-    public static final String DATA_TAG = "data";
-    public static final String MSG_TAG = "msg";
-
+    public static final Integer SUCCESS = 200;
+    public static final String STATUS = "status";
+    public static final String DATA = "data";
+    public static final String MSG = "msg";
     public static final String SERVER_ADDRESS = "http://117.72.11.38:8989/api/license/create";
 
     @RequestMapping("")
@@ -75,7 +74,6 @@ public class LicenseController extends BaseController {
         model.put("company", appConfig.getCompany());
         model.put("userInfo", getUserInfo());
         model.put("productInfo", licenseService.getProductInfo());
-        model.put("url", SERVER_ADDRESS);
         return "license/license";
     }
 
@@ -149,7 +147,6 @@ public class LicenseController extends BaseController {
         String phone = params.get("phone");
         String mail = params.get("mail");
         String remark = params.get("remark");
-        String url = params.get("url");
         map.put("licenseKey", licenseService.getKey());
         map.put("company", StringUtil.isNotBlank(company) ? company : appConfig.getCompany());
         UserInfo userInfo = getUserInfo();
@@ -158,7 +155,7 @@ public class LicenseController extends BaseController {
         map.put("phone", StringUtil.isNotBlank(phone) ? phone : userInfo.getPhone());
         map.put("mail", StringUtil.isNotBlank(mail) ? mail : userInfo.getMail());
         map.put("remark", StringUtil.isNotBlank(remark) ? remark : StringUtil.EMPTY);
-        return invoke(StringUtil.isNotBlank(url) ? url : SERVER_ADDRESS, map);
+        return invoke(SERVER_ADDRESS, map);
     }
 
     public String invoke(String url, Map params) throws IOException {
@@ -171,15 +168,15 @@ public class LicenseController extends BaseController {
         CloseableHttpClient httpClient = HttpClients.createDefault();
         try {
             CloseableHttpResponse response = httpClient.execute(httpPost);
-            if (response.getStatusLine().getStatusCode() == 200) {
+            if (response.getStatusLine().getStatusCode() == SUCCESS) {
                 Map<String, String> result = JsonUtil.jsonToObj(EntityUtils.toString(response.getEntity()), Map.class);
-                if (result.containsKey(DATA_TAG)) {
-                    String status = String.valueOf(result.get(STATUS_TAG));
-                    if (Integer.parseInt(status) == SUCCESS_TAG) {
-                        return result.get(DATA_TAG);
+                if (result.containsKey(DATA)) {
+                    String status = String.valueOf(result.get(STATUS));
+                    if (Integer.parseInt(status) == SUCCESS) {
+                        return result.get(DATA);
                     }
                 }
-                throw new IllegalArgumentException(result.get(MSG_TAG));
+                throw new IllegalArgumentException(result.get(MSG));
             }
         } catch (HttpHostConnectException e) {
             throw new IllegalArgumentException("网络连接异常,无法激活");

+ 1 - 6
dbsyncer-web/src/main/resources/public/license/license.html

@@ -24,7 +24,6 @@
             <address>
                 <strong>[[${productInfo?.company}]]</strong><br>
                 申请人:[[${productInfo?.owner}]]<br>
-                手机号:[[${productInfo?.phone}]]<br>
                 授权时间:[[${#dates.format(productInfo?.createTime, 'yyyy-MM-dd HH:mm:ss')}]]<br>
                 <abbr>备注:</abbr>[[${productInfo?.remark}]]
             </address>
@@ -83,14 +82,10 @@
             </div>
             <div class="form-group">
                 <div class="row">
-                    <div class="col-md-6">
+                    <div class="col-md-12">
                         <label>备注</label>
                         <input class="form-control" type="text" maxlength="64" name="remark"/>
                     </div>
-                    <div class="col-md-6">
-                        <label>授权服务</label>
-                        <input class="form-control" type="text" maxlength="256" name="url" th:value="${url}"/>
-                    </div>
                 </div>
             </div>
             <div class="form-group">