generated from root/miduo_server
master
parent
539bc968d4
commit
decef4c0ae
|
@ -29,7 +29,15 @@ public class GetUserController extends HttpServlet {
|
|||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
String openId = request.getParameter("openId");
|
||||
if (openId == null || openId.isEmpty()) {
|
||||
response.sendError(400, "openId is empety");
|
||||
return;
|
||||
}
|
||||
String serverId = request.getParameter("serverId");
|
||||
if (serverId == null || serverId.isEmpty()) {
|
||||
response.sendError(400, "serverId is empety");
|
||||
return;
|
||||
}
|
||||
DBObject dbObject = new BasicDBObject();
|
||||
dbObject.put("openId", openId);
|
||||
dbObject.put("serverId", serverId);
|
||||
|
@ -38,8 +46,9 @@ public class GetUserController extends HttpServlet {
|
|||
List<DBObject> userInfos = BaseGlobal.getInstance().mongoDBPool.find(_COLLECTION_NAME, dbObject);
|
||||
DBObject res = new BasicDBObject();
|
||||
if (userInfos.size() == 0) {
|
||||
uid = BaseGlobal.getInstance().mongoDBPool.inc("uid");
|
||||
uid = BaseGlobal.getInstance().mongoDBPool.inc("uid") + 10000000;
|
||||
dbObject.put("uid", uid);
|
||||
dbObject.put("_id", uid);
|
||||
userInfos.add(dbObject);
|
||||
BaseGlobal.getInstance().mongoDBPool.save(_COLLECTION_NAME, dbObject);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@ public class RegistController extends HttpServlet {
|
|||
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
//int serverId = BaseGlobal.mongoDBPool.inc("server_id");
|
||||
int serverId = 0;
|
||||
int serverId = BaseGlobal.getInstance().mongoDBPool.inc("server_id");
|
||||
request.setCharacterEncoding("utf-8");
|
||||
String name = request.getParameter("name");
|
||||
String ip = request.getParameter("ip");
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 94 KiB |
|
@ -7,28 +7,58 @@
|
|||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<STYLE type="text/css">
|
||||
#login {
|
||||
width: 400px;
|
||||
height: 280px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 20%;
|
||||
margin-left: -200px;
|
||||
margin-top: -140px;
|
||||
border: 1px;
|
||||
/* background-color: #befff1;*/
|
||||
align: center;
|
||||
}
|
||||
|
||||
#form {
|
||||
width: 300px;
|
||||
height: 160px;
|
||||
position: relative;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-left: -150px;
|
||||
margin-top: -80px;
|
||||
}
|
||||
</STYLE>
|
||||
|
||||
<head>
|
||||
<title>注册服务器</title>
|
||||
<title>《戒灵》添加服务器</title>
|
||||
</head>
|
||||
<body>
|
||||
<form action="regist" method="post">
|
||||
<p>name: <input type="text" name="name"/></p>
|
||||
<p>ip: <input type="text" name="ip"/></p>
|
||||
<p>port: <input type="text" value="9000" name="port"/></p>
|
||||
<p>server_id: <input type="text" name="server_id"/></p>
|
||||
<p>channel:<select name="channel">
|
||||
<option value="pc" selected>pc</option>
|
||||
<option value="qq">qq</option>
|
||||
<option value="wx">wx</option>
|
||||
</select></p>
|
||||
<p>sub_channel: <input type="text" name="sub_channel"/></p>
|
||||
<p>plat:<select name="plat">
|
||||
<option value="android" selected>android</option>
|
||||
<option value="ios">ios</option>
|
||||
</select></p>
|
||||
<p>state: <input type="text" value="0" name="state"/></p>
|
||||
<p>open_time: <input type="text" value="0" name="open_time"/></p>
|
||||
<input type="submit" value="Submit"/>
|
||||
</form>
|
||||
<body style="background: url(WEB-INF/images/test.png)">
|
||||
<div id="login">
|
||||
<h1 style="color: #000000" onresize="50">《戒灵》添加服务器</h1>>
|
||||
<div id="form">
|
||||
<form action="regist" method="post">
|
||||
<p>name: <input type="text" name="name"/></p>
|
||||
<p>ip: <input type="text" name="ip"/></p>
|
||||
<p>port: <input type="text" value="9000" name="port"/></p>
|
||||
<p>server_id: <input type="text" name="server_id"/></p>
|
||||
<p>channel:<select name="channel">
|
||||
<option value="pc" selected>pc</option>
|
||||
<option value="qq">qq</option>
|
||||
<option value="wx">wx</option>
|
||||
</select></p>
|
||||
<p>sub_channel: <input type="text" name="sub_channel"/></p>
|
||||
<p>plat:<select name="plat">
|
||||
<option value="android" selected>android</option>
|
||||
<option value="ios">ios</option>
|
||||
</select></p>
|
||||
<p>state: <input type="text" value="0" name="state"/></p>
|
||||
<p>open_time: <input type="text" value="0" name="open_time"/></p>
|
||||
<input type="submit" value="Submit"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue