101 行
2.7 KiB
PHP
101 行
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class FileController extends Controller {
|
|
public function getAllFiles() { // /api/rpc/file/getallfiles
|
|
return DB::table('str_file')
|
|
->select('*')
|
|
->get();
|
|
}
|
|
|
|
public function getAllApprovedFiles() { // /api/rpc/file/getallapprovedfiles
|
|
return DB::table('str_file')
|
|
->select('*')
|
|
->where('isApproved', 1)
|
|
->get();
|
|
}
|
|
|
|
public function getAllBrokenFiles() { // /api/rpc/file/getallbrokenfiles
|
|
return DB::table('str_file')
|
|
->select('*')
|
|
->where('isBroken', 1)
|
|
->get();
|
|
}
|
|
|
|
public function getAllPendingFiles() { // /api/rpc/file/getallpendingfiles
|
|
return DB::table('str_file')
|
|
->select('*')
|
|
->where('isApproved', 0)
|
|
->get();
|
|
}
|
|
|
|
public function getNewFiles() { // /api/rpc/file/getnewfiles
|
|
return DB::table('str_file')
|
|
->select('id', 'title', 'submit_date')
|
|
->where('isApproved', 1)
|
|
->orderBy('submit_date', 'desc')
|
|
->limit(5)
|
|
->get();
|
|
}
|
|
|
|
public function getHotFiles() { // /api/rpc/file/gethotfiles
|
|
return DB::table('str_file')
|
|
->select('id', 'title', 'downloads')
|
|
->where('isApproved', 1)
|
|
->orderBy('downloads', 'desc')
|
|
->limit(5)
|
|
->get();
|
|
}
|
|
|
|
public function getFile($id) { // /api/rpc/file/getfile/id
|
|
return DB::table('str_file')
|
|
->select('*')
|
|
->where('id', $id)
|
|
->get();
|
|
}
|
|
|
|
public function getFileTitle($id) { // /api/rpc/file/getfiletitle/id
|
|
return DB::table('str_file')
|
|
->select(
|
|
'title',
|
|
'version',
|
|
'views',
|
|
'downloads',
|
|
'submit_date',
|
|
'last_date'
|
|
)
|
|
->where('id', $id)
|
|
->get();
|
|
}
|
|
|
|
public function getFileDescription($id) { // /api/rpc/file/getfiledescription/id
|
|
return DB::table('str_file')
|
|
->select('description')
|
|
->where('id', $id)
|
|
->get();
|
|
}
|
|
|
|
public function getFileChangelog($id) { // /api/rpc/file/getfilechangelog/id
|
|
return DB::table('str_file')
|
|
->select('changelog', 'version')
|
|
->where('id', $id)
|
|
->get();
|
|
}
|
|
|
|
public function getFilesInCategory($cat_id) { // /api/rpc/file/getfilesincategory/cat_id
|
|
return DB::table('str_file')
|
|
->select('*')
|
|
->where('cat_id', $cat_id)
|
|
->get();
|
|
}
|
|
|
|
public function entry($file_id) { // /entry/file_id
|
|
return view('entry', compact('file_id'));
|
|
}
|
|
}
|