ComplianceServer/oldcode/WEB/Controllers/Level2/L2RetPasswordController.cs

157 lines
6.0 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Web.Mvc;
using WX.CRM.Common;
using WX.CRM.IBLL.Base;
using WX.CRM.IBLL.Res;
using WX.CRM.IBLL.Sms;
using WX.CRM.IBLL.Util;
using WX.CRM.Model.Enum;
using WX.CRM.WEB.ViewModel.Level2;
using WX.CRM.WebHelper;
namespace WX.CRM.WEB.Controllers.Level2
{
public class L2RetPasswordController : BaseController
{
[Ninject.Inject]
public ISecurityHelper sHelper { get; set; }
[Ninject.Inject]
public ICACHE_Q cacheQ { get; set; }
[Ninject.Inject]
public IRES_RESOURCEMOBILE_Q RESOURCEMOBILE_Q { get; set; }
[Ninject.Inject]
public IBAS_PARAMETER_Q PARAMETER_Q { get; set; }
[Ninject.Inject]
public IRES_CUSTOMER_Q RES_CUSTOMER_Q { get; set; }
[Ninject.Inject]
public ISMS_MESSAGE_HIS_Q SMS_MESSAGE_HIS_Q { get; set; }
//
// GET: /L2RetPassword/
[AuthorizeRedirect(Roles = InitRights.CONST_L2重置密码)]
public ActionResult Index()
{
return View();
}
/// <summary>
/// 重置密码
/// </summary>
/// <param name="uname"></param>
/// <returns></returns>
[AuthorizeRedirect(Roles = InitRights.CONST_L2重置密码)]
public JsonResult RetPaw(string uname, string resid, string randnum)
{
#region New
//重置密码
Soft_CRMRetPwd crmRetpwd = new Soft_CRMRetPwd();
returnResult result = crmRetpwd.Retpaw(uname, "");
if (result.result)
{
return JsonHandler.ManageMessage("密码重置成功,新密码为" + result.retpwd, true);
}
else
{
return JsonHandler.ManageMessage("重置失败:" + Utility.GetCheckEnumNameByValue<EnumInterfaceErrcode>(result.retcode), false);
}
#endregion
#region OLD ID
//#region 判断resid和电话号码是否存在
//RES_CUSTOMER RES_CUSTOMER = RES_CUSTOMER_Q.getResCustomerByResId(resid);
//if (RES_CUSTOMER == null)
//{
// return JsonHandler.ManageMessage("RESID不存在", false);
//}
//string mobile = RESOURCEMOBILE_Q.GetNumberByResId(resid);
//if (string.IsNullOrEmpty(mobile))
//{
// return JsonHandler.ManageMessage("RESID没有找到对应的电话号码", false);
//}
//#endregion
////判断当天是否已发送3次短信
//if (SMS_MESSAGE_HIS_Q.IsSendSmsThree(resid))
//{
// //重置密码
// Soft_CRMRetPwd crmRetpwd = new Soft_CRMRetPwd();
// returnResult result = crmRetpwd.Retpaw(uname, mobile);
// if (result.result)
// {
// try
// {
// #region 发送短信
// //短信内容
// BAS_PARAMETER resp = PARAMETER_Q.GetModel_Patameter("SMS_ResetPwd_Message");
// if (resp != null)
// {
// string smsmessage = string.Format(resp.PARAVALUE, uname, result.retpwd);
// //短信model
// SmsServiceModel smsmodel = new SmsServiceModel();
// smsmodel.SubTypeCode = "SMS_ResetPwd";
// smsmodel.typeCode = "ISVRSMS0001";
// smsmodel.resid = resid;
// smsmodel.mobile = mobile;
// smsmodel.message = smsmessage;
// //将短信model转成json
// string key = Utility.ObjectToJson(smsmodel);
// key = sHelper.createSignEncodingStr(key,SecurityHelper.OrderClientIdKey);
// //获取url
// string url = Utility.GetSettingByKey("L2Retpwdsms");
// string retmsg = Utility.PostData(url + "?" + key, Encoding.UTF8);
// //retmsg = JsonHelper.JsonDivertToObj<string>(retmsg);
// retmsg = sHelper.decyptData(SecurityHelper.OrderClientIdKey, retmsg);
// SmsSendMsgModel retmessage = JsonHelper.JsonDivertToObj<SmsSendMsgModel>(retmsg);
// if (retmessage.result)
// {
// return JsonHandler.ManageMessage("密码重置成功,短信发送成功!", true);
// }
// else
// {
// return JsonHandler.ManageMessage("密码重置成功,短信发送失败!" + retmsg, false);
// }
// }
// else
// {
// return JsonHandler.ManageMessage("获取短信内容失败!", false);
// }
// #endregion
// }
// catch (Exception e)
// {
// Common.LogHelper.Error(string.Concat("短信发送错误", e.Message, e.StackTrace));
// return JsonHandler.ManageMessage("密码重置成功,短信发送失败!", false);
// }
// }
// else
// {
// return JsonHandler.ManageMessage("重置失败:" + Utility.GetCheckEnumNameByValue<EnumInterfaceErrcode>(result.retcode), false);
// }
//}
//else
//{
// return JsonHandler.ManageMessage("密码重置失败今天重置密码已超过3次", false);
//}
#endregion
}
}
}