示例#1
0
        /// <summary>
        /// 促销专区
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="promType">方案类型(DHG,DZK,DMZ,DXQ)</param>
        /// <param name="imgType">图片类型ProFloor</param>
        /// <param name="num">显示条目数(8)</param>
        /// <returns></returns>
        public JsonResult GetTopPromSingle(string userId, string promType, string imgType /*,int num*/, string entId, int pageIndex = 1, int pageSize = 8)
        {
            try
            {
                if (string.IsNullOrEmpty(promType))
                {
                    return(Json(new { success = false, message = "缺少必传参数方案类型" }));
                }
                if (string.IsNullOrEmpty(entId))
                {
                    entId = BaseConfiguration.EntId;
                }
                ///获取用户信息
                UserInfoDal     dal        = new UserInfoDal();
                List <UserInfo> user       = dal.GetUserInfo(userId, entId);
                string          Pricelevel = "";
                string          KhType     = "";
                bool            landing    = false;
                bool            staleDated = false;
                if (user.Count > 0)
                {
                    entId      = user[0].EntId;
                    Pricelevel = user[0].Pricelevel;
                    KhType     = user[0].KhType;
                    staleDated = user[0].StaleDated;
                    landing    = true;
                }
                //获取促销信息
                PromotionDal     pdal  = new PromotionDal();
                string[]         Array = promType.Split(new char[] { ',' });
                List <PromModel> pList = new List <PromModel>();
                int record             = pageSize;
                int page = pageIndex;
                for (int i = 0; i < Array.Length; i++)
                {
                    PromModel p = new PromModel();
                    if (Array[i] != "")
                    {
                        p.Name     = Array[i];
                        p.PromList = pdal.GetTopPromSingle(entId, userId, Array[i], Pricelevel, KhType /*, num*/, pageIndex, pageSize, landing, staleDated, out int recordCount, out int pageCount);
                        pList.Add(p);
                        if (Array.Length > 1)
                        {
                            record = pageSize;
                            page   = pageIndex;
                        }
                        else
                        {
                            record = recordCount;
                            page   = pageCount;
                        }
                    }
                }
                //获取图片信息
                ImgInfoDal     idal  = new ImgInfoDal();
                List <ImgInfo> ilist = idal.GetImgInfo(4, imgType, entId, "PC", "");

                return(Json(new { success = true, list = pList, imgList = ilist, recordCount = record, pageCount = page }));
            }
            catch (Exception ex)
            {
                LogQueue.Write(LogType.Error, "Prom/GetTopPromSingle", ex.Message.ToString());
                return(Json(new { success = false, message = ex.Message.ToString() }));
            }
        }
        public JsonResult GetPharmacy(string userId, string ArrondiType, string imgType, /*int num,*/ string entId, int pageIndex = 1, int pageSize = 8)
        {
            try
            {
                if (string.IsNullOrEmpty(ArrondiType))
                {
                    return(Json(new { success = false, message = "必传参数为空" }));
                }
                if (string.IsNullOrEmpty(entId))
                {
                    entId = BaseConfiguration.EntId;
                }
                ///获取用户信息
                UserInfoDal     dal        = new UserInfoDal();
                List <UserInfo> user       = dal.GetUserInfo(userId, entId);
                string          Pricelevel = "";
                string          KhType     = "";
                bool            landing    = false;
                bool            staleDated = false;
                if (user.Count > 0)
                {
                    entId      = user[0].EntId;
                    Pricelevel = user[0].Pricelevel;
                    KhType     = user[0].KhType;
                    staleDated = user[0].StaleDated;
                    landing    = true;
                }
                string[]         Array = ArrondiType.Split(new char[] { ',' });
                BrandDal         brand = new BrandDal();
                List <PromModel> pList = new List <PromModel>();
                int record             = pageSize;
                int page = pageIndex;
                for (int i = 0; i < Array.Length; i++)
                {
                    PromModel p = new PromModel();
                    if (Array[i] != "")
                    {
                        p.Name     = Array[i];
                        p.PromList = brand.GetPharmacyList(entId, userId, Array[i], Pricelevel, KhType, /*num,*/ pageIndex, pageSize, landing, staleDated, out int recordCount, out int pageCount);
                        pList.Add(p);
                        if (Array.Length > 1)
                        {
                            record = pageSize;
                            page   = pageIndex;
                        }
                        else
                        {
                            record = recordCount;
                            page   = pageCount;
                        }
                    }
                }

                //获取图片信息
                ImgInfoDal     idal  = new ImgInfoDal();
                List <ImgInfo> ilist = idal.GetImgInfo(2, imgType, entId, "PC", "");

                return(Json(new { success = true, list = pList, imgList = ilist, recordCount = record, pageCount = page }));
            }
            catch (Exception ex)
            {
                LogQueue.Write(LogType.Error, "Brand/GetPharmacy", ex.Message);
                return(Json(new { success = false, message = "E005" }));
            }
        }