private void Login() { string UID = g_Context.Request["user_id"]; string PWD = g_Context.Request["password"]; string PWD_MD5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(PWD, "MD5"); User user = WebUserBase.GetUser(UID); bool isSuccess = false; if (user.PWD == PWD_MD5) { isSuccess = true; } if (isSuccess) { //记录Session g_Context.Session["LoginStatus"] = UID; SendError sendError = new SendError("200", "登陆成功", "user_id"); Send(sendError); } else { SendError sendError = new SendError("100", "登陆失败,账号密码有误,请重试!", "user_id"); Send(sendError); } }
private void GetUserInfo() { User u = WebUserBase.GetUser(SessionUID); if (u.ID == null) { SendError sendError = new SendError("100", "不存在小伙伴信息", "user_id"); Send(sendError); } else { SendError sendError = new SendError("201", JsonConvert.SerializeObject(u), "user_id"); Send(sendError); } }