//获取用户信息 public JsonResult getUserInfo(string deviceId) { var res = new JsonResult(); BLL.User _user = new BLL.User(); DataTable dt = _user.getUserInfo(deviceId); if (dt.Rows.Count > 0) { user u = new user(); u.id = dt.Rows[0]["id"].ToString(); u.open_id = dt.Rows[0]["open_id"].ToString(); u.name = dt.Rows[0]["name"].ToString(); u.age = Convert.ToInt32(dt.Rows[0]["age"].ToString()); u.sex = dt.Rows[0]["sex"].ToString(); u.telephone = dt.Rows[0]["telephone"].ToString(); u.period = dt.Rows[0]["period"].ToString(); u.height = Convert.ToSingle(dt.Rows[0]["height"].ToString()); u.weight = Convert.ToSingle(dt.Rows[0]["weight"].ToString()); u.waistline = Convert.ToSingle(dt.Rows[0]["waistline"].ToString()); u.workingType = dt.Rows[0]["workingType"].ToString(); res.Data = new { success = true, backData = u }; } else { res.Data = new { success = false, backMsg = "用户查询失败" }; } res.JsonRequestBehavior = JsonRequestBehavior.AllowGet;//允许使用GET方式获取,否则用GET获取是会报错。 return(res); }