sitearticlecomment.table.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. class SitearticlecommentTable extends We7Table {
  8. protected $tableName = 'site_article_comment';
  9. protected $primaryKey = 'id';
  10. protected $field = array('id', 'uniacid', 'articleid', 'parentid', 'uid', 'openid', 'content', 'is_read', 'iscomment', 'createtime');
  11. public function articleCommentList() {
  12. global $_W;
  13. return $this->query->from($this->tableName)->where('uniacid', $_W['uniacid'])->getall();
  14. }
  15. public function articleCommentOrder($order = 'DESC') {
  16. $order = !empty($order) ? $order : 'DESC';
  17. return $this->query->orderby('id', $order);
  18. }
  19. public function articleCommentAdd($comment) {
  20. if (!empty($comment['parentid'])) {
  21. table('sitearticlecomment')->where('id', $comment['parentid'])->fill('iscomment', ARTICLE_COMMENT)->save();
  22. }
  23. $comment['createtime'] = TIMESTAMP;
  24. table('sitearticlecomment')->fill($comment)->save();
  25. return true;
  26. }
  27. public function srticleCommentUnread($articleIds) {
  28. global $_W;
  29. return $this->query->from($this->tableName)->select('articleid, count(*) as count')->where('uniacid', $_W['uniacid'])->where('articleid', $articleIds)->where('is_read', ARTICLE_COMMENT_NOREAD)->groupby('articleid')->getall('articleid');
  30. }
  31. }