ZhiYeJianKang_PeiXun/Song.Site/Student/DoIndex.aspx.cs
2025-02-20 15:41:53 +08:00

64 lines
2.7 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Song.Extend;
using Song.ServiceInterfaces;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WeiSha.Common;
namespace Song.Site.Student
{
public partial class DoIndex : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string Ac_ygid = Request.QueryString["ygid"];
if (Ac_ygid == null)
{
Response.Write("{\"success\":\"2\",\"state\":\"参数不可以为空\"}"); //参数不可以为空
return;
}
Song.Entities.Accounts tmp = WeiSha.Common.Business.Do<IAccounts>().AccountsYgId(Ac_ygid);
int acc = tmp.Ac_ID;
string pw = tmp.Ac_Pw;
string sign = "on";
int signnum = 30;
//string succurl = "http://36.133.51.104:8913/"; //登录成功跳转的页面用于非ajax请求时政务版专用
//string failurl = "http://36.133.51.104:8913/student/index.ashx"; //登录失败要跳转的页面用于非ajax请求时政务版专用
string succurl = ConfigurationManager.AppSettings["pxUrl"]; //登录成功跳转的页面用于非ajax请求时政务版专用
string failurl = succurl + "/student/index.ashx"; //登录失败要跳转的页面用于非ajax请求时政务版专用
//通过验证,进入登录状态
Song.Entities.Accounts emp = Business.Do<IAccounts>().AccountsLogin(acc, pw, true);
if (emp != null)
{
//如果没有设置免登录,则按系统设置的时效
if (sign == "")
LoginState.Accounts.Write(emp);
else
LoginState.Accounts.Write(emp, signnum);
//登录成功
Business.Do<IAccounts>().PointAdd4Login(emp, "电脑网页", "账号密码登录", ""); //增加登录积分
Business.Do<IStudent>().LogForLoginAdd(emp);
if (string.IsNullOrWhiteSpace(succurl))
Response.Write("{\"success\":\"1\",\"acid\":\"" + emp.Ac_ID + "\",\"name\":\"" + emp.Ac_Name + "\"}");
else
Response.Redirect(succurl);
}
else
{
//登录失败
if (string.IsNullOrWhiteSpace(failurl))
Response.Write("{\"success\":\"-1\"}");
else
Response.Redirect(failurl);
}
}
}
}