示例#1
0
 /**
  * 获取登录信息
  *
  * @param string
  * @return
  */
 public static Object getLoginModel(String string) {
   if (getResultInt(string) == 0) {
     try {
       JSONObject object = new JSONObject(string);
       JSONObject result = object.getJSONObject("result");
       int type = result.getInt("type");
       if (type == 0) {
         JSONObject data = result.getJSONObject("data");
         LoginModel model = new LoginModel();
         model.setRole_id(data.getInt("role_id"));
         model.setSeller_id(data.getInt("seller_id"));
         model.setShop_id(data.getInt("shop_id"));
         model.setHead_photo(data.getString("head_photo"));
         model.setDeposit(data.getString("deposit"));
         model.setAccount_name(data.getString("account_name"));
         model.setSum(data.getString("sum"));
         model.setCount(data.getString("count"));
         model.setLastMonthIncome(data.getString("lastMonthIncome"));
         model.setCurMonthIncome(data.getString("curMonthIncome"));
         model.setLogin_phone(data.getString("login_phone"));
         return model;
       } else if (type == 2) {
         return result.getString("info");
       }
     } catch (JSONException e) {
       e.printStackTrace();
     }
     return null;
   } else {
     return getErrorValue(string);
   }
 }
示例#2
0
 /**
  * 我的资料
  *
  * @param string
  * @return
  */
 public static Object getMyData(String string) {
   if (getResultInt(string) == 0) {
     try {
       JSONObject object = new JSONObject(string);
       JSONObject result = object.getJSONObject("result");
       JSONObject data1 = result.getJSONObject("data");
       LoginModel model = new LoginModel();
       model.setHead_photo(data1.getString("head_photo"));
       model.setShop_name(data1.getString("shop_name"));
       model.setContact_person(data1.getString("contact_person"));
       model.setMobile(data1.getString("mobile"));
       model.setAreaframe(data1.getString("areaframe"));
       model.setShop_addr(data1.getString("shop_addr"));
       model.setShopuser_name(data1.getString("shopuser_name"));
       model.setRevenues_code(data1.getString("revenues_code"));
       model.setContact_tel(data1.getString("contact_tel"));
       model.setBusiness_encoding(data1.getString("business_encoding"));
       return model;
     } catch (JSONException e) {
       e.printStackTrace();
     }
     return null;
   } else {
     return getErrorValue(string);
   }
 }