获取json某个值

来源:互联网 发布:淘宝店铺违规 编辑:程序博客网 时间:2024/05/22 17:13
/**
* 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;
}
0 0
原创粉丝点击