예제 #1
0
        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("批量更新经销商!");
            //}
        }
예제 #2
0
        public string CloseJob(JobModel jobModel)
        {
            ValidationErrors validationErrors = new ValidationErrors();

            Log.Write("CloseJob", jobModel.taskName, "关闭");
            TaskJob.UpdateState(ref validationErrors, jobModel.id, 3, "挂起");
            return("关闭获取Access_Token任务");
        }
예제 #3
0
        public string RunJob(ref JobDataMap dataMap, string jobName, string id, string taskName)
        {
            WC_OfficalAccountsRepository m_Rep = new WC_OfficalAccountsRepository();

            IQueryable <WC_OfficalAccounts> queryable = m_Rep.FindList();
            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.ToString("yyyy-MM-dd HH:mm:ss");
                }
            }
            if (queryable.Count() > 0)
            {
                TaskJob.UpdateState(ref validationErrors, jobName, 1, "成功");
                m_Rep.SaveChanges();
            }

            return("批量更新Access_Token!");
        }