예제 #1
0
 /**
  * 获取用户收货地址信息getDefaultAddr:(这里用一句话描述这个方法的作用). <br>
  * TODO(这里描述这个方法适用条件 – 可选).<br>
  * TODO(这里描述这个方法的执行流程 – 可选).<br>
  * TODO(这里描述这个方法的使用方法 – 可选).<br>
  * TODO(这里描述这个方法的注意事项 – 可选).<br>
  *
  * @author chenhao
  * @return
  * @since JDK 1.6
  */
 public DefaultAddr getDefaultAddr() {
   DefaultAddr defaultAddr = null;
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("userno", Appcontents.userno));
   String request = Constant.URL + "user/defaultAddr";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   // System.out.println("strResult" + strResult);
   if (!StringUtils.isEmpty(strResult)) {
     try {
       JSONObject jsonObject = new JSONObject(strResult);
       defaultAddr = new DefaultAddr();
       if (jsonObject.has("code")) {
         int code = jsonObject.optInt("code");
         if (code == 0) {
           defaultAddr.code = jsonObject.optInt("code");
           return defaultAddr;
         } else {
           defaultAddr.phone = jsonObject.getString("phone");
           defaultAddr.uname = jsonObject.getString("uname");
           defaultAddr.addr = jsonObject.getString("addr");
           defaultAddr.code = jsonObject.optInt("code");
           return defaultAddr;
         }
       }
     } catch (JSONException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
   // System.out.println("defaultAddr===" + defaultAddr.addr);
   return defaultAddr;
 }
예제 #2
0
 /**
  * 获取用户详细信息
  *
  * @param userinfo
  * @return
  */
 public UserInfo doUserInfo(String userno) {
   UserInfo user = null;
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("userno", userno));
   String request = Constant.URL + "user/userinfo";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     try {
       JSONObject jsonObject = new JSONObject(strResult);
       user = new UserInfo();
       user.path = jsonObject.getString("path");
       user.mobile = jsonObject.getString("mobile");
       user.addr = jsonObject.getString("addr");
       user.uname = jsonObject.getString("uname");
       Appcontents.phone = user.mobile;
       // user.push = jsonObject.getInt("push");
       // Appcontents.userInfo = user;
       return user;
     } catch (JSONException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
   return user;
 }
예제 #3
0
  /**
   * 自动登录doLogin:(这里用一句话描述这个方法的作用). <br>
   * TODO(这里描述这个方法适用条件 – 可选).<br>
   * TODO(这里描述这个方法的执行流程 – 可选).<br>
   * TODO(这里描述这个方法的使用方法 – 可选).<br>
   * TODO(这里描述这个方法的注意事项 – 可选).<br>
   *
   * @author chenhao
   * @param mobile
   * @param upwd
   * @since JDK 1.6
   */
  public Userddk doLogin(String mobile, String upwd) {
    Userddk userddk = null;
    List<NameValuePair> nv = new ArrayList<NameValuePair>();
    nv.add(new BasicNameValuePair("mobile", mobile));
    nv.add(new BasicNameValuePair("upwd", upwd));
    nv.add(new BasicNameValuePair("Loginkey", Appcontents.LoginKey));
    String request = Constant.URL + "login/ulogins";
    String strResult = HttpTools.getHttpRequestString(nv, request);
    if (!StringUtils.isEmpty(strResult)) {
      JSONObject jsonObject;
      try {
        // {"code":1,"userno":"152","mobile":"13477030046"}
        jsonObject = new JSONObject(strResult);
        userddk = new Userddk();
        userddk.userno = jsonObject.getString("userno");
        userddk.mobile = jsonObject.getString("mobile");
        userddk.code = jsonObject.getString("code");
      } catch (JSONException e) {
        // TODO Auto-generated catch block
        // e.printStackTrace();

      }
    }
    return userddk;
  }
예제 #4
0
 /**
  * 充值流水
  *
  * @param userno
  * @return
  */
 public List<RechargeWater> doUpdatalogin(String userno) {
   List<RechargeWater> listrechargeWaters = null;
   RechargeWater rechargeWater;
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("userno", userno));
   String request = Constant.URL + "ddk/user/withdrawRecord";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     try {
       JSONObject jsonObject = new JSONObject(strResult);
       if (!StringUtils.isEmpty(jsonObject)) {
         listrechargeWaters = new ArrayList<RechargeWater>();
         JSONArray jsonArray = jsonObject.getJSONArray("");
         int nn = jsonArray.length();
         if (nn > 0) {
           for (int i = 0; i < nn; i++) {
             rechargeWater = getRechargeWater(jsonArray.getJSONObject(i));
             if (rechargeWater != null) {
               listrechargeWaters.add(rechargeWater);
             }
           }
         }
       }
     } catch (JSONException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       return null;
     }
   }
   return listrechargeWaters;
 }
예제 #5
0
 /**
  * private String mobile;// 手机号码 private String password;// 用户密码 private String uname;// 用户名称
  * private String email;// 用户邮箱 private String addr;// 用户生活圈地址 private String judge;
  * //推荐判别(1|商家推荐,2|用户推荐) private String upno; //推荐用户编号或者商家编号
  *
  * @return 注册
  */
 public String doReg(
     String mobile,
     String password,
     String uname,
     String email,
     String addr,
     String judge,
     String upno) {
   String returns = "";
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("mobile", mobile));
   nv.add(new BasicNameValuePair("password", public_class.MD5(password)));
   nv.add(new BasicNameValuePair("uname", uname));
   nv.add(new BasicNameValuePair("email", email));
   nv.add(new BasicNameValuePair("addr", addr));
   nv.add(new BasicNameValuePair("judge", judge));
   nv.add(new BasicNameValuePair("upno", upno));
   nv.add(new BasicNameValuePair("LoginKey", Appcontents.LoginKey));
   String request = Constant.URL + "register/uregister";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     // [mobile=18986167582, password=123456, uname, email, addr,
     // judge=1, upno=100]
     returns = strResult;
   }
   return returns;
 }
예제 #6
0
 /**
  * 验证手机号findumobile:(这里用一句话描述这个方法的作用). <br>
  * TODO(这里描述这个方法适用条件 – 可选).<br>
  * TODO(这里描述这个方法的执行流程 – 可选).<br>
  * TODO(这里描述这个方法的使用方法 – 可选).<br>
  * TODO(这里描述这个方法的注意事项 – 可选).<br>
  *
  * @author chenhao
  * @param mobile
  * @return
  * @since JDK 1.6
  */
 public int findumobile(String mobile) {
   int s = 0;
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("mobile", mobile));
   String request = Constant.URL + "register/findumobile";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     s = Integer.parseInt(strResult);
   }
   return s;
 }
예제 #7
0
 /**
  * 更新用户昵称 updataUserName:(这里用一句话描述这个方法的作用). <br>
  * TODO(这里描述这个方法适用条件 – 可选).<br>
  * TODO(这里描述这个方法的执行流程 – 可选).<br>
  * TODO(这里描述这个方法的使用方法 – 可选).<br>
  * TODO(这里描述这个方法的注意事项 – 可选).<br>
  *
  * @author chenhao
  * @param uname
  * @return
  * @since JDK 1.6
  */
 public String updataUserName(String uname) {
   String s;
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("userno", Appcontents.userno));
   nv.add(new BasicNameValuePair("uname", uname));
   String request = Constant.URL + "user/updateUser";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     s = strResult;
   }
   return uname;
 }
예제 #8
0
 /**
  * updataUserName:(这里用一句话描述这个方法的作用). <br>
  * TODO(这里描述这个方法适用条件 – 可选).<br>
  * TODO(这里描述这个方法的执行流程 – 可选).<br>
  * TODO(这里描述这个方法的使用方法 – 可选).<br>
  * TODO(这里描述这个方法的注意事项 – 可选).<br>
  *
  * @author chenhao
  * @param uname
  * @return
  * @since JDK 1.6
  */
 public int checkFindpay(String newcode) {
   int s = 0;
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("userno", Appcontents.userno));
   nv.add(new BasicNameValuePair("newcode", newcode));
   String request = Constant.URL + "user/findpay";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     s = Integer.parseInt(strResult);
   }
   return s;
 }
예제 #9
0
 /**
  * 修改登录密码
  *
  * @param userno
  * @param passcode
  * @param newcode
  * @return
  */
 public int doUpdatalogin(String userno, String passcode, String newcode) {
   int returns = 0;
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("userno", userno));
   // nv.add(new BasicNameValuePair("passcode", passcode));
   nv.add(new BasicNameValuePair("newcode", newcode));
   String request = Constant.URL + "/user/updatelogin";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     returns = Integer.parseInt(strResult);
   }
   return returns;
 }
예제 #10
0
 /**
  * 验证支付密码
  *
  * @param userno
  * @param passcode
  * @param newcode
  * @return
  */
 public String doCheckcode(String userno, String passcode, String newcode) {
   String returns = "";
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("userno", userno));
   nv.add(new BasicNameValuePair("passcode", passcode));
   nv.add(new BasicNameValuePair("newcode", newcode));
   String request = Constant.URL + "user/checkcode";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     returns = strResult;
   }
   return returns;
 }
예제 #11
0
 /**
  * 找回(设置)支付密码 免密码支付
  *
  * @param userno
  * @param passcode
  * @param amount
  * @return
  */
 public int doFindpay(String userno, String passcode, String amount) {
   int returns = 0;
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("userno", userno));
   nv.add(new BasicNameValuePair("rechpwd", passcode));
   nv.add(new BasicNameValuePair("amount", amount));
   String request = Constant.URL + "user/alterAmount";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     returns = Integer.parseInt(strResult);
   }
   return returns;
 }
예제 #12
0
 /**
  * 修改支付密码
  *
  * @param userno
  * @param passcode
  * @param newcode
  * @return
  */
 public int doUpdatepay(String userno, String passcode, String newcode) {
   int returns = -1;
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("userno", userno));
   nv.add(new BasicNameValuePair("passcode", public_class.MD5(Appcontents.mine.rechpwd)));
   nv.add(new BasicNameValuePair("newcode", public_class.MD5(newcode)));
   String request = Constant.URL + "/user/updatepay";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     returns = Integer.parseInt(strResult);
   }
   return returns;
 }
예제 #13
0
 /**
  * @param mobile 手机号
  * @param sms 短信内容
  * @param uid 验证码
  * @param key 验证密码
  * @return
  */
 public void doSMS(String uid, String key, String mobile, String sms, String variable) {
   String returns = "";
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("uid", uid));
   nv.add(new BasicNameValuePair("key", key));
   nv.add(new BasicNameValuePair("mobile", mobile));
   nv.add(new BasicNameValuePair("sms", sms));
   nv.add(new BasicNameValuePair("variable", variable));
   String request = Constant.URL + "bank/messages";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     returns = strResult;
   }
 }
예제 #14
0
  /**
   * 推送开关
   *
   * @param push
   * @return
   */
  public String updatePush(String push) {
    String strRespers = "";
    String strResult = "";
    List<NameValuePair> nv = new ArrayList<NameValuePair>();
    nv.add(new BasicNameValuePair("userno", Appcontents.userno));
    nv.add(new BasicNameValuePair("push", push));
    String request = Constant.URL + "user/updatePush";
    strResult = HttpTools.getHttpRequestString(nv, request);
    if (!StringUtils.isEmpty(strResult)) {
      strRespers = strResult + "";
      // System.out.println("strRespers==" + strRespers);
    }

    return strRespers;
  }
예제 #15
0
 /** 检查更新 private String latest_version;// 版本号 private String ptly; //平台来源(1/安卓,2/IOS) 返回值类型: */
 public Versions get_checkVersion(String latest_version) {
   Versions versions = null;
   String strResult = "";
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("latest_version", latest_version));
   nv.add(new BasicNameValuePair("ptly", 1 + ""));
   nv.add(new BasicNameValuePair("plat", 2 + ""));
   String request = Constant.URL + "bank/appUpdate";
   strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     try {
       JSONObject jObject = new JSONObject(strResult);
       if (!StringUtils.isEmpty(jObject)) {
         if (jObject.has("code")) {
           versions = new Versions();
           versions.code = jObject.getString("code");
           // if (Integer.parseInt(versions.code) == 1) {
           // return versions;
           // } else if (Integer.parseInt(versions.code) == 2) {
           // versions.versions = jObject.getString("versions");
           // versions.link = jObject.getString("link");
           // versions.note = jObject.getString("note");
           // Appcontents.versions = versions;
           // return versions;
           // }
           versions.versions = jObject.getString("versions");
           versions.link = jObject.getString("link");
           versions.note = jObject.getString("note");
           return versions;
         }
       }
     } catch (JSONException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
   return versions;
 }
예제 #16
0
 /**
  * 获取用户金额信息 getCartCheck:(这里用一句话描述这个方法的作用). <br>
  * TODO(这里描述这个方法适用条件 – 可选).<br>
  * TODO(这里描述这个方法的执行流程 – 可选).<br>
  * TODO(这里描述这个方法的使用方法 – 可选).<br>
  * TODO(这里描述这个方法的注意事项 – 可选).<br>
  *
  * @author chenhao
  * @param userno
  * @return
  * @since JDK 1.6
  */
 public CartCheck getCartCheck() {
   CartCheck cartCheck = null;
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("userno", Appcontents.userno));
   String request = Constant.URL + "user/cartCheck";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     try {
       JSONObject jsonObject = new JSONObject(strResult);
       if (jsonObject != null) {
         cartCheck = new CartCheck();
         cartCheck.balance = jsonObject.getString("balance");
         cartCheck.exemptamount = jsonObject.getString("exemptamount");
         cartCheck.havamount = jsonObject.getString("havamount");
         cartCheck.rechpwd = jsonObject.getString("rechpwd");
       }
     } catch (JSONException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
   return cartCheck;
 }
예제 #17
0
 /**
  * 用户信息查询
  *
  * @param userno 用户编号
  * @return
  *     [{"uname":"木棉","mobile":"13710601173","rechpwd":"e10adc3949ba59abbe56e057f20f883e","exemptamount":"10.00","iname":"http://183.129.233.50:9100/ddk/Userimg/20141011020429501858.jpg","push":0,"balance":"362.67"
  *     ]
  */
 public Mine getSimpleuser(String userno) {
   Mine mine = null;
   List<NameValuePair> nv = new ArrayList<NameValuePair>();
   nv.add(new BasicNameValuePair("userno", userno));
   String request = Constant.URL + "/user/simpleuser";
   String strResult = HttpTools.getHttpRequestString(nv, request);
   if (!StringUtils.isEmpty(strResult)) {
     try {
       JSONArray jsonObject = new JSONArray(strResult);
       int nn = jsonObject.length();
       if (nn > 0) {
         for (int i = 0; i < nn; i++) {
           mine = Mine(jsonObject.getJSONObject(i));
           Appcontents.mine = mine;
         }
       }
     } catch (JSONException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       return null;
     }
   }
   return mine;
 }