diff --git a/src/main/java/hk/zdl/crypto/tura/miner/controller/MinerConfServController.java b/src/main/java/hk/zdl/crypto/tura/miner/controller/MinerConfServController.java index c3919bb..d72616e 100755 --- a/src/main/java/hk/zdl/crypto/tura/miner/controller/MinerConfServController.java +++ b/src/main/java/hk/zdl/crypto/tura/miner/controller/MinerConfServController.java @@ -2,6 +2,8 @@ import java.net.URL; +import org.json.JSONObject; + import com.jfinal.core.Controller; import com.jfinal.core.Path; @@ -18,7 +20,7 @@ public void index() { renderJson(MyDb.list_server_url()); break; case "POST": - String line = getRawData(); + var line = getRawData(); try { new URL(line); } catch (Exception e) { @@ -30,7 +32,8 @@ public void index() { break; case "PUT": renderText(""); - getResponse().setStatus(MyDb.update_server_url(getParaToInt("id"), getPara("url")) ? 201 : 400); + var jobj = new JSONObject(getRawData()); + getResponse().setStatus(MyDb.update_server_url(jobj.getInt("id"), jobj.getString("url")) ? 201 : 400); break; case "DELETE": renderText("");