/// <summary> /// 验证注册码 /// </summary> /// <returns>verifyResult:true 或者 verifyResult:false</returns> public IHttpActionResult Get([FromUri] string phone, string verifycode) { bool verifyResult; #if DEBUG verifyResult = phone == verifycode; if (verifyResult) { return(Ok()); } else { return(BadRequest()); } #endif var sms = smsRepository.GetMany(s => s.ValidUntil >= DateTime.Now && s.Phone == phone).OrderByDescending(k => k.LastUpdatedOn).ToList().FirstOrDefault(); var sentCode = string.Empty; if ((sms != null) && (!string.IsNullOrEmpty(sms.VerifyCode))) { sentCode = sms.VerifyCode; } else { return(Ok(new { verifyResult = false })); } verifyResult = sentCode == verifycode; if (verifyResult) { return(Ok()); } else { return(BadRequest()); } }