public async Task<IHttpActionResult> ArticleRankingJob(CronRequest req) { // if (CronRequest.IsCronRequest(req)) // { var context = Request.GetOwinContext().Get<ApplicationDbContext>(); TableStorageConnection tConnection = new TableStorageConnection(); StatisticsLogModel logModel = StatisticsLogModel.CreateNewModel(); StatisticsLogModel lastLog = context.StatisticsLog.OrderByDescending(f => f.JobTime).Take(1).FirstOrDefault(); context.StatisticsLog.Add(logModel); await context.SaveChangesAsync(); ArticleStatisticsBasicManager asbm=new ArticleStatisticsBasicManager(tConnection); await asbm.InsertArticleLog(context, logModel.Key, lastLog==null?"":lastLog.Key); return Json(true); // } // else // { // return Json(false); // } }
public static bool IsCronRequest(CronRequest req) { return req.Key.Equals("9AB21015-A590-4D9C-8927-337D0354A0B9"); }