獲取json某個值

/**
* 4.查詢賬戶餘額
* 查詢聚合賬號現金餘額,頻率限制30s/次
* @return
* @throws Exception
* eq:{"reason":"查詢成功","result":{"uid":"jingliangshuju","money":"0.000"},"error_code":0}
*/
@SuppressWarnings("static-access")
public double getBalance() throws Exception {
String timestamp = System.currentTimeMillis() / 1000 + "";
String sign = md5(openId + key + timestamp);
String result = get(yueUrl.replace("%", timestamp).replace("$", sign),
0);
com.alibaba.fastjson.JSONObject json=(new com.alibaba.fastjson.JSONObject()).parseObject(result);
if(json.getString("error_code").equals("0")){
com.alibaba.fastjson.JSONObject data=(new com.alibaba.fastjson.JSONObject()).parseObject(json.getString("result"));
return data.getDouble("money");
}
return 0;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章