コード例 #1
0
        public ResultObject <OutSMS> SmsGetCode(string mobilePhone, string userOpenId, int IntervalSec)
        {
            ResultObject <OutSMS> result = new ResultObject <OutSMS>();

            try
            {
                bool isUser = _userSrv.IsExistUser(userOpenId);
                if (isUser)
                {
                    result.Entity = _smsSrv.RequireVerifyCode(mobilePhone, IntervalSec);
                }
                else
                {
                    result.ErrorMsg = "非法请求";
                }
            }
            catch (Exception ex)
            {
                result.ErrorMsg = "请求短信失败";
                NLogHelper.ErrorTxt($"验证码获取[GetSmsCode]:{ex.Message}");
            }

            return(result);
        }
コード例 #2
0
        public IActionResult OnPostRequireVerifyCode(string mobilePhone, int IntervalSec)
        {
            ResultObject <OutSMS> result = new ResultObject <OutSMS>();

            try
            {
                var us = GetUserSession(false);
                if (us != null)
                {
                    result.Entity = _smsSrv.RequireVerifyCode(mobilePhone, IntervalSec);
                }
                else
                {
                    result.IntMsg   = -1;
                    result.ErrorMsg = "请重新登陆";
                }
            }
            catch (Exception ex)
            {
                result.ErrorMsg = "请求短信失败";
                NLogHelper.ErrorTxt($"验证码获取[OnPostRequireVerifyCode]:{ex.Message}");
            }
            return(new JsonResult(result));
        }