相信一定会帮上你

public ActionResult Index()
{
return View();
}

public ActionResult About()
{
ViewBag.Message = "Your application description page.";

return View();
}

public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";

return View();
}。。。。。。。。

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="Scripts/jquery-3.3.1.js"></script>
</head>
<body>
<input type="button" onclick="get()" />
<script>
function get() {
$.ajax({
url: 'http://localhost:53035/api/Default/get',
type: 'get',
headers: {"BWAUTH":"dsafasdfasd"},
dataType: 'json',
success: function (data) {
if (data.Code != 0) {
alert(data.Msg);
} else {
alert(data.Data);
}
}
});
}
</script>
</body>
</html>

-------------------------------

public string Login(UserInfo user)
{
string token = "";
if (user.Name == "Admin" && user.Pass == "1234")
{
JWTHelper helper = new JWTHelper();
Dictionary<string, object> playload = new Dictionary<string, object>();
playload.Add("Name", user.Name);
playload.Add("Id", user.Id);
token =helper.GetToken(playload, 1200);
}
return token;
}

-----

posted @ 2020-07-19 20:56  G蠢蠢  阅读(110)  评论(0编辑  收藏  举报