示例#1
0
    public function getMsgsByMlid($mlid, $uid, $limit)
    {
        $list = array();
        if (empty($mlid)) {
            return $list;
        }
        $mlist = MessageService::getListByMlid($mlid, $uid);
        if (empty($mlist) || $mlist['type'] != 1) {
            return $list;
        }
        $where = '';
        if ($mlist['uid'] == $uid) {
            $where .= ' AND status IN (0,2)';
        } else {
            $where .= ' AND status IN (0,1)';
        }
        $query = FDB::query('SELECT * 
			FROM ' . MessageService::getTablaName($mlid) . " \r\n\t\t\tWHERE mlid='{$mlid}' {$where} ORDER BY dateline DESC LIMIT {$limit}");
        while ($data = FDB::fetch($query)) {
            $data['time'] = getBeforeTimelag($data['dateline']);
            $list[] = $data;
        }
        FDB::query("UPDATE " . FDB::table('user_msg_member') . " SET is_new=0 WHERE mlid='{$mlid}' AND uid='{$uid}' AND is_new=1");
        return array_reverse($list);
    }