/// <summary>
        /// 发送忘记密码短信验证码
        /// </summary>
        /// <param name="requestObject"></param>
        /// <returns></returns>
        public ResponseObject <string> SendForgetVerificationCode(RequestObject <VerificationInputModel> requestObject)
        {
            string result = string.Empty;

            if (requestObject.PostData == null)
            {
                return(ResponseUtil <string> .FailResult("PostData不能都为null"));
            }
            List <SingleReceiverMessage> messageList = new List <SingleReceiverMessage>();
            string templateId = @"595c42190cf847caadb0822b3685bcb6";
            string randCode   = RandCodeCreate.GenerateRandomOnlyNumber(6);

            result = randCode;
            string[] templateParas = { randCode };
            SingleReceiverMessage singleReceiverMessage = new SingleReceiverMessage(requestObject.PostData.Mobile, templateId, templateParas);

            messageList.Add(singleReceiverMessage);
            //发送短信
            Task.Factory.StartNew(() =>
            {
                try
                {
                    HuaWeiShortMessageProvider.SendDiffContentMessages(messageList);
                }
                catch { }
            });

            //写 登陆状态到redis
            var    redis    = CacheFactory.Instance(CacheType.Redis);
            string redisKey = string.Format(CacheKeyString.ForgetMsgCode, requestObject.PostData.Mobile);

            redis.AddOrUpdateKey <string>(redisKey, result, 300);
            return(ResponseUtil <string> .SuccessResult("发送成功"));
        }
Exemplo n.º 2
0
        public SubmitResult Post(RequestObject <VerificationEditModel> requestObject)
        {
            List <SingleReceiverMessage> messageList = new List <SingleReceiverMessage>();

            string templateId = @"1bb04f68ab6247ac904c2b8269420b32";
            string randCode   = RandCodeCreate.GenerateRandomOnlyNumber(6);

            string[] templateParas = { randCode };
            SingleReceiverMessage singleReceiverMessage = new SingleReceiverMessage(requestObject.PostData.Mobile, templateId, templateParas);

            messageList.Add(singleReceiverMessage);

            //发送短信
            SubmitResult result = HuaWeiShortMessageProvider.SendDiffContentMessages(messageList);

            return(result);
        }