Comment.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Community\Lib;
  3. use Dever;
  4. class Comment
  5. {
  6. public function getData($method = 'getAll', $uid, $type = false, $type_id = false)
  7. {
  8. $where['type'] = $type;
  9. $where['type_id'] = $type_id;
  10. $info = Dever::db('community/comment')->$method($where);
  11. $data['info'] = array();
  12. $data['total'] = Dever::total();
  13. if ($info) {
  14. foreach ($info as $k => $v) {
  15. $data['info'][$k]['uid'] = $v['uid'];
  16. $data['info'][$k]['content'] = $v['content'];
  17. }
  18. }
  19. return $data;
  20. }
  21. # 发表信息
  22. public function submit($uid, $id, $type, $content)
  23. {
  24. $where['uid'] = $uid;
  25. $where['type_id'] = $id;
  26. $where['type'] = $type;
  27. $where['content'] = $content;
  28. $table = 'community/comment';
  29. $info = false;
  30. if (!$info) {
  31. Dever::db($table)->insert($where);
  32. Dever::score($uid, 'submit_comment', '发布弹幕');
  33. }
  34. return true;
  35. }
  36. }