Beispiel #1
0
        /// <summary>
        /// 获取发帖用户列表
        /// </summary>
        /// <returns></returns>

        public ActionResult GetUsers()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("aid", 0);

            if (appId <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            int pageSize  = Utility.IO.Context.GetRequestInt("pageSize", 10);
            int pageIndex = Utility.IO.Context.GetRequestInt("pageIndex", 1);


            string userName  = Utility.IO.Context.GetRequest("userName", string.Empty);
            string userPhone = Utility.IO.Context.GetRequest("userPhone", string.Empty);

            string startTime = Utility.IO.Context.GetRequest("startTime", string.Empty);
            string endTime   = Utility.IO.Context.GetRequest("endTime", string.Empty);

            int totalCount           = 0;
            List <PlatPostUser> list = PlatPostUserBLL.SingleModel.getListByaid(appId, ref totalCount, pageSize, pageIndex, userName, userPhone, startTime, endTime);

            result.Msg     = "获取成功";
            result.isok    = true;
            result.dataObj = new { totalCount = totalCount, list = list };
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        /// <summary>
        /// 删除规则
        /// </summary>
        /// <returns></returns>

        public ActionResult DelMsgRules()
        {
            result = new PlatReturnMsg();
            int appId  = Utility.IO.Context.GetRequestInt("appId", 0);
            int ruleId = Utility.IO.Context.GetRequestInt("ruleId", 0);

            if (appId <= 0 || ruleId <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }

            PlatMsgRule model = PlatMsgRuleBLL.SingleModel.GetMsgRules(appId, ruleId);

            if (model == null)
            {
                result.Msg = "数据不存在";
                return(Json(result));
            }


            model.State      = -1;
            model.UpdateTime = DateTime.Now;
            if (!PlatMsgRuleBLL.SingleModel.Update(model, "State,UpdateTime"))
            {
                result.Msg = "删除异常";
                return(Json(result));
            }

            result.isok = true;
            result.Msg  = "删除成功";
            return(Json(result));
        }
Beispiel #3
0
        /// <summary>
        /// 类别名称是否存在
        /// </summary>
        /// <returns></returns>
        public ActionResult CheckCategoryName()
        {
            result = new PlatReturnMsg();
            int    appId        = Utility.IO.Context.GetRequestInt("appId", 0);
            int    Id           = Utility.IO.Context.GetRequestInt("Id", 0);
            int    isFirstType  = Utility.IO.Context.GetRequestInt("isFirstType", 0);
            string categoryName = Utility.IO.Context.GetRequest("categoryName", string.Empty);

            if (appId <= 0 || string.IsNullOrEmpty(categoryName))
            {
                result.Msg = "参数错误";
                return(Json(result));
            }

            PlatStoreCategory model = PlatStoreCategoryBLL.SingleModel.msgTypeNameIsExist(appId, categoryName, isFirstType);

            if (model != null && model.Id != Id)
            {
                result.Msg = "类别名称已存在";
                return(Json(result));
            }
            result.isok = true;
            result.Msg  = "ok";
            return(Json(result));
        }
Beispiel #4
0
        /// <summary>
        /// 获取信息列表
        /// </summary>
        /// <returns></returns>

        public ActionResult GetMsg()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("aid", 0);

            if (appId <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            int pageSize  = Utility.IO.Context.GetRequestInt("pageSize", 10);
            int pageIndex = Utility.IO.Context.GetRequestInt("pageIndex", 1);

            string         msgTypeName = Utility.IO.Context.GetRequest("msgTypeName", string.Empty);
            string         userName    = Utility.IO.Context.GetRequest("userName", string.Empty);
            string         userPhone   = Utility.IO.Context.GetRequest("userPhone", string.Empty);
            int            isTop       = Utility.IO.Context.GetRequestInt("isTop", 0);
            int            Review      = Utility.IO.Context.GetRequestInt("Review", -2);
            int            isFromStore = Utility.IO.Context.GetRequestInt("isFromStore", -1);
            int            totalCount  = 0;
            List <PlatMsg> list        = PlatMsgBLL.SingleModel.GetListByaid(appId, out totalCount, isTop, pageSize, pageIndex, msgTypeName, userName, userPhone, "addTime desc", Review, isFromStore);

            result.isok    = true;
            result.Msg     = "获取成功";
            result.dataObj = new { totalCount = totalCount, list = list };
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
        /// <summary>
        /// 保存审核配置
        /// </summary>
        /// <param name="aid"></param>
        /// <param name="reviewSetting"></param>
        /// <returns></returns>

        public ActionResult SaveConf(int aid = 0, int reviewSetting = 0)
        {
            result = new PlatReturnMsg();
            if (aid <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result));
            }

            PlatMsgConf model = PlatMsgConfBLL.SingleModel.GetMsgConf(aid);

            if (model == null)
            {
                result.Msg = "数据不存在";
                return(Json(result));
            }

            model.ReviewSetting = reviewSetting;
            model.UpdateTime    = DateTime.Now;
            if (PlatMsgConfBLL.SingleModel.Update(model, "ReviewSetting,UpdateTime"))
            {
                result.isok = true;
                result.Msg  = "操作成功";
                return(Json(result));
            }
            else
            {
                result.Msg = "操作失败";
                return(Json(result));
            }
        }
Beispiel #6
0
        public ActionResult GetGoodsDB()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("aid", 0);

            if (appId <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            XcxAppAccountRelation r = XcxAppAccountRelationBLL.SingleModel.GetModel(appId);

            if (r == null)
            {
                result.Msg = "小程序未授权";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            int pageSize  = Utility.IO.Context.GetRequestInt("pageSize", 10);
            int pageIndex = Utility.IO.Context.GetRequestInt("pageIndex", 1);

            string storeName    = Utility.IO.Context.GetRequest("storeName", string.Empty);
            string goodsName    = Utility.IO.Context.GetRequest("goodsName", string.Empty);
            int    goodsSync    = Utility.IO.Context.GetRequestInt("goodsSync", -1);           //表示全部 0表示未同步的 1表示已经同步了的
            string categoryName = Utility.IO.Context.GetRequest("categoryName", string.Empty); //产品所绑定的小类名称

            int totalCount = 0;
            List <PlatChildGoods> listGoods = PlatStoreBLL.SingleModel.GetSyncGoods(appId, out totalCount, storeName, goodsName, goodsSync, categoryName, pageSize, pageIndex, appId: r.AppId);

            result.isok    = true;
            result.Msg     = "获取成功";
            result.dataObj = new { totalCount = totalCount, list = listGoods };
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #7
0
        public ActionResult DeleteMsgComment()
        {
            result      = new PlatReturnMsg();
            result.code = "200";
            int    appId = Utility.IO.Context.GetRequestInt("appId", 0);
            string ids   = Utility.IO.Context.GetRequest("ids", string.Empty);


            if (appId <= 0 || string.IsNullOrEmpty(ids))
            {
                result.Msg = "参数错误";
                return(Json(result));
            }
            XcxAppAccountRelation r = XcxAppAccountRelationBLL.SingleModel.GetModel(appId);

            if (r == null)
            {
                result.Msg = "小程序未授权";
                return(Json(result));
            }
            if (!Utility.StringHelper.IsNumByStrs(',', ids))
            {
                result.Msg = "非法操作";
                return(Json(result));
            }

            List <PlatMsgComment> list = PlatMsgCommentBLL.SingleModel.GetListByIds(ids);

            if (list == null || list.Count <= 0)
            {
                result.Msg = "没有评论需要删除";
                return(Json(result));
            }

            TransactionModel tranModel = new TransactionModel();

            foreach (PlatMsgComment item in list)
            {
                if (item == null || item.AId != r.Id)
                {
                    result.Msg = "帖子评论不存在或者没有权限";
                    return(Json(result));
                }
                item.State = -1;
                tranModel.Add(PlatMsgCommentBLL.SingleModel.BuildUpdateSql(item, "State"));
            }


            if (PlatMsgCommentBLL.SingleModel.ExecuteTransactionDataCorect(tranModel.sqlArray))
            {
                result.isok = true;
                result.Msg  = "删除成功";
                return(Json(result));
            }
            else
            {
                result.Msg = "删除失败";
                return(Json(result));
            }
        }
Beispiel #8
0
        /// <summary>
        /// 获取指定帖子的评论
        /// </summary>
        /// <returns></returns>
        public ActionResult GetMsgComment()
        {
            result      = new PlatReturnMsg();
            result.code = "200";
            int    appId     = Utility.IO.Context.GetRequestInt("appId", 0);
            int    Id        = Utility.IO.Context.GetRequestInt("Id", 0);//指定某条帖子的 评论
            int    pageSize  = Utility.IO.Context.GetRequestInt("pageSize", 10);
            int    pageIndex = Utility.IO.Context.GetRequestInt("pageIndex", 1);
            string keyMsg    = Utility.IO.Context.GetRequest("keyMsg", string.Empty);

            if (appId <= 0 || Id <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            XcxAppAccountRelation r = XcxAppAccountRelationBLL.SingleModel.GetModel(appId);

            if (r == null)
            {
                result.Msg = "小程序未授权";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            int totalCount = 0;
            List <PlatMsgComment> listComment = PlatMsgCommentBLL.SingleModel.GetPlatMsgComment(r.Id, out totalCount, 0, keyMsg, pageSize, pageIndex, Id);

            result.dataObj = new { totalCount = totalCount, list = listComment };
            result.isok    = true;
            result.Msg     = "获取成功";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #9
0
        public ActionResult SyncGoods()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("aid", 0);
            int act   = Utility.IO.Context.GetRequestInt("act", 0);

            if (appId <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            TransactionModel         transactionModel = new TransactionModel();
            string                   ids  = Utility.IO.Context.GetRequest("ids", string.Empty);
            List <PlatGoodsRelation> list = PlatGoodsRelationBLL.SingleModel.GetPlatGoodsRelationListByGoodsId(appId, ids);

            foreach (PlatGoodsRelation item in list)
            {
                item.Synchronized = act;
                transactionModel.Add(PlatGoodsRelationBLL.SingleModel.BuildUpdateSql(item, "Synchronized"));
            }

            if (transactionModel.sqlArray.Length > 0 && PlatGoodsRelationBLL.SingleModel.ExecuteTransactionDataCorect(transactionModel.sqlArray))
            {
                result.Msg  = "操作成功";
                result.isok = true;
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            result.dataObj = transactionModel.sqlArray;
            result.Msg     = "操作失败";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #10
0
        public ActionResult GetSettingList()
        {
            result = new PlatReturnMsg();
            int appId      = Utility.IO.Context.GetRequestInt("appId", 0);
            int configType = Utility.IO.Context.GetRequestInt("configType", 0);
            int adImgType  = Utility.IO.Context.GetRequestInt("adImgType", 0);

            if (appId <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            int pageSize  = Utility.IO.Context.GetRequestInt("pageSize", 50);
            int pageIndex = Utility.IO.Context.GetRequestInt("pageIndex", 1);


            int totalCount         = 0;
            List <PlatConfig> list = new List <PlatConfig>();


            list.AddRange(PlatConfigBLL.SingleModel.getListByaid(appId, out totalCount, configType, pageSize, pageIndex, "sortNumber desc,addTime desc"));

            result.isok    = true;
            result.Msg     = "获取成功";
            result.dataObj = new { totalCount = totalCount, list = list };
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #11
0
        /// <summary>
        /// 获取店铺分类
        /// </summary>
        /// <returns></returns>

        public ActionResult GetCategoryList()
        {
            result = new PlatReturnMsg();
            int appId       = Utility.IO.Context.GetRequestInt("appId", 0);
            int isFirstType = Utility.IO.Context.GetRequestInt("isFirstType", 1);
            int parentId    = Utility.IO.Context.GetRequestInt("parentId", 0);

            if (appId <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            int pageSize  = Utility.IO.Context.GetRequestInt("pageSize", 10);
            int pageIndex = Utility.IO.Context.GetRequestInt("pageIndex", 1);

            int isList     = Utility.IO.Context.GetRequestInt("isList", 0);
            int totalCount = 0;
            List <PlatStoreCategory> list = new List <PlatStoreCategory>();

            if (isList != 0)
            {
                list.Add(new PlatStoreCategory()
                {
                    Id   = 0,
                    Name = "请选择"
                });
            }

            list.AddRange(PlatStoreCategoryBLL.SingleModel.getListByaid(appId, out totalCount, isFirstType, pageSize, pageIndex, "sortNumber desc,addTime desc", parentId));

            result.isok    = true;
            result.Msg     = "获取成功";
            result.dataObj = new { totalCount = totalCount, list = list };
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #12
0
        /// <summary>
        /// 批量更新排序
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>

        public ActionResult SaveCategorySort(List <PlatStoreCategory> list)
        {
            result = new PlatReturnMsg();

            if (list == null || list.Count <= 0)
            {
                result.Msg = "数据不能为空";
                return(Json(result));
            }
            PlatStoreCategory model     = new PlatStoreCategory();
            TransactionModel  tranModel = new TransactionModel();
            string            sql       = string.Empty;

            string categoryIds = string.Join(",", list.Select(s => s.Id));
            List <PlatStoreCategory> platStoreCategoryList = PlatStoreCategoryBLL.SingleModel.GetListByIds(categoryIds);

            foreach (PlatStoreCategory item in list)
            {
                model = platStoreCategoryList?.FirstOrDefault(f => f.Id == item.Id);
                if (model == null)
                {
                    result.Msg = $"Id={item.Id}不存在数据库里";
                    return(Json(result));
                }

                if (model.Aid != item.Aid)
                {
                    result.Msg = $"Id={item.Id}权限不足";
                    return(Json(result));
                }


                model.SortNumber = item.SortNumber;
                model.UpdateTime = DateTime.Now;
                sql = PlatStoreCategoryBLL.SingleModel.BuildUpdateSql(model, "SortNumber,UpdateTime");
                tranModel.Add(sql);
            }

            if (tranModel.sqlArray != null && tranModel.sqlArray.Length > 0)
            {
                if (PlatStoreCategoryBLL.SingleModel.ExecuteTransactionDataCorect(tranModel.sqlArray))
                {
                    result.isok = true;
                    result.Msg  = "操作成功";
                    return(Json(result));
                }
                else
                {
                    result.Msg = "操作失败";
                    return(Json(result));
                }
            }
            else
            {
                result.Msg = "没有需要更新的数据";
                return(Json(result));
            }
        }
Beispiel #13
0
        /// <summary>
        /// 后台手动置顶将未置顶的消息
        /// </summary>
        /// <returns></returns>
        public ActionResult DoTopMsg()
        {
            result = new PlatReturnMsg();
            int appId  = Utility.IO.Context.GetRequestInt("aid", 0);
            int Id     = Utility.IO.Context.GetRequestInt("Id", 0);
            int ruleId = Utility.IO.Context.GetRequestInt("ruleId", 0);

            if (appId <= 0 || Id <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }
            PlatMsg model = PlatMsgBLL.SingleModel.GetModel(Id);

            if (model == null)
            {
                result.Msg = "数据不存在";
                return(Json(result));
            }


            if (ruleId <= 0)
            {
                result.Msg = "请选择置顶时间";
                return(Json(result));
            }

            PlatMsgRule platMsgRule = PlatMsgRuleBLL.SingleModel.GetMsgRules(appId, ruleId);

            if (platMsgRule == null)
            {
                result.Msg = "非法操作(置顶时间有误)";
                return(Json(result));
            }
            //if (model.Review == 2|| model.Review == 0)
            //{
            //    model.ReviewTime = DateTime.Now;
            //}
            model.ReviewTime   = DateTime.Now;
            model.TopDay       = platMsgRule.ExptimeDay;
            model.TopCostPrice = platMsgRule.Price;
            model.IsTop        = 1;
            model.IsDoTop      = 1;
            model.UpdateTime   = DateTime.Now;
            if (PlatMsgBLL.SingleModel.Update(model, "TopDay,TopCostPrice,IsTop,IsDoTop,UpdateTime,ReviewTime"))
            {
                result.isok = true;
                result.Msg  = "操作成功";
                return(Json(result));
            }
            else
            {
                result.Msg = "操作失败";
                return(Json(result));
            }
        }
Beispiel #14
0
        /// <summary>
        /// 更改店铺在平台的显示状态
        /// </summary>
        /// <returns></returns>
        public ActionResult UpdateStoreRelationState()
        {
            result = new PlatReturnMsg();
            int    appId = Utility.IO.Context.GetRequestInt("appId", 0);
            int    act   = Utility.IO.Context.GetRequestInt("act", 0);//默认为屏蔽操作
            string ids   = Utility.IO.Context.GetRequest("ids", string.Empty);

            if (appId <= 0 || string.IsNullOrEmpty(ids))
            {
                result.Msg = "参数错误";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }


            TransactionModel transactionModel = new TransactionModel();

            List <PlatStoreRelation> list = PlatStoreRelationBLL.SingleModel.GetListPlatStoreRelation(ids);

            if (list != null && list.Count <= 0)
            {
                result.Msg = "请先选择需要操作的数据";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            foreach (PlatStoreRelation item in list)
            {
                if (item.Aid != appId)
                {
                    result.Msg = "操作异常(暂无权限)";
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                item.State      = act;
                item.UpdateTime = DateTime.Now;
                transactionModel.Add(PlatStoreRelationBLL.SingleModel.BuildUpdateSql(item, "State,UpdateTime"));
            }



            if (PlatStoreRelationBLL.SingleModel.ExecuteTransactionDataCorect(transactionModel.sqlArray))
            {
                result.isok = true;
                result.Msg  = "操作成功";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                result.Msg = "操作失败(请联系客服)";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #15
0
        public ActionResult SaveAddSetting()
        {
            result = new PlatReturnMsg();
            int appId  = Utility.IO.Context.GetRequestInt("appId", 0);
            int addWay = Utility.IO.Context.GetRequestInt("addWay", 0);

            if (appId <= 0 || addWay < 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }

            if (dzaccount == null)
            {
                result.Msg = "登录信息超时";
                return(Json(result));
            }

            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (xcx == null)
            {
                result.Msg = "小程序未授权";
                return(Json(result));
            }

            PlatStoreAddSetting platStoreAddSetting = PlatStoreAddSettingBLL.SingleModel.GetPlatStoreAddSetting(appId);

            if (platStoreAddSetting == null)
            {
                result.Msg = "数据不存在";
                return(Json(result));
            }


            platStoreAddSetting.AddWay     = addWay;
            platStoreAddSetting.UpdateTime = DateTime.Now;
            if (!PlatStoreAddSettingBLL.SingleModel.Update(platStoreAddSetting, "AddWay,UpdateTime"))
            {
                result.Msg = "设置异常";
                return(Json(result));
            }

            result.isok = true;
            result.Msg  = "设置成功";
            return(Json(result));
        }
Beispiel #16
0
        public ActionResult DelRule()
        {
            result = new PlatReturnMsg();
            int appId  = Utility.IO.Context.GetRequestInt("appId", 0);
            int ruleId = Utility.IO.Context.GetRequestInt("ruleId", 0);

            if (appId <= 0 || ruleId <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }

            if (dzaccount == null)
            {
                result.Msg = "登录信息超时";
                return(Json(result));
            }

            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (xcx == null)
            {
                result.Msg = "小程序未授权";
                return(Json(result));
            }

            PlatStoreAddRules model = PlatStoreAddRulesBLL.SingleModel.getRule(appId, ruleId);

            if (model == null)
            {
                result.Msg = "数据不存在";
                return(Json(result));
            }


            model.State      = -1;
            model.UpdateTime = DateTime.Now;
            if (!PlatStoreAddRulesBLL.SingleModel.Update(model, "State,UpdateTime"))
            {
                result.Msg = "删除异常";
                return(Json(result));
            }

            result.isok = true;
            result.Msg  = "删除成功";
            return(Json(result));
        }
Beispiel #17
0
        /// <summary>
        /// 开启或者关闭平台店铺分类二级模式
        /// </summary>
        /// <returns></returns>
        public ActionResult UpdateStoreCategoryLevel()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("appId", 0);
            int id    = Utility.IO.Context.GetRequestInt("Id", 0);
            int act   = Utility.IO.Context.GetRequestInt("act", 0);//默认平台店铺级别配置 1表示 优选商城商品数据同步配置

            if (appId <= 0 || id <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }

            PlatStoreCategoryConfig platStoreCategoryConfig = PlatStoreCategoryConfigBLL.SingleModel.GetModel(id);

            if (platStoreCategoryConfig.Aid != appId)
            {
                result.Msg = "暂无权限";
                return(Json(result));
            }
            string filed = "Level";

            if (act == 0)
            {
                platStoreCategoryConfig.Level = platStoreCategoryConfig.Level == 1 ? 2 : 1;
            }
            else
            {
                filed = "SyncSwitch";
                platStoreCategoryConfig.SyncSwitch = platStoreCategoryConfig.SyncSwitch == 0 ? 1 : 0;
            }

            platStoreCategoryConfig.UpdateTime = DateTime.Now;

            if (PlatStoreCategoryConfigBLL.SingleModel.Update(platStoreCategoryConfig, $"{filed},UpdateTime"))
            {
                result.isok = true;
                result.Msg  = "操作成功";
                return(Json(result));
            }
            else
            {
                result.Msg = "操作失败";
                return(Json(result));
            }
        }
Beispiel #18
0
        /// <summary>
        /// 保存流量广告
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public ActionResult SaveQianRuGuangGaoConfig(List <PlatConfig> list)
        {
            result = new PlatReturnMsg();
            if (list == null || list.Count <= 0)
            {
                result.Msg = "数据不能为空";
                return(Json(result));
            }

            TransactionModel TranModel = new TransactionModel();

            foreach (PlatConfig item in list)
            {
                if (item.Id <= 0)
                {
                    TranModel.Add(PlatConfigBLL.SingleModel.BuildAddSql(new PlatConfig()
                    {
                        Aid        = item.Aid,
                        ConfigType = item.ConfigType,
                        ADImgType  = item.ADImgType,
                        ADImg      = item.ADImg,
                        AddTime    = DateTime.Now,
                        Name       = item.Name,
                    }));
                }
                else
                {
                    TranModel.Add(PlatConfigBLL.SingleModel.GetUpdateAdImgSql(item.ADImg, item.Id));
                }
            }

            //表示新增
            if (PlatConfigBLL.SingleModel.ExecuteTransactionDataCorect(TranModel.sqlArray))
            {
                result.isok = true;
                result.Msg  = "保存成功";
                return(Json(result));
            }

            result.Msg = "保存失败";
            return(Json(result));
        }
Beispiel #19
0
        /// <summary>
        /// 获取置顶规则列表
        /// </summary>
        /// <param name="aid"></param>
        /// <returns></returns>

        public ActionResult GetMsgRules(int aid = 0)
        {
            result = new PlatReturnMsg();


            if (aid <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            int pageSize  = Utility.IO.Context.GetRequestInt("pageSize", 10);
            int pageIndex = Utility.IO.Context.GetRequestInt("pageIndex", 1);

            int totalCount          = 0;
            List <PlatMsgRule> list = PlatMsgRuleBLL.SingleModel.GetListByaid(aid, out totalCount, pageSize, pageIndex);

            result.isok    = true;
            result.Msg     = "获取成功";
            result.dataObj = new { totalCount = totalCount, list = list };
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #20
0
        /// <summary>
        /// 获取信息分类
        /// </summary>
        /// <returns></returns>

        public ActionResult GetMsgTypes()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("appId", 0);

            if (appId <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            int pageSize  = Utility.IO.Context.GetRequestInt("pageSize", 10);
            int pageIndex = Utility.IO.Context.GetRequestInt("pageIndex", 1);

            string             msgTypeName = Utility.IO.Context.GetRequest("typeName", string.Empty);
            int                totalCount  = 0;
            List <PlatMsgType> list        = PlatMsgTypeBLL.SingleModel.getListByaid(appId, out totalCount, pageSize, pageIndex, msgTypeName);

            result.isok    = true;
            result.Msg     = "获取成功";
            result.dataObj = new { totalCount = totalCount, list = list };
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #21
0
        /// <summary>
        /// 获取店铺列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetStoreList()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("aid", 0);

            if (appId <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            XcxAppAccountRelation r = XcxAppAccountRelationBLL.SingleModel.GetModel(appId);

            if (r == null)
            {
                result.Msg = "小程序未授权";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }


            int pageSize  = Utility.IO.Context.GetRequestInt("pageSize", 10);
            int pageIndex = Utility.IO.Context.GetRequestInt("pageIndex", 1);

            string storeName              = Utility.IO.Context.GetRequest("storeName", string.Empty);
            string appName                = Utility.IO.Context.GetRequest("appName", string.Empty);
            string agentName              = Utility.IO.Context.GetRequest("agentName", string.Empty);
            int    storeState             = Utility.IO.Context.GetRequestInt("storeState", -1);
            string categoryName           = Utility.IO.Context.GetRequest("categoryName", string.Empty);
            int    haveAid                = Utility.IO.Context.GetRequestInt("haveAid", -1);          //是否绑定了小程序 0则表示没有否则表示绑定了
            int    fromType               = Utility.IO.Context.GetRequestInt("fromType", -1);         //数据来源 0表示通过平台入驻  1表示同步其它平台建立的关系
            string storeOwnerPhone        = Utility.IO.Context.GetRequest("userPhone", string.Empty); //会员账号
            int    totalCount             = 0;
            List <PlatStoreRelation> list = PlatStoreBLL.SingleModel.GetListStore(appId, out totalCount, storeName, appName, agentName, categoryName, storeState, haveAid, fromType, pageSize, pageIndex, "AddTime desc", storeOwnerPhone, appId: r.AppId);

            result.isok    = true;
            result.Msg     = "获取成功";
            result.dataObj = new { totalCount = totalCount, list = list };
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #22
0
        public ActionResult MsgCommentMgr()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("appId", 0);
            int Id    = Utility.IO.Context.GetRequestInt("Id", 0);

            if (appId <= 0 || Id <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            if (dzaccount == null)
            {
                result.Msg = "登录信息超时";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }


            ViewBag.appId = appId;
            ViewBag.Id    = Id;

            return(View());
        }
Beispiel #23
0
        /// <summary>
        /// 后台取消置顶的消息
        /// </summary>
        /// <returns></returns>
        public ActionResult DoNotTopMsg()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("aid", 0);
            int Id    = Utility.IO.Context.GetRequestInt("Id", 0);

            if (appId <= 0 || Id <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }
            PlatMsg model = PlatMsgBLL.SingleModel.GetModel(Id);

            if (model == null)
            {
                result.Msg = "数据不存在";
                return(Json(result));
            }


            model.TopDay = 0;

            //  model.IsTop = 0;
            model.IsDoNotTop = 1;
            model.UpdateTime = DateTime.Now;
            if (PlatMsgBLL.SingleModel.Update(model, "TopDay,IsTop,IsDoNotTop,UpdateTime"))
            {
                result.isok = true;
                result.Msg  = "操作成功";
                return(Json(result));
            }
            else
            {
                result.Msg = "操作失败";
                return(Json(result));
            }
        }
Beispiel #24
0
        public ActionResult GetRules()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("appId", 0);

            if (appId <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            if (dzaccount == null)
            {
                result.Msg = "登录信息超时";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (xcx == null)
            {
                result.Msg = "小程序未授权";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }


            int pageSize  = Utility.IO.Context.GetRequestInt("pageSize", 10);
            int pageIndex = Utility.IO.Context.GetRequestInt("pageIndex", 1);

            int totalCount = 0;
            List <PlatStoreAddRules> list = PlatStoreAddRulesBLL.SingleModel.getListByaid(appId, out totalCount, pageSize, pageIndex);

            result.isok    = true;
            result.Msg     = "获取成功";
            result.dataObj = new { totalCount = totalCount, list = list };
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #25
0
        public ActionResult GetMsgDetail()
        {
            result = new PlatReturnMsg();
            int appId = Utility.IO.Context.GetRequestInt("aid", 0);
            int Id    = Utility.IO.Context.GetRequestInt("Id", 0);

            if (appId <= 0 || Id <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            PlatMsg model = PlatMsgBLL.SingleModel.GetModel(Id);

            if (model == null)
            {
                result.Msg = "数据不存在";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            result.Msg     = "获取成功";
            result.isok    = true;
            result.dataObj = model;
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #26
0
        /// <summary>
        /// 更改店铺在平台的显示类别
        /// </summary>
        /// <returns></returns>
        public ActionResult UpdateStoreRelationCategory()
        {
            result = new PlatReturnMsg();
            int appId           = Utility.IO.Context.GetRequestInt("appId", 0);
            int storeRelationId = Utility.IO.Context.GetRequestInt("storeRelationId", 0);
            int categoryId      = Utility.IO.Context.GetRequestInt("Id", 0);

            if (appId <= 0 || storeRelationId <= 0 || categoryId <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            PlatStoreRelation platStoreRelation = PlatStoreRelationBLL.SingleModel.GetModel(storeRelationId);

            if (platStoreRelation == null || platStoreRelation.Aid != appId)
            {
                result.Msg = "操作异常";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            TransactionModel tranModel = new TransactionModel();

            platStoreRelation.Category   = categoryId;
            platStoreRelation.UpdateTime = DateTime.Now;
            tranModel.Add(PlatStoreRelationBLL.SingleModel.BuildUpdateSql(platStoreRelation, "Category,UpdateTime"));
            if (platStoreRelation.FromType == 0)
            {
                //表示店铺入驻过来的,也就是本平台的 还需要更改店铺类别
                //否则没有权限更改店铺里的类别 只能更改在本平台显示的店铺类别 因为是同步其它代理商的
                PlatStore platStore = PlatStoreBLL.SingleModel.GetModel(platStoreRelation.StoreId);
                if (platStore == null && platStore.BindPlatAid != appId)
                {
                    result.Msg = "暂无权限操作";
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                platStore.Category   = categoryId;
                platStore.UpdateTime = DateTime.Now;
                tranModel.Add(PlatStoreBLL.SingleModel.BuildUpdateSql(platStore, "Category,UpdateTime"));
            }

            if (tranModel.sqlArray != null && tranModel.sqlArray.Length > 0)
            {
                if (PlatStoreRelationBLL.SingleModel.ExecuteTransactionDataCorect(tranModel.sqlArray))
                {
                    result.isok = true;
                    result.Msg  = "操作成功";
                    return(Json(result));
                }
                else
                {
                    result.Msg = "操作失败";
                    return(Json(result));
                }
            }
            else
            {
                result.Msg = "没有需要更新的数据";
                return(Json(result));
            }
        }
Beispiel #27
0
        /// <summary>
        /// 删除店铺类别包括单个批量
        /// </summary>
        /// <returns></returns>

        public ActionResult DelCategory()
        {
            result = new PlatReturnMsg();
            int    appId = Utility.IO.Context.GetRequestInt("appId", 0);
            string ids   = Utility.IO.Context.GetRequest("ids", string.Empty);

            if (appId <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result));
            }

            if (!Utility.StringHelper.IsNumByStrs(',', ids))
            {
                result.Msg = "非法操作";
                return(Json(result));
            }
            //判断是否有权限
            List <PlatStoreCategory> list      = PlatStoreCategoryBLL.SingleModel.GetListByIds(appId, ids);
            TransactionModel         tranModel = new TransactionModel();

            foreach (PlatStoreCategory item in list)
            {
                if (appId != item.Aid)
                {
                    result.Msg = $"非法操作(无权限对id={item.Id}的类别)";
                    return(Json(result));
                }
                int count = 0;
                if (item.ParentId == 0)
                {
                    //表示删除的是大类,要检测有没有子类,没有子类才能删除
                    count = PlatStoreCategoryBLL.SingleModel.GetSecondCategoryCount(item.Id);
                    if (count > 0)
                    {
                        result.Msg = $"{item.Name}类别下包含{count}子类别,请先删除子类别再删除)";
                        return(Json(result));
                    }
                }
                //else
                //{

                //    //表示删除的是子类,要检测该类别下有没有关联的店铺,没有店铺才能删除
                //    count = _platStoreBLL.
                //    if (count > 0)
                //    {
                //        result.Msg = $"{item.Name}类别下包含{count}子类别,请先删除子类别再删除)";
                //        return Json(result);
                //    }

                //}



                item.State      = -1;
                item.UpdateTime = DateTime.Now;
                tranModel.Add(PlatStoreCategoryBLL.SingleModel.BuildUpdateSql(item, "State,UpdateTime"));
            }


            if (tranModel.sqlArray != null && tranModel.sqlArray.Length > 0)
            {
                if (PlatStoreCategoryBLL.SingleModel.ExecuteTransactionDataCorect(tranModel.sqlArray))
                {
                    result.isok = true;
                    result.Msg  = "操作成功";
                    return(Json(result));
                }
                else
                {
                    result.Msg = "操作失败";
                    return(Json(result));
                }
            }
            else
            {
                result.Msg = "没有需要删除的数据";
                return(Json(result));
            }
        }
Beispiel #28
0
        /// <summary>
        /// 编辑或者新增 信息分类
        /// </summary>
        /// <param name="city_Storemsgrules"></param>
        /// <returns></returns>

        public ActionResult SaveCategory(PlatStoreCategory platStoreCategory)
        {
            result = new PlatReturnMsg();
            if (platStoreCategory == null)
            {
                result.Msg = "数据不能为空";
                return(Json(result));
            }

            if (platStoreCategory.Aid <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result));
            }



            int Id = platStoreCategory.Id;

            if (Id == 0)
            {
                //表示新增
                Id = Convert.ToInt32(PlatStoreCategoryBLL.SingleModel.Add(new PlatStoreCategory()
                {
                    MaterialPath = platStoreCategory.MaterialPath,
                    Name         = platStoreCategory.Name,
                    AddTime      = DateTime.Now,
                    UpdateTime   = DateTime.Now,
                    Aid          = platStoreCategory.Aid,
                    State        = 0,
                    SortNumber   = platStoreCategory.SortNumber,
                    ParentId     = platStoreCategory.ParentId
                }));
                if (Id > 0)
                {
                    result.isok = true;
                    result.Msg  = "新增成功";
                    return(Json(result));
                }
                else
                {
                    result.Msg = "新增失败";
                    return(Json(result));
                }
            }
            else
            {
                //表示更新
                PlatStoreCategory model = PlatStoreCategoryBLL.SingleModel.GetModel(Id);
                if (model == null)
                {
                    result.Msg = "不存在数据库里";
                    return(Json(result));
                }

                if (model.Aid != platStoreCategory.Aid)
                {
                    result.Msg = "权限不足";
                    return(Json(result));
                }
                model.UpdateTime   = DateTime.Now;
                model.MaterialPath = platStoreCategory.MaterialPath;
                model.Name         = platStoreCategory.Name;
                model.SortNumber   = platStoreCategory.SortNumber;
                model.ParentId     = platStoreCategory.ParentId;
                if (PlatStoreCategoryBLL.SingleModel.Update(model, "UpdateTime,MaterialPath,Name,SortNumber,ParentId"))
                {
                    result.isok = true;
                    result.Msg  = "更新成功";
                    return(Json(result));
                }
                else
                {
                    result.Msg = "更新失败";
                    return(Json(result));
                }
            }
        }
Beispiel #29
0
        public ActionResult SaveRule(PlatStoreAddRules rule)
        {
            result = new PlatReturnMsg();
            if (rule == null)
            {
                result.Msg = "数据不能为空";
                return(Json(result));
            }


            if (rule.Aid <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result));
            }

            if (dzaccount == null)
            {
                result.Msg = "登录信息超时";
                return(Json(result));
            }

            if (!Regex.IsMatch(rule.YearCount.ToString(), @"^\+?[1-9][0-9]*$"))
            {
                result.Msg = "使用期限必须为大于零的整数";
                return(Json(result));
            }

            if (!Regex.IsMatch(rule.CostPrice.ToString(), @"^\+?[0-9][0-9]*$"))
            {
                result.Msg = "金额不合法";
                return(Json(result));
            }

            if (PlatStoreAddRulesBLL.SingleModel.GetRuleByYearCount(rule.Aid, rule.YearCount, rule.Id) != null)
            {
                result.Msg = "已存在相同使用年限规则";
                return(Json(result));
            }


            int Id = rule.Id;

            if (Id == 0)
            {
                //表示新增
                Id = Convert.ToInt32(PlatStoreAddRulesBLL.SingleModel.Add(new PlatStoreAddRules()
                {
                    YearCount  = rule.YearCount,
                    CostPrice  = rule.CostPrice,
                    AddTime    = DateTime.Now,
                    UpdateTime = DateTime.Now,
                    Aid        = rule.Aid,
                    State      = 0
                }));
                if (Id > 0)
                {
                    result.isok = true;
                    result.Msg  = "新增成功";
                    return(Json(result));
                }
                else
                {
                    result.Msg = "新增失败";
                    return(Json(result));
                }
            }
            else
            {
                //表示更新
                PlatStoreAddRules model = PlatStoreAddRulesBLL.SingleModel.GetModel(Id);
                if (model == null)
                {
                    result.Msg = "不存在数据库里";
                    return(Json(result));
                }

                if (model.Aid != rule.Aid)
                {
                    result.Msg = "权限不足";
                    return(Json(result));
                }

                model.UpdateTime = DateTime.Now;
                model.YearCount  = rule.YearCount;
                model.CostPrice  = rule.CostPrice;

                if (PlatStoreAddRulesBLL.SingleModel.Update(model, "UpdateTime,YearCount,CostPrice"))
                {
                    result.isok = true;
                    result.Msg  = "更新成功";
                    return(Json(result));
                }
                else
                {
                    result.Msg = "更新失败";
                    return(Json(result));
                }
            }
        }
Beispiel #30
0
        /// <summary>
        /// 确认或者删除
        /// 确认则删除被举报的帖子
        /// 删除则删除举报记录
        /// </summary>
        /// <returns></returns>

        public ActionResult delOrConfirmReportMsg()
        {
            result = new PlatReturnMsg();
            int    appId      = Utility.IO.Context.GetRequestInt("aid", 0);
            int    actionType = Utility.IO.Context.GetRequestInt("actionType", 0);//行为类别 默认为0删除 1为确认
            string ids        = Utility.IO.Context.GetRequest("ids", string.Empty);

            if (appId <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }


            if (!Utility.StringHelper.IsNumByStrs(',', ids))
            {
                result.Msg = "非法操作";
                return(Json(result));
            }
            //判断是否有权限
            List <PlatMsgReport> list      = PlatMsgReportBLL.SingleModel.GetListByIds(appId, ids);
            TransactionModel     tranModel = new TransactionModel();

            foreach (PlatMsgReport item in list)
            {
                if (appId != item.Aid)
                {
                    result.Msg = $"非法操作(无权限对id={item.Id}的信息)";
                    return(Json(result));
                }

                if (actionType == 0)//删除举报记录
                {
                    item.State = -1;
                }
                else
                {
                    item.ConfirmState = 1;//确认已经处理 后续可能发送模板消息给举报者
                }

                item.UpdateTime = DateTime.Now;
                tranModel.Add(PlatMsgReportBLL.SingleModel.BuildUpdateSql(item, "ConfirmState,State,UpdateTime"));
            }

            if (tranModel.sqlArray != null && tranModel.sqlArray.Length > 0)
            {
                if (PlatMsgReportBLL.SingleModel.ExecuteTransactionDataCorect(tranModel.sqlArray))
                {
                    result.Msg  = "操作成功";
                    result.isok = true;
                    return(Json(result));
                }
                else
                {
                    result.Msg = "操作失败";
                    return(Json(result));
                }
            }
            else
            {
                result.Msg = "没有合适的数据";
                return(Json(result));
            }
        }