| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 | 
							- <?php
 
- namespace Community\Lib;
 
- use Dever;
 
- class Comment
 
- {
 
-     public function getData($method = 'getAll', $uid, $type = false, $type_id = false, $user = 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'];
 
-                 if ($v['pic']) {
 
-                     $data['info'][$k]['pic'] = explode(',', $v['pic']);
 
-                 }
 
-                 if ($user) {
 
-                     $data['info'][$k]['user'] = Dever::load('passport/api')->info($v['uid']);
 
-                     $data['info'][$k]['cdate_string'] = Dever::mdate($v['cdate'], 2);
 
-                 }
 
-             }
 
-         }
 
-         return $data;
 
-     }
 
-     # 发表信息
 
-     public function submit($uid, $id, $type, $pic, $content)
 
-     {
 
-         # 如果是商品,要先验证是否购买
 
-         if ($type == 'content/product') {
 
-         }
 
-         $where['uid'] = $uid;
 
-         $where['type_id'] = $id;
 
-         $where['type'] = $type;
 
-         $where['content'] = $content;
 
-         if ($pic) {
 
-             $where['pic'] = $pic;
 
-         }
 
-         $table = 'community/comment';
 
-         $info = false;
 
-         if (!$info) {
 
-             Dever::db($table)->insert($where);
 
-             Dever::score($uid, 'submit_comment', '发布弹幕');
 
-         }
 
-         return true;
 
-     }
 
- }
 
 
  |