public H5ResponseViewModel <ValidateCodeView> GetValidate([FromBody] H5RequestViewModel Parameters) { H5ResponseViewModel <ValidateCodeView> response = null; ValidateCode validatecode = new ValidateCode(); ValidateSetting _imgurl = new ValidateSetting(); ValidateCodeView validate = null; var sysCode = _sys.CheckParameters(Parameters.data, "GetValidate"); if (sysCode == SysCode.Ok) { dynamic dyParameter = Parameters.data; string strCodeId = dyParameter.codeId; if (!string.IsNullOrEmpty(strCodeId)) { RedisHelper.KeyDelete(strCodeId, RedisFolderEnum.code, RedisEnum.Four); //删除原来的图片 } validatecode.key = Guid.NewGuid().ToString(); validatecode.CreateValidateImage(4); validate = new ValidateCodeView { name = validatecode.key, imgUrl = $"{_validate.Url}{validatecode.key}.gif" }; } else { sysCode = SysCode.Err; } response = new H5ResponseViewModel <ValidateCodeView>(sysCode, validate); return(response); }
/// <summary> /// 构造函数注入 /// </summary> /// <param name="sys"></param> /// <param name="validate"></param> public ValidateController(ISystems sys, IOptions <ValidateSetting> validate) { _sys = sys; _validate = validate.Value; }