Update calcStat for Topic

Add data update for the first post
This commit is contained in:
Visman 2020-06-25 19:52:05 +07:00
parent 620245db42
commit da1959e449

View file

@ -33,6 +33,19 @@ class CalcStat extends Method
$num_replies = $this->c->DB->query($sql, $vars)->fetchColumn();
$sql = 'SELECT p.id, p.poster, p.poster_id, p.posted
FROM ::posts AS p
WHERE p.topic_id=?i:tid
ORDER BY p.id
LIMIT 1';
$result = $this->c->DB->query($sql, $vars)->fetch();
$this->model->poster = $result['poster'];
$this->model->poster_id = $result['poster_id'];
$this->model->posted = $result['posted'];
$this->model->first_post_id = $result['id'];
$sql = 'SELECT p.id, p.poster, p.poster_id, p.posted, p.edited
FROM ::posts AS p
WHERE p.topic_id=?i:tid