/// <summary> /// 添加短信记录 /// </summary> /// <param name="model"></param> public void SendMsg(ShortMessage model) { #region validate if (string.IsNullOrWhiteSpace(model.Receive)) throw new DataValidationException(string.Format(BusinessResourceMessage.PleaseInput, "接收手机号")); if (string.IsNullOrWhiteSpace(model.Content)) throw new DataValidationException(string.Format(BusinessResourceMessage.PleaseInput, "短信内容")); #endregion model.SendTime = DateTime.Now; this._shortMessageRepository.Insert(model); }
public DataResult SendVCode(string phone) { bool flag = this.userService.CheckPhone(phone); if (flag) { string vcode = CommonMethod.GetInstance.GenerateRandomCode(6); ShortMessage model = new ShortMessage() { Code = vcode, Content = "您正在找回密码,验证码为:" + vcode + ",请不要告诉他人哟", Receive = phone, Status = ShortMessageStatus.Normal, Type = ShortMessageType.RetrievePWD }; this.shortMessageService.SendMsg(model); dataResult.Code = ResponseStatusCode.Success; dataResult.Msg = BusinessResourceMessage.Success; //dataResult.Data = vcode; } return dataResult; }