Пример #1
0
        /// <summary>
        /// 改变微头条  已发布  状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public int UpYpStatus_YFB(long id, int status)
        {
            Ypjrttweitoutiaoinfo model = db.Ypjrttweitoutiaoinfo.Where(w => w.Id == id).FirstOrDefault();

            if (model == null)
            {
                return(0);
            }
            model.Status = status;
            //model.Status = (int)AIDB.Enum.JrttWeiTouTiaoEnum.status.头条平台已发布;
            return(db.SaveChanges());
        }
Пример #2
0
        /// <summary>
        /// 添加微头条
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public AjaxResult <Object> AddYPWTT(JrttWeiTouTiaoReq req)
        {
            Ypjrttweitoutiaoinfo model = new Ypjrttweitoutiaoinfo();

            model.Content     = req.Content;
            model.Createtime  = DateTime.Now;
            model.Images      = req.Images;
            model.PlatformIds = req.Pid;
            model.Status      = (int)AIDB.Enum.JrttWeiTouTiaoEnum.status.未发布;

            db.Ypjrttweitoutiaoinfo.Add(model);
            db.SaveChanges();
            return(new AjaxResult <Object>("添加成功!", 0));
        }
Пример #3
0
        /// <summary>
        /// 编辑微头条
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public AjaxResult <object> EditYPWTT(JrttWeiTouTiaoReq req)
        {
            Ypjrttweitoutiaoinfo model = db.Ypjrttweitoutiaoinfo.Where(w => w.Id == req.Id).FirstOrDefault();

            if (model == null)
            {
                return(new AjaxResult <Object>("头条信息不存在!"));
            }
            model.PlatformIds = req.Pid;
            model.Content     = req.Content;
            if (db.SaveChanges() > 0)
            {
                return(new AjaxResult <Object>("编辑成功!", 0));
            }
            return(new AjaxResult <Object>("编辑失败!"));
        }
Пример #4
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public AjaxResult <object> DelYPWTT(long id)
        {
            if (id < 1)
            {
                return(new AjaxResult <Object>("请选择您要删除的对象!"));
            }
            Ypjrttweitoutiaoinfo model = db.Ypjrttweitoutiaoinfo.Where(w => w.Id == id).FirstOrDefault();

            if (model == null)
            {
                return(new AjaxResult <Object>("您要删除的对象不存在!"));
            }
            db.Remove(model);
            if (db.SaveChanges() > 0)
            {
                return(new AjaxResult <Object>("删除成功!", 0));
            }
            return(new AjaxResult <Object>("删除失败!"));
        }
Пример #5
0
        public IActionResult EditWttPage(long id)
        {
            Ypjrttweitoutiaoinfo model = wtt.Sel_Ypjrttweitoutiaoinfo(id);

            return(View(model));
        }
Пример #6
0
        public JsonResult Ajax_PostWTT(string PYScript, long id)
        {
            if (id < 1)
            {
                return(Json(new AjaxResult <Object>("信息错误!")));
            }

            Ypjrttweitoutiaoinfo model = wtt.Sel_Ypjrttweitoutiaoinfo(id);

            if (model == null)
            {
                return(Json(new AjaxResult <Object>("头条信息不存在!")));
            }
            //验证图片路径
            string[] Images = model.Images.Split(",");
            foreach (var it in Images)
            {
                string its = it.Replace("/", "\\");
                its = its.Substring(0, its.LastIndexOf("\\"));
                if (!Directory.Exists(its))
                {
                    return(Json(new AjaxResult <Object>("图片路劲错误!")));
                }
            }

            //循环查询脚本
            var pids = model.PlatformIds.Split(',');

            foreach (var item in pids)
            {
                Subchannel md = sh.SelSubchannel((long)Convert.ToInt32(item));
                if (md != null)
                {
                    if (string.IsNullOrWhiteSpace(md.PyscriptShortEssay))
                    {
                        return(Json(new AjaxResult <Object>("渠道《" + md.SubChannelName + "》,没有填写发布 短文 脚本!")));
                    }
                    if (string.IsNullOrWhiteSpace(md.AnalogPacket))
                    {
                        return(Json(new AjaxResult <Object>("渠道COOKIE错误!")));
                    }


                    //base64加密(COOKIE)
                    string ck = EncodeBase64("utf-8", md.AnalogPacket);

                    //base64加密
                    string content = EncodeBase64("utf-8", model.Content);

                    string script = md.PyscriptShortEssay + " " + ck + " " + model.Images + " " + content;

                    //base64解码
                    //string ss = DecodeBase64("utf-8", content);

                    //PY执行脚本
                    return(Ajax_PublicPostWTT(script, id));
                }
            }

            return(Json(new AjaxResult <Object>("发布完成!", 0)));

            #region

            /*//开始同步信息
             * //string[] imgs = model.Images.Split(',');
             * //base64加密
             * string content = EncodeBase64("utf-8", model.Content);
             * //string imgs= EncodeBase64("utf-8", model.Images);
             *
             * string script = PYScript + " " + model.Images + " " + content;
             * //string script = "E:/work/NET/WebManager/WebManager/Web.Manager/wwwroot/PY/发微头条图文皆可.py  1111 123123";
             *
             * //base64解码
             * //string ss = DecodeBase64("utf-8", content);
             *
             * //PY执行脚本
             * return Ajax_PublicPostWTT(script, id);*/

            #endregion
        }