137 lines
4.2 KiB
C#
137 lines
4.2 KiB
C#
|
|
using CYQ.Data.Json;
|
|||
|
|
using CYQ.Data.Tool;
|
|||
|
|
using Song.ServiceInterfaces;
|
|||
|
|
using Song.Site.SyncData.Entity;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Web.Security;
|
|||
|
|
using Taurus.Core;
|
|||
|
|
|
|||
|
|
namespace Song.Site
|
|||
|
|
{
|
|||
|
|
public class AccountsAPIController : Controller
|
|||
|
|
{
|
|||
|
|
public override bool BeforeInvoke(string methodName)
|
|||
|
|
{
|
|||
|
|
CancelLoadHtml = true;
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
[HttpGet]
|
|||
|
|
public void SS()
|
|||
|
|
{
|
|||
|
|
string id = Query<string>("id");
|
|||
|
|
|
|||
|
|
Write(id);
|
|||
|
|
//Context.Response.Write(id);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// demo
|
|||
|
|
/// </summary>
|
|||
|
|
[HttpPost]
|
|||
|
|
public void demo()
|
|||
|
|
{
|
|||
|
|
string name = Query<string>("name");
|
|||
|
|
string gender = Query<string>("gender");
|
|||
|
|
//List<AB> list = JsonHelper.ToList<AB>(GetJson());
|
|||
|
|
|
|||
|
|
|
|||
|
|
GetJson();
|
|||
|
|
//GetEntity<ZybYgxxVo>();
|
|||
|
|
Write("1");
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 同步员工信息
|
|||
|
|
/// </summary>
|
|||
|
|
[HttpPost]
|
|||
|
|
public void setNetZc()
|
|||
|
|
{
|
|||
|
|
string Ac_MobiTel1 = Query<string>("phone");
|
|||
|
|
string Ac_IDCardNumber = Query<string>("idCard");
|
|||
|
|
string Ac_Pw = Query<string>("password");
|
|||
|
|
Ac_Pw = MD5(Ac_Pw);
|
|||
|
|
string Ac_qyid = Query<string>("qyId");
|
|||
|
|
string Ac_QyName = Query<string>("qyName");
|
|||
|
|
string Ac_Name = Query<string>("name");
|
|||
|
|
string Ac_ygid = Query<string>("ygid");
|
|||
|
|
string type = Query<string>("type");
|
|||
|
|
string Ac_IsOrgAdmin = Query<string>("isOrgAdmin");
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (Ac_MobiTel1 == null)
|
|||
|
|
{
|
|||
|
|
Write("{\"success\":\"2\",\"state\":\"参数不可以为空\"}"); //参数不可以为空
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//验证手机号是否存在
|
|||
|
|
Song.Entities.Accounts acc = WeiSha.Common.Business.Do<IAccounts>().IsAccountsExist(-1, Ac_MobiTel1, 1);
|
|||
|
|
if (acc != null)
|
|||
|
|
{
|
|||
|
|
Write("{\"success\":\"1\",\"state\":\"手机号已经存在\"}"); //手机号已经存在
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (Ac_IDCardNumber == null)
|
|||
|
|
{
|
|||
|
|
Write("{\"success\":\"2\",\"state\":\"参数不可以为空\"}"); //参数不可以为空
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (Ac_Pw == null)
|
|||
|
|
{
|
|||
|
|
Write("{\"success\":\"2\",\"state\":\"参数不可以为空\"}"); //参数不可以为空
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (Ac_qyid == null)
|
|||
|
|
{
|
|||
|
|
Write("{\"success\":\"2\",\"state\":\"参数不可以为空\"}"); //参数不可以为空
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (Ac_ygid == null)
|
|||
|
|
{
|
|||
|
|
Write("{\"success\":\"2\",\"state\":\"参数不可以为空\"}"); //参数不可以为空
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
Song.Entities.Accounts tmp = new Entities.Accounts();
|
|||
|
|
tmp.Ac_MobiTel1 = Ac_MobiTel1;
|
|||
|
|
tmp.Ac_IDCardNumber = Ac_IDCardNumber;
|
|||
|
|
tmp.Ac_Pw = Ac_Pw;
|
|||
|
|
tmp.Ac_qyid = Ac_qyid;
|
|||
|
|
tmp.Ac_QyName = Ac_QyName;
|
|||
|
|
tmp.Ac_AccName = tmp.Ac_MobiTel1;
|
|||
|
|
tmp.Ac_IsPass = true;
|
|||
|
|
tmp.Ac_Name = Ac_Name;
|
|||
|
|
tmp.Ac_ygid = Ac_ygid;
|
|||
|
|
tmp.Ac_Pay = 0;
|
|||
|
|
tmp.Ac_IsOrgAdmin = int.Parse(Ac_IsOrgAdmin);
|
|||
|
|
tmp.Ac_Type = type;
|
|||
|
|
|
|||
|
|
int id = WeiSha.Common.Business.Do<IAccounts>().AccountsAdd(tmp);
|
|||
|
|
Write("{\"success\":\"0\",\"state\":\"成功\"}"); //成功
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
|
|||
|
|
Write("1");
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 批量同步员工信息
|
|||
|
|
/// </summary>
|
|||
|
|
[HttpPost]
|
|||
|
|
public void SyncStaffs()
|
|||
|
|
{
|
|||
|
|
List<ZybYgxxVo> list = JsonHelper.ToList<ZybYgxxVo>(GetJson());
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
Write("1");
|
|||
|
|
}
|
|||
|
|
public static string MD5(string toCryString)
|
|||
|
|
{
|
|||
|
|
return FormsAuthentication.HashPasswordForStoringInConfigFile(toCryString, "MD5");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|