using BizCom; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using Utils; namespace SiteCore.Handler { public partial class sync { #region 账户 public void get_account() { DataStruct dStruct = GetStruct(); DataTable dt = WebCache.GetData("x_User", dStruct); foreach (DataRow dr in dt.Rows) { dr["PassWord"] = SecurityHelper.DecryptSymmetric(dr["PassWord"]); } writeGridJson(dStruct.TotalCount, Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt)); } public void save_account() { if (UrlParmsCheck("name,pwd")) { string name = GetString("name"); if (XUser.Exists("Account=?", name)) { returnErrorMsg("该账户名已经存在,请更换!"); return; } string pwd = GetString("pwd"); XUser user = new XUser(); user.Account = name; user.CreateTime = DateTime.Now; user.PassWord = SecurityHelper.EncryptSymmetric(pwd); user.Create(); returnSuccessMsg("保存成功!"); } } public void resetpwd_account() { int id = GetInt("id"); int pId = GetInt("pid"); if (id > 0) XUser.ResetPwd(id, SecurityHelper.EncryptSymmetric("000000")); else if (pId > 0) XUser.ResetPersonPwd(pId, SecurityHelper.EncryptSymmetric("000000")); returnSuccessMsg("密码重置成功!"); } public void del_account() { if (UrlParmsCheck("id")) { int id = GetInt("id"); XUser.Del(id); returnSuccessMsg("删除成功!"); } } public void open_account() { if (UrlParmsCheck("id,pid")) { int pId = GetInt("pid"); int id = GetInt("id"); XUser.OpenAccount(id, pId); returnSuccessMsg("成功开通账户!"); } } public void close_account() { if (UrlParmsCheck("id,pid")) { int pId = GetInt("pid"); int id = GetInt("id"); XUser.FreezeAccount(id, pId); returnSuccessMsg("成功冻结账户!"); } } public void update_pwd() { if (UrlParmsCheck("pwd,newpwd,newpwd2")) { string pwd = SecurityHelper.EncryptSymmetric(GetString("pwd")); string newpwd = GetString("newpwd"); string newpwd2 = GetString("newpwd2"); XUser user = XUser.Get(CurrentUser.UserID, pwd); if (user == null) { returnErrorMsg("旧密码不正确!"); return; } user.PassWord = SecurityHelper.EncryptSymmetric(newpwd); user.Update(); returnSuccessMsg("密码修改成功!"); } } #endregion } }