Esempio n. 1
0
        public JsonResult Create(PlateSettingDto model)
        {
            string errs = GetModelStateError();

            if (!string.IsNullOrEmpty(errs))
            {
                return(Json(new OperateMessage <string>(OperateResult.Fail, true, errs)));
            }
            bool IsSucceed = _PlateSettingAppService.Create(new PlateSettingDto()
            {
                ID               = Guid.NewGuid(),
                CreateTime       = DateTime.Now,
                CreatorID        = _currUser.ID,
                Key              = model.Key,
                LastUpdateTime   = DateTime.Now,
                LastUpdateUserID = _currUser.ID,
                Tag              = model.Tag,
                Value            = model.Value,
            });

            if (IsSucceed)
            {
                return(Json(new OperateMessage <string>("/PlateSetting/Index")));
            }
            return(Json(new OperateMessage <string>(IsSucceed ? OperateResult.Success : OperateResult.Fail, true, IsSucceed ? "添加成功!" : "添加失败!")));
        }
Esempio n. 2
0
        public IEnumerable <string> Get()
        {
            _log.LogError("日志测试2017");
            _PlateSettingAppService.Create(new PlateSettingDto()
            {
                CreateTime       = DateTime.Now,
                CreatorID        = Vic.Core.Utils.ConstDefine.SuperAdminID,
                Key              = "API接口",
                Value            = "API接口",
                Tag              = "API接口",
                LastUpdateTime   = DateTime.Now,
                LastUpdateUserID = Vic.Core.Utils.ConstDefine.SuperAdminID,
            });
            var list = _PlateSettingAppService.ListByReadOnlyDB();

            return(list.Select(a => a.Key).AsEnumerable());
        }
Esempio n. 3
0
        public JsonResult PublishData()
        {
            var ids   = _plateSettingAppService.QueryProperty(a => a.Tag == "", a => a.ID).ToArray();
            var data  = _articleAppService.QueryList(a => !ids.Contains(a.ID));
            int cpunt = 0;

            foreach (var item in data)
            {
                if (string.IsNullOrEmpty(item.Content))
                {
                    continue;
                }
                int count = _plateSettingAppService.Count(a => a.ID == item.ID);
                if (count > 0)
                {
                    continue;
                }
                var ret = Vic.Core.Utils.Spider.WeiBoHelper.PublishArticle(new Vic.Core.Utils.Spider.ReqModel()
                {
                    title   = "【AspNetCore 2.0】" + item.Title,// + " @AspNetCore @告白驿站",
                    summary = item.Description.Length > 200 ? item.Description.Substring(1, 200) : item.Description,
                    content = "【AspNetCore 2.0 】" + item.Content,
                });
                if (ret != null && ret.data != null && !string.IsNullOrEmpty(ret.data.object_id))
                {
                    _plateSettingAppService.Create(new PlateSettingDto()
                    {
                        ID               = item.ID,
                        Key              = item.ID.ToString(),
                        Value            = item.ID.ToString(),
                        Tag              = "",
                        CreateTime       = DateTime.Now,
                        LastUpdateTime   = DateTime.Now,
                        LastUpdateUserID = Vic.Core.Utils.ConstDefine.SuperAdminID,
                        CreatorID        = Vic.Core.Utils.ConstDefine.SuperAdminID
                    });
                    cpunt++;
                }
                System.Threading.Thread.Sleep(1000 * 60 * 5);
            }
            return(Json("ok_" + cpunt));
        }