Esempio n. 1
0
        /// <summary>
        /// 删除广告图片
        /// </summary>
        /// <param name="aid"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult delPic(int aid = 0, int id = 0)
        {
            if (aid <= 0 || id <= 0)
            {
                result.code = 0;
                result.msg  = "参数错误";
                return(Json(result));
            }
            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelById(aid);

            if (xcx == null)
            {
                result.code = 0;
                result.msg  = "小程序不存在";
                return(Json(result));
            }

            PinPicture pic = PinPictureBLL.SingleModel.GetModelByAid_Id(aid, id);

            if (pic == null)
            {
                result.code = 0;
                result.msg  = "数据不存在";
                return(Json(result));
            }
            pic.state = -1;
            if (PinPictureBLL.SingleModel.Update(pic, "state"))
            {
                result.code = 1;
                result.msg  = "操作成功";
                return(Json(result));
            }
            else
            {
                result.code = 0;
                result.msg  = "操作失败";
                return(Json(result));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 添加广告图片
        /// </summary>
        /// <param name="pic"></param>
        /// <param name="act"></param>
        /// <returns></returns>
        public ActionResult AddPic(PinPicture pic, string act = "")

        {
            if (pic == null || pic.aid <= 0)
            {
                if (act == "save")
                {
                    result.code = 0;
                    result.msg  = "参数错误";
                    return(Json(result));
                }
                return(Content("参数错误"));
            }
            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelById(pic.aid);

            if (act == "save")
            {
                if (xcx == null)
                {
                    result.code = 0;
                    result.msg  = "小程序不存在";
                    return(Json(result));
                }
                if (string.IsNullOrEmpty(pic.img))
                {
                    result.code = 0;
                    result.msg  = "请选择广告图片";
                    return(Json(result));
                }

                if (pic.funId == 1)
                {
                    if (string.IsNullOrEmpty(pic.target))
                    {
                        result.msg = "请选择跳转目标";
                        return(Json(result));
                    }
                    pic.target = $"/pages/shopping/goodInfo/goodInfo?gid={pic.target}";
                }
                else
                {
                    pic.target = "/pages/store/applyEnter/applyEnter";
                }

                pic.Id = Convert.ToInt32(PinPictureBLL.SingleModel.Add(pic));
                if (pic.Id > 0)
                {
                    result.code = 1;
                    result.msg  = "保存成功";
                    return(Json(result));
                }
                else
                {
                    result.code = 0;
                    result.msg  = "保存失败";
                    return(Json(result));
                }
            }
            else
            {
                if (xcx == null)
                {
                    return(Content("小程序不存在"));
                }

                return(View(funList));
            }
        }