com.alibaba.fastjson.JSONObject.getLongValue()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(226)

本文整理了Java中com.alibaba.fastjson.JSONObject.getLongValue()方法的一些代码示例,展示了JSONObject.getLongValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.getLongValue()方法的具体详情如下:
包路径:com.alibaba.fastjson.JSONObject
类名称:JSONObject
方法名:getLongValue

JSONObject.getLongValue介绍

暂无

代码示例

代码示例来源:origin: ltsopensource/light-task-scheduler

@Override
public long getLongValue(String key) {
  return jsonObject.getLongValue(key);
}

代码示例来源:origin: ltsopensource/light-task-scheduler

@Override
public long getLongValue(String key) {
  return jsonObject.getLongValue(key);
}

代码示例来源:origin: alibaba/Tangram-Android

public ComponentInfo(JSONObject json) {
  this.name = json.getString(NAME);
  this.id = json.getString(ID);
  this.type = json.getString(TYPE);
  this.version = json.getLongValue(VERSION);
  this.url = json.getString(URL);
}

代码示例来源:origin: ScienJus/smartqq

private void getUinAndPsessionid() {
  LOGGER.debug("开始获取uin和psessionid");
  JSONObject r = new JSONObject();
  r.put("ptwebqq", ptwebqq);
  r.put("clientid", Client_ID);
  r.put("psessionid", "");
  r.put("status", "online");
  Response<String> response = post(ApiURL.GET_UIN_AND_PSESSIONID, r);
  JSONObject result = getJsonObjectResult(response);
  this.psessionid = result.getString("psessionid");
  this.uin = result.getLongValue("uin");
}

代码示例来源:origin: ScienJus/smartqq

public GroupMessage(JSONObject json) {
  JSONArray cont = json.getJSONArray("content");
  this.font = cont.getJSONArray(0).getObject(1, Font.class);
  final int size = cont.size();
  final StringBuilder contentBuilder = new StringBuilder();
  for (int i = 1; i < size; i++) {
    contentBuilder.append(cont.getString(i));
  }
  this.content = contentBuilder.toString();
  this.time = json.getLongValue("time");
  this.groupId = json.getLongValue("group_code");
  this.userId = json.getLongValue("send_uin");
}

代码示例来源:origin: ScienJus/smartqq

/**
 * 获得qq号
 *
 * @param friendId 用户id
 * @return
 */
public long getQQById(long friendId) {
  LOGGER.debug("开始获取QQ号");
  Response<String> response = get(ApiURL.GET_QQ_BY_ID, friendId, vfwebqq);
  return getJsonObjectResult(response).getLongValue("account");
}

代码示例来源:origin: ScienJus/smartqq

public DiscussMessage(JSONObject json) {
  JSONArray content = json.getJSONArray("content");
  this.font = content.getJSONArray(0).getObject(1, Font.class);
  this.content = content.getString(1);
  if (content.size() > 2)
    this.content += content.getString(3);
  this.time = json.getLongValue("time");
  this.discussId = json.getLongValue("did");
  this.userId = json.getLongValue("send_uin");
}

代码示例来源:origin: ScienJus/smartqq

public Message(JSONObject json) {
  JSONArray cont = json.getJSONArray("content");
  this.font = cont.getJSONArray(0).getObject(1, Font.class);
  final int size = cont.size();
  final StringBuilder contentBuilder = new StringBuilder();
  for (int i = 1; i < size; i++) {
    contentBuilder.append(cont.getString(i));
  }
  this.content = contentBuilder.toString();
  this.time = json.getLongValue("time");
  this.userId = json.getLongValue("from_uin");
}

代码示例来源:origin: alibaba/nacos

source.ip = params.getJSONObject("source").getString("ip");
source.state = RaftPeer.State.valueOf(params.getJSONObject("source").getString("state"));
source.term.set(params.getJSONObject("source").getLongValue("term"));
source.heartbeatDueMs = params.getJSONObject("source").getLongValue("heartbeatDueMs");
source.leaderDueMs = params.getJSONObject("source").getLongValue("leaderDueMs");
source.voteFor = params.getJSONObject("source").getString("voteFor");

代码示例来源:origin: alibaba/nacos

remote.ip = beat.getJSONObject("peer").getString("ip");
remote.state = RaftPeer.State.valueOf(beat.getJSONObject("peer").getString("state"));
remote.term.set(beat.getJSONObject("peer").getLongValue("term"));
remote.heartbeatDueMs = beat.getJSONObject("peer").getLongValue("heartbeatDueMs");
remote.leaderDueMs = beat.getJSONObject("peer").getLongValue("leaderDueMs");
remote.voteFor = beat.getJSONObject("peer").getString("voteFor");

代码示例来源:origin: ScienJus/smartqq

/**
 * 获得好友列表(包含分组信息)
 *
 * @return
 */
public List<Category> getFriendListWithCategory() {
  LOGGER.debug("开始获取好友列表");
  JSONObject r = new JSONObject();
  r.put("vfwebqq", vfwebqq);
  r.put("hash", hash());
  Response<String> response = post(ApiURL.GET_FRIEND_LIST, r);
  JSONObject result = getJsonObjectResult(response);
  //获得好友信息
  Map<Long, Friend> friendMap = parseFriendMap(result);
  //获得分组
  JSONArray categories = result.getJSONArray("categories");
  Map<Integer, Category> categoryMap = new HashMap<>();
  categoryMap.put(0, Category.defaultCategory());
  for (int i = 0; categories != null && i < categories.size(); i++) {
    Category category = categories.getObject(i, Category.class);
    categoryMap.put(category.getIndex(), category);
  }
  JSONArray friends = result.getJSONArray("friends");
  for (int i = 0; friends != null && i < friends.size(); i++) {
    JSONObject item = friends.getJSONObject(i);
    Friend friend = friendMap.get(item.getLongValue("uin"));
    categoryMap.get(item.getIntValue("categories")).addFriend(friend);
  }
  return new ArrayList<>(categoryMap.values());
}

代码示例来源:origin: ScienJus/smartqq

private static Map<Long, Friend> parseFriendMap(JSONObject result) {
  Map<Long, Friend> friendMap = new HashMap<>();
  JSONArray info = result.getJSONArray("info");
  for (int i = 0; info != null && i < info.size(); i++) {
    JSONObject item = info.getJSONObject(i);
    Friend friend = new Friend();
    friend.setUserId(item.getLongValue("uin"));
    friend.setNickname(item.getString("nick"));
    friendMap.put(friend.getUserId(), friend);
  }
  JSONArray marknames = result.getJSONArray("marknames");
  for (int i = 0; marknames != null && i < marknames.size(); i++) {
    JSONObject item = marknames.getJSONObject(i);
    friendMap.get(item.getLongValue("uin")).setMarkname(item.getString("markname"));
  }
  JSONArray vipinfo = result.getJSONArray("vipinfo");
  for (int i = 0; vipinfo != null && i < vipinfo.size(); i++) {
    JSONObject item = vipinfo.getJSONObject(i);
    Friend friend = friendMap.get(item.getLongValue("u"));
    friend.setVip(item.getIntValue("is_vip") == 1);
    friend.setVipLevel(item.getIntValue("vip_level"));
  }
  return friendMap;
}

代码示例来源:origin: ScienJus/smartqq

/**
 * 获得讨论组的详细信息
 *
 * @param discussId 讨论组id
 * @return
 */
public DiscussInfo getDiscussInfo(long discussId) {
  LOGGER.debug("开始获取讨论组资料");
  Response<String> response = get(ApiURL.GET_DISCUSS_INFO, discussId, vfwebqq, psessionid);
  JSONObject result = getJsonObjectResult(response);
  DiscussInfo discussInfo = result.getObject("info", DiscussInfo.class);
  //获得讨论组成员信息
  Map<Long, DiscussUser> discussUserMap = new HashMap<>();
  JSONArray minfo = result.getJSONArray("mem_info");
  for (int i = 0; minfo != null && i < minfo.size(); i++) {
    DiscussUser discussUser = minfo.getObject(i, DiscussUser.class);
    discussUserMap.put(discussUser.getUin(), discussUser);
    discussInfo.addUser(discussUser);
  }
  JSONArray stats = result.getJSONArray("mem_status");
  for (int i = 0; stats != null && i < stats.size(); i++) {
    JSONObject item = stats.getJSONObject(i);
    DiscussUser discussUser = discussUserMap.get(item.getLongValue("uin"));
    discussUser.setClientType(item.getIntValue("client_type"));
    discussUser.setStatus(item.getString("status"));
  }
  return discussInfo;
}

代码示例来源:origin: ScienJus/smartqq

for (int i = 0; stats != null && i < stats.size(); i++) {
  JSONObject item = stats.getJSONObject(i);
  GroupUser groupUser = groupUserMap.get(item.getLongValue("uin"));
  groupUser.setClientType(item.getIntValue("client_type"));
  groupUser.setStatus(item.getIntValue("stat"));
for (int i = 0; cards != null && i < cards.size(); i++) {
  JSONObject item = cards.getJSONObject(i);
  groupUserMap.get(item.getLongValue("muin")).setCard(item.getString("card"));
  GroupUser groupUser = groupUserMap.get(item.getLongValue("u"));
  groupUser.setVip(item.getIntValue("is_vip") == 1);
  groupUser.setVipLevel(item.getIntValue("vip_level"));

代码示例来源:origin: TommyLemon/APIJSON

long exceptId = real.getLongValue(KEY_ID);
for (String u : uniques) {
  verifyRepeat(name, u, real.get(u), exceptId, creator);

代码示例来源:origin: foxinmy/weixin4j

@Override
  public Token create() throws WeixinException {
    JSONObject obj = new JSONObject();
    obj.put("corpid", corpid);
    obj.put("provider_secret", providersecret);
    WeixinResponse response = weixinExecutor.post(
        URLConsts.PROVIDER_TOKEN_URL, obj.toJSONString());
    obj = response.getAsJson();
    return new Token(obj.getString("provider_access_token"),
        obj.getLongValue("expires_in") * 1000l);
  }
}

代码示例来源:origin: foxinmy/weixin4j

@Override
  public Token create() throws WeixinException {
    String tokenUrl = String.format(URLConsts.ASSESS_TOKEN_URL, appid, secret);
    WeixinResponse response = weixinExecutor.get(tokenUrl);
    JSONObject result = response.getAsJson();
    return new Token(result.getString("access_token"), result.getLongValue("expires_in") * 1000l);
  }
}

代码示例来源:origin: foxinmy/weixin4j

@Override
public Token create() throws WeixinException {
  WeixinResponse response = weixinExecutor.post(
      String.format(URLConsts.COMPONENET_PRE_CODE_URL, componentTokenManager.getAccessToken()),
      String.format("{\"component_appid\":\"%s\"}", componentId));
  JSONObject result = response.getAsJson();
  return new Token(result.getString("pre_auth_code"), result.getLongValue("expires_in") * 1000l);
}

代码示例来源:origin: foxinmy/weixin4j

@Override
  public Token create() throws WeixinException {
    WeixinResponse response = weixinExecutor.post(
        String.format(URLConsts.SUITE_PRE_CODE_URL,
            suiteTokenManager.getAccessToken()),
        String.format("{\"suite_id\":\"%s\"}", suiteId));
    JSONObject result = response.getAsJson();
    return new Token(result.getString("pre_auth_code"),
        result.getLongValue("expires_in") * 1000l);
  }
}

代码示例来源:origin: foxinmy/weixin4j

@Override
  public Token create() throws WeixinException {
    JSONObject obj = new JSONObject();
    obj.put("component_appid", ticketManager.getThirdId());
    obj.put("component_appsecret", ticketManager.getThirdSecret());
    obj.put("component_verify_ticket", ticketManager.getAccessTicket());
    WeixinResponse response = weixinExecutor.post(URLConsts.COMPONENT_TOKEN_URL, obj.toJSONString());
    obj = response.getAsJson();
    return new Token(obj.getString("component_access_token"), obj.getLongValue("expires_in") * 1000l);
  }
}

相关文章

微信公众号

最新文章

更多