123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace Community\Lib;
- use Dever;
- class Comment
- {
- public function getData($method = 'getAll', $uid, $type = false, $type_id = false)
- {
- $where['type'] = $type;
- $where['type_id'] = $type_id;
- $info = Dever::db('community/comment')->$method($where);
- $data['info'] = array();
- $data['total'] = Dever::total();
- if ($info) {
- foreach ($info as $k => $v) {
- $data['info'][$k]['uid'] = $v['uid'];
- $data['info'][$k]['content'] = $v['content'];
- }
- }
- return $data;
- }
- # 发表信息
- public function submit($uid, $id, $type, $content)
- {
- $where['uid'] = $uid;
- $where['type_id'] = $id;
- $where['type'] = $type;
- $where['content'] = $content;
- $table = 'community/comment';
- $info = false;
- if (!$info) {
- Dever::db($table)->insert($where);
- Dever::score($uid, 'submit_comment', '发布弹幕');
- }
- return true;
- }
- }
|