178 lines
4.9 KiB
C#
178 lines
4.9 KiB
C#
using KJD_Web.BLL.BXX;
|
|
using KJD_Web.Utils;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Services;
|
|
|
|
namespace KJD_Web
|
|
{
|
|
/// <summary>
|
|
/// UserService 的摘要说明
|
|
/// </summary>
|
|
[WebService(Namespace = "http://tempuri.org/")]
|
|
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
|
[System.ComponentModel.ToolboxItem(false)]
|
|
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
|
|
// [System.Web.Script.Services.ScriptService]
|
|
public class DYUserService : System.Web.Services.WebService
|
|
{
|
|
[WebMethod]
|
|
public string hello_world()
|
|
{
|
|
return "Hello World";
|
|
}
|
|
|
|
private string GetRequestJsonString()
|
|
{
|
|
Context.Response.ContentType = "text/html;charset=utf-8";
|
|
Context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
|
|
|
|
using (Stream s = HttpContext.Current.Request.InputStream) // 获得json 字符流
|
|
{
|
|
// 还原数据流
|
|
byte[] b = new byte[s.Length];
|
|
s.Read(b, 0, (int)s.Length);
|
|
string jsonText = Encoding.UTF8.GetString(b); // JSON字符串
|
|
if (string.IsNullOrEmpty(jsonText))
|
|
{
|
|
var qs = HttpContext.Current.Request.QueryString;
|
|
if (qs != null && qs.Keys.Count > 0)
|
|
{
|
|
jsonText = "{";
|
|
foreach (var key in qs.Keys)
|
|
{
|
|
jsonText += "\"" + key + "\":" + "\"" + qs[key.ToString()] + "\";";
|
|
}
|
|
jsonText = jsonText.TrimEnd(';') + "}";
|
|
}
|
|
}
|
|
return jsonText;
|
|
}
|
|
}
|
|
|
|
[WebMethod]
|
|
public void user_login()
|
|
{
|
|
string jsontext = GetRequestJsonString();
|
|
|
|
var result = jsontext;
|
|
result = new BXXUserManage().CheckUserLogin(jsontext);
|
|
|
|
Context.Response.Write(result);
|
|
Context.Response.End();
|
|
}
|
|
|
|
[WebMethod]
|
|
public void get_package_sign()
|
|
{
|
|
string jsontext = GetRequestJsonString();
|
|
|
|
var result = jsontext;
|
|
result = new BXXUserManage().GetPackageSign(jsontext);
|
|
|
|
Context.Response.Write(result);
|
|
Context.Response.End();
|
|
}
|
|
|
|
[WebMethod]
|
|
public void change_password()
|
|
{
|
|
string jsontext = GetRequestJsonString();
|
|
|
|
var result = jsontext;
|
|
result = new BXXUserManage().ChangePassword(jsontext);
|
|
|
|
Context.Response.Write(result);
|
|
Context.Response.End();
|
|
}
|
|
|
|
[WebMethod]
|
|
public void get_sub_user()
|
|
{
|
|
string jsontext = GetRequestJsonString();
|
|
|
|
var result = jsontext;
|
|
result = new BXXUserManage().GetSubUser(jsontext);
|
|
|
|
Context.Response.Write(result);
|
|
Context.Response.End();
|
|
}
|
|
|
|
[WebMethod]
|
|
public void update_sub_user()
|
|
{
|
|
string jsontext = GetRequestJsonString();
|
|
|
|
var result = jsontext;
|
|
result = new BXXUserManage().UpdateSubUser(jsontext);
|
|
|
|
Context.Response.Write(result);
|
|
Context.Response.End();
|
|
}
|
|
|
|
[WebMethod]
|
|
public void add_sub_user()
|
|
{
|
|
string jsontext = GetRequestJsonString();
|
|
|
|
var result = jsontext;
|
|
result = new BXXUserManage().AddSubUser(jsontext);
|
|
|
|
Context.Response.Write(result);
|
|
Context.Response.End();
|
|
}
|
|
|
|
[WebMethod]
|
|
public void delete_user()
|
|
{
|
|
string jsontext = GetRequestJsonString();
|
|
|
|
var result = jsontext;
|
|
result = new BXXUserManage().DelUser(jsontext);
|
|
|
|
Context.Response.Write(result);
|
|
Context.Response.End();
|
|
}
|
|
|
|
[WebMethod]
|
|
public void get_all_user()
|
|
{
|
|
string jsontext = GetRequestJsonString();
|
|
|
|
var result = jsontext;
|
|
result = new BXXUserManage().GetAllUser(jsontext);
|
|
|
|
Context.Response.Write(result);
|
|
Context.Response.End();
|
|
}
|
|
|
|
[WebMethod]
|
|
public void update_user()
|
|
{
|
|
string jsontext = GetRequestJsonString();
|
|
|
|
var result = jsontext;
|
|
result = new BXXUserManage().UpdateUser(jsontext);
|
|
|
|
Context.Response.Write(result);
|
|
Context.Response.End();
|
|
}
|
|
|
|
[WebMethod]
|
|
public void add_user()
|
|
{
|
|
string jsontext = GetRequestJsonString();
|
|
|
|
var result = jsontext;
|
|
result = new BXXUserManage().AddUser(jsontext);
|
|
|
|
Context.Response.Write(result);
|
|
Context.Response.End();
|
|
}
|
|
}
|
|
}
|