/// <summary> /// 发送回复通知 /// </summary> /// <param name="postinfo">回复信息</param> /// <param name="topicinfo">所属主题信息</param> /// <param name="replyuserid">回复的某一楼的作者</param> public static void SendPostReplyNotice(PostInfo postinfo, TopicInfo topicinfo, int replyuserid) { NoticeInfo noticeinfo = new NoticeInfo(); noticeinfo.Note = Utils.HtmlEncode(string.Format("<a href=\"userinfo.aspx?userid={0}\">{1}</a> 给您回帖, <a href =\"showtopic.aspx?topicid={2}&postid={3}#{3}\">{4}</a>.", postinfo.Posterid, postinfo.Poster, topicinfo.Tid, postinfo.Pid, topicinfo.Title)); noticeinfo.Type = NoticeType.PostReplyNotice; noticeinfo.New = 1; noticeinfo.Posterid = postinfo.Posterid; noticeinfo.Poster = postinfo.Poster; noticeinfo.Postdatetime = Utils.GetDateTime(); noticeinfo.Fromid = topicinfo.Tid; noticeinfo.Uid = replyuserid; //当回复人与帖子作者不是同一人时,则向帖子作者发送通知 if (postinfo.Posterid != replyuserid && replyuserid > 0) { Notices.CreateNoticeInfo(noticeinfo); } //当上面通知的用户与该主题作者不同,则还要向主题作者发通知 if (postinfo.Posterid != topicinfo.Posterid && topicinfo.Posterid != replyuserid && topicinfo.Posterid > 0) { noticeinfo.Uid = topicinfo.Posterid; Notices.CreateNoticeInfo(noticeinfo); } }
/// <summary> /// 创建留言 /// </summary> /// <param name="goodsleavewordinfo">要创建的留言信息</param> /// <param name="selleruid">卖家id</param> /// <param name="sendnotice">是否发送通知</param> /// <returns></returns> public static int CreateLeaveWord(Goodsleavewordinfo goodsLeaveWordInfo, int sellerUid, bool sendNotice) { goodsLeaveWordInfo.Postdatetime = DateTime.Now; goodsLeaveWordInfo.Usesig = 0; goodsLeaveWordInfo.Invisible = 0; goodsLeaveWordInfo.Htmlon = 0; goodsLeaveWordInfo.Smileyoff = 1; goodsLeaveWordInfo.Parseurloff = 1; goodsLeaveWordInfo.Bbcodeoff = 1; //当为买家时,则发送消息给卖家 if (sendNotice && goodsLeaveWordInfo.Isbuyer == 1) { NoticeInfo noticeInfo = new NoticeInfo(); //商品交易通知 noticeInfo.Note = Utils.HtmlEncode(string.Format("有买家 <a href=\"userinfo.aspx?userid={0}\">{1}</a> 给您留言, 请<a href =\"showgoods.aspx?goodsid={2}\">点击这里</a>查看详情.", goodsLeaveWordInfo.Uid, goodsLeaveWordInfo.Username, sellerUid)); noticeInfo.Uid = sellerUid; noticeInfo.Type = NoticeType.GoodsLeaveWordNotice; noticeInfo.New = 1; noticeInfo.Posterid = goodsLeaveWordInfo.Uid; noticeInfo.Poster = goodsLeaveWordInfo.Username; noticeInfo.Postdatetime = Utils.GetDateTime(); Notices.CreateNoticeInfo(noticeInfo); } return DbProvider.GetInstance().CreateGoodsLeaveWord(goodsLeaveWordInfo); }
/// <summary> /// Copies the elements of the specified <see cref="Noticeinfo">Noticeinfo</see> array to the end of the collection. /// </summary> /// <param name="value">An array of type <see cref="Noticeinfo">Noticeinfo</see> containing the Components to add to the collection.</param> public void AddRange(NoticeInfo[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } }
/// <summary> /// 获取指定通知id的信息 /// </summary> /// <param name="nid">通知id</param> /// <returns>通知信息</returns> public static NoticeInfo GetNoticeInfo(int nid) { NoticeInfo noticeinfo = new NoticeInfo(); IDataReader idatareader = DatabaseProvider.GetInstance().GetNoticeByNid(nid); if (idatareader.Read()) { LoadSingleNoticeInfo(idatareader); } idatareader.Close(); return noticeinfo; }
private static NoticeInfo LoadSingleNoticeInfo(IDataReader reader) { NoticeInfo noticeinfo = new NoticeInfo(); noticeinfo.Nid = TypeConverter.ObjectToInt(reader["nid"], 0); noticeinfo.Uid = TypeConverter.ObjectToInt(reader["uid"], 0); noticeinfo.Type = (NoticeType)TypeConverter.ObjectToInt(reader["type"], 0); noticeinfo.New = TypeConverter.ObjectToInt(reader["new"], 0); noticeinfo.Posterid = TypeConverter.ObjectToInt(reader["posterid"], 0); noticeinfo.Poster = reader["poster"].ToString().Trim(); noticeinfo.Note = Utils.HtmlDecode(reader["note"].ToString()); noticeinfo.Postdatetime = reader["postdatetime"].ToString(); return noticeinfo; }
/// <summary> /// 添加指定的通知信息 /// </summary> /// <param name="noticeinfo">要添加的通知信息</param> /// <returns></returns> public static int CreateNoticeInfo(NoticeInfo noticeinfo) { #if !DEBUG if (noticeinfo.Posterid == noticeinfo.Uid) return 0; #endif int olid = OnlineUsers.GetOlidByUid(noticeinfo.Uid); if (olid > 0) { OnlineUsers.UpdateNewNotices(olid, 1); } return Discuz.Data.Notices.CreateNoticeInfo(noticeinfo); }
public NotifyPage() { if (EPayments.CheckPayment(DNTRequest.GetString("notify_id")))//验证请求是否来自支付宝,或者是伪造的 { //获取需要的信息 int orderStatus = EPayments.ConvertAlipayTradeStatus(DNTRequest.GetString("trade_status")); string orderCode = DNTRequest.GetString("out_trade_no", true); string tradeNo = DNTRequest.GetString("trade_no", true); if (string.IsNullOrEmpty(orderCode) || string.IsNullOrEmpty(tradeNo) || orderStatus <= 0) return; CreditOrderInfo orderInfo = CreditOrders.GetCreditOrderInfoByOrderCode(orderCode); //如果订单状态为未成功交易 if (orderInfo != null && orderInfo.OrderStatus < 2) { float[] extcredits = new float[8]; extcredits[orderInfo.Credit - 1] = orderInfo.Amount; if (UserCredits.UpdateUserExtCredits(orderInfo.Uid, extcredits, true) != 1) orderStatus = 0; CreditsLogs.AddCreditsLog(orderInfo.Uid, orderInfo.Uid, orderInfo.Credit, orderInfo.Credit, 0, orderInfo.Amount, Utils.GetDateTime(), 3);//添加积分兑换转账和充值记录 NoticeInfo notice = new NoticeInfo(); notice.Postdatetime = Utils.GetDateTime(); notice.Type = Noticetype.GoodsTradeNotice; notice.Poster = "系统"; notice.Posterid = 0; notice.Uid = orderInfo.Uid; notice.Note = string.Format("您购买的积分 {0} 已经成功充值,请<a href=\"usercpcreaditstransferlog.aspx\">查收</a>!(支付宝订单号:{1})", ForumUtils.ConvertCreditAndAmountToWord(orderInfo.Credit, orderInfo.Amount), tradeNo); Notices.CreateNoticeInfo(notice); CreditOrders.UpdateCreditOrderInfo(orderInfo.OrderId, tradeNo, orderStatus, Utils.GetDateTime());//修改积分订单记录状态 } //判断当前请求是支付宝GET式(直接跳转)或者是服务器POST式(需返回success使得支付宝停止继续发送通知) if (DNTRequest.IsPost()) HttpContext.Current.Response.Write("success"); else HttpContext.Current.Response.Redirect("../usercpcreaditstransferlog.aspx?paysuccess=true"); } else HttpContext.Current.Response.Write("fail"); }
/// <summary> /// 添加指定的通知信息 /// </summary> /// <param name="noticeinfo">要添加的通知信息</param> /// <returns></returns> public static int CreateNoticeInfo(NoticeInfo noticeinfo) { return DatabaseProvider.GetInstance().CreateNoticeInfo(noticeinfo); }
/// <summary> /// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index. /// </summary> /// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param> /// <param name="index">The index of the array at which to begin inserting.</param> public void CopyTo(NoticeInfo[] array, int index) { this.List.CopyTo(array, index); }
public override bool Run(CommandParameter commandParam, ref string result) { //如果是桌面程序则需要验证用户身份 if (commandParam.AppInfo.ApplicationType == (int)ApplicationType.DESKTOP) { if (commandParam.LocalUid < 1) { result = Util.CreateErrorMessage(ErrorType.API_EC_SESSIONKEY, commandParam.ParamList); return false; } //如果当前用户不是管理员 if (Discuz.Forum.UserGroups.GetUserGroupInfo(Discuz.Forum.Users.GetShortUserInfo(commandParam.LocalUid).Groupid).Radminid != 1) { result = Util.CreateErrorMessage(ErrorType.API_EC_PERMISSION_DENIED, commandParam.ParamList); return false; } } if (!commandParam.CheckRequiredParams("notification")) { result = Util.CreateErrorMessage(ErrorType.API_EC_PARAM, commandParam.ParamList); return false; } //给当前登录用户发送通知可以将to_ids设置为空 if (commandParam.LocalUid < 1 && (!commandParam.CheckRequiredParams("to_ids") || !Utils.IsNumericList(commandParam.GetDNTParam("to_ids").ToString()))) { result = Util.CreateErrorMessage(ErrorType.API_EC_PARAM, commandParam.ParamList); return false; } string ids = commandParam.GetDNTParam("to_ids").ToString(); string notification = commandParam.GetDNTParam("notification").ToString(); string[] to_ids; if (ids == string.Empty) { to_ids = new string[1]; to_ids[0] = commandParam.LocalUid.ToString(); } else { to_ids = commandParam.GetDNTParam("to_ids").ToString().Split(','); } string successfulIds = string.Empty; ShortUserInfo shortUserInfo = null; if (commandParam.LocalUid > 0) shortUserInfo = Discuz.Forum.Users.GetShortUserInfo(commandParam.LocalUid); foreach (string id in to_ids) { if (Utils.StrToInt(id, 0) < 1) continue; NoticeInfo noticeinfo = new NoticeInfo(); noticeinfo.Uid = Utils.StrToInt(id, 0); noticeinfo.New = 1; noticeinfo.Postdatetime = Utils.GetDateTime(); //如果应用程序没有指定来源id,则会将当前应用程序id的hash值作为来源ID,若不指定来源id,用户的通知列表中只存在一条最新的应用程序通知 noticeinfo.Fromid = commandParam.GetIntParam("from_id", Utils.BKDEHash(commandParam.AppInfo.APIKey, 113)); //如果应用程序指定了来源id,则通知类型为“应用程序自定义通知”,否则是“应用程序通知” noticeinfo.Type = commandParam.CheckRequiredParams("from_id") ? NoticeType.ApplicationCustomNotice : NoticeType.ApplicationNotice; if (commandParam.LocalUid > 0) { noticeinfo.Poster = shortUserInfo == null ? "" : shortUserInfo.Username; noticeinfo.Posterid = commandParam.LocalUid; } else { noticeinfo.Poster = ""; noticeinfo.Posterid = 0; } noticeinfo.Note = Utils.EncodeHtml(notification);//需要做ubb标签转换 if (Notices.CreateNoticeInfo(noticeinfo) > 0) successfulIds += (id + ","); } if (successfulIds.Length > 0) successfulIds = successfulIds.Remove(successfulIds.Length - 1); if (commandParam.Format == FormatType.JSON) { result = string.Format("\"{0}\"", successfulIds); } else { NotificationSendResponse nsr = new NotificationSendResponse(); nsr.Result = successfulIds; result = SerializationHelper.Serialize(nsr); } return true; }
/// <summary> /// 发送应用通知 /// </summary> /// <param name="uid"></param> /// <param name="toUid"></param> /// <param name="message"></param> /// <returns></returns> public static int SendApplicationNotice(int uid, int toUid, string message) { ShortUserInfo userInfo = Users.GetShortUserInfo(uid); if (userInfo == null || userInfo.Uid <= 0) return 0; NoticeInfo noticeinfo = new NoticeInfo(); noticeinfo.Note = Utils.HtmlEncode(message); noticeinfo.Type = Noticetype.ApplicationNotice; noticeinfo.New = 1; noticeinfo.Posterid = userInfo.Uid; noticeinfo.Poster = userInfo.Username.Trim(); noticeinfo.Postdatetime = Utils.GetDateTime(); noticeinfo.Uid = toUid; return Notices.CreateNoticeInfo(noticeinfo); }
/// <summary> /// 发送相册图片评论通知 /// </summary> /// <param name="pcomment">评论信息</param> private void SendPhotoComment(PhotoCommentInfo pcomment) { //当回复人与相册所有人不是同一人时,则向相册所有人发送通知 if (album.Userid != pcomment.Userid && pcomment.Commentid > 0) { NoticeInfo noticeinfo = new NoticeInfo(); noticeinfo.Note = Utils.HtmlEncode(string.Format("<a href=\"userinfo.aspx?userid={0}\">{1}</a> 评论了您的{2}--\"{3}\" , 请<a href =\"showphoto.aspx?photoid={4}&reply={5}#comments\">点击这里</a>查看详情.", pcomment.Userid, pcomment.Username, config.Albumname, album.Title, pcomment.Photoid, pcomment.Commentid)); noticeinfo.Type = Noticetype.AlbumCommentNotice; noticeinfo.New = 1; noticeinfo.Posterid = pcomment.Userid; noticeinfo.Poster = pcomment.Username; noticeinfo.Postdatetime = Utils.GetDateTime(); noticeinfo.Uid = album.Userid; Notices.CreateNoticeInfo(noticeinfo); } }
/// <summary> /// 更新指定的通知信息 /// </summary> /// <param name="noticeinfo">要更新的通知信息</param> /// <returns></returns> public static bool UpdateNoticeInfo(NoticeInfo noticeinfo) { return DatabaseProvider.GetInstance().UpdateNoticeInfo(noticeinfo); }
/// <summary> /// 日志评论通知 /// </summary> /// <param name="commentinfo">日志评论信息</param> public void SendSpaceCommentNotice(SpaceCommentInfo commentinfo) { //要回复的用户id int replyuserid = DNTRequest.GetInt("userid", 0); //当日志有效时 if (commentinfo.PostID > 0) { SpacePostInfo __spacepostsinfo = BlogProvider.GetSpacepostsInfo(Space.Data.DbProvider.GetInstance().GetSpacePost(commentinfo.PostID)); //当日志有效时 if (__spacepostsinfo != null) { NoticeInfo __noticeinfo = new NoticeInfo(); __noticeinfo.Type = NoticeType.SpaceCommentNotice; __noticeinfo.New = 1; __noticeinfo.Posterid = commentinfo.Uid; __noticeinfo.Poster = commentinfo.Author; __noticeinfo.Postdatetime = Utils.GetDateTime(); //当回复人与评论作者不是同一人时,则向评论作者发送通知 if (__noticeinfo.Posterid != replyuserid && replyuserid > 0) { __noticeinfo.Note = Utils.HtmlEncode(string.Format("<a href=\"userinfo.aspx?userid={0}\">{1}</a> 回复了您的日志信息 <a href =\"viewspacepost.aspx?postid={3}\">{4}</a>.", commentinfo.Uid, commentinfo.Author, config.Spacename, commentinfo.PostID, __spacepostsinfo.Title)); __noticeinfo.Uid = replyuserid; Notices.CreateNoticeInfo(__noticeinfo); } //当上面通知的用户与该空间日志作者不同,则还要向主题作者发通知 if (__noticeinfo.Posterid != __spacepostsinfo.Uid && __spacepostsinfo.Uid > 0) { __noticeinfo.Note = Utils.HtmlEncode(string.Format("<a href=\"userinfo.aspx?userid={0}\">{1}</a> 评论了您的{2}日志 <a href =\"viewspacepost.aspx?postid={3}\">{4}</a>.", commentinfo.Uid, commentinfo.Author, config.Spacename, commentinfo.PostID, __spacepostsinfo.Title)); __noticeinfo.Uid = __spacepostsinfo.Uid; Notices.CreateNoticeInfo(__noticeinfo); } } } }
public void Remove(NoticeInfo value) { base.List.Remove(value); }
public bool Contains(NoticeInfo value) { return(base.List.Contains(value)); }
private void BonusPostMessage(TopicInfo topicInfo, int pid, int answerUid, bool isBeta, int num) { NoticeInfo ni = new NoticeInfo(); ni.New = 1; ni.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ni.Type = NoticeType.TopicAdmin; ni.Poster = username; ni.Posterid = userid; ni.Uid = answerUid; ni.Fromid = pid; ni.Note = Utils.HtmlEncode(string.Format("您发表的 {0} 被 {1} 评为 {2} ,给予 {3}{4} 奖励", "<a href=\"" + Urls.ShowTopicAspxRewrite(topicInfo.Tid, 0, topicInfo.Typeid) + "#" + pid + "\" target=\"_blank\" >回帖</a>", "<a href=\"" + UserInfoAspxRewrite(userid) + "\" target=\"_blank\" >" + username + "</a>", isBeta ? "最佳答案" : "有价值的答案", num, Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans()).Name)); Notices.CreateNoticeInfo(ni); }
public int Add(NoticeInfo value) { return this.List.Add(value); }
private void MessagePost(DataRow dr, string operationName, string subjecttype, string reason) { int posterid = Utils.StrToInt(dr["posterid"], -1); if (posterid == -1) //是游客,管理操作就不发短消息了 return; string titlemsg = ""; NoticeInfo ni = new NoticeInfo(); ni.New = 1; ni.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ni.Type = NoticeType.TopicAdmin; ni.Poster = username; ni.Posterid = userid; ni.Uid = posterid; reason = string.IsNullOrEmpty(reason) ? reason : "理由:" + reason; if (subjecttype == "主题" || Utils.StrToInt(dr["layer"], -1) == 0) { titlemsg = operation != "delete" ? GetOperatePostUrl(int.Parse(dr["tid"].ToString()), dr["title"].ToString().Trim()) : dr["title"].ToString().Trim(); ni.Note = Utils.HtmlEncode(string.Format("您发表的主题 {0} 被 {1} 执行了{2}操作 {3}", titlemsg, "<a href=\"" + UserInfoAspxRewrite(userid) + "\" target=\"_blank\" >" + username + "</a>", operationName, reason)); } else { titlemsg = GetOperatePostUrl(int.Parse(dr["tid"].ToString()), Topics.GetTopicInfo(Utils.StrToInt(dr["tid"], 0)).Title); ni.Note = Utils.HtmlEncode(string.Format("您在 {0} 回复的帖子被 {1} 执行了{2}操作 {3}", titlemsg, "<a href=\"" + UserInfoAspxRewrite(userid) + "\" target=\"_blank\" >" + username + "</a>", operationName, reason)); } Notices.CreateNoticeInfo(ni); }
/// <summary> /// Gets a value indicating whether the collection contains the specified <see cref="NoticeinfoCollection">NoticeinfoCollection</see>. /// </summary> /// <param name="value">The <see cref="NoticeinfoCollection">NoticeinfoCollection</see> to search for in the collection.</param> /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns> public bool Contains(NoticeInfo value) { return this.List.Contains(value); }
/// <summary> /// 根据交易日志的状态发送相应通知 /// </summary> /// <param name="__goodstradelog">交易日志信息</param> /// <returns>是否发送成功</returns> public static bool SendNotice(Goodstradeloginfo goodsTradeLog) { string noticeContent = "这是由论坛系统自动发送的通知短消息.<BR />"; bool isSendNotice = false; int noticeUid = 0; int posterId = 0; string poster = ""; string pageName = goodsTradeLog.Offline == 1 ? "offlinetrade.aspx" : "onlinetrade.aspx"; switch ((TradeStatusEnum)goodsTradeLog.Status) { case TradeStatusEnum.UnStart: { noticeContent = string.Format("买家 {0} 购买您的商品 {1}. 但交易尚未生效, 等待您的确认, 请<a href =\"" + pageName + "?goodstradelogid={2}\">点击这里</a>查看详情.", goodsTradeLog.Buyer, goodsTradeLog.Subject, goodsTradeLog.Id); isSendNotice = true; noticeUid = goodsTradeLog.Sellerid; posterId = goodsTradeLog.Buyerid; poster = goodsTradeLog.Buyername; break; } case TradeStatusEnum.WAIT_SELLER_SEND_GOODS: { noticeContent = string.Format("买家 {0} 购买您的商品 {1}. 买家已付款, 等待您发货, 请<a href =\"" + pageName + "?goodstradelogid={2}\">点击这里</a>查看详情.", goodsTradeLog.Buyer, goodsTradeLog.Subject, goodsTradeLog.Id); isSendNotice = true; noticeUid = goodsTradeLog.Sellerid; posterId = goodsTradeLog.Buyerid; poster = goodsTradeLog.Buyername; break; } case TradeStatusEnum.WAIT_BUYER_CONFIRM_GOODS: { noticeContent = string.Format("您购买的商品 {0} . 卖家 {1} 已发货, 等待您的确认, 请<a href =\"" + pageName + "?goodstradelogid={2}\">点击这里</a>查看详情.", goodsTradeLog.Subject, goodsTradeLog.Seller, goodsTradeLog.Id); noticeUid = goodsTradeLog.Buyerid; posterId = goodsTradeLog.Sellerid; poster = goodsTradeLog.Seller; isSendNotice = true; break; } case TradeStatusEnum.WAIT_SELLER_AGREE: { noticeContent = string.Format("买家 {0} 等待你同意退款, 请<a href =\"" + pageName + "?goodstradelogid={1}\">点击这里</a>查看详情.", goodsTradeLog.Buyer, goodsTradeLog.Id); isSendNotice = true; noticeUid = goodsTradeLog.Sellerid; posterId = goodsTradeLog.Buyerid; poster = goodsTradeLog.Buyername; break; } case TradeStatusEnum.SELLER_REFUSE_BUYER: { noticeContent = string.Format("卖家 {0} 拒绝您的条件, 等待您修改条件, 请<a href =\"" + pageName + "?goodstradelogid={1}\">点击这里</a>查看详情.", goodsTradeLog.Seller, goodsTradeLog.Id); isSendNotice = true; noticeUid = goodsTradeLog.Buyerid; posterId = goodsTradeLog.Sellerid; poster = goodsTradeLog.Seller; break; } case TradeStatusEnum.WAIT_BUYER_RETURN_GOODS: { noticeContent = string.Format("卖家 {0} 同意退款, 等待您退货, 请<a href =\"" + pageName + "?goodstradelogid={1}\">点击这里</a>查看详情.", goodsTradeLog.Seller, goodsTradeLog.Id); noticeUid = goodsTradeLog.Buyerid; posterId = goodsTradeLog.Sellerid; poster = goodsTradeLog.Seller; isSendNotice = true; break; } case TradeStatusEnum.WAIT_SELLER_CONFIRM_GOODS: { noticeContent = string.Format("买家 {0} 已退货, 等待您收货, 请<a href =\"" + pageName + "?goodstradelogid={1}\">点击这里</a>查看详情.", goodsTradeLog.Buyer, goodsTradeLog.Id); noticeUid = goodsTradeLog.Sellerid; posterId = goodsTradeLog.Buyerid; poster = goodsTradeLog.Buyername; isSendNotice = true; break; } case TradeStatusEnum.TRADE_FINISHED: { noticeContent = string.Format("商品 {0} 已交易成功, 请<a href =\"goodsrate.aspx?goodstradelogid={1}\">点击这里</a>给对方评分.", goodsTradeLog.Subject, goodsTradeLog.Id); noticeUid = goodsTradeLog.Sellerid; posterId = goodsTradeLog.Buyerid; poster = goodsTradeLog.Buyername; isSendNotice = true; break; } case TradeStatusEnum.TRADE_CLOSED: { noticeContent = string.Format("商品 {0} 交易失败, 卖家取消交易, 请<a href =\"goodsrate.aspx?goodstradelogid={1}\">点击这里</a>查看详情.", goodsTradeLog.Subject, goodsTradeLog.Id); noticeUid = goodsTradeLog.Sellerid; posterId = goodsTradeLog.Buyerid; poster = goodsTradeLog.Buyername; isSendNotice = true; break; } case TradeStatusEnum.REFUND_SUCCESS: { noticeContent = string.Format("商品 {0} 已退款成功, 请<a href =\"goodsrate.aspx?goodstradelogid={1}\">点击这里</a>给对方评分.", goodsTradeLog.Subject, goodsTradeLog.Id); noticeUid = goodsTradeLog.Buyerid; posterId = goodsTradeLog.Sellerid; poster = goodsTradeLog.Seller; isSendNotice = true; break; } } //发送通知 if (isSendNotice) { NoticeInfo noticeInfo = new NoticeInfo(); //商品交易通知 noticeInfo.Note = Utils.HtmlEncode(noticeContent); noticeInfo.Uid = noticeUid; noticeInfo.Type = NoticeType.GoodsTradeNotice; noticeInfo.New = 1; noticeInfo.Posterid = posterId; noticeInfo.Poster = poster; noticeInfo.Postdatetime = Utils.GetDateTime(); Notices.CreateNoticeInfo(noticeInfo); } return true; }
/// <summary> /// 更新被禁止的用户 /// </summary> /// <param name="groupid">用户组id</param> /// <param name="groupexpiry">过期时间</param> /// <param name="uid">用户id</param> public static void UpdateBanUser(int groupid, string groupexpiry, int uid) { Discuz.Data.Users.UpdateBanUser(groupid, groupexpiry, uid); //此处应该增加日志 把ban的原因记录下来 NoticeInfo noticeinfo = new NoticeInfo(); noticeinfo.New = 1; if (groupid == 4) noticeinfo.Type = Noticetype.BanPostNotice; if (groupid == 5) noticeinfo.Type = Noticetype.BanVisitNotice; noticeinfo.Postdatetime = DateTime.Now.ToShortDateString(); noticeinfo.Poster = DNTRequest.GetFormString("uname"); noticeinfo.Posterid = uid; noticeinfo.Uid = uid; noticeinfo.Note = DNTRequest.GetFormString("reason") + "截至到" + groupexpiry + "到期"; Notices.CreateNoticeInfo(noticeinfo); }
/// <summary> /// 发送通知 /// </summary> /// <returns></returns> public string Send() { if (Signature != GetParam("sig").ToString()) { ErrorCode = (int)ErrorType.API_EC_SIGNATURE; return ""; } //如果是桌面程序则需要验证用户身份 if (this.App.ApplicationType == (int)ApplicationType.DESKTOP) { if (Uid < 1) { ErrorCode = (int)ErrorType.API_EC_SESSIONKEY; return ""; } if (Discuz.Forum.UserGroups.GetUserGroupInfo(Discuz.Forum.Users.GetShortUserInfo(Uid).Groupid).Radminid != 1) { ErrorCode = (int)ErrorType.API_EC_PERMISSION_DENIED; return ""; } } if (CallId <= LastCallId) { ErrorCode = (int)ErrorType.API_EC_CALLID; return ""; } if (!CheckRequiredParams("notification")) { ErrorCode = (int)ErrorType.API_EC_PARAM; return ""; } if (GetParam("to_ids") == null) { ErrorCode = (int)ErrorType.API_EC_PARAM; return ""; } if (Uid < 1 && (!CheckRequiredParams("to_ids") || !Utils.IsNumericArray(GetParam("to_ids").ToString().Split(',')))) { ErrorCode = (int)ErrorType.API_EC_PARAM; return ""; } string ids = GetParam("to_ids").ToString(); string notification = GetParam("notification").ToString(); string[] to_ids; if (ids == string.Empty) { to_ids = new string[1]; to_ids[0] = Uid.ToString(); } else { to_ids = GetParam("to_ids").ToString().Split(','); } string successfulIds = string.Empty; ShortUserInfo shortUserInfo = null; if (Uid > 0) { shortUserInfo = Discuz.Forum.Users.GetShortUserInfo(Uid); } foreach (string id in to_ids) { if (Utils.StrToInt(id, 0) < 1) { continue; } NoticeInfo noticeinfo = new NoticeInfo(); noticeinfo.Uid = Utils.StrToInt(id, 0); noticeinfo.New = 1; noticeinfo.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (Uid > 0) { //ShortUserInfo shortUserInfo = Discuz.Forum.Users.GetShortUserInfo(Uid); noticeinfo.Poster = shortUserInfo == null ? "" : shortUserInfo.Username; noticeinfo.Posterid = Uid; } else { noticeinfo.Poster = ""; noticeinfo.Posterid = 0; } noticeinfo.Note = Utils.EncodeHtml(notification);//需要做ubb标签转换 if (Notices.CreateNoticeInfo(noticeinfo) > 0) { successfulIds += (id + ","); } } if (successfulIds.Length > 0) successfulIds = successfulIds.Remove(successfulIds.Length - 1); if (Format == FormatType.JSON) return string.Format("\"{0}\"", successfulIds); NotificationSendResponse nsr = new NotificationSendResponse(); nsr.Result = successfulIds; return SerializationHelper.Serialize(nsr); }
private void MessagePost(DataRow dr, string operationName, string subjecttype, string reason) { int posterid = Utils.StrToInt(dr["posterid"], -1); if (posterid == -1) //是游客,管理操作就不发短消息了 return; string titlemsg = ""; //switch (operation) //{ // case "delete": titlemsg = "ID:" + dr["tid"].ToString(); break; // case "banpost": titlemsg = GetOperatePostUrl(int.Parse(dr["tid"].ToString()), "[点击进入被屏蔽的帖子所在主题]"); break; // case "delposts": titlemsg = GetOperatePostUrl(int.Parse(dr["tid"].ToString()), "[点击进入被删除的帖子所在主题]"); break; // default: titlemsg = GetOperatePostUrl(int.Parse(dr["tid"].ToString()), dr["title"].ToString().Trim()); break; //} //PrivateMessageInfo privatemessageinfo = new PrivateMessageInfo(); //// 收件箱 //privatemessageinfo.Message = Utils.HtmlEncode(string.Format( // "这是由论坛系统自动发送的通知短消息。\r\n以下您所发表的{7}被 {0} {1} 执行 {2} 操作。\r\n\r\n{7}: {3} \r\n发表时间: {4}\r\n所在论坛: {5}\r\n操作理由: {6}\r\n\r\n如果您对本管理操作有异议,请与我取得联系。", // Utils.RemoveHtml(this.usergroupinfo.Grouptitle), username, // operationName, titlemsg, // dr["postdatetime"].ToString(), this.forumname, reason, subjecttype)); //privatemessageinfo.Subject = Utils.HtmlEncode(string.Format("您发表的{0}被执行管理操作", subjecttype)); //privatemessageinfo.Msgto = dr["poster"].ToString(); //privatemessageinfo.Msgtoid = posterid; //privatemessageinfo.Msgfrom = username; //privatemessageinfo.Msgfromid = userid; //privatemessageinfo.New = 1; //privatemessageinfo.Postdatetime = Utils.GetDateTime(); //privatemessageinfo.Folder = 0; //PrivateMessages.CreatePrivateMessage(privatemessageinfo, 0); NoticeInfo ni = new NoticeInfo(); ni.New = 1; if (reason != "") { reason = "理由:" + reason; } if (subjecttype == "主题" || Utils.StrToInt(dr["layer"], -1) == 0) { titlemsg = operation != "delete" ? GetOperatePostUrl(int.Parse(dr["tid"].ToString()), dr["title"].ToString().Trim()) : dr["title"].ToString().Trim(); ni.Note = Utils.HtmlEncode(string.Format("您发表的主题 {0} 被 {1} 执行了{2}操作 {3}", titlemsg, "<a href=\"" + UserInfoAspxRewrite(userid) + "\" target=\"_blank\" >" + username + "</a>", operationName, reason)); } else { titlemsg = GetOperatePostUrl(int.Parse(dr["tid"].ToString()), Topics.GetTopicInfo(Utils.StrToInt(dr["tid"], 0)).Title); ni.Note = Utils.HtmlEncode(string.Format("您在 {0} 回复的帖子被 {1} 执行了{2}操作 {3}", titlemsg, "<a href=\"" + UserInfoAspxRewrite(userid) + "\" target=\"_blank\" >" + username + "</a>", operationName, reason)); } ni.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ni.Type = Noticetype.TopicAdmin; ni.Poster = username; ni.Posterid = userid; ni.Uid = posterid; Notices.CreateNoticeInfo(ni); }
/// <summary> /// 增加一个会员信息到在线列表中。用户login.aspx或在线用户信息超时,但用户仍在线的情况下重新生成用户在线列表 /// </summary> /// <param name="uid"></param> private static OnlineUserInfo CreateUser(int uid, int timeout) { OnlineUserInfo onlineuserinfo = new OnlineUserInfo(); if (uid > 0) { ShortUserInfo ui = Users.GetShortUserInfo(uid); if (ui != null) { onlineuserinfo.Userid = uid; onlineuserinfo.Username = ui.Username.Trim(); onlineuserinfo.Nickname = ui.Nickname.Trim(); onlineuserinfo.Password = ui.Password.Trim(); onlineuserinfo.Groupid = short.Parse(ui.Groupid.ToString()); onlineuserinfo.Olimg = GetGroupImg(short.Parse(ui.Groupid.ToString())); onlineuserinfo.Adminid = short.Parse(ui.Adminid.ToString()); onlineuserinfo.Invisible = short.Parse(ui.Invisible.ToString()); onlineuserinfo.Ip = DNTRequest.GetIP(); onlineuserinfo.Lastposttime = "1900-1-1 00:00:00"; onlineuserinfo.Lastpostpmtime = "1900-1-1 00:00:00"; onlineuserinfo.Lastsearchtime = "1900-1-1 00:00:00"; onlineuserinfo.Lastupdatetime = Utils.GetDateTime(); onlineuserinfo.Action = 0; onlineuserinfo.Lastactivity = 0; onlineuserinfo.Verifycode = ForumUtils.CreateAuthStr(5, false); int newPms = PrivateMessages.GetPrivateMessageCount(uid, 0, 1); int newNotices = Notices.GetNewNoticeCountByUid(uid); onlineuserinfo.Newpms = short.Parse(newPms > 1000 ? "1000" : newPms.ToString()); onlineuserinfo.Newnotices = short.Parse(newNotices > 1000 ? "1000" : newNotices.ToString()); //onlineuserinfo.Newfriendrequest = short.Parse(Friendship.GetUserFriendRequestCount(uid).ToString()); //onlineuserinfo.Newapprequest = short.Parse(ManyouApplications.GetApplicationInviteCount(uid).ToString()); onlineuserinfo.Olid = Discuz.Data.OnlineUsers.CreateOnlineUserInfo(onlineuserinfo, timeout); //给管理人员发送关注通知 if (ui.Adminid > 0 && ui.Adminid < 4) { if (Discuz.Data.Notices.ReNewNotice((int)NoticeType.AttentionNotice, ui.Uid) == 0) { NoticeInfo ni = new NoticeInfo(); ni.New = 1; ni.Note = "请及时查看<a href=\"modcp.aspx?operation=attention&forumid=0\">需要关注的主题</a>"; ni.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ni.Type = NoticeType.AttentionNotice; ni.Poster = ""; ni.Posterid = 0; ni.Uid = ui.Uid; Notices.CreateNoticeInfo(ni); } } Discuz.Data.OnlineUsers.SetUserOnlineState(uid, 1); HttpCookie cookie = HttpContext.Current.Request.Cookies["dnt"]; if (cookie != null) { cookie.Values["tpp"] = ui.Tpp.ToString(); cookie.Values["ppp"] = ui.Ppp.ToString(); if (HttpContext.Current.Request.Cookies["dnt"]["expires"] != null) { int expires = TypeConverter.StrToInt(HttpContext.Current.Request.Cookies["dnt"]["expires"].ToString(), 0); if (expires > 0) { cookie.Expires = DateTime.Now.AddMinutes(TypeConverter.StrToInt(HttpContext.Current.Request.Cookies["dnt"]["expires"].ToString(), 0)); } } } string cookieDomain = GeneralConfigs.GetConfig().CookieDomain.Trim(); if (!Utils.StrIsNullOrEmpty(cookieDomain) && HttpContext.Current.Request.Url.Host.IndexOf(cookieDomain) > -1 && ForumUtils.IsValidDomain(HttpContext.Current.Request.Url.Host)) cookie.Domain = cookieDomain; HttpContext.Current.Response.AppendCookie(cookie); } else { onlineuserinfo = CreateGuestUser(timeout); } } else { onlineuserinfo = CreateGuestUser(timeout); } return onlineuserinfo; }
public bool UpdateNoticeInfo(NoticeInfo noticeInfo) { DbParameter[] parms = { DbHelper.MakeInParam("@nid", (DbType)SqlDbType.Int, 4, noticeInfo.Nid), DbHelper.MakeInParam("@uid", (DbType)SqlDbType.Int, 4, noticeInfo.Uid), DbHelper.MakeInParam("@type", (DbType)SqlDbType.Int, 4, noticeInfo.Type), DbHelper.MakeInParam("@new", (DbType)SqlDbType.Int, 4, noticeInfo.New), DbHelper.MakeInParam("@posterid", (DbType)SqlDbType.Int, 4, noticeInfo.Posterid), DbHelper.MakeInParam("@poster", (DbType)SqlDbType.NChar, 20, noticeInfo.Poster), DbHelper.MakeInParam("@note", (DbType)SqlDbType.NText, 0, noticeInfo.Note), DbHelper.MakeInParam("@postdatetime", (DbType)SqlDbType.DateTime, 8, noticeInfo.Postdatetime) }; string commandText = string.Format("UPDATE [{0}notices] SET [uid] = @uid, [type] = @type, [new] = @new, [posterid] = @posterid, [poster] = @poster, [note] = @note, [postdatetime] = @postdatetime WHERE [nid] = @nid", BaseConfigs.GetTablePrefix); return DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms) > 0; }
/// <summary> /// Gets the index in the collection of the specified <see cref="NoticeinfoCollection">NoticeinfoCollection</see>, if it exists in the collection. /// </summary> /// <param name="value">The <see cref="NoticeinfoCollection">NoticeinfoCollection</see> to locate in the collection.</param> /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns> public int IndexOf(NoticeInfo value) { return this.List.IndexOf(value); }
public int CreateNoticeInfo(NoticeInfo noticeInfo) { DbParameter[] parms = { DbHelper.MakeInParam("@uid", (DbType)SqlDbType.Int, 4, noticeInfo.Uid), DbHelper.MakeInParam("@type", (DbType)SqlDbType.Int, 4, noticeInfo.Type), DbHelper.MakeInParam("@new", (DbType)SqlDbType.Int, 4, noticeInfo.New), DbHelper.MakeInParam("@posterid", (DbType)SqlDbType.Int, 4, noticeInfo.Posterid), DbHelper.MakeInParam("@poster", (DbType)SqlDbType.NChar, 20, noticeInfo.Poster), DbHelper.MakeInParam("@note", (DbType)SqlDbType.NText, 0, noticeInfo.Note), DbHelper.MakeInParam("@postdatetime", (DbType)SqlDbType.DateTime, 8, noticeInfo.Postdatetime), DbHelper.MakeInParam("@fromid", (DbType)SqlDbType.Int, 4, noticeInfo.Fromid) }; return TypeConverter.ObjectToInt(DbHelper.ExecuteScalar(CommandType.StoredProcedure, string.Format("{0}createnotice", BaseConfigs.GetTablePrefix), parms), -1); }
public void Insert(int index, NoticeInfo value) { List.Insert(index, value); }
public void Insert(int index, NoticeInfo value) { base.List.Insert(index, value); }
public void Remove(NoticeInfo value) { List.Remove(value); }
public int Add(NoticeInfo value) { return(base.List.Add(value)); }
/// <summary> /// Initializes a new instance of the <see cref="NoticeinfoCollection">NoticeinfoCollection</see> class containing the specified array of <see cref="Noticeinfo">Noticeinfo</see> Components. /// </summary> /// <param name="value">An array of <see cref="Noticeinfo">Noticeinfo</see> Components with which to initialize the collection. </param> public NoticeinfoCollection(NoticeInfo[] value) { this.AddRange(value); }
public int IndexOf(NoticeInfo value) { return(base.List.IndexOf(value)); }
public int Add(NoticeInfo value) { return(this.List.Add(value)); }