Ejemplo n.º 1
0
        /// <summary>
        /// 获取一条帖子的详情
        /// </summary>
        /// <returns></returns>
        public ActionResult GetMsgDetail()
        {
            returnObj = new Return_Msg_APP();
            string appId  = Utility.IO.Context.GetRequest("appId", string.Empty);
            int    msgId  = Utility.IO.Context.GetRequestInt("msgId", 0);  //帖子信息Id
            int    userId = Utility.IO.Context.GetRequestInt("userId", 0); // 类似用户Id

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

            XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId);

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


            PlatMsg model = PlatMsgBLL.SingleModel.GetMsg(r.Id, msgId);

            if (model == null)
            {
                returnObj.code = "200";
                returnObj.Msg  = "找不到数据";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }



            PlatUserFavoriteMsg _userFavoriteMsg = PlatUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsg(r.Id, msgId, userId, (int)PointsActionType.收藏);

            model.IsFavorited = (_userFavoriteMsg != null && _userFavoriteMsg.State != -1);

            PlatUserFavoriteMsg _userFavoriteMsgDz = PlatUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsg(r.Id, msgId, userId, (int)PointsActionType.点赞);

            model.IsDzed = (_userFavoriteMsgDz != null && _userFavoriteMsgDz.State != -1);

            PlatMsgReport _platMsgReport = PlatMsgReportBLL.SingleModel.GetMsgReport(userId, msgId);

            model.IsReported = (_platMsgReport != null);

            returnObj.isok    = true;
            returnObj.Msg     = "获取成功";
            returnObj.dataObj = new { msg = model };
            return(Json(returnObj, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取名片,并返回我是否点赞了该名片
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="myuserid"></param>
        /// <param name="aid"></param>
        /// <param name="datatype"></param>
        /// <returns></returns>
        public PlatMyCard GetMyCardData(long userid, int myuserid, int aid, int datatype)
        {
            PlatMyCard model = GetModelByUserId(userid, aid);

            if (model == null)
            {
                return(new PlatMyCard());
            }
            PlatMsgviewFavoriteShare smodel = PlatMsgviewFavoriteShareBLL.SingleModel.GetModelByMsgId(aid, model.Id, datatype);

            if (smodel == null)
            {
                return(model);
            }
            List <PlatUserFavoriteMsg> userfavoritelist = PlatUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsgList(aid, model.Id.ToString(), myuserid, (int)PointsDataType.片);

            if (userfavoritelist != null && userfavoritelist.Count > 0)
            {
                PlatUserFavoriteMsg userfavorite = userfavoritelist.Where(w => w.ActionType == (int)PointsActionType.收藏).FirstOrDefault();
                model.IsFavorite = userfavorite?.State >= 0;

                userfavorite   = userfavoritelist.Where(w => w.ActionType == (int)PointsActionType.关注).FirstOrDefault();
                model.IsFollow = userfavorite?.State >= 0;

                userfavorite = userfavoritelist.Where(w => w.ActionType == (int)PointsActionType.点赞).FirstOrDefault();
                model.IsDz   = userfavorite?.State >= 0;
            }

            model.FollowCount   = smodel.FollowCount;
            model.FavoriteCount = smodel.FavoriteCount;
            model.DzCount       = smodel.DzCount;
            model.ViewCount     = smodel.ViewCount + model.FictitiousCount;
            model.SiXinCount    = smodel.SiXinCount;
            model.NewData       = GetRedisCach(model.Id);
            return(model);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 数据雷达
        /// </summary>
        /// <returns></returns>
        public ActionResult GetRadarData()
        {
            PlatRadarReportModel radar = new PlatRadarReportModel();

            returnObj = new Return_Msg_APP();
            int userId = Context.GetRequestInt("userid", 0);
            int aid    = Context.GetRequestInt("aid", 0);
            int type   = Context.GetRequestInt("type", 0);//-1:统计,0:本月,1:上个月

            if (userId <= 0)
            {
                returnObj.Msg = "userid不能为0";
                return(Json(returnObj));
            }
            PlatMyCard myCard = PlatMyCardBLL.SingleModel.GetModelByUserId(userId);

            if (myCard == null)
            {
                returnObj.Msg = "名片已过期";
                return(Json(returnObj));
            }

            string startTime = "";
            string endTime   = "";

            switch (type)
            {
            case -1: break;

            case 0:
                startTime = DateTime.Now.ToString("yyyy-MM") + "-1";
                endTime   = DateTime.Now.AddMonths(1).ToString("yyyy-MM") + "-1";
                break;

            case 1:
                startTime = DateTime.Now.AddMonths(1).ToString("yyyy-MM") + "-1";
                endTime   = DateTime.Now.AddMonths(2).ToString("yyyy-MM") + "-1";
                break;
            }

            #region  片数据分析
            //浏览量
            //点赞量
            //关注量
            //与多少人私信
            //转发量
            PlatMsgviewFavoriteShare reportData = PlatMsgviewFavoriteShareBLL.SingleModel.GetModelByMsgId(aid, myCard.Id, (int)PointsDataType.片);
            radar.MyCardViewCount = myCard.FictitiousCount;
            if (reportData != null)
            {
                radar.MyCardDzCount     = reportData.DzCount;
                radar.MyCardViewCount  += reportData.ViewCount;
                radar.MyCardFollowCount = reportData.FollowCount;
                radar.MyCardShareCount  = reportData.ShareCount;
            }
            radar.MyCardSiXinCount = ImMessageBLL.SingleModel.GetCountByTuesrId(userId);

            //访客人数
            int visitorCount = PlatUserFavoriteMsgBLL.SingleModel.GetVisitorCount(myCard.Id, myCard.AId, (int)PointsDataType.片, startTime, endTime);
            radar.MyCardVisitorCount = visitorCount;
            #endregion

            #region 人脉关系统计
            //已关注人数
            int myFavoriteCount = PlatUserFavoriteMsgBLL.SingleModel.GetUserMsgCount(aid, 0, (int)PointsActionType.关注, (int)PointsDataType.片, userId);
            radar.FollowCount = myFavoriteCount;

            //粉丝人数
            int fanCount = PlatUserFavoriteMsgBLL.SingleModel.GetUserMsgCount(aid, myCard.Id, (int)PointsActionType.关注, (int)PointsDataType.片, 0);
            radar.FanCount = fanCount;

            //相互关注人数
            radar.MutualFollowCount = PlatUserFavoriteMsgBLL.SingleModel.GetMutualFollowCount(aid, userId);
            #endregion

            #region 平台入驻店铺数据统计
            PlatStore storeModel = PlatStoreBLL.SingleModel.GetPlatStore(myCard.Id, 1);
            if (storeModel != null)
            {
                //浏览量
                radar.StoreViewCount = storeModel.StorePV + storeModel.StoreVirtualPV;
                //收藏数
                List <PlatUserFavoriteMsg> storelist = PlatUserFavoriteMsgBLL.SingleModel.GetReportData(storeModel.Id, myCard.AId, (int)PointsDataType.店铺, startTime, endTime);
                if (storelist != null && storelist.Count > 0)
                {
                    PlatUserFavoriteMsg tempmodel = storelist.Where(w => w.ActionType == (int)PointsActionType.收藏).FirstOrDefault();
                    radar.StoreFavoriteCount = tempmodel == null ? 0 : tempmodel.Count;
                }

                //访客人数
                int storeVisitorCount = PlatUserFavoriteMsgBLL.SingleModel.GetVisitorCount(storeModel.Id, myCard.AId, (int)PointsDataType.店铺, startTime, endTime);
                radar.StoreVisitorCount = storeVisitorCount;
            }
            #endregion

            returnObj.isok    = true;
            returnObj.dataObj = radar;
            return(Json(returnObj));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取帖子列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetMsgList()
        {
            returnObj      = new Return_Msg_APP();
            returnObj.code = "200";
            int    userId    = Context.GetRequestInt("userId", 0);
            string appId     = Context.GetRequest("appId", string.Empty);
            string keyMsg    = Context.GetRequest("keyMsg", string.Empty);
            int    orderType = Context.GetRequestInt("orderType", 0); //默认为0 表示最新发布  1表示距离最近
            int    msgTypeId = Context.GetRequestInt("msgTypeId", 0); //类别默认为0 表示获取所有
            int    pageSize  = Context.GetRequestInt("pageSize", 10);
            int    pageIndex = Context.GetRequestInt("pageIndex", 1);
            string latStr    = Context.GetRequest("lat", string.Empty);
            string lngStr    = Context.GetRequest("lng", string.Empty);

            if (string.IsNullOrEmpty(appId))
            {
                returnObj.Msg = "参数错误";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }
            XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId);

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

            int totalCount        = 0;
            int commentTotalCount = 0; //帖子对应的评论条数
            int count             = 0; //帖子对应的点赞用户数

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

            if (orderType == 1)
            {
                double lat = 0.00;
                double lng = 0.00;
                //表示按照距离最近的
                //表示没有传坐标 通过客户端IP获取经纬度
                // log4net.LogHelper.WriteInfo(this.GetType(), $"!!!!orderType={orderType};{lat},{lng}");
                if (!double.TryParse(latStr, out lat) || !double.TryParse(lngStr, out lng) || lat == 0 || lng == 0)
                {
                    string IP = WebHelper.GetIP();

                    IPToPoint iPToPoint = CommondHelper.GetLoctionByIP(IP);
                    if (iPToPoint != null)
                    {
                        lat = iPToPoint.result.location.lat;
                        lng = iPToPoint.result.location.lng;
                        //log4net.LogHelper.WriteInfo(this.GetType(), $"IP={IP};{lat},{lng}");
                    }
                }
                //log4net.LogHelper.WriteInfo(this.GetType(),$"orderType={orderType};{lat},{lng}" );

                list = PlatMsgBLL.SingleModel.GetListMsg(r.Id, out totalCount, keyMsg, msgTypeId, pageSize, pageIndex, 1, lat, lng);

                list.ForEach(x =>
                {
                    PlatUserFavoriteMsg _userFavoriteMsg = PlatUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsg(r.Id, x.Id, userId, (int)PointsActionType.收藏);
                    x.IsFavorited = (_userFavoriteMsg != null && _userFavoriteMsg.State != -1);

                    _userFavoriteMsg = PlatUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsg(r.Id, x.Id, userId, (int)PointsActionType.点赞);
                    x.IsDzed         = (_userFavoriteMsg != null && _userFavoriteMsg.State != -1);

                    PlatMsgReport _platMsgReport = PlatMsgReportBLL.SingleModel.GetMsgReport(userId, x.Id);
                    x.IsReported = (_platMsgReport != null);


                    x.Comments = PlatMsgCommentBLL.SingleModel.GetPlatMsgComment(r.Id, out commentTotalCount, 0, string.Empty, 1000, 1, x.Id, 0);


                    x.DzUsers = PlatUserFavoriteMsgBLL.SingleModel.GetMsgUserFavoriteList(0, x.Aid, x.Id, (int)PointsActionType.点赞, (int)PointsDataType.帖子, 1, 1000, ref count);
                });
            }
            else
            {
                list = PlatMsgBLL.SingleModel.GetListMsg(r.Id, out totalCount, keyMsg, msgTypeId, pageSize, pageIndex);

                list.ForEach(x =>
                {
                    PlatUserFavoriteMsg _userFavoriteMsg = PlatUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsg(r.Id, x.Id, userId, (int)PointsActionType.收藏);
                    x.IsFavorited = (_userFavoriteMsg != null && _userFavoriteMsg.State != -1);

                    _userFavoriteMsg = PlatUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsg(r.Id, x.Id, userId, (int)PointsActionType.点赞);
                    x.IsDzed         = (_userFavoriteMsg != null && _userFavoriteMsg.State != -1);

                    PlatMsgReport _platMsgReport = PlatMsgReportBLL.SingleModel.GetMsgReport(userId, x.Id);
                    x.IsReported = (_platMsgReport != null);


                    x.Comments = PlatMsgCommentBLL.SingleModel.GetPlatMsgComment(r.Id, out commentTotalCount, 0, string.Empty, 1000, 1, x.Id, 0);

                    x.DzUsers = PlatUserFavoriteMsgBLL.SingleModel.GetMsgUserFavoriteList(0, x.Aid, x.Id, (int)PointsActionType.点赞, (int)PointsDataType.帖子, 1, 1000, ref count);
                });
            }

            returnObj.isok    = true;
            returnObj.Msg     = "获取成功";
            returnObj.dataObj = new { totalCount = totalCount, list = list };
            return(Json(returnObj, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取平台指定店铺详情
        /// </summary>
        /// <returns></returns>
        public ActionResult GetStoreDetail()
        {
            returnObj      = new Return_Msg_APP();
            returnObj.code = "200";
            string appId   = Context.GetRequest("appId", string.Empty);
            int    userId  = Context.GetRequestInt("userId", 0);
            int    storeId = Context.GetRequestInt("storeId", 0);
            int    type    = Context.GetRequestInt("type", 0);

            if (string.IsNullOrEmpty(appId))
            {
                returnObj.Msg = "参数错误";
                return(Json(returnObj));
            }
            List <string>         listPlatMyCardIds = new List <string>();
            int                   myCardId          = Context.GetRequestInt("myCardId", 0);
            int                   isStoreID         = Context.GetRequestInt("isStoreID", 0);//如果是1 表示myCardId为店铺Id 这里是轮播图处理兼容旧数据
            XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId);

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

            if (type == 1 && isStoreID == 0)
            {
                //表示从我的店铺名片进来
                if (myCardId <= 0)
                {
                    platStore = null;
                }
                else
                {
                    platStore = PlatStoreBLL.SingleModel.GetPlatStore(myCardId, type);
                }
            }
            else if (type == 2)
            {
                //表示独立小程序进来的
                platStore = PlatStoreBLL.SingleModel.GetPlatStore(r.Id, type);
                r         = _xcxAppAccountRelationBLL.GetModel(platStore.BindPlatAid);//查找所属平台
                if (r != null)
                {
                    listPlatMyCardIds = PlatMyCardBLL.SingleModel.GetCardIds(r.Id, r.AppId).Split(',').ToList();
                    if (!listPlatMyCardIds.Contains(platStore.MyCardId.ToString()))
                    {
                        returnObj.Msg = "店铺不存在(平台换绑了小程序,请重新入驻)";
                        return(Json(returnObj, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            else
            {
                //平台轮播图 置顶商家 进入店铺会带上isStoreID

                if (isStoreID > 0)
                {
                    type      = 0;
                    platStore = PlatStoreBLL.SingleModel.GetPlatStore(myCardId, type);
                }
                else
                {
                    platStore = PlatStoreBLL.SingleModel.GetPlatStore(storeId, type);
                }
            }

            if (platStore == null)
            {
                returnObj.Msg = "店铺不存在";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }
            if (platStore.State == -1)
            {
                returnObj.Msg = "店铺无效(未支付)";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }



            if (type != 2)
            {
                //这里的appID是平台的
                listPlatMyCardIds = PlatMyCardBLL.SingleModel.GetCardIds(r.Id, appId).Split(',').ToList();
                if (!listPlatMyCardIds.Contains(platStore.MyCardId.ToString()))
                {
                    returnObj.Msg = "店铺不存在(平台换绑了小程序,请重新入驻绑定)";
                    return(Json(returnObj, JsonRequestBehavior.AllowGet));
                }
            }



            //店铺关联的权限表数据
            XcxAppAccountRelation storexcxrelation = _xcxAppAccountRelationBLL.GetModel(platStore.Aid);

            if (storexcxrelation != null)
            {
                platStore.AppId = storexcxrelation.AppId;
            }

            //TODO 后续流量大了再放入redis然后定时去更新
            platStore.StorePV++;
            //访客人数
            platStore.StoreUV       = PlatUserFavoriteMsgBLL.SingleModel.GetVisitorCount(platStore.MyCardId, platStore.BindPlatAid, (int)PointsDataType.店铺, "", "");
            platStore.FavoriteCount = PlatUserFavoriteMsgBLL.SingleModel.GetStoreFavoriteCount(r.Id, platStore.Id);

            PlatUserFavoriteMsg platUserFavoriteMsg = PlatUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsg(r.Id, platStore.Id, userId, (int)PointsActionType.收藏, (int)PointsDataType.店铺);

            platStore.Favorited = (platUserFavoriteMsg != null && platUserFavoriteMsg.State != -1 ? 1 : 0);

            platStore.CategoryName = PlatStoreCategoryBLL.SingleModel.GetModel(platStore.Category).Name;

            int tjCount = 0;

            List <PlatChildGoods> listTjGoods = listTjGoods = PlatChildGoodsBLL.SingleModel.GetListByRedis(platStore.Aid, ref tjCount, string.Empty, 0, 0, 1, 1, 4, "TopState desc,VirtualSalesCount+SalesCount desc,sort desc");

            //if (type == 0)
            //{

            //    listTjGoods = _platChildGoodsBLL.GetListByRedis(platStore.Aid, ref tjCount, string.Empty, 0, 0, 1, 1, 4, "TopState desc,VirtualSalesCount+SalesCount desc,sort desc");
            //}
            //else
            //{
            //    listTjGoods = _platChildGoodsBLL.GetListByRedis(r.Id, ref tjCount, string.Empty, 0, 0, 1, 1, 4, "TopState desc,VirtualSalesCount+SalesCount desc,sort desc");
            //}
            if (listTjGoods != null && listTjGoods.Count > 0)
            {
                listTjGoods.ForEach(x =>
                {
                    platStore.TjGoods.Add(new TjGoods()
                    {
                        Aid       = x.AId,
                        Id        = x.Id,
                        Name      = x.Name,
                        Img       = x.Img,
                        PriceStr  = (x.PriceFen * 0.01).ToString("0.00"),
                        SaleCount = (x.SalesCount + x.VirtualSalesCount),
                        TopState  = x.TopState
                    });
                });
            }

            PlatApplyApp platApplyApp = PlatApplyAppBLL.SingleModel.GetPlatApplyAppByStoreId(platStore.Id);

            if (platApplyApp != null)
            {
                platStore.AppState = platApplyApp.OpenState;
            }

            if (!PlatStoreBLL.SingleModel.Update(platStore, "StorePV"))
            {
                returnObj.Msg = "更新店铺浏览量异常";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }
            //PlatMsgviewFavoriteShare msgview = _platMsgviewFavoriteShareBLL.GetModelByMsgId(platStore.BindPlatAid, platStore.Id,(int)PointsDataType.店铺);
            //if(msgview!=null)
            //{
            //    platStore.StorePV = msgview.ViewCount;
            //}

            PlatMyCard platMyCard = PlatMyCardBLL.SingleModel.GetModel(platStore.MyCardId);

            if (platMyCard != null)
            {
                platStore.storeOwner = new StoreOwner()
                {
                    UserId = platMyCard.UserId,
                    Name   = platMyCard.Name,
                    Avatar = platMyCard.ImgUrl,
                    State  = platMyCard.State,
                };
            }

            if (!string.IsNullOrEmpty(platStore.StoreService))
            {
                platStore.StoreServiceModelList = Newtonsoft.Json.JsonConvert.DeserializeObject <List <StoreServiceModel> >(platStore.StoreService);
            }
            else
            {
                List <StoreServiceModel> list = new List <StoreServiceModel>();
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "WIFI"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "停车位"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "支付宝支付"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "微信支付"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "刷卡支付"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "空调雅座"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "付费停车"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "接送服务"
                });
                platStore.StoreServiceModelList = list;
            }

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

            platStore.StorePV += platStore.StoreVirtualPV;
            returnObj.dataObj  = new
            {
                platStore = platStore
            };
            returnObj.isok = true;
            returnObj.Msg  = "获取成功";
            return(Json(returnObj, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 附近人脉
        /// </summary>
        /// <param name="lng">经度</param>
        /// <param name="lat">纬度</param>
        /// <param name="citycode">同城编码</param>
        /// <param name="distance">距离</param>
        /// <param name="userid">登陆用户ID</param>
        /// <param name="aid">权限表ID</param>
        /// <param name="actiontype"></param>
        /// <param name="count"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public List <PlatMyCard> GetCardApiList(string appid, int industryid, int areacode, string lng, string lat, int citycode, int distance, int userid, int aid, int actiontype, ref int count, int pageSize = 5, int pageIndex = 1)
        {
            string                  key       = string.Format(_redis_RenMaiQuanKey, aid, userid);
            List <PlatMyCard>       list      = new List <PlatMyCard>();
            RedisModel <PlatMyCard> redisList = RedisUtil.Get <RedisModel <PlatMyCard> >(key);

            if (pageIndex <= 1 || redisList == null || redisList.DataList == null || redisList.DataList.Count <= 0)
            {
                redisList = new RedisModel <PlatMyCard>();
                string sql        = $"select {"{0}"} from (select p.*,f.followcount,f.dzcount,(f.viewcount+p.fictitiouscount) viewcount,f.SiXinCount,f.FavoriteCount,GetDistance({lng},{lat},p.lng,p.lat) distance from platmycard p left join platmsgviewfavoriteshare f on p.id = f.msgid and f.aid={aid} and f.datatype={(int)PointsDataType.名片}) d";
                string sqlcount   = string.Format(sql, "count(*)");
                string sqllist    = string.Format(sql, "*");
                string sqlwhere   = $" where d.aid = {aid} and d.appid='{appid}' and d.state>=0";
                string sqlorderby = " order by p.id desc";
                //string sqlpage = $" limit {(pageIndex - 1) * pageSize},{pageSize}";

                //行业
                if (industryid > 0)
                {
                    sqlwhere += $" and IndustryId={industryid} ";
                }
                //区域
                if (areacode > 0)
                {
                    sqlwhere += $" and (citycode={areacode} or ProvinceCode={areacode}) ";
                }

                //人气排序
                switch (actiontype)
                {
                case (int)PointsActionType.关注: sqlorderby = " order by followcount desc "; break;

                case (int)PointsActionType.点赞: sqlorderby = " order by dzcount desc "; break;

                case (int)PointsActionType.过: sqlorderby = " order by viewcount desc "; break;
                }

                //附近人脉
                if (distance > 0)
                {
                    sqlwhere  += $" and distance<={distance * 1000}";
                    sqlorderby = " order by distance asc ";
                }
                else if (citycode > 0)
                {
                    sqlwhere  += $" and citycode={citycode} ";
                    sqlorderby = " order by distance asc ";
                }
                //log4net.LogHelper.WriteInfo(this.GetType(), sqllist + sqlwhere + sqlorderby + sqlpage);
                count = base.GetCountBySql(sqlcount + sqlwhere);
                using (MySqlDataReader dr = SqlMySql.ExecuteDataReaderMaster(connName, CommandType.Text, sqllist + sqlwhere + sqlorderby, null))
                {
                    while (dr.Read())
                    {
                        PlatMyCard model = base.GetModel(dr);
                        if (dr["followcount"] != DBNull.Value)
                        {
                            model.FollowCount = Convert.ToInt32(dr["followcount"]);
                        }
                        if (dr["dzcount"] != DBNull.Value)
                        {
                            model.DzCount = Convert.ToInt32(dr["dzcount"]);
                        }
                        if (dr["viewcount"] != DBNull.Value)
                        {
                            model.ViewCount = Convert.ToInt32(dr["viewcount"]);
                        }
                        if (dr["SiXinCount"] != DBNull.Value)
                        {
                            model.SiXinCount = Convert.ToInt32(dr["SiXinCount"]);
                        }
                        if (dr["FavoriteCount"] != DBNull.Value)
                        {
                            model.FavoriteCount = Convert.ToInt32(dr["FavoriteCount"]);
                        }
                        //PlatMyCard modelitem = GetMyCardData(model.UserId,userid,aid,(int)PointsDataType.名片);
                        if (DBNull.Value != dr["distance"])
                        {
                            int tempdistance = Convert.ToInt32(dr["distance"]);
                            model.Distance = DataHelper.GetDistanceFormat(tempdistance, 1);
                        }
                        else
                        {
                            model.Distance = "0m";
                        }
                        list.Add(model);
                    }
                }
                if (list != null && list.Count > 0)
                {
                    string msgids = string.Join(",", list.Select(s => s.Id).Distinct());
                    List <PlatUserFavoriteMsg> userfavoritelist = PlatUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsgList(aid, msgids, userid, (int)PointsDataType.片);
                    //入驻店铺
                    List <PlatStore> storelist = PlatStoreBLL.SingleModel.GetListByCardId(msgids);

                    foreach (PlatMyCard item in list)
                    {
                        PlatUserFavoriteMsg userfavorite = userfavoritelist?.FirstOrDefault(f => f.MsgId == item.Id && f.ActionType == (int)PointsActionType.关注);
                        item.IsFavorite = userfavorite?.State >= 0;

                        userfavorite  = userfavoritelist?.FirstOrDefault(f => f.MsgId == item.Id && f.ActionType == (int)PointsActionType.关注);
                        item.IsFollow = userfavorite?.State >= 0;

                        userfavorite = userfavoritelist?.FirstOrDefault(f => f.MsgId == item.Id && f.ActionType == (int)PointsActionType.点赞);
                        item.IsDz    = userfavorite?.State >= 0;

                        //是否有入驻店铺
                        PlatStore store = storelist?.FirstOrDefault(f => f.MyCardId == item.Id);
                        item.StoreId = store == null ? 0 : store.Id;
                    }
                }
                redisList.DataList = list;
                redisList.Count    = count;
                RedisUtil.Set <RedisModel <PlatMyCard> >(key, redisList);
            }
            list  = redisList.DataList.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
            count = redisList.Count;
            return(list);
        }