| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | <?phpnamespace Community\Lib;use Dever;class Tips{    public function getData($method = 'getAll', $uid, $type = false, $type_id = false, $user = false, $collection_id = false)    {        $where['type'] = $type;        $info = Dever::db('community/tips')->$method($where);        $data['info'] = array();        $data['total'] = Dever::total();        if ($info) {        	$temp = array();            foreach ($info as $k => $v) {            	$temp['type'] = $v['type'];            	$temp['type_id'] = $v['type_id'];            	$temp['uid'] = $v['uid'];                $temp['content'] = $v['content'];                $temp['playtime'] = $v['playtime'];                if ($v['pic']) {                    $temp['pic'] = explode(',', $v['pic']);                }                if ($user) {                    $temp['user'] = Dever::load('user/lib/info')->get($v['uid'], $collection_id, true);                    $temp['cdate_string'] = Dever::mdate($v['cdate'], 2);                }                $data['info'][$v['playtime']][] = $temp;            }        }        return $data;    }    # 发表信息    public function submit($uid, $id, $type, $pic, $content, $playtime, $score_type = false, $score_type_id = false)    {        $where['uid'] = $uid;        $where['type_id'] = $id;        $where['type'] = $type;        $where['content'] = $content;        if ($pic) {            $where['pic'] = $pic;        }        if ($playtime) {            $where['playtime'] = $playtime;        } else {            $where['playtime'] = '-1';        }        $table = 'community/tips';        $info = false;        if (!$info) {            Dever::db($table)->insert($where);            Dever::score($uid, 'submit_tips', '发布聊天泡泡', false, false, false, $score_type, $score_type_id);        }        return true;    }}
 |