|
@@ -8,6 +8,11 @@ using System.Web.Mvc;
|
|
|
using EMIS.Web.Controls;
|
|
|
using EMIS.ViewModel;
|
|
|
using EMIS.ViewModel.SystemView;
|
|
|
+using Bowin.Web.Controls.Mvc;
|
|
|
+using EMIS.Utility;
|
|
|
+using Bowin.Common.Utility;
|
|
|
+using System.Web.Http;
|
|
|
+using System.Configuration;
|
|
|
|
|
|
namespace EMIS.Web.ServiceControllers.SystemManage
|
|
|
{
|
|
@@ -20,32 +25,40 @@ namespace EMIS.Web.ServiceControllers.SystemManage
|
|
|
public IWechatMPServices WechatMPServices { get; set; }
|
|
|
public IMailVerifyServices MailVerifyServices { get; set; }
|
|
|
|
|
|
-
|
|
|
+ [System.Web.Http.HttpPost]
|
|
|
public ActionResult Login(string loginID, string password, string openID)
|
|
|
{
|
|
|
+ if (loginID == null)
|
|
|
+ {
|
|
|
+ return Json(new ReturnMessage { IsSuccess = false, Message = "没有接收loginid" });
|
|
|
+ }
|
|
|
+
|
|
|
password = Bowin.Common.Utility.StringEx.MD5(password);
|
|
|
var isLogined = UserServices.Login(loginID, password);
|
|
|
bool isCanLogin = UserServices.LoginHistory(loginID, isLogined);
|
|
|
-
|
|
|
- try
|
|
|
+
|
|
|
+ if (ConfigurationManager.AppSettings["WeixinOnDebug"] != "1")
|
|
|
{
|
|
|
- if (!isCanLogin)
|
|
|
- {
|
|
|
- throw new Exception("当天登陆失败次数超过5次,请明天再试或联系管理员。");
|
|
|
- }
|
|
|
- if (openID != null && openID != "null")
|
|
|
+ try
|
|
|
{
|
|
|
- WechatMPServices.BindOpenID(loginID, openID);
|
|
|
+ if (!isCanLogin)
|
|
|
+ {
|
|
|
+ throw new Exception("当天登陆失败次数超过5次,请明天再试或联系管理员。");
|
|
|
+ }
|
|
|
+ if (openID != null && openID != "null")
|
|
|
+ {
|
|
|
+ WechatMPServices.BindOpenID(loginID, openID);
|
|
|
+ }
|
|
|
+ else if (openID == "null")
|
|
|
+ {
|
|
|
+ throw new Exception("微信openid获取失败,请关注公众号之后,刷新页面重试!如果已经关注公众号,请联系老师或管理员。");
|
|
|
+ }
|
|
|
}
|
|
|
- else if (openID == "null")
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
- throw new Exception("微信openid获取失败,请关注公众号之后,刷新页面重试!如果已经关注公众号,请联系老师或管理员。");
|
|
|
+ return Json(new ReturnMessage { IsSuccess = false, Message = ex.Message });
|
|
|
}
|
|
|
}
|
|
|
- catch(Exception ex)
|
|
|
- {
|
|
|
- return Json(new ReturnMessage { IsSuccess = false, Message = ex.Message });
|
|
|
- }
|
|
|
return Json(new ReturnMessage { IsSuccess = isLogined, Message = "密码错误或不存在该账户!(注意:如密码连续输入错误5次以上账号将被锁定)" });
|
|
|
}
|
|
|
|
|
@@ -99,6 +112,51 @@ namespace EMIS.Web.ServiceControllers.SystemManage
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public ActionResult GetSchoolAreaWithoutSocial(DropdownListBindType? bindType)
|
|
|
+ {
|
|
|
+ List<DropdownListItem> list = DictionaryHelper.GetDictionaryValue(DictionaryItem.CF_SchoolArea)
|
|
|
+ .Where(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE && x.Value < 3)
|
|
|
+ .Select(x => new DropdownListItem { Text = x.Name, Value = x.Value.ToString() }).ToList();
|
|
|
+ DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
|
|
|
+
|
|
|
+ DropdownList.FormatDropdownItemList(dbt, list);
|
|
|
+
|
|
|
+ return base.Json(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ [System.Web.Http.HttpPost]
|
|
|
+ public ActionResult ChangePassword(ChangePasswordView changePasswordView, Guid userID)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var user = UserServices.GetUserByID(userID);
|
|
|
+ if (user.Password.ToLower() != changePasswordView.OldPassword.MD5().ToLower())
|
|
|
+ {
|
|
|
+ return Json(new ReturnMessage()
|
|
|
+ {
|
|
|
+ IsSuccess = false,
|
|
|
+ Message = "保存失败:原密码验证失败"
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ UserServices.ChangePassword(changePasswordView, user.UserID);
|
|
|
+
|
|
|
+ return Json(new ReturnMessage()
|
|
|
+ {
|
|
|
+ IsSuccess = true,
|
|
|
+ Message = "密码已经成功修改!"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Json(new ReturnMessage()
|
|
|
+ {
|
|
|
+ IsSuccess = false,
|
|
|
+ Message = "保存失败:" + ex.Message
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//[HttpPost]
|
|
|
//public ActionResult ForgotPassword(string LoginID)
|
|
|
//{
|