public ApiResultModel EditLifeBill(EditLifeBillModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //通过用户Id查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); ILifeBillBLL lifeBillBll = BLLFactory <ILifeBillBLL> .GetBLL("LifeBillBLL"); T_LifeBill lifebill = lifeBillBll.GetEntity(u => u.Id == model.Id && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果该生活记账存在 if (lifebill != null) { lifebill.Id = model.Id; lifebill.BillTypeId = model.CategoryId; lifebill.PayTypeId = model.PayId; lifebill.Money = model.Money; lifebill.ConsumptionDate = Convert.ToDateTime(model.PayDate); lifebill.CreateDate = Convert.ToDateTime(model.DateStr); lifebill.Memo = model.Mark; //更新 lifeBillBll.Update(lifebill); } else { resultModel.Msg = "生活记账不存在"; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel GetShopInfo([FromUri] ShopInfoModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //获取当前用户 IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL"); T_ShopUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); //调用商家BLL层获取商家信息 IShopBLL shopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); var shop = shopBll.GetEntity(s => s.Id == model.ShopId); //如果商家信息不为空 if (shop != null) { resultModel.result = new { ShopName = shop.ShopName, ShopContent = string.Format("MobilePage/StoreIntroduce?ShopId={0}", shop.Id), ShopMainSale = shop.MainSale, StartBusinessTime = shop.StartBusinessTime, EndBusinessTime = shop.EndBusinessTime, ShopAddress = shop.Address, Phone = shop.Phone, ShopPicList = shop.ImgPath }; } else { resultModel.Msg = APIMessage.NO_APP; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel GetAllTopicListByType([FromUri] AllTopicPagedSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); var collectedTopicIds = owner.UserPostBarTopics.Select(o => o.PostBarTopicId).ToList(); IPostBarTopicBLL topicBLL = BLLFactory <IPostBarTopicBLL> .GetBLL("PostBarTopicBLL"); // 获取小区某分类下的所有主题列表 var list = topicBLL.GetSetTopPageList(m => m.PropertyPlaceId == model.PropertyPlaceId && m.TopicTypeId == model.TopicTypeId, model.PageIndex, ConstantParam.PAGE_SIZE).Select(m => new { Id = m.Id, PostDate = m.PostDate.ToString("yyyy-MM-dd HH:mm:ss"), IsTop = m.IsTop, UserImage = m.PostUser.HeadPath, UserName = m.PostUser.UserName, Title = m.Title, Content = m.Content, PicList = m.ImgPath, CommentCount = m.PostBarTopicDiscusss.Count(), IsCollected = collectedTopicIds.Contains(m.Id) ? 1 : 0, TopicType = m.PostBarTopicType.Name, PostUserId = m.PostUserId }).ToList(); resultModel.result = list; resultModel.Total = topicBLL.Count(m => m.PropertyPlaceId == model.PropertyPlaceId && m.TopicTypeId == model.TopicTypeId); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel DeleteReply(DeleteReplyModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL userBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); //获取要删除的回复内容 IPostBarTopicDiscussBLL postBarTopicDiscussBll = BLLFactory <IPostBarTopicDiscussBLL> .GetBLL("PostBarTopicDiscussBLL"); T_PostBarTopicDiscuss reply = postBarTopicDiscussBll.GetEntity(u => u.Id == model.Id); //如果该回复存在 if (reply == null) { resultModel.Msg = "该回复不存在"; } else { if (reply.ParentId == null) { postBarTopicDiscussBll.DeleteLevelOneDiscuss(reply.Id); } else { postBarTopicDiscussBll.Delete(reply); } } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel EditGoodsCategory(GoodsCategoryInfoModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //获取当前商家用户 IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL"); T_ShopUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果商家用户存在 if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); if (model.Id.HasValue) { IGoodsCategoryBLL goodsBLL = BLLFactory <IGoodsCategoryBLL> .GetBLL("GoodsCategoryBLL"); if (goodsBLL.Exist(m => m.Name == model.Name && m.Id != model.Id && m.ShopId == model.ShopId)) { resultModel.Msg = "该商品类别已经存在"; } else { var goodsCategory = goodsBLL.GetEntity(g => g.Id == model.Id.Value); //修改商品分类 if (goodsCategory != null) { goodsCategory.Name = model.Name; goodsBLL.Update(goodsCategory); } else { resultModel.Msg = "不存在当前商品分类"; } } } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel DisposeFeedbackList([FromUri] PagedSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //获取要公示的问题解决反馈 总个数和分页数据 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); //条件已处理和要公示 var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId); Expression <Func <T_Question, bool> > where = u => u.Status == ConstantParam.DISPOSED && u.IsPublish == ConstantParam.PUBLISHED_TRUE && placeList.Contains(u.PropertyPlaceId); resultModel.Total = questionBll.Count(where); resultModel.result = questionBll.GetPageList(where, "Id", false, model.PageIndex).ToList().Select(q => new { Id = q.Id, Title = q.Title, Desc = string.IsNullOrEmpty(q.Desc) ? "" : q.Desc, UploadUserName = q.UploadUser.UserName, UploadTime = q.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Imgs = string.IsNullOrEmpty(q.Imgs) ? new string[] { } : q.Imgs.Split(';'), AudioPath = q.AudioPath, VoiceDuration = q.VoiceDuration, PlaceName = q.PropertyPlace.Name, DisposeDesc = q.QuestionDisposes.FirstOrDefault().DisposeDesc, DisposeUserName = string.IsNullOrEmpty(q.QuestionDisposes.FirstOrDefault().DisposeUser.TrueName) ? q.QuestionDisposes.FirstOrDefault().DisposeUser.UserName : q.QuestionDisposes.FirstOrDefault().DisposeUser.TrueName, DisposesTime = q.QuestionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss") }); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ActionResult ReceiveMassTextingDetail(int id) { WeixinApiInit(); var Owner = GetCurrentUser(); //将该圈子发给当前用户的群发消息改为已读 IUserSocialCircleMassTextingBLL usMassTextingBll = BLLFactory <IUserSocialCircleMassTextingBLL> .GetBLL("UserSocialCircleMassTextingBLL"); var usMassTextings = usMassTextingBll.GetList(um => um.UserId == Owner.Id && um.SocialCircleMassTexting.SocialCircleId == id && um.IsNoRead).ToList(); foreach (var texting in usMassTextings) { texting.IsNoRead = false; usMassTextingBll.Update(texting); } //获取指定圈子的信息 ISocialCircleBLL socialCircleBll = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var sc = socialCircleBll.GetEntity(s => s.Id == id); SocialCircleChatModel model = new SocialCircleChatModel() { Id = sc.Id, Name = sc.Name }; ViewBag.TimeInterval = Convert.ToInt32(PropertyUtils.GetConfigParamValue("ChatTimeInterval")); return(View(model)); }
public ApiPageResultModel OwnInspectionExceptionList([FromUri] PagedSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); T_PropertyUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); Expression <Func <T_InspectionResult, bool> > where = u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.InspectionTimePlan.InspectionPlan.PropertyPlaceId == user.PropertyPlaceId && u.Status == ConstantParam.EXCEPTION && u.DisposerId == user.Id; //获取巡检异常总个数和分页数据 IInspectionResultBLL resultBll = BLLFactory <IInspectionResultBLL> .GetBLL("InspectionResultBLL"); resultModel.Total = resultBll.Count(where); resultModel.result = new { ExceptionList = resultBll.GetOwnInspectionResultPageList(where, model.PageIndex, ConstantParam.PAGE_SIZE).Select(r => new { Id = r.Id, PlanName = r.InspectionTimePlan.InspectionPlan.PlanName, PointName = r.InspectionPoint.PointName, Desc = string.IsNullOrEmpty(r.Desc) ? "" : r.Desc, DisposeStatus = r.DisposeStatus == null ? ConstantParam.NO_DISPOSE : r.DisposeStatus.Value, UploadTime = r.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Uploader = r.UploadUser.UserName, Imgs = string.IsNullOrEmpty(r.Imgs) ? new string[] { } : r.Imgs.Split(';'), DisposeDesc = r.DisposeStatus == ConstantParam.DISPOSED ? r.ExceptionDisposes.FirstOrDefault().DisposeDesc : "", DisposeTime = r.DisposeStatus == ConstantParam.DISPOSED ? r.ExceptionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss") : "", DisposeUser = r.DisposeStatus == ConstantParam.DISPOSED ? r.ExceptionDisposes.FirstOrDefault().DisposeUser.UserName : (r.DisposerId != null ? r.Disposer.UserName : "") }) }; } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel DeleteOrder(DetailSearchModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //获取当前商家用户 IShopUserBLL shopUserBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL"); var user = shopUserBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user == null) { resultModel.Msg = APIMessage.NO_USER; return(resultModel); } //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); shopUserBll.Update(user); //获取指定订单 IOrderBLL orderBll = BLLFactory <IOrderBLL> .GetBLL("OrderBLL"); var order = orderBll.GetEntity(o => o.Id == model.Id && o.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && o.IsStoreHided == ConstantParam.DEL_FLAG_DEFAULT); if (order != null) { if (order.OrderStatus == ConstantParam.OrderStatus_FINISH || order.OrderStatus == ConstantParam.OrderStatus_EXIT || order.OrderStatus == ConstantParam.OrderStatus_CLOSE) { order.IsStoreHided = ConstantParam.DEL_FLAG_DELETE; //删除订单 if (!orderBll.Update(order)) { resultModel.Msg = "订单删除失败"; } } else { resultModel.Msg = "当前状态的订单不能被删除"; } } else { resultModel.Msg = APIMessage.ORDER_NOEXIST; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel GetVersionInfo([FromUri] TokenModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //获取当前用户 IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); T_PropertyUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); //调用版本信息BLL层获取最新的版本信息 IMobileVersionBLL versionBll = BLLFactory <IMobileVersionBLL> .GetBLL("MobileVersionBLL"); var Versions = versionBll.GetList(v => v.Type == ConstantParam.MOBILE_TYPE_PROPERTY, "VersionCode", false); //如果版本信息不为空 if (Versions != null && Versions.Count() > 0) { var highestVersion = Versions.First(); if (highestVersion != null) { resultModel.result = new { VersionCode = highestVersion.VersionCode, VersionName = highestVersion.VersionName, Desc = highestVersion.Desc, ApkFilePath = highestVersion.ApkFilePath }; } } else { resultModel.Msg = APIMessage.NO_APP; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel GetSaleList([FromUri] GoodsSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //该门店销售中的商品 Expression <Func <T_ShopSale, bool> > where = s => s.GoodsCategory.ShopId == model.ShopId && s.InSales == 1; //如果选择了商品分类 if (model.GoodsCategoryId > 0) { where = PredicateBuilder.And(where, s => s.GoodsCategoryId == model.GoodsCategoryId); } //获取指定门店指定类别的商品列表 IShopSaleBLL SaleBll = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL"); resultModel.Total = SaleBll.Count(where); resultModel.result = SaleBll.GetPageList(where, "Id", false, model.PageIndex).ToList().Select(s => new { GoodsId = s.Id, GoodsName = s.Title, GoodsDesc = s.Content, RemainingAmout = s.RemainingAmout, SellAmout = s.OrderDetails.Where(od => od.Order.OrderStatus == ConstantParam.OrderStatus_FINISH).Select(od => od.SaledAmount).ToArray().Sum(), GoodsCoverImg = string.IsNullOrEmpty(s.ImgThumbnail) ? "" : s.ImgThumbnail.Split(';')[0], GoodsOtherImg = string.IsNullOrEmpty(s.ImgPath) ? "" : s.ImgPath, Price = s.Price }); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel GetMyLevel2RepliesList([FromUri] Level2RepliedListModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); IPostBarTopicDiscussBLL topicDiscussBLL = BLLFactory <IPostBarTopicDiscussBLL> .GetBLL("PostBarTopicDiscussBLL"); var level1Disscuss = topicDiscussBLL.GetEntity(m => m.Id == model.Id); // 获取我的二级回复列表 var list = topicDiscussBLL.GetPageList(m => m.ParentId == model.Id && m.TopicId == model.TopicId, "PostTime", true, model.PageIndex, ConstantParam.PAGE_SIZE).Select(m => new { Id = m.Id, PostDate = m.PostTime.ToString("yyyy-MM-dd HH:mm:ss"), UserId = m.PostUserId, UserImage = m.PostUser.HeadPath, UserName = m.PostUser.UserName, Content = m.Content, PicList = m.ImgPath, RepliedUserName = m.ReplyUser.UserName, Level2ParentId = m.ParentId }).ToList(); resultModel.result = list; resultModel.Total = topicDiscussBLL.Count(m => m.ParentId == model.Id && m.TopicId == model.TopicId); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel GetShopUserInfo([FromUri] TokenModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //获取当前用户 IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL"); T_ShopUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); var shop = user.Shops.FirstOrDefault(); //如果商家信息不为空 if (shop != null) { resultModel.result = new { ShopUserName = user.UserName, ShopUserImage = user.HeadPath, ShopName = shop.ShopName, TrueName = user.TrueName, UserGender = user.Gender.HasValue ? user.Gender.Value == 1 ? "男" : "女" : "", PhoneNumber = user.Phone, Email = user.Email }; } else { resultModel.Msg = APIMessage.SHOP_NOEXIST; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel DisposeException(DisposerModel model) { ApiResultModel resultModel = new ApiResultModel(); try { IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); T_PropertyUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); //获取要处理的巡检异常 IInspectionResultBLL resultBll = BLLFactory <IInspectionResultBLL> .GetBLL("InspectionResultBLL"); T_InspectionResult result = resultBll.GetEntity(m => m.Id == model.Id); if (result != null) { //修改处理状态并添加处理记录 result.DisposeStatus = ConstantParam.DISPOSED; T_InspectionExceptionDispose exceptionDispose = new T_InspectionExceptionDispose() { DisposeDesc = model.DisposeDesc, DisposeUserId = user.Id, ExceptionResultId = model.Id, DisposeTime = DateTime.Now }; //保存到数据库 resultBll.DisposeException(result, exceptionDispose); } else { resultModel.Msg = APIMessage.EXCEPTION_NOEXIST; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel SetShopInfo(ShopInfoModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //获取当前用户 IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL"); T_ShopUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); //调用商家BLL层获取商家信息 IShopBLL shopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); var shop = shopBll.GetEntity(s => s.Id == model.ShopId); //设置主营内容 if (shop != null) { shop.ShopName = model.ShopName; //shop.Content = model.ShopContent; shop.MainSale = model.MainSale; shop.StartBusinessTime = model.StartBusinessTime; shop.EndBusinessTime = model.EndBusinessTime; shop.Address = model.Address; shop.Phone = model.Phone; shop.UpdateTime = DateTime.Now; shopBll.Update(shop); } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel ExpensedRecordList([FromUri] PagedSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //初始化查询条件 var DoorIds = owner.PropertyIdentityVerification.Where(v => v.DoorId != null).Select(m => m.DoorId); var CompanyIds = owner.PropertyIdentityVerification.Where(v => v.BuildCompanyId != null).Select(m => m.BuildCompanyId); Expression <Func <T_HouseUserExpenseDetails, bool> > where = u => u.IsPayed == ConstantParam.PAYED_TRUE && (DoorIds.Contains(u.BuildDoorId) || CompanyIds.Contains(u.BuildCompanyId)); // 获取当前用户对应业主的缴费记录 IHouseUserExpenseDetailsBLL expenseDetailsBLL = BLLFactory <IHouseUserExpenseDetailsBLL> .GetBLL("HouseUserExpenseDetailsBLL"); var list = expenseDetailsBLL.GetPageList(where, "PayedDate", false, model.PageIndex).Select(e => new { RecordId = e.Id, ExpenseTypeName = e.PropertyExpenseType.Name, ExpenseDateDes = e.ExpenseDateDes, PlaceName = e.BuildCompanyId == null ? e.BuildDoor.BuildUnit.Build.PropertyPlace.Name : e.BuildCompany.PropertyPlace.Name, Expense = e.Expense, PayedTime = e.PayedDate.Value.ToString("yyyy-MM-dd HH:mm:ss") }).ToList(); resultModel.result = list; resultModel.Total = expenseDetailsBLL.GetList(where).Count(); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel ShopList([FromUri] ShopSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); IShopBLL shopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); Expression <Func <T_Shop, bool> > where = u => u.Type.Contains(model.Type.ToString()); //如果是生活小卖店或五金店 if (model.Type == 2 || model.Type == 3) { var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId); where = PredicateBuilder.And(where, u => u.ShopPlaces.Count(p => placeList.Contains(p.PropertyPlaceId)) > 0); } resultModel.Total = shopBll.Count(where); resultModel.result = shopBll.GetPageList(where, "Id", false, model.PageIndex).ToList().Select(s => new { Id = s.Id, ShopName = s.ShopName, Content = s.MainSale, Phone = string.IsNullOrEmpty(s.Phone) ? "" : s.Phone, Img = string.IsNullOrEmpty(s.ImgThumbnail) ? "" : s.ImgThumbnail.Split(';')[0] }); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel QuestionDetail([FromUri] DetailSearchModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //获取问题总个数和分页数据 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); var question = questionBll.GetEntity(u => u.Id == model.Id); resultModel.result = new { Id = question.Id, Title = question.Title, Desc = string.IsNullOrEmpty(question.Desc) ? "" : question.Desc, Status = question.Status, UploadTime = question.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Imgs = string.IsNullOrEmpty(question.Imgs) ? new string[] {} : question.Imgs.Split(';'), AudioPath = question.AudioPath, VoiceDuration = question.VoiceDuration, PlaceName = question.PropertyPlace.Name, DisposesTime = question.Status == ConstantParam.NO_DISPOSE ? null : question.QuestionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss") }; } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel GetShopPayWay([FromUri] DetailSearchModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //获取要查询的门店 IShopBLL shopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); var shop = shopBll.GetEntity(s => s.Id == model.Id); if (shop != null) { var PayWays = shop.ShopPaymentManagements.Select(p => p.PayTypeId).ToList(); if (PayWays.Count > 0) { resultModel.result = PayWays; } else { resultModel.result = new List <int>(); } } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel GetShopFreight([FromUri] ShopFreightSearchModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //获取要查询的门店 IShopBLL shopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); var shop = shopBll.GetEntity(s => s.Id == model.Id); if (shop != null) { var cost = shop.ShopShippingCosts.FirstOrDefault(); if (cost != null && cost.IsFree == 0 && (cost.OrderExpense == null || model.TotalPrice < cost.OrderExpense.Value)) { resultModel.result = cost.Price.Value; } else { resultModel.result = 0; } } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel SetQuestionDisposer(SetDisposerModel model) { ApiResultModel resultModel = new ApiResultModel(); try { IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); T_PropertyUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); //获取要指派处理人的问题 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); T_Question question = questionBll.GetEntity(m => m.Id == model.Id); if (question != null) { //指派处理人 question.DisposerId = model.DisposerId; //保存到数据库 if (!questionBll.Update(question)) { resultModel.Msg = APIMessage.SET_DISPOSER_FAIL; } } else { resultModel.Msg = APIMessage.QUESTION_NOEXIST; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel ShopDetail2([FromUri] DetailSearchModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //获取要查看详细的门店实体对象 IShopBLL ShopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); T_Shop Shop = ShopBll.GetEntity(s => s.Id == model.Id); if (Shop != null) { resultModel.result = new { ShopImg = Shop.ImgPath, ShopInfoPath = "MobilePage/StoreDetail2?ShopId=" + model.Id, }; } else { resultModel.Msg = APIMessage.SHOP_NOEXIST; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel CollectTopic(CollectTopicModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL userBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); //如果没有收藏,则收藏主题 var check = user.UserPostBarTopics.FirstOrDefault(m => m.PostBarTopicId == model.TopicId && m.UserId == model.UserId); if (check == null) { var userPostBarTopic = new R_UserPostBarTopic() { PostBarTopicId = model.TopicId, UserId = model.UserId }; user.UserPostBarTopics.Add(userPostBarTopic); } userBll.Update(user); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel NewsList([FromUri] PagedSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); // 获取指定物业小区id的公告列表 IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId); Expression <Func <T_Post, bool> > where = u => placeList.Contains(u.PropertyPlaceId) && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PublishedFlag == ConstantParam.PUBLISHED_TRUE; // TODO:此处Content不需要全部返回,待优化 var list = postBll.GetPageList(where, "PublishedTime", false, model.PageIndex).Select(s => new { ID = s.Id, propertyName = s.PropertyPlace.Name, propertyPic = string.IsNullOrEmpty(s.PropertyPlace.ImgThumbnail) ? "/Images/news_item_default.png" : s.PropertyPlace.ImgThumbnail, pubDate = s.PublishedTime.ToString(), title = s.Title }).ToList(); resultModel.result = list; resultModel.Total = postBll.GetList(where).Count(); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel SetRecordToExpensed(DetailSearchModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //设置缴费记录为已在线缴费 IHouseUserExpenseDetailsBLL expenseDetailsBLL = BLLFactory <IHouseUserExpenseDetailsBLL> .GetBLL("HouseUserExpenseDetailsBLL"); var record = expenseDetailsBLL.GetEntity(e => e.Id == model.Id); if (record != null) { record.IsPayed = ConstantParam.PAYED_TRUE; record.PaymentType = 2; record.PayedDate = DateTime.Now; expenseDetailsBLL.Update(record); } else { resultModel.Msg = APIMessage.EXPENSE_RECORD_NOEXIST; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel NewsDetail([FromUri] NewsDetailModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); var post = postBll.GetEntity(p => p.Id == model.PostId && p.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && p.PublishedFlag == 1); if (post != null) { // 返回详细页面url resultModel.result = new { PlaceTel = post.PropertyPlace.Tel, Url = "MobilePage/NewsDetail?id=" + model.PostId }; } else { resultModel.Msg = "新闻公告不存在"; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel GetGoodsCategoryList([FromUri] GoodsCategorySearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { //获取当前用户 IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL"); T_ShopUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); IGoodsCategoryBLL goodsBLL = BLLFactory <IGoodsCategoryBLL> .GetBLL("GoodsCategoryBLL"); Expression <Func <T_GoodsCategory, bool> > where = g => g.ShopId == model.ShopId; // 获取商家的商品分类 var list = goodsBLL.GetPageList(where, model.PageIndex).Select( g => new { Id = g.Id, Name = g.Name, Count = g.ShopSales.Count() }).ToList(); resultModel.result = list; resultModel.Total = goodsBLL.Count(g => g.ShopId == model.ShopId); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel GetTopicSortList([FromUri] TopicSortSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != model.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //获取小区所有主题分类列表 IPostBarTopicTypeBLL postBarTopicTypeBll = BLLFactory <IPostBarTopicTypeBLL> .GetBLL("PostBarTopicTypeBLL"); Expression <Func <T_PostBarTopicType, bool> > where = u => u.PropertyPlaceId == model.PropertyPlaceId; var list = postBarTopicTypeBll.GetList(where, "Id", false).Select(s => new { ID = s.Id, Name = s.Name }).ToList(); resultModel.result = list; } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel GetLifePayType([FromUri] TokenModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据业主Id查询业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //获取所有生活支付方式列表 ILifePayTypeBLL lifePayTypeBll = BLLFactory <ILifePayTypeBLL> .GetBLL("LifePayTypeBLL"); Expression <Func <T_LifePayType, bool> > where = u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT; var list = lifePayTypeBll.GetList(where, "Id", true).ToList(); resultModel.result = list.Select(u => new { Id = u.Id, Img = u.Img, Name = u.Name }); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel GetExpressCompany([FromUri] TokenModel model) { ApiResultModel resultModel = new ApiResultModel(); try { ///查询用户Id查找业主 IUserBLL userBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User user = userBll.GetEntity(m => m.Id == model.UserId && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主不存在 if (user != null) { if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近的登录时间和最新的token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); IExpressCompanyBLL expressCompanyBLL = BLLFactory <IExpressCompanyBLL> .GetBLL("ExpressCompanyBLL"); Expression <Func <T_ExpressCompany, bool> > where = o => o.DelFlag == ConstantParam.DEL_FLAG_DEFAULT; var list = expressCompanyBLL.GetList(where, "Id", true).ToList(); resultModel.result = list.Select(u => new { Id = u.Id, Img = u.Img, Phone = u.Phone }); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }