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("id"); Write(id); //Context.Response.Write(id); } /// /// demo /// [HttpPost] public void demo() { string name = Query("name"); string gender = Query("gender"); //List list = JsonHelper.ToList(GetJson()); GetJson(); //GetEntity(); Write("1"); } /// /// 同步员工信息 /// [HttpPost] public void setNetZc() { string Ac_MobiTel1 = Query("phone"); string Ac_IDCardNumber = Query("idCard"); string Ac_Pw = Query("password"); Ac_Pw = MD5(Ac_Pw); string Ac_qyid = Query("qyId"); string Ac_QyName = Query("qyName"); string Ac_Name = Query("name"); string Ac_ygid = Query("ygid"); string type = Query("type"); string Ac_IsOrgAdmin = Query("isOrgAdmin"); if (Ac_MobiTel1 == null) { Write("{\"success\":\"2\",\"state\":\"参数不可以为空\"}"); //参数不可以为空 return; } else { //验证手机号是否存在 Song.Entities.Accounts acc = WeiSha.Common.Business.Do().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().AccountsAdd(tmp); Write("{\"success\":\"0\",\"state\":\"成功\"}"); //成功 return; Write("1"); } /// /// 批量同步员工信息 /// [HttpPost] public void SyncStaffs() { List list = JsonHelper.ToList(GetJson()); Write("1"); } public static string MD5(string toCryString) { return FormsAuthentication.HashPasswordForStoringInConfigFile(toCryString, "MD5"); } } }