示例#1
0
  public ArrayList<NewsType> getNewsType() throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(URL_DOMAIN + URL_API_NEWS, new BasicNameValuePair("act", "listc"));
    String content = mHttpApi.doHttpRequest(httpGet);
    Type type = new TypeToken<ArrayList<NewsType>>() {}.getType();
    return gson.fromJson(content, type);
  }
示例#2
0
  // load magazine
  public String loadMagzine(int sid) throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(
            URL_DOMAIN + URL_API_MAGAZINE,
            new BasicNameValuePair("act", "down"),
            new BasicNameValuePair("sid", String.valueOf(sid)));
    return mHttpApi.doHttpRequest(httpGet);
  }
示例#3
0
  public ArrayList<MagazineSort> getMagazineSort()
      throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(URL_DOMAIN + URL_API_MAGAZINE, new BasicNameValuePair("act", "cls"));
    String content = mHttpApi.doHttpRequest(httpGet);
    Type type = new TypeToken<ArrayList<MagazineSort>>() {}.getType();
    return gson.fromJson(content, type);
  }
示例#4
0
  public String getVoteNum(int vid) throws WH_DMException, UnKnownException, IOException {

    HttpPost httpPost =
        mHttpApi.createHttpPost(
            URL_API_DOMAIN,
            new BasicNameValuePair("act", "vnum"),
            new BasicNameValuePair("vid", String.valueOf(vid)));
    String content = mHttpApi.doHttpRequest(httpPost);
    return content;
  }
示例#5
0
  public boolean unsubcribe(int id) throws WH_DMException, UnKnownException, IOException {

    HttpPost httPost =
        mHttpApi.createHttpPost(
            URL_DOMAIN + URL_API_MAGAZINE,
            new BasicNameValuePair("act", "orderc"),
            new BasicNameValuePair("mid", "" + id));
    String content = mHttpApi.doHttpRequest(httPost);
    PostResult result = gson.fromJson(content, PostResult.class);
    return result.getResult();
  }
示例#6
0
  public ArrayList<PicsNews> getPicsNews() throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(URL_DOMAIN + URL_API_NEWS, new BasicNameValuePair("act", "listn"));
    String content = mHttpApi.doHttpRequest(httpGet);
    if (DEBUG) {
      Log.d("getPicsNews", "getPicsNews");
    }
    Type type = new TypeToken<ArrayList<PicsNews>>() {}.getType();
    return gson.fromJson(content, type);
  }
示例#7
0
  public boolean delFav(int nid, int type) throws WH_DMException, UnKnownException, IOException {

    HttpPost httpPost =
        mHttpApi.createHttpPost(
            URL_DOMAIN + URL_API_FAV,
            new BasicNameValuePair("act", "del"),
            new BasicNameValuePair("nid", String.valueOf(nid)),
            new BasicNameValuePair("type", String.valueOf(type)));
    String content = mHttpApi.doHttpRequest(httpPost);
    PostResult result = gson.fromJson(content, PostResult.class);
    return result.getResult();
  }
示例#8
0
  public ArrayList<VoteResultPercent> getVoteResultPercent(int vid)
      throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(
            URL_API_DOMAIN,
            new BasicNameValuePair("act", "result"),
            new BasicNameValuePair("vid", String.valueOf(vid)));
    String content = mHttpApi.doHttpRequest(httpGet);
    Type type = new TypeToken<ArrayList<VoteResultPercent>>() {}.getType();
    return gson.fromJson(content, type);
  }
示例#9
0
  public ArrayList<PictureMagzine> getPictureMagzine(int sid)
      throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(
            URL_DOMAIN + URL_API_MAGAZINE,
            new BasicNameValuePair("act", "maglist"),
            new BasicNameValuePair("sid", String.valueOf(sid)));
    String content = mHttpApi.doHttpRequest(httpGet);
    Type type = new TypeToken<ArrayList<PictureMagzine>>() {}.getType();
    return gson.fromJson(content, type);
  }
示例#10
0
  public ArrayList<PhotoDetails> getPhotoDetails(int aid)
      throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(
            URL_API_DOMAIN,
            new BasicNameValuePair("act", "listpic"),
            new BasicNameValuePair("id", String.valueOf(aid)));
    String content = mHttpApi.doHttpRequest(httpGet);
    Type type = new TypeToken<ArrayList<PhotoDetails>>() {}.getType();
    return gson.fromJson(content, type);
  }
示例#11
0
  public Article getArticle(int sid) throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(
            URL_DOMAIN + URL_API_MAGAZINE,
            new BasicNameValuePair("act", "cont"),
            new BasicNameValuePair("id", String.valueOf(sid)));
    String content = mHttpApi.doHttpRequest(httpGet);
    Type type = new TypeToken<ArrayList<Article>>() {}.getType();
    Article article = ((ArrayList<Article>) gson.fromJson(content, type)).get(0);
    return article;
  }
示例#12
0
  // find password
  public PostResult findPassword(String email)
      throws WH_DMException, UnKnownException, IOException {

    HttpPost httPost =
        mHttpApi.createHttpPost(
            URL_DOMAIN + URL_API_MEM,
            new BasicNameValuePair("act", "findpass"),
            new BasicNameValuePair("mail", email));
    String content = mHttpApi.doHttpRequest(httPost);
    PostResult result = gson.fromJson(content, PostResult.class);
    return result;
  }
示例#13
0
  public PostResult loginById(String machine) throws WH_DMException, UnKnownException, IOException {

    HttpPost httPost =
        mHttpApi.createHttpPost(
            URL_DOMAIN + URL_API_MEM,
            new BasicNameValuePair("act", "load"),
            new BasicNameValuePair("machine", machine),
            new BasicNameValuePair("mail", null),
            new BasicNameValuePair("pass", null));
    String content = mHttpApi.doHttpRequest(httPost);
    PostResult result = gson.fromJson(content, PostResult.class);
    return result;
  }
示例#14
0
  public PostResult login2(String logemail, String logpassword, String machine)
      throws WH_DMException, UnKnownException, IOException {

    HttpPost httPost =
        mHttpApi.createHttpPost(
            URL_DOMAIN + URL_API_MEM,
            new BasicNameValuePair("act", "login"),
            new BasicNameValuePair("mail", logemail),
            new BasicNameValuePair("pass", logpassword),
            new BasicNameValuePair("machine", machine));
    String content = mHttpApi.doHttpRequest(httPost);
    return gson.fromJson(content, PostResult.class);
  }
示例#15
0
  // vote
  public ArrayList<Vote> getVote(int sid, String machine)
      throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(
            URL_API_DOMAIN,
            new BasicNameValuePair("act", "listv"),
            new BasicNameValuePair("sid", String.valueOf(sid)),
            new BasicNameValuePair("machine", machine));
    String content = mHttpApi.doHttpRequest(httpGet);

    return VoteUitl.parseVote(content);
  }
示例#16
0
  public PostResult addTop(String fid, String machine)
      throws WH_DMException, UnKnownException, IOException {

    HttpPost httPost =
        mHttpApi.createHttpPost(
            URL_DOMAIN + URL_API_NEWS,
            new BasicNameValuePair("act", "ftop"),
            new BasicNameValuePair("fid", fid),
            new BasicNameValuePair("machine", machine));
    String content = mHttpApi.doHttpRequest(httPost);
    PostResult result = gson.fromJson(content, PostResult.class);
    return result;
  }
示例#17
0
  public PostResult commitFeedBack(String contactways, String fcontent)
      throws WH_DMException, UnKnownException, IOException {

    HttpPost httPost =
        mHttpApi.createHttpPost(
            URL_DOMAIN + URL_API_FEEDBACK,
            new BasicNameValuePair("Act", "feedback"),
            new BasicNameValuePair("User", contactways),
            new BasicNameValuePair("Memo", fcontent));
    String content = mHttpApi.doHttpRequest(httPost);
    PostResult result = gson.fromJson(content, PostResult.class);
    return result;
  }
示例#18
0
  public boolean addReply(String rcontent, String fid)
      throws WH_DMException, UnKnownException, IOException {

    HttpPost httPost =
        mHttpApi.createHttpPost(
            URL_DOMAIN + URL_API_NEWS,
            new BasicNameValuePair("act", "Reply"),
            new BasicNameValuePair("fid", fid),
            new BasicNameValuePair("rcontent", rcontent));
    String content = mHttpApi.doHttpRequest(httPost);
    PostResult result = gson.fromJson(content, PostResult.class);
    Log.d("review", content);
    return result.getResult();
  }
示例#19
0
  public ArrayList<Magazine> getMagazine(String cid, int page)
      throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(
            URL_DOMAIN + URL_API_MAGAZINE,
            new BasicNameValuePair("act", "list"),
            new BasicNameValuePair("pi", String.valueOf(page)),
            new BasicNameValuePair("pz", String.valueOf(20)),
            new BasicNameValuePair("cid", cid));
    String content = mHttpApi.doHttpRequest(httpGet);
    Type type = new TypeToken<ArrayList<Magazine>>() {}.getType();
    return gson.fromJson(content, type);
  }
示例#20
0
  public VoteResult postVote(int aid, String vtitle, String machine)
      throws WH_DMException, UnKnownException, IOException {

    HttpPost httpPost =
        mHttpApi.createHttpPost(
            URL_API_DOMAIN,
            new BasicNameValuePair("act", "vote"),
            new BasicNameValuePair("vid", String.valueOf(aid)),
            new BasicNameValuePair("vtitle", vtitle),
            new BasicNameValuePair("machine", machine));
    String content = mHttpApi.doHttpRequest(httpPost);
    Type type = new TypeToken<VoteResult>() {}.getType();
    return gson.fromJson(content, type);
  }
示例#21
0
  public NewsContent[] getNewsContent(int id) throws WH_DMException, UnKnownException, IOException {

    HttpGet httpget =
        mHttpApi.createHttpGet(
            URL_DOMAIN + URL_API_NEWS,
            new BasicNameValuePair("act", "listd"),
            new BasicNameValuePair("id", String.valueOf(id)));
    String content = mHttpApi.doHttpRequest(httpget);
    if (DEBUG) {
      Log.d("getNewsContent", "getNewsContent");
      Log.d("gson", content);
    }
    return gson.fromJson(content, NewsContent[].class);
  }
示例#22
0
  public ArrayList<Reply> getReply(int fid) throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(
            URL_DOMAIN + URL_API_NEWS,
            new BasicNameValuePair("act", "listrp"),
            new BasicNameValuePair("fid", String.valueOf(fid)));
    String content = mHttpApi.doHttpRequest(httpGet);
    if (DEBUG) {
      Log.d("getComment", "getComment");
      Log.d("gson", content);
    }
    Type type = new TypeToken<ArrayList<Reply>>() {}.getType();
    return gson.fromJson(content, type);
  }
示例#23
0
  public PostResult register(String regemail, String regepass, String machineId)
      throws WH_DMException, UnKnownException, IOException {

    HttpPost httPost =
        mHttpApi.createHttpPost(
            URL_DOMAIN + URL_API_MEM,
            new BasicNameValuePair("act", "reg"),
            new BasicNameValuePair("mail", regemail),
            new BasicNameValuePair("pass", regepass),
            new BasicNameValuePair("machine", machineId));
    String content = mHttpApi.doHttpRequest(httPost);
    Log.d("content", content);
    PostResult result = gson.fromJson(content, PostResult.class);
    return result;
  }
示例#24
0
  public boolean addPhotoReview(String _content, int id)
      throws WH_DMException, UnKnownException, IOException {

    HttpPost httPost =
        mHttpApi.createHttpPost(
            URL_DOMAIN + URL_API_NEWS,
            new BasicNameValuePair("act", "addtfb"),
            new BasicNameValuePair("id", String.valueOf(id)),
            new BasicNameValuePair("fcontent", _content));
    String content = mHttpApi.doHttpRequest(httPost);

    PostResult result = gson.fromJson(content, PostResult.class);
    Log.d("review", content);
    return result.getResult();
  }
示例#25
0
  public ArrayList<TwoPhotos> getHotPhotos(int page)
      throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(
            URL_DOMAIN + URL_API_NEWS,
            new BasicNameValuePair("act", "listh"),
            new BasicNameValuePair("spage", "12"),
            new BasicNameValuePair("page", String.valueOf(page)));
    String content = mHttpApi.doHttpRequest(httpGet);
    if (DEBUG) {
      Log.d("getPhotos", "getPhotos");
    }
    Type type = new TypeToken<ArrayList<Photo>>() {}.getType();
    return PhotoUtil.chagePhoto((ArrayList<Photo>) gson.fromJson(content, type));
  }
示例#26
0
  public ArrayList<PicWithTxtNews> getHeadNews(int page)
      throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(
            URL_DOMAIN + URL_API_NEWS,
            new BasicNameValuePair("act", "listt"),
            new BasicNameValuePair("cid", "1"),
            new BasicNameValuePair("spage", "12"),
            new BasicNameValuePair("page", String.valueOf(page)));
    String content = mHttpApi.doHttpRequest(httpGet);
    if (DEBUG) {
      Log.d("getHeadNews", "getHeadNews");
      Log.d("gson", content);
    }
    Type type = new TypeToken<ArrayList<PicWithTxtNews>>() {}.getType();
    return gson.fromJson(content, type);
  }
示例#27
0
  public ArrayList<Comment> getPhotoComment(int id, int page)
      throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(
            URL_DOMAIN + URL_API_NEWS,
            new BasicNameValuePair("act", "listtfb"),
            new BasicNameValuePair("id", String.valueOf(id)),
            new BasicNameValuePair("spage", "12"),
            new BasicNameValuePair("page", "" + page));
    String content = mHttpApi.doHttpRequest(httpGet);
    if (DEBUG) {
      Log.d("getComment", "getComment");
      Log.d("gson", content);
    }
    Type type = new TypeToken<ArrayList<Comment>>() {}.getType();
    return gson.fromJson(content, type);
  }
示例#28
0
  public ArrayList<Favorite> getFav(int pz, int pi)
      throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet =
        mHttpApi.createHttpGet(
            URL_DOMAIN + URL_API_FAV,
            new BasicNameValuePair("act", "list"),
            new BasicNameValuePair("pz", String.valueOf(pz)),
            new BasicNameValuePair("pi", String.valueOf(pi)));
    String content = mHttpApi.doHttpRequest(httpGet);
    // return content;
    Type typetoken = new TypeToken<ArrayList<Favorite>>() {}.getType();
    try {
      return gson.fromJson(content, typetoken);
    } catch (Exception ex) {
      gson.fromJson(content, PostResult.class);
      return null;
    }
  }
示例#29
0
  public Cover subcribe(int id) throws WH_DMException, UnKnownException, IOException {

    HttpPost httPost =
        mHttpApi.createHttpPost(
            URL_DOMAIN + URL_API_MAGAZINE,
            new BasicNameValuePair("act", "order"),
            new BasicNameValuePair("mid", "" + id));
    String content = mHttpApi.doHttpRequest(httPost);
    PostResult result = gson.fromJson(content, PostResult.class);
    if (result.getResult()) {
      Cover cover = new Cover();
      String[] msg = (result.getMsg()).split(",", 3);
      cover.setId(Integer.parseInt(msg[0]));
      cover.setMagazineName(msg[1]);
      cover.setMagazinePic(msg[2]);
      return cover;
    } else {
      return null;
    }
  }
示例#30
0
  public PostResult getLoadPic() throws WH_DMException, UnKnownException, IOException {

    HttpGet httpGet = mHttpApi.createHttpGet(URL_DOMAIN + URL_API_LOADPIC);
    String content = mHttpApi.doHttpRequest(httpGet);
    return gson.fromJson(content, PostResult.class);
  }