Пример #1
0
 public MiddleBreakSearcher(IServiceScopeFactory serviceScopeFactory,
                            string userId, IConfiguration configuration,
                            ILogger logger, ArgMiddleBreak arg) : base(serviceScopeFactory, userId, configuration)
 {
     _logger          = logger;
     _arg             = arg;
     this._actionName = "中阶突破";
 }
        public ActionResult MiddleBreak([FromBody] ArgMiddleBreak model)
        {
            var userId   = HttpContext.User.Identity.Name;
            var searcher = new MiddleBreakSearcher(_serviceScopeFactory, userId, _configuration,
                                                   _logger, model);

            //开启新的线程来执行任务
            Task.Run(async() => await searcher.Search());
            return(NoContent());
        }