tStream())), true);
out.println("{\"fun\":\"timer\"}");
// out.println("{\"fun\":\"getcity\"}");
// 接收来自服务器的消息
BufferedReader br = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
String msg = br.readLine();
int time = (int) (System.currentTimeMillis() / 1000);
MainMapActivity.cha = time - Integer.parseInt(msg);
long tokenTime = System.currentTimeMillis() / 1000 - MainMapActivity.cha - 1;
String token = null;
try {
token = DES3.encode(String.valueOf(tokenTime));
token = URLEncoder.encode(token, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
String url = MainApplication.url + "/zhannew/basic/web/index.php/car/my?userid=" + MainApplication.userId + "&order=1" + "&token=" + token;
Log.e("TAG -- hyc", "getCarOwnerCertificateList: "+url);
OkHttpUtils.get().url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
@Override
public void onError(Call call, Exception e) {
}
@Override
public void onResponse(String response) {
String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
if ("01".equals(rtnCode)) {
String chexing = "";
String data = JsonUtils.getKeyResult(response, "data");
List<CarOwnerCertificateBean> list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
boolean certificated = false;
for (CarOwnerCertificateBean bean : list) {
chexing = bean.getChexing();
certificated = true;
}
if (certificated) {
Gson gson = new Gson();
CarSeriesEntity carSeriesEntity = gson.fromJson(chexing, CarSeriesEntity.class);
userCertifiedModel= carSeriesEntity.getSeriesName();
}
if (userCertifiedModel.equals("")){
int max = ProfileManager.getInstance().getMaxCarModelCount(getApplicationContext());
carCount=ProfileManager.getInstance().getCarModelCount(getApplicationContext()) + 1;
int count =carCount >= max ? 0 :carCount;
ProfileManager.getInstance().setCarModelCount(getApplicationContext(), count);
}else{
ProfileManager.getInstance().setCarModelCount(getApplicationContext(),0);
ProfileManager.getInstance().setMaxCarModelCount(getApplicationContext(), 4);
}
}
}
});
}catch (Exception e){
}
}).start();
}
}
|
||
| 10 | 10 |
|
| 11 | 11 |
|
| 12 | 12 |
|
| 13 |
|
|
| 13 |
|
|
| 14 | 14 |
|
| 15 | 15 |
|
| 16 | 16 |
|