private void LoginResponse(string str, string pf, bool isRediect) { switch (str) { case UAErrorCode.ErrDataOP: UAHelper.WriteLog("ret", "参数不正确"); Response.Write("{\"ret\":\"fail\",\"msg\":\"参数不正确\"}"); break; case UAErrorCode.ErrOther: Response.Write("{\"ret\":\"fail\",\"msg\":\"其他\"}"); break; case UAErrorCode.ErrTimeout: Response.Write("{\"ret\":\"fail\",\"msg\":\"链接超时\"}"); break; case UAErrorCode.ErrPlatform: Response.Write("{\"ret\":\"fail\",\"msg\":\"pf错误}"); break; case UAErrorCode.ErrCheckSign: Response.Write("{\"ret\":\"fail\",\"msg\":\"sign错误\"}"); break; case UAErrorCode.ErrNoUser: Response.Write("{\"ret\":\"fail\",\"msg\":\"读取错误\"}"); break; case UAErrorCode.ErrException: Response.Write("{\"ret\":\"fail\",\"msg\":\"throw\"}"); break; case UAErrorCode.ErrOK: Response.Write("{\"ret\":\"success\",\"msg\":\"ok\"}"); break; } if (isRediect) { HttpContext.Current.Response.Redirect("Index.aspx?pf=" + pf + "&ck=" + Response.Cookies[FormsAuthentication.FormsCookieName].Value); } Response.End(); }
private string LoginCheck(string openid, string state, string serverId, string nowTimestamp, string pf, string sessionId, string sign, string jsNeed, string nickName) { if (string.IsNullOrEmpty(openid) || string.IsNullOrEmpty(state) || string.IsNullOrEmpty(serverId) || string.IsNullOrEmpty(nowTimestamp) || string.IsNullOrEmpty(pf) || string.IsNullOrEmpty(sessionId) || string.IsNullOrEmpty(sign)) { UAHelper.WriteLog("ret", "参数为空"); return(UAErrorCode.ErrDataOP); } if (nowTimestamp.IndexOf(' ') >= 0) { var times = nowTimestamp.Split(' '); if (times.Length > 0) { nowTimestamp = times[0]; } } var channelAliasEntity = UAFactory.Instance.GetPlatform("" + A8csdkEnum.txh5_a8); //枚举参数修改腾讯key //md5(openid+state+serverId+nowTimestamp+pf+sessionId+nickName+md5Key).tolowcase() string cryptKey = channelAliasEntity.LoginKey; string signParam = ""; string signserverId = "default"; //if (string.IsNullOrEmpty(nickName)) signParam = CryptHelper.GetMD5(openid + state + signserverId + nowTimestamp + pf + sessionId + cryptKey) .ToLower(); //else // signParam = // CryptHelper.GetMD5(openid + state + signserverId + nowTimestamp + pf + sessionId + nickName + // cryptKey).ToLower(); return("0"); }