public JsonResult UpdateContent(EditContentModel model) { JsonModel jm = new JsonModel(); try { ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var sc = socialCircleBLL.GetEntity(s => s.Id == model.Id); if (sc != null) { //修改名称 sc.Content = model.Content; socialCircleBLL.Update(sc); } else { jm.Msg = "圈子已不存在"; } } catch { jm.Msg = "请求发生异常"; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
public JsonResult Dissolve(int id) { JsonModel jm = new JsonModel(); try { ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var sc = socialCircleBLL.GetEntity(s => s.Id == id); if (sc != null) { if (sc.CreaterId == GetCurrentUser().Id) { if (!socialCircleBLL.Dissolve(sc)) { jm.Msg = "解散失败"; } } else { jm.Msg = "只有创建人自己才能解散圈子"; } } else { jm.Msg = "圈子已不存在"; } } catch { jm.Msg = "请求发生异常"; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
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 ActionResult Deatil(int id) { WeixinApiInit(); ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var sc = socialCircleBLL.GetEntity(s => s.Id == id); ViewBag.CurrentUserId = GetCurrentUser().Id; return(View(sc)); }
public ActionResult UpdateContent(int id) { ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var sc = socialCircleBLL.GetEntity(s => s.Id == id); EditContentModel model = new EditContentModel() { Id = sc.Id, Content = sc.Content }; return(View(model)); }
public ActionResult UpdateName(int id) { ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var sc = socialCircleBLL.GetEntity(s => s.Id == id); EditNameModel model = new EditNameModel() { Id = sc.Id, Name = sc.Name }; return(View(model)); }
public ActionResult MassTextingList(int id) { //获取指定圈子信息 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 ActionResult CircleUserManage(int Id) { ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var src = socialCircleBLL.GetEntity(s => s.Id == Id); int coun = src.UserSocialCircles.Where(s => s.ApplyStatus == ConstantParam.IsVerified_YES).Count(); circleuserModel model = new circleuserModel() { Count = coun + 1, Id = src.Id, UserId = GetCurrentUser().Id, CreateId = src.Creater.Id, CreateName = src.Creater.UserName, HeadImg = string.IsNullOrEmpty(src.Creater.HeadPath) ? "/Images/WeiXin/header_default.png" : src.Creater.HeadPath }; return(View(model)); }
/// <summary> /// 圈子聊天页面 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Chat(int id) { WeixinApiInit(); ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var sc = socialCircleBLL.GetEntity(s => s.Id == id); int MemberCount = sc.UserSocialCircles.Where(us => us.ApplyStatus == Property.Common.ConstantParam.IsVerified_YES).Select(us => us.UserId).Distinct().Count(); SocialCircleChatModel model = new SocialCircleChatModel() { Id = sc.Id, Name = sc.Name, MemberCount = MemberCount + 1 }; ViewBag.TimeInterval = Convert.ToInt32(PropertyUtils.GetConfigParamValue("ChatTimeInterval")); return(View(model)); }
public JsonResult UpdateImg(int id, string Img) { JsonModel jm = new JsonModel(); try { ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var sc = socialCircleBLL.GetEntity(s => s.Id == id); if (sc != null) { if (!string.IsNullOrEmpty(Img)) { string oldImgPath = sc.HeadImgPath; //头像路径保存 sc.HeadImgPath = GetMultimedia(ConstantParam.SOCIAL_CIRCLE_HEAD_DIR, Img); socialCircleBLL.Update(sc); //删除旧头像 if (!string.IsNullOrEmpty(oldImgPath)) { FileInfo f = new FileInfo(Server.MapPath(oldImgPath)); if (f.Exists) { f.Delete(); } } } } else { jm.Msg = "圈子已不存在"; } } catch { jm.Msg = "请求发生异常"; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 发送模板消息 /// <param name="openId">关注公众号的用户openId</param> /// </summary> public void SendTemplateMessage(int circleId, string openId, string accessToken) { //获取新消息的所属圈子 ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var socialCircle = socialCircleBLL.GetEntity(s => s.Id == circleId); //获取圈子群发消息未读条数 int noReadCount = socialCircle.SocialCircleMassTextings.Count(m => m.UserSocialCircleMassTextings.Count(usm => usm.User != null && !string.IsNullOrEmpty(usm.User.WeixinOpenId) && usm.User.WeixinOpenId == openId && usm.IsNoRead) > 0); var data = new { first = new TemplateDataItem(string.Format("您好,{0}发来一条新消息,请尽快查看", socialCircle.Name)), keyword1 = new TemplateDataItem(noReadCount.ToString()), keyword2 = new TemplateDataItem("【Ai我家】"), keyword3 = new TemplateDataItem(DateTime.Now.ToString()), remark = new TemplateDataItem("请点击查看消息详细内容!") }; TemplateApi.SendTemplateMessage(accessToken, openId, TemplateId, "#000", "http://v.homekeeper.com.cn/WeixinSocialCircle/ReceiveMassTexting", data); }
public ActionResult SendMsg(int id, string ids) { WeixinApiInit(); ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL"); var sc = socialCircleBLL.GetEntity(s => s.Id == id); string[] i = ids.Split(','); int[] d = new int[i.Length - 1]; for (var s = 0; s < i.Length - 1; s++) { d[s] = int.Parse(i[s]); } string names = ""; for (int c = 0; c < d.Length; c++) { int o = d[c]; IUserSocialCircleBLL userSocialCircleBll = BLLFactory <IUserSocialCircleBLL> .GetBLL("UserSocialCircleBLL"); R_UserSocialCircle user = userSocialCircleBll.GetEntity(u => u.UserId == o); names += user.ApplyUser.UserName + "、"; } names = names.Substring(0, names.Length - 1); UserListSocialCircleMassTextingModel model = new UserListSocialCircleMassTextingModel() { Id = sc.Id, CreaterName = sc.Creater.UserName, CreaterHeadPath = string.IsNullOrEmpty(sc.Creater.HeadPath) ? "/Images/Weixin/header_default.png" : sc.Creater.HeadPath, MemberIds = ids, NameList = names, Count = d.Length }; return(View(model)); }