1 /// <summary>
2 /// UserValidate 的摘要说明
3 /// </summary>
4 [WebService(Namespace = "http://tempuri.org/")]
5 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
6 [System.ComponentModel.ToolboxItem(false)]
7 // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
8 [System.Web.Script.Services.ScriptService]
9 public class UserValidate : System.Web.Services.WebService
10 {
11 DFHon.Content.Common.rootPublic rp = new DFHon.Content.Common.rootPublic();
12 [WebMethod]
13 [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
14 public string ValidateUserLogState()
15 {
16 string result = "";
17 HttpCookie cookie = HttpContext.Current.Request.Cookies["DHFonMenberInfo"];
18 if (cookie != null)
19 {
20 string username = System.Web.HttpUtility.UrlDecode(cookie["MenberName"]);
21 int ipoint = 0;
22 int gpoint = 0;
23 try
24 {
25 DataTable dt = UserBll.ExecuteUserAllInfo(username);
26
27 if (dt.Rows.Count > 0)
28 {
29 ipoint = int.Parse(dt.Rows[0]["iPoint"].ToString());
30 gpoint = int.Parse(dt.Rows[0]["gPoint"].ToString());
31 }
32 }
33 catch
34 { }
35 result = "{'user':{'id':'" + cookie["UserId"] + "','name':'" + username + "','message':'" + rp.getUserMsg(DFHon.Global.CurrentCookie.UserName) + "','ipoint':'" + ipoint.ToString() + "','gpoint':'" + gpoint.ToString() + "'}}";
36 }
37 else
38 {
39 result = "{'user':{'id':'0','name':'','message':'0','ipoint':'0','gpoint':'0'}}";
40 }
41 return result;
42 }
43
44 [WebMethod]
45 [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
46 public string UserLogin(string userName, string userPwd)
47 {
48 string returnVal = "";
49 try
50 {
51 GlobalUserInfo info;
52 DFHon.Content.UserLogin _UserLogin = new DFHon.Content.UserLogin();
53 EnumLoginState state = _UserLogin.PersonLogin(HttpUtility.UrlDecode(userName), userPwd, out info);
54 if (state == EnumLoginState.Succeed)
55 {
56 DFHon.Global.CurrentCookie.Set(info);
57 DFHon.API.PDO.DiscuzNT.PassportLogin.UserLogin(Server.UrlDecode(userName), userPwd, -1);
58 int ipoint = 0;
59 int gpoint = 0;
60 DataTable dt = UserBll.ExecuteUserAllInfo(userName);
61
62 if (dt.Rows.Count > 0)
63 {
64 ipoint = int.Parse(dt.Rows[0]["iPoint"].ToString());
65 gp