Discuz!发送系统通知方法notification_add介绍
发布时间:2021-12-09 18:52:17 所属栏目:教程 来源:互联网
导读:方法定义位置: sourcefunctionfunction_core.php 代码如下: [php] view plain copy function notification_add($touid, $type, $note, $notevars = array(), $system = 0) { return helper_notification::notification_add($touid, $type, $note, $notev
方法定义位置: sourcefunctionfunction_core.php 代码如下: [php] view plain copy function notification_add($touid, $type, $note, $notevars = array(), $system = 0) { return helper_notification::notification_add($touid, $type, $note, $notevars, $system); } 参数说明: $touid:接收通知的uid,即发给谁; $type:通知类型,如system为系统通知,这里$type参数稍微复制一点,下面我们把type参数的各种意义罗列出来供大家参考: appId(数字) 漫游应用 myapp 应用邀请或请求 credit 积分充值 goods 商品 mod_member 用户审核 system 系统消息 group 群组审核通过 report 举报 verify 认证 manage_ 管理通知 magic 道具 poke 打招呼 friend 好友 task 任务 wall 留言 piccomment 图片评论 blogcomment 日志评论 sharecomment 分享评论 follow 关注 pusearticle 推送 at @功能 pcomment 点评 post 回帖引用 show 排行榜 clickblog 日志顶操作 clickarticle 文章顶操作 clickpic 图片顶操作 doing 记录 pmreport 消息举报 sharenotice 分享通知 group 群组 reward 悬赏 activity 活动 thread 主题 blog 日志 article 文章 $note:通知内容,支持html代码; $notevars:附加参数,如:actor、from_num、from_id、from_idtype $system:是否系统通知,默认0,强制转为系统通知; 详细代码逻辑参考helper_notification类代码 helper类所在位置: sourceclasshelperhelper_notification.php 相关代码如下: 01 [php] view plain copy 02 public static function notification_add($touid, $type, $note, $notevars = array(), $system = 0, $category = -1) { 03 global $_G; 04 05 if(!($tospace = getuserbyuid($touid))) { 06 return false; 07 } 08 space_merge($tospace, 'field_home'); 09 $filter = empty($tospace['privacy']['filter_note'])?array():array_keys($tospace['privacy']['filter_note']); 10 11 if($filter && (in_array($type.'|0', $filter) || in_array($type.'|'.$_G['uid'], $filter))) { 12 return false; 13 } 14 if($category == -1) { 15 $category = 0; 16 $categoryname = ''; 17 if($type == 'follow' || $type == 'follower') { 18 switch ($type) { 19 case 'follow' : $category = 5; break; 20 case 'follower' : $category = 6; break; 21 } 22 $categoryname = $type; 23 } else { 24 foreach($_G['notice_structure'] as $key => $val) { 25 if(in_array($type, $val)) { 26 switch ($key) { 27 case 'mypost' : $category = 1; break; 28 case 'interactive' : $category = 2; break; 29 case 'system' : $category = 3; break; 30 case 'manage'爱站库温馨提示:如果你正在寻找优秀的discuz模板,那你可以到爱站库的 discuz模板 频道看看,相信一定有你喜欢的! (编辑:我爱故事小小网_铜陵站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |