Example #1
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="phone">电话</param>
        /// <param name="code">验证码</param>
        public void SmsLogin(string phone, string code)
        {
            WriteLog(phone, code);

            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("code", code);
            var a = SendSMSCommon.SendSMSsingleAsync(SmsTemplate.SmsRegister, phone, dic, SmsSignNameTemplate.DefaultSignName);
        }
Example #2
0
        public ResponseModel SendBindMobileCode(string Mobile, string OpenId)
        {
            var    result = new ResponseModel();
            object obj    = new object();

            result.error_code = Result.SUCCESS;
            if (CheckInputHelper.RegexPhone(Mobile) && !string.IsNullOrWhiteSpace(OpenId))
            {
                var user = _userService.GetUserByPhoneOrOpenId(Mobile, OpenId);
                if (user == null)
                {
                    //发送验证码
                    lock (obj)
                    {
                        string code = Assistant.GetRandomNumber(6);
                        Dictionary <string, string> dic = new Dictionary <string, string>();
                        dic.Add("code", code);
                        dic.Add("product", "H5点餐系统");
                        var a = SendSMSCommon.SendSMSsingleAsync(SmsTemplate.SmsRegister, Mobile, dic);
                        _smsLogService.Insert(new SmsLog()
                        {
                            Code       = code,
                            CreateTime = System.DateTime.Now,
                            Module     = (int)EnumHelp.SmsLogModuleEnum.前端,
                            Phone      = Mobile,
                            Remark     = "手机绑定验证码"
                        });
                    }
                }
                else
                {
                    result.message    = "您已绑定手机号,请勿重复绑定";
                    result.error_code = Result.ERROR;
                }
            }
            else
            {
                result.message    = "手机号码或OpenId有误";
                result.error_code = Result.ERROR;
            }
            return(result);
        }