Пример #1
0
        /// <summary>
        /// 店铺类别
        /// </summary>
        /// <returns></returns>
        public ActionResult Category(int aid = 0, int isFirstType = 2)
        {
            if (aid <= 0)
            {
                return(View("PageError", new PlatReturnMsg()
                {
                    Msg = "参数错误!", code = "500"
                }));
            }

            int pageType = XcxAppAccountRelationBLL.SingleModel.GetXcxTemplateType(aid);

            if (pageType <= 0)
            {
                return(View("PageError", new PlatReturnMsg()
                {
                    Msg = "小程序模板不存在!", code = "500"
                }));
            }

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

            list.Add(new PlatStoreCategory()
            {
                Id   = 0,
                Name = "请选择"
            });
            list.AddRange(PlatStoreCategoryBLL.SingleModel.getListByaid(aid, out totalCount, 0, 100, 1));

            PlatStoreCategoryConfig platStoreCategoryConfig = PlatStoreCategoryConfigBLL.SingleModel.GetModelByAid(aid);

            if (platStoreCategoryConfig == null)
            {
                platStoreCategoryConfig = new PlatStoreCategoryConfig()
                {
                    Aid        = aid,
                    AddTime    = DateTime.Now,
                    Level      = 1,
                    SyncSwitch = 0
                };
                int id = Convert.ToInt32(PlatStoreCategoryConfigBLL.SingleModel.Add(platStoreCategoryConfig));
                if (id <= 0)
                {
                    return(View("PageError", new PlatReturnMsg()
                    {
                        Msg = "初始化数据异常!", code = "500"
                    }));
                }
            }

            ViewBag.PlatStoreCategoryConfig = platStoreCategoryConfig;
            ViewBag.isFirstType             = isFirstType;
            ViewBag.PageType = pageType;
            ViewBag.appId    = aid;
            return(View(list));
        }
Пример #2
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));
            }
        }
Пример #3
0
        /// <summary>
        /// 同步产品到 店铺所属平台 以及 所属平台的一级 二级代理商平台
        /// </summary>
        /// <param name="id"></param>
        /// <param name="platStore"></param>
        /// <param name="agentinfo"></param>
        /// <returns></returns>
        public bool SyncProduct(int id, PlatStore platStore, Agentinfo agentinfo)
        {
            TransactionModel tramModelGoodsRelation = new TransactionModel();

            #region 当前新增产品插入关系表
            PlatGoodsRelation platGoodsRelation = new PlatGoodsRelation();
            platGoodsRelation.AddTime = DateTime.Now;
            platGoodsRelation.Aid     = platStore.BindPlatAid;
            platGoodsRelation.GoodsId = id;
            PlatStoreCategoryConfig platStoreCategoryConfig = PlatStoreCategoryConfigBLL.SingleModel.GetModelByAid(platStore.BindPlatAid);
            if (platStoreCategoryConfig != null)
            {
                platGoodsRelation.Synchronized = platStoreCategoryConfig.SyncSwitch;
            }
            tramModelGoodsRelation.Add(PlatGoodsRelationBLL.SingleModel.BuildAddSql(platGoodsRelation));
            #endregion



            #region  //2.查找上级代理 暂时先屏蔽
            //AgentDistributionRelation agentDistributionRelationFirst = new AgentDistributionRelationBLL().GetModel(agentinfo.id);
            //if (agentDistributionRelationFirst != null)
            //{
            //    Agentinfo agentinfoFirst = _agentinfoBll.GetModel(agentDistributionRelationFirst.ParentAgentId);
            //    if (agentinfoFirst != null)
            //    {
            //        XcxAppAccountRelation xcxAppAccountRelationFirst = _xcxappaccountrelationBll.GetModelByaccountidAndTid(agentinfoFirst.useraccountid, (int)TmpType.小未平台);
            //        if (xcxAppAccountRelationFirst != null)
            //        {
            //            PlatGoodsRelation platGoodsRelationFist = new PlatGoodsRelation();
            //            platGoodsRelationFist.GoodsId = id;
            //            platGoodsRelationFist.AddTime = DateTime.Now;
            //            platGoodsRelationFist.Aid = xcxAppAccountRelationFirst.Id;
            //            PlatStoreCategoryConfig platStoreCategoryConfigFist = _platStoreCategoryConfigBLL.GetModelByAid(xcxAppAccountRelationFirst.Id);
            //            if (platStoreCategoryConfigFist != null)
            //            {
            //                platGoodsRelationFist.Synchronized = platStoreCategoryConfigFist.SyncSwitch;
            //            }
            //            tramModelGoodsRelation.Add(_platGoodsRelationBLL.BuildAddSql(platGoodsRelationFist));



            //            //3.查找上级的上级代理
            //            AgentDistributionRelation agentDistributionRelationSecond = new AgentDistributionRelationBLL().GetModel(agentinfoFirst.id);
            //            if (agentDistributionRelationSecond != null)
            //            {
            //                Agentinfo agentinfoSecond = _agentinfoBll.GetModel(agentDistributionRelationSecond.ParentAgentId);
            //                if (agentinfoSecond != null)
            //                {
            //                    XcxAppAccountRelation xcxAppAccountRelationSecond = _xcxappaccountrelationBll.GetModelByaccountidAndTid(agentinfoSecond.useraccountid, (int)TmpType.小未平台);
            //                    if (xcxAppAccountRelationSecond != null)
            //                    {
            //                        PlatGoodsRelation platGoodsRelationSecond = new PlatGoodsRelation();
            //                        platGoodsRelationSecond.GoodsId = id;
            //                        platGoodsRelationSecond.AddTime = DateTime.Now;
            //                        platGoodsRelationSecond.Aid = xcxAppAccountRelationSecond.Id;
            //                        PlatStoreCategoryConfig platStoreCategoryConfigSecond = _platStoreCategoryConfigBLL.GetModelByAid(xcxAppAccountRelationSecond.Id);
            //                        if (platStoreCategoryConfigSecond != null)
            //                        {
            //                            platGoodsRelationSecond.Synchronized = platStoreCategoryConfigSecond.SyncSwitch;
            //                        }
            //                        tramModelGoodsRelation.Add(_platGoodsRelationBLL.BuildAddSql(platGoodsRelationSecond));
            //                    }


            //                }
            //            }


            //        }
            //    }
            //}
            #endregion

            return(base.ExecuteTransactionDataCorect(tramModelGoodsRelation.sqlArray));
        }
Пример #4
0
        /// <summary>
        /// 在平台店铺列表里新增没有主人的店铺
        /// </summary>
        /// <returns></returns>
        public ActionResult CreateStore(int aid = 0)
        {
            int storeId = Utility.IO.Context.GetRequestInt("storeId", 0);
            PlatStoreCategoryConfig platStoreCategoryConfig = PlatStoreCategoryConfigBLL.SingleModel.GetModelByAid(aid);

            if (platStoreCategoryConfig == null)
            {
                platStoreCategoryConfig = new PlatStoreCategoryConfig()
                {
                    Aid        = aid,
                    AddTime    = DateTime.Now,
                    Level      = 1,
                    SyncSwitch = 0
                };
                int id = Convert.ToInt32(PlatStoreCategoryConfigBLL.SingleModel.Add(platStoreCategoryConfig));
                if (id <= 0)
                {
                    return(View("PageError", new PlatReturnMsg()
                    {
                        Msg = "初始化数据异常!", code = "500"
                    }));
                }
            }

            List <PlatStoreCategory> list = new List <PlatStoreCategory>();

            list.Add(new PlatStoreCategory()
            {
                Id   = 0,
                Name = "请选择"
            });
            int totalCount = 0;

            ViewBag.firstCategoryId = 0;
            ViewBag.appId           = aid;
            list.AddRange(PlatStoreCategoryBLL.SingleModel.getListByaid(aid, out totalCount, platStoreCategoryConfig.Level == 1 ? 2 : 1, 100, 1));
            ViewBag.CategoryList  = list;
            ViewBag.CategoryLevel = platStoreCategoryConfig.Level;
            Agentinfo agentinfo = AgentinfoBLL.SingleModel.GetModelByAccoundId(dzuserId.ToString());

            ViewBag.AgentinfoId = agentinfo == null ? 0 : agentinfo.id;
            PlatStore platStore = PlatStoreBLL.SingleModel.GetModel(storeId);
            bool      isHave    = false;

            if (platStore == null)
            {
                platStore             = new PlatStore();
                platStore.BindPlatAid = aid;
                isHave = true;
            }
            else
            {
                PlatStoreCategory platStoreCategory = PlatStoreCategoryBLL.SingleModel.GetModel(platStore.Category);
                if (platStoreCategory != null)
                {
                    ViewBag.firstCategoryId = platStoreCategory.ParentId;
                }

                if (!string.IsNullOrEmpty(platStore.StoreService))
                {
                    platStore.StoreServiceModelList = JsonConvert.DeserializeObject <List <StoreServiceModel> >(platStore.StoreService);
                }
                else
                {
                    isHave = true;
                }
            }

            if (isHave)
            {
                List <StoreServiceModel> listService = new List <StoreServiceModel>();
                listService.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "WIFI"
                });
                listService.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "停车位"
                });
                listService.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "支付宝支付"
                });
                listService.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "微信支付"
                });
                listService.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "刷卡支付"
                });
                listService.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "空调雅座"
                });
                listService.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "付费停车"
                });
                listService.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "接送服务"
                });
                platStore.StoreServiceModelList = listService;
            }

            if (!string.IsNullOrEmpty(platStore.SwitchConfig))
            {
                platStore.SwitchModel = Newtonsoft.Json.JsonConvert.DeserializeObject <PlatStoreSwitchModel>(platStore.SwitchConfig);
            }
            else
            {
                platStore.SwitchModel = new PlatStoreSwitchModel();
            }


            return(View(platStore));
        }