| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- 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
- }
- }
|