用于管理员发布的文章不回复自己(管理员审核版)
位置:dayrui/App/Comment/Models/Comment.php,加入以下代码:
// 挂钩点 评论完成之后
\Phpcmf\Hooks::trigger('comment_after', $row);
// 评论回复短消息代码_S 2023.02.15.xdy
// 默认UID=1,为管理员
// 因为程序机制,需要通过被回复评论ID获取被回复人UID
if ($row['reply'] > 0 && ($row['uid'] == '1' || $row['uid'] == '623')) {
// 判断为回复评论
// 获取 原始评论ID
$reply_uid = $this->table($this->mytable . '_comment')->get($row['reply']);
$reply_uid = $reply_uid['uid'];
// 挂钩点 审核成功后,发送通知
if ($reply_uid > 0) { //判断游客不发布通知
\Phpcmf\Service::L('Notice')->send_notice_user("评价消息回复", $reply_uid, [
'type' => '内容',
'url' => $row['index']['url'] . '#pinglun',
'mark' => '标记代码'
], [
'notice' => [
'tpl_content' => '您对【' . $row['index']['title'] . '】的评论在【' . date('Y-m-d H:i') . '】有新的回复。',
],
]);
}
}
首页动态判断有没有新短信,官方count方法只能静态,不能动态,自己写值即可
// 评论回复短消息代码_E 2023.02.15.xdy
//$uid 会员id
//$type 类型:1系统 2用户 3内容 4应用 5交易 6订单,也可以由开发者自己定义类型分组
//$note 通知内容
//$url 相关链接
//$mark 一般用于二次开发时的判断作用
<?php
$rt = \Phpcmf\Service::M()->db->query('select count(id) AS count FROM dr_member_notice WHERE isnew = 1 AND uid = '.$member['uid']);
if ($rt) {
$row = $rt->getRowArray();
$count = $row['count'];
}
?>