Ejemplo n.º 1
0
        public ActionResult OnBindUser(string userName, string password, string sessionId)
        {
            StatusReport sr         = new StatusReport();
            SessionBag   sessionBag = null;

            sessionBag = SessionContainer.GetSession(sessionId);
            if (sessionBag == null)
            {
                sr.status = "Fail";
                sr.result = "session已失效";
                return(Json(sr));
            }
            string openId = sessionBag.OpenId;
            //string openId = "oTTDy0KN71B2XLMXobrapvhqlHcY";
            int    id   = EmployeeDal.CheckEmployeeExist(userName, password);
            string temp = id > 0 ? "存在" : "不存在";

            if (id > 0)
            {
                sr = EmployeeDal.BindEmployee(id, openId);
                return(Json(sr));
            }
            else
            {
                var data = new
                {
                    msg      = "hello world",
                    username = userName,
                    password = password,
                    isExist  = temp
                };
                return(Json(data));
            }
        }