Commit f7f9e113 by patpat

修改错别词

parent a0a2109e
......@@ -2,10 +2,8 @@ package com.bgycc.smartcanteen.server.websocket;
import android.util.Log;
import android.util.SparseArray;
import com.bgycc.smartcanteen.App;
import com.bgycc.smartcanteen.AppConfig;
import com.bgycc.smartcanteen.action.ActionEnum;
import com.bgycc.smartcanteen.action.Action;
import com.bgycc.smartcanteen.action.PayOfflineAction;
import com.bgycc.smartcanteen.server.websocket.event.ConnectStateEvent;
import com.bgycc.smartcanteen.server.websocket.event.RecvMessageEvent;
......@@ -151,7 +149,7 @@ public class MainWebSocket extends WebSocketClient {
}
private int mSessionId = 0;
private final SparseArray<Resquest> mResquestList = new SparseArray<>();
private final SparseArray<Request> mRequestList = new SparseArray<>();
private final HashMap<String, ArrayList<Response>> mSubscribeList = new HashMap<>();
private MainWebSocket(URI serverUri) {
......@@ -163,18 +161,18 @@ public class MainWebSocket extends WebSocketClient {
if (mSessionId >= Integer.MAX_VALUE) mSessionId = 0;
mSessionId++;
Resquest resquest = new Resquest();
resquest.action = action;
resquest.time = System.currentTimeMillis();
resquest.response = callback;
resquest.params = new JSONObject();
resquest.params.put(FieldEnum.equipmentId.name(), sDeviceSN);
resquest.params.put(FieldEnum.serialNumber.name(), mSessionId);
resquest.params.put(FieldEnum.action.name(), action);
resquest.params.put(FieldEnum.data.name(), data);
mResquestList.put(mSessionId, resquest);
String msg = resquest.params.toString();
Request request = new Request();
request.action = action;
request.time = System.currentTimeMillis();
request.response = callback;
request.params = new JSONObject();
request.params.put(FieldEnum.equipmentId.name(), sDeviceSN);
request.params.put(FieldEnum.serialNumber.name(), mSessionId);
request.params.put(FieldEnum.action.name(), action);
request.params.put(FieldEnum.data.name(), data);
mRequestList.put(mSessionId, request);
String msg = request.params.toString();
Log.i(TAG, String.format("send: %s", msg));
EventBus.getDefault().post(new SendMessageEvent(msg));
super.send(msg);
......@@ -207,9 +205,9 @@ public class MainWebSocket extends WebSocketClient {
if (res != null) res.parse(code, json);
}
} else {
Resquest resquest = mResquestList.get(sessionId);
if (resquest != null && resquest.response != null) {
resquest.response.parse(code, json);
Request request = mRequestList.get(sessionId);
if (request != null && request.response != null) {
request.response.parse(code, json);
}
}
} catch (JSONException e) {
......@@ -229,7 +227,7 @@ public class MainWebSocket extends WebSocketClient {
ex.printStackTrace();
}
public static class Resquest {
public static class Request {
String action;
long time = 0;
JSONObject params;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment