在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
@*<div>
方法测试<a href="/ProMyGroupYF/ProGroupList?key=A3EFF194-5954-DA06-5B14-4B9E97F82BC9">学生与组列表</a>
</div>*@
<div style="width:100%">
<table style="width:50%; border:1px">
<tr><td colspan="2"> 杨帆所写方法</td><td></td></tr>
<tr>
<td width="30%">XXX列表方法:</td>
<td><a href="#"> 方法</a></td>
</tr>
</table>
</div>
</body>
</html>
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
$(function () {
var Account = "admin";
var Passwords = "123";
var Key = "A3EFF194-5954-DA06-5B14-4B9E97F82BC9";
var url = "http://120.55.240.217:8085/Pro/Login";// '../Pro/Login';
alert(Account);
alert(Passwords);
$.ajax({
url: url,
type: 'get', //传值方式
datatype: 'json',//返回值类型
data: { Account: Account, password: Passwords, key: Key }, //'account='+account+'password='+passwords+'key='+key,
success: function (data) {
debugger;
var re = JSON.parse(data);
var dd = re.ReturnType;
debugger;
alert('ddd');
alert(dd);
},
error: function () {
alert('11111');
return false;
},
});
});
</script>
public ResultMessage Login()
{
string Account = string.Empty;
string Password = string.Empty;
string Key = string.Empty;
if (Request["Account"] != null && Request["Account"].ToString() != "")
{
Account = Request["Account"].ToString();
}
if (Request["Password"] != null && Request["Password"].ToString() != "")
{
Password = Request["Password"].ToString();
}
if (Request["Key"] != null && Request["Key"].ToString() != "")
{
Key = Request["Key"].ToString();
}
ResultMessage ResultMessage = new Brg.Global.Common.ResultMessage();
Base_UserModel Base_UserModel = new Base_UserModel();
Base_UserModel.Account = Account;
Base_UserModel.Password = Password;
Base_UserModel.Enabled = 1;
Base_UserModel.DeleteMark = 0;
if (Key == ConfigurationManager.AppSettings["Key"])
{
Base_UserModel list = Base_OperaBpl.QueryObject(Base_UserModel);
try
{
if (list != null)
{
string opRoleIdstr = ConfigurationManager.AppSettings["OpRoleID"];//从web.config 配置而来
if (true) //opRoleIdstr.Contains(Convert.ToString(list.RoleId)) == true
{
string optid = list.Account.ToString();//获取当前登录人的Id
string getpwd = Brg.Global.Common.Common.Md5Encrypt(Base_UserModel.Password);//密码加密
if (getpwd == list.Password)
{
ResultMessage = new ResultMessage(true, "1", 1, list);
}
else
{
//密码错误
ResultMessage = new ResultMessage(false, "3");
}
}
else
{
ResultMessage = new ResultMessage(false, "4");
}
}
else
{
//登录名错误 没有此登录人
ResultMessage = new ResultMessage(false, "2");
}
}
catch (Exception ex)
{
CommonBpl.AddLog(1, "登录", "", "BrgService/UptongService/LoginService.cs/Login", "public ResultMessage Login(string context)", ex.ToString(), "");
ResultMessage = new ResultMessage(false, ex.Message);
}
}
else
{
ResultMessage = new ResultMessage(false, "请传入正确的安全码");
}
HttpContext.Response.AppendHeader("Access-Control-Allow-Origin", "*");
return ResultMessage;
}
|
请发表评论