public ActionResult ActivationUser(string key) { try { if (string.IsNullOrEmpty(key)) { return(Ok(new { mark = "2", msg = "Key为空" })); } var rsaHelper = new RSAHelper(RSAType.RSA2, Encoding.UTF8, _configuration["private_key"], _configuration["public_key"]); var userId = rsaHelper.Decrypt(key); if (_userService.ActiveUser(int.Parse(userId))) { return(Ok(new { mark = "1", msg = "激活成功" })); } else { return(Ok(new { mark = "2", msg = "激活失败" })); } } catch (Exception ex) { Console.WriteLine(ex); return(Ok(new { mark = "2", msg = ex.Message })); } }
public void Active(int id) { _userService.ActiveUser(id, CurrentUserId); }