summaryrefslogtreecommitdiffstats
path: root/libs/Contents.php
diff options
context:
space:
mode:
authorEltrac <45323514+BigCoke233@users.noreply.github.com>2019-08-05 12:54:44 +0800
committerGitHub <noreply@github.com>2019-08-05 12:54:44 +0800
commite70a3aa7486fd4b759918893476dff1c4e6147ef (patch)
tree1f307144fb7d916515a61d621b7a2f015f3421eb /libs/Contents.php
parent12adea65b04339d52d4ba3dc13645e227382693c (diff)
样式优化/体验优化/Bug Fix
Diffstat (limited to 'libs/Contents.php')
-rw-r--r--libs/Contents.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/libs/Contents.php b/libs/Contents.php
index 40a27c6..c376824 100644
--- a/libs/Contents.php
+++ b/libs/Contents.php
@@ -50,7 +50,29 @@ class Contents
}
return $text;
}
-
+
+ /**
+ * 通过查询数据库
+ * 获取上级评论人
+ */
+ public static function getParent($comment)
+ {
+ $recipients = [];
+ $db = Typecho_Db::get();
+ $widget = new Widget_Abstract_Comments(new Typecho_Request(), new Typecho_Response());
+ // 查询
+ $select = $widget->select()->where('coid' . ' = ?', $comment->parent)->limit(1);
+ $parent = $db->fetchRow($select, [$widget, 'push']); // 获取上级评论对象
+ if ($parent && $parent['mail']) {
+ $recipients = [
+ 'name' => $parent['author'],
+ 'mail' => $parent['mail'],
+ ];
+ }
+ return $recipients;
+ }
+
+ //从这里开始的代码来自 熊猫小A (https://imalan.cn)
/**
* 根据 id 返回对应的对象
* 此方法在 Typecho 1.2 以上可以直接调用 Helper::widgetById();