62,074
社区成员
发帖
与我相关
我的任务
分享
$.ajax({
type: "get",
url: ApiUrl + "api/Login/Validate",
contentType: "application/json",
data: { userName: uname, password: upass },
success: function (data, status) {
/**************data第一次接受到返回值平均用了8秒左右********************/
},
error: function (e) {
MaskUtil.unmask();
$.messager.alert("提示", e);
},
complete: function () {
}
});
public HttpResponseMessage Validate(string userName, string password)
{
try
{
bool result = userManager.ValidateUser(userName, password);
if (result)
{
int userId = UserManager.GetUserIdByUserName(userName);
TokenInfo token = tokenManager.CreateToken(userId, userName);
string json = JsonConvert.SerializeObject(token);
return new HttpResponseMessage { Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") };
}
}
catch (Exception ex)
{
PPLogger.Error("Passport-->LoginService-->Login:", ex);
}
return null;
}