/// <summary> /// 获取店铺列表 /// </summary> /// <returns></returns> public ActionResult GetStoreList(double lat = 0.00, double lng = 0.00) { returnObj = new Return_Msg_APP(); returnObj.code = "200"; string appId = Context.GetRequest("appId", string.Empty); if (string.IsNullOrEmpty(appId)) { returnObj.Msg = "参数错误"; return(Json(returnObj)); } XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId); if (r == null) { returnObj.Msg = "小程序未授权"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); } string keyMsg = Utility.IO.Context.GetRequest("keyMsg", string.Empty); int orderType = Utility.IO.Context.GetRequestInt("orderType", 0); //默认为0 1表示按照距离由近到远 2表示默认按照时间降序 int categoryId = Utility.IO.Context.GetRequestInt("categoryId", 0); //默认为0 表示获取所有 其它表示获取某个类别 int pageSize = Utility.IO.Context.GetRequestInt("pageSize", 10); int pageIndex = Utility.IO.Context.GetRequestInt("pageIndex", 1); int isBigType = Utility.IO.Context.GetRequestInt("isBigType", 0); //点击的是否为大类,如果为1则表示点击大类获取其下的小类 int cityCode = Utility.IO.Context.GetRequestInt("cityCode", 0); //哪个地区 默认为0 获取全部地区 //表示按照距离最近的 //表示没有传坐标 通过客户端IP获取经纬度 if (lat == 0 || lng == 0) { string IP = Utility.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}"); } } int totalCount = 0; List <PlatStore> list = PlatStoreBLL.SingleModel.GetListStore(r.Id, out totalCount, categoryId, keyMsg, lat, lng, cityCode, orderType, pageSize, pageIndex, isBigType, r.AppId); returnObj.dataObj = new { totalCount = totalCount, list = list }; returnObj.isok = true; returnObj.Msg = "获取成功"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 获取首页轮播图以及推荐商家 /// </summary> /// <returns></returns> public ActionResult GetConfig() { returnObj = new Return_Msg_APP(); returnObj.code = "200"; string appId = Context.GetRequest("appId", string.Empty); if (string.IsNullOrEmpty(appId)) { returnObj.Msg = "参数错误"; return(Json(returnObj)); } int pageIndexAdImg = Context.GetRequestInt("pageIndexAdImg", 1); int pageSizeAdImg = Context.GetRequestInt("pageSizeAdImg", 10); int pageIndexTjStore = Context.GetRequestInt("pageIndexTjStore", 1); int pageSizeTjStore = Context.GetRequestInt("pageSizeTjStore", 20); XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId); if (r == null) { returnObj.Msg = "小程序未授权"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); } string appname = ""; OpenAuthorizerConfig openonfigmodel = OpenAuthorizerConfigBLL.SingleModel.GetModelByAppids(r.AppId); if (openonfigmodel != null) { appname = openonfigmodel.nick_name; } else { UserXcxTemplate userXcxModel = UserXcxTemplateBLL.SingleModel.GetModelByAppId(r.AppId); appname = userXcxModel?.Name; } int adImgCount, tjStoreCount = 0; List <PlatConfig> listADImg = PlatConfigBLL.SingleModel.getListByaid(r.Id, out adImgCount, 0, pageSizeAdImg, pageIndexAdImg); List <PlatConfig> listTjStore = PlatConfigBLL.SingleModel.getListByaid(r.Id, out tjStoreCount, 1, pageSizeTjStore, pageIndexTjStore); string lngStr = Context.GetRequest("lng", string.Empty); string latStr = Context.GetRequest("lat", string.Empty); double lng = 0.00; double lat = 0.00; string curLocation = "未知城市"; int curCityCode = 0; if (!double.TryParse(lngStr, out lng) || !double.TryParse(latStr, out lat)) { string IP = WebHelper.GetIP(); IPToPoint iPToPoint = CommondHelper.GetLoctionByIP(IP); if (iPToPoint != null) { lat = iPToPoint.result.location.lat; lng = iPToPoint.result.location.lng; lngStr = lng.ToString(); latStr = lat.ToString(); //log4net.LogHelper.WriteInfo(this.GetType(), $"IP={IP};{lat},{lng}"); } } AddressApi addressinfo = AddressHelper.GetAddressByApi(lngStr, latStr); // log4net.LogHelper.WriteInfo(this.GetType(), Newtonsoft.Json.JsonConvert.SerializeObject(addressinfo)); if (addressinfo != null && addressinfo.result != null && addressinfo.result.address_component != null) { curLocation = addressinfo.result.address_component.city; curCityCode = C_AreaBLL.SingleModel.GetCodeByName(curLocation); } listTjStore.ForEach(x => { x.ObjName = x.ObjName.Length > 6 ? (x.ObjName.Substring(0, 5) + "...") : x.ObjName; }); PlatConfig platConfigRemark = PlatConfigBLL.SingleModel.GetPlatConfig(r.Id, 3); var remarkObj = new { haveRemark = false, remark = string.Empty, remarkOpenFrm = false }; if (platConfigRemark != null && !string.IsNullOrEmpty(platConfigRemark.ADImg)) { remarkObj = new { haveRemark = true, remark = platConfigRemark.ADImg, remarkOpenFrm = platConfigRemark.ObjId == 0 }; } PlatConfig platOther = PlatConfigBLL.SingleModel.GetPlatConfig(r.Id, 5);//获取平台其它设置 if (platOther == null) { platOther = new PlatConfig() { Aid = r.Id, AddTime = DateTime.Now, ConfigType = 5 }; } PlatOtherConfig platOtherConfig = new PlatOtherConfig(); platOtherConfig.VirtualPV = platOther.ADImgType; platOtherConfig.VirtualPlatMsgCount = platOther.ObjId; platOtherConfig.PlatMsgCount = PlatMsgBLL.SingleModel.GetCountByAId(r.Id); platOtherConfig.PV = PlatStatisticalFlowBLL.SingleModel.GetPVCount(r.Id); int totalPV = platOtherConfig.VirtualPV + platOtherConfig.PV; int totalMsgCout = platOtherConfig.PlatMsgCount + platOtherConfig.VirtualPlatMsgCount; PlatConfig platOfficialAccount = PlatConfigBLL.SingleModel.GetPlatConfig(r.Id, 6);//获取关注公众号设置 if (platOfficialAccount == null) { platOfficialAccount = new PlatConfig() { Aid = r.Id, AddTime = DateTime.Now, ConfigType = 6 }; } returnObj.dataObj = new { appname = appname, ADImgs = new { totalCount = adImgCount, list = listADImg }, TjStores = new { totalCount = tjStoreCount, list = listTjStore }, Location = new { curLocation = curLocation, curCityCode = curCityCode }, platConfigRemark = remarkObj, platOtherConfig = new { TotalPV = totalPV > 100000?Convert.ToInt32(totalPV * 0.0001).ToString() + "万+": totalPV.ToString(), TotalMsgCount = totalMsgCout > 100000? Convert.ToInt32(totalMsgCout * 0.0001).ToString() + "万+": totalMsgCout.ToString() }, platOfficialAccount = platOfficialAccount }; returnObj.isok = true; returnObj.Msg = "获取成功"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 谁看过我,谁关注我,谁收藏我,谁点赞我列表数据 /// </summary> /// <returns></returns> public ActionResult GetOtherFavoriteList() { returnObj = new Return_Msg_APP(); int actionType = Context.GetRequestInt("actiontype", (int)PointsActionType.收藏); int myCardId = Context.GetRequestInt("mycardid", 0); int userId = Context.GetRequestInt("userid", 0); int aid = Context.GetRequestInt("aid", 0); int dataType = Context.GetRequestInt("datatype", (int)PointsDataType.片); int pageIndex = Context.GetRequestInt("pageindex", 1); int pageSize = Context.GetRequestInt("pagesize", 10); int type = Context.GetRequestInt("type", 0); string lng = Context.GetRequest("lng", "0"); string lat = Context.GetRequest("lat", "0"); int ver = Context.GetRequestInt("ver", 0); if (myCardId <= 0) { returnObj.Msg = "我的名片ID不能小于0"; return(Json(returnObj)); } if (userId <= 0) { returnObj.Msg = "userid不能小于0"; return(Json(returnObj)); } if (aid <= 0) { returnObj.Msg = "aid不能小于0"; return(Json(returnObj)); } PlatMyCard myCard = PlatMyCardBLL.SingleModel.GetModelByUserId(userId, aid); if (myCard != null) { lng = myCard.Lng.ToString(); lat = myCard.Lat.ToString(); } int count = 0; switch (dataType) { case (int)PointsDataType.片: if (actionType == (int)PointsActionType.私信) { List <PlatUserFavoriteMsg> myCardList = PlatUserFavoriteMsgBLL.SingleModel.GetMyCardUserFavoriteList(ver, myCard.Id, userId, aid, pageIndex, pageSize, ref count); returnObj.dataObj = new { list = myCardList, count = count }; } else { List <PlatUserFavoriteMsg> mycardlist = PlatUserFavoriteMsgBLL.SingleModel.GetMyCardUserFavoriteList(myCard.AppId, lng, lat, userId, type, aid, myCardId, actionType, dataType, pageIndex, pageSize, ref count); returnObj.dataObj = new { list = mycardlist, count = count }; } break; case (int)PointsDataType.帖子: List <PlatUserFavoriteMsg> msgList = PlatUserFavoriteMsgBLL.SingleModel.GetMsgUserFavoriteList(type, aid, myCardId, actionType, dataType, pageIndex, pageSize, ref count); returnObj.dataObj = new { list = msgList, count = count }; break; case (int)PointsDataType.店铺: List <PlatStore> storeList = PlatUserFavoriteMsgBLL.SingleModel.GetListMyFavoriteStore(aid, userId, out count, pageSize, pageIndex); //表示没有传坐标 通过客户端IP获取经纬度 IPToPoint iPToPoint = new IPToPoint(); if (lng == "0" || lat == "0") { string IP = WebHelper.GetIP(); iPToPoint = CommondHelper.GetLoctionByIP(IP); if (iPToPoint != null && iPToPoint.result != null) { lat = iPToPoint.result.location.lat.ToString(); lng = iPToPoint.result.location.lng.ToString(); } } double distance = 0.00; storeList.ForEach(x => { distance = CommondHelper.GetDistance(x.Lat, x.Lng, Convert.ToDouble(lat), Convert.ToDouble(lng)); if (distance < 1) { x.Distance = (distance * 1000).ToString() + "m"; } else { x.Distance = distance.ToString() + "km"; } }); returnObj.dataObj = new { list = storeList, count = count }; break; } returnObj.isok = true; return(Json(returnObj)); }
/// <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)); }
public ActionResult getMsgDetail() { returnObj = new Return_Msg_APP(); string appId = Context.GetRequest("appId", string.Empty); int msgId = Context.GetRequestInt("msgId", 0); //帖子信息Id int userId = Context.GetRequestInt("userId", 0); //用户Id string latStr = Context.GetRequest("lat", string.Empty); string lngStr = Context.GetRequest("lng", string.Empty); 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)); } CityMsg model = CityMsgBLL.SingleModel.getMsg(r.Id, msgId); if (model == null) { returnObj.code = "200"; returnObj.Msg = "找不到数据"; return(Json(returnObj, JsonRequestBehavior.AllowGet)); } 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}"); } } model.distance = CityMsgBLL.SingleModel.GetDistance(Convert.ToDouble(model.lat), Convert.ToDouble(model.lng), lat, lng); CityUserFavoriteMsg _userFavoriteMsg = CityUserFavoriteMsgBLL.SingleModel.getCity_UserFavoriteMsg(r.Id, msgId, userId); model.isFavorited = (_userFavoriteMsg != null); _userFavoriteMsg = CityUserFavoriteMsgBLL.SingleModel.getCity_UserFavoriteMsg(r.Id, msgId, userId, 1); model.isDzed = (_userFavoriteMsg != null); CityMsgReport city_MsgReport = CityMsgReportBLL.SingleModel.GetCityMsgReport(userId, msgId); model.isReported = (city_MsgReport != null); int commentTotalCount = 0; model.Comments = CityMsgCommentBLL.SingleModel.GetCityMsgComment(r.Id, out commentTotalCount, string.Empty, 1000, 1, model.Id); returnObj.isok = true; returnObj.Msg = "获取成功"; returnObj.dataObj = new { msg = model }; return(Json(returnObj, JsonRequestBehavior.AllowGet)); }
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 commentTotalCount = 0; int totalCount = 0; List <CityMsg> list = new List <CityMsg>(); 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 && iPToPoint.result != 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 = CityMsgBLL.SingleModel.getListCity_Msg(r.Id, out totalCount, pageSize, pageIndex, msgTypeId, keyMsg, 1, lat, lng); list.ForEach(x => { x.distance = CityMsgBLL.SingleModel.GetDistance(Convert.ToDouble(x.lat), Convert.ToDouble(x.lng), lat, lng); if (x.distance < 1) { x.distanceStr = (x.distance * 1000).ToString("0.00") + "m"; } else { x.distanceStr = x.distance.ToString("0.00") + "km"; } CityUserFavoriteMsg _userFavoriteMsg = CityUserFavoriteMsgBLL.SingleModel.getCity_UserFavoriteMsg(r.Id, x.Id, userId, 1); x.isDzed = (_userFavoriteMsg != null); CityMsgReport city_MsgReport = CityMsgReportBLL.SingleModel.GetCityMsgReport(userId, x.Id); x.isReported = (city_MsgReport != null); x.Comments = CityMsgCommentBLL.SingleModel.GetCityMsgComment(x.aid, out commentTotalCount, string.Empty, 1000, 1, x.Id); }); } else { list = CityMsgBLL.SingleModel.getListCity_Msg(r.Id, out totalCount, pageSize, pageIndex, msgTypeId, keyMsg); list.ForEach(x => { CityUserFavoriteMsg _userFavoriteMsg = CityUserFavoriteMsgBLL.SingleModel.getCity_UserFavoriteMsg(r.Id, x.Id, userId, 1); x.isDzed = (_userFavoriteMsg != null); CityMsgReport city_MsgReport = CityMsgReportBLL.SingleModel.GetCityMsgReport(userId, x.Id); x.isReported = (city_MsgReport != null); x.Comments = CityMsgCommentBLL.SingleModel.GetCityMsgComment(x.aid, out commentTotalCount, string.Empty, 1000, 1, x.Id); }); } returnObj.isok = true; returnObj.Msg = "获取成功"; returnObj.dataObj = new { totalCount = totalCount, list = list }; return(Json(returnObj, JsonRequestBehavior.AllowGet)); }