示例#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);
   }
 }