Пример #1
0
        public IActionResult GetMusic(int id)
        {
            if (id <= 0)
            {
                return(new JsonResult(new { code = -1, msg = "参数异常" }));
            }
            var result = NetEaseMusicCache.Get(id.ToString());

            if (result == null)
            {
                result = service.GetDetial(id).Result;
                if (result != null && !string.IsNullOrWhiteSpace(result.Src))
                {
                    NetEaseMusicCache.Set(id.ToString(), result);
                }
            }

            if (result == null)
            {
                return(new JsonResult(new { code = -1, msg = "获取失败" }));
            }
            else
            {
                return(new JsonResult(new { code = 0, data = result }));
            }
        }
Пример #2
0
        public void DetialMethod()
        {
            var result = _service.GetDetial(27678655).Result;

            Assert.IsNotNull(result);
        }