Example #1
0
        public async void Delete_Blog_Test()
        {
            var deleteModel = (await blogarticleServices.Query(d => d.btitle == "xuint test title")).FirstOrDefault();

            Assert.NotNull(deleteModel);

            var IsDel = await blogarticleServices.Delete(deleteModel);

            Assert.True(IsDel);
        }
Example #2
0
        public async Task <object> TestMutiDBAPI()
        {
            // 从主库(Sqlite)中,操作blogs
            var blogs = await _blogarticleServices.Query(d => d.Id == 1);

            // 从从库(Sqlserver)中,获取pwds
            var pwds = await _passwordLibServices.Query(d => d.PLID > 0);

            return(new
            {
                blogs,
                pwds
            });
        }
Example #3
0
        public async Task <MessageModel <List <blogarticle> > > GetBlogsByTypesForMVP(string types = "", int id = 0)
        {
            if (types.IsNotEmptyOrNull())
            {
                var blogs = await _blogarticleServices.Query(d => d.bcategory != null && types.Contains(d.bcategory) && d.IsDeleted == false);

                return(new MessageModel <List <blogarticle> >()
                {
                    msg = "获取成功",
                    success = true,
                    response = blogs
                });
            }

            return(new MessageModel <List <blogarticle> >()
            {
            });
        }
Example #4
0
        public async Task Run(IJobExecutionContext context, int jobid)
        {
            var list = await _blogarticleServices.Query();

            if (jobid > 0)
            {
                var model = await _tasksQzServices.QueryById(jobid);

                if (model != null)
                {
                    model.RunTimes += 1;
                    var separator = "<br>";
                    model.Remark =
                        $"【{DateTime.Now}】执行任务【Id:{context.JobDetail.Key.Name},组别:{context.JobDetail.Key.Group}】【执行成功】{separator}"
                        + string.Join(separator, StringHelper.GetTopDataBySeparator(model.Remark, separator, 9));

                    await _tasksQzServices.Update(model);
                }
            }

            await Console.Out.WriteLineAsync("博客总数量" + list.Count.ToString());
        }