public string RunJobBefore(Job jobModel) { Log.Write("RunJobBefor", jobModel.taskName, "运行"); ValidationErrors validationErrors = new ValidationErrors(); WC_OfficalAccountsRepository m_Rep = new WC_OfficalAccountsRepository(); IQueryable <WC_OfficalAccounts> queryable = m_Rep.FindList(); int count = queryable.Count(); if (count < 1) { return("没有符合获取Access_Token的数据!"); } return(null); }
public string RunJob(ref JobDataMap dataMap, string jobName, string id, string taskName) { using (IWC_OfficalAccountsRepository m_Rep = new WC_OfficalAccountsRepository(new DBContainer())) { IQueryable <WC_OfficalAccounts> queryable = m_Rep.GetList(); ValidationErrors validationErrors = new ValidationErrors(); foreach (var entity in queryable) { if (!string.IsNullOrEmpty(entity.AppId) && !string.IsNullOrEmpty(entity.AppSecret)) { entity.AccessToken = Senparc.Weixin.MP.CommonAPIs.CommonApi.GetToken(entity.AppId, entity.AppSecret).access_token; entity.ModifyTime = ResultHelper.NowTime; } } if (queryable.Count() > 0) { TaskJob.UpdateState(ref validationErrors, jobName, 1, "成功"); m_Rep.SaveChanges(); } return("批量更新Access_Token!"); } }
public WC_OfficalAccountsBLL() { m_Rep = new WC_OfficalAccountsRepository(); }