public JsonResult Ajax_EditSubchannel(SubchannelReq req)
 {
     if (string.IsNullOrWhiteSpace(req.PYScript_Video) &&
         string.IsNullOrWhiteSpace(req.PYScript_ShortEssay) &&
         string.IsNullOrWhiteSpace(req.PYScript_LongEssay) &&
         string.IsNullOrWhiteSpace(req.PYScript_Comment) &&
         string.IsNullOrWhiteSpace(req.PYScript_PIC))
     {
         return(Json(new AjaxResult <Object>("必须填写至少一个PY执行脚本程序!")));
     }
     if (req.ID < 1)
     {
         return(Json(new AjaxResult <Object>("请选择您要编辑的推广平台渠道!")));
     }
     if (string.IsNullOrWhiteSpace(req.SubChannelName))
     {
         return(Json(new AjaxResult <Object>("请输入推广平台渠道名称!")));
     }
     if (string.IsNullOrWhiteSpace(req.AddressURL))
     {
         return(Json(new AjaxResult <Object>("请输入渠道地址URL!")));
     }
     if (string.IsNullOrWhiteSpace(req.AnalogPacket))
     {
         return(Json(new AjaxResult <Object>("请输入模拟提交数据包!")));
     }
     return(Json(sh.EditSubchannel(req)));
 }
 public JsonResult Ajax_AddSubchannel(SubchannelReq req)
 {
     if (string.IsNullOrWhiteSpace(req.PYScript_Video) &&
         string.IsNullOrWhiteSpace(req.PYScript_ShortEssay) &&
         string.IsNullOrWhiteSpace(req.PYScript_LongEssay) &&
         string.IsNullOrWhiteSpace(req.PYScript_Comment) &&
         string.IsNullOrWhiteSpace(req.PYScript_PIC))
     {
         return(Json(new AjaxResult <Object>("必须填写至少一个PY执行脚本程序!")));
     }
     if (string.IsNullOrWhiteSpace(req.SubChannelName))
     {
         return(Json(new AjaxResult <Object>("请输入推广平台渠道名称!")));
     }
     if (string.IsNullOrWhiteSpace(req.AddressURL))
     {
         return(Json(new AjaxResult <Object>("请输入渠道地址URL!")));
     }
     if (string.IsNullOrWhiteSpace(req.AnalogPacket))
     {
         return(Json(new AjaxResult <Object>("请输入模拟提交数据包!")));
     }
     req.ManagerID   = user.CurAccount.ManagerId;
     req.ManagerName = user.CurAccount.ManagerName;
     return(Json(sh.AddSubchannel(req)));
 }
Beispiel #3
0
        /// <summary>
        /// 编辑推广平台子平台
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public AjaxResult <Object> EditSubchannel(SubchannelReq req)
        {
            Subchannel model = db.Subchannel.Where(w => w.Id == req.ID).FirstOrDefault();

            if (model == null)
            {
                return(new AjaxResult <Object>("推广子平台渠道不存在!"));
            }
            model.PyscriptVideo      = req.PYScript_Video;
            model.PyscriptShortEssay = req.PYScript_ShortEssay;
            model.PyscriptLongEssay  = req.PYScript_LongEssay;
            model.PyscriptComment    = req.PYScript_Comment;
            model.PyscriptPic        = req.PYScript_PIC;

            model.SubChannelName = req.SubChannelName;
            model.AddressUrl     = req.AddressURL;
            model.States         = req.States;
            model.UserName       = req.UserName;
            model.UserPwd        = req.UserPwd;
            model.Remark         = req.Remark;
            model.AnalogPacket   = req.AnalogPacket;

            db.SaveChanges();
            return(new AjaxResult <Object>("编辑成功!", 0));
        }
Beispiel #4
0
        /// <summary>
        /// 添加  推广平台子平台渠道
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public AjaxResult <Object> AddSubchannel(SubchannelReq req)
        {
            Subchannel model_1 = db.Subchannel.Where(w => w.SubChannelName == req.SubChannelName).FirstOrDefault();

            if (model_1 != null)
            {
                return(new AjaxResult <Object>("推广子平台渠道已存在!"));
            }

            Subchannel model = new Subchannel();

            model.PyscriptVideo      = req.PYScript_Video;
            model.PyscriptShortEssay = req.PYScript_ShortEssay;
            model.PyscriptLongEssay  = req.PYScript_LongEssay;
            model.PyscriptComment    = req.PYScript_Comment;
            model.PyscriptPic        = req.PYScript_PIC;
            model.SubChannelName     = req.SubChannelName;
            model.AddressUrl         = req.AddressURL;
            model.CreateTime         = DateTime.Now;
            model.States             = 0;
            model.UserName           = req.UserName;
            model.UserPwd            = req.UserPwd;
            model.Remark             = req.Remark;
            model.AnalogPacket       = req.AnalogPacket;
            model.ManagerId          = req.ManagerID;
            model.ManagerName        = req.ManagerName;

            db.Subchannel.Add(model);
            db.SaveChanges();
            return(new AjaxResult <Object>("添加成功!", 0));
        }
Beispiel #5
0
        /// <summary>
        /// 根据条件查询  推广平台子平台渠道列表
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public AjaxResult <Pagination <SubchannelDto> > GetList(SubchannelReq req)
        {
            Pagination <SubchannelDto> page = new Pagination <SubchannelDto>();
            var query = from b in db.Subchannel
                        select new SubchannelDto
            {
                ID             = b.Id,
                PlatformID     = (long)b.PlatformId,
                SubChannelName = b.SubChannelName,
                AddressURL     = b.AddressUrl,
                CreateTime     = Convert.ToDateTime(b.CreateTime),
                States         = Convert.ToInt32(b.States),
                UserName       = b.UserName,
                UserPwd        = b.UserPwd,
                Remark         = b.Remark,
                StatesName     = b.States == 0 ? "有效" : b.States == 1 ? "无效" : "",
            };

            if (!string.IsNullOrWhiteSpace(req.SubChannelName))
            {
                query = query.Where(w => w.SubChannelName.Contains(req.SubChannelName));
            }
            page.TotalCount = query.Count();
            page.dataList   = query.OrderByDescending(m => m.ID).Skip((req.PageIndex - 1) * req.PageSize).Take(req.PageSize).ToList();
            return(new AjaxResult <Pagination <SubchannelDto> >(page));
        }
 public JsonResult Ajax_GetList(SubchannelReq req)
 {
     return(Json(sh.GetList(req)));
 }