67 行
2.0 KiB
PHP
67 行
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class OwnerController extends Controller {
|
|
public function countOwnersOfFile($file_id) { // /api/rpc/owner/countownersoffile/id
|
|
return DB::table('str_owners')
|
|
->where('file_id', $file_id)
|
|
->count();
|
|
}
|
|
|
|
public function getOwnersOfFile($file_id) { // /api/rpc/owner/getownersoffile/id
|
|
return DB::table('str_owners')
|
|
->join('str_file', 'str_owners.file_id', '=', 'str_file.id')
|
|
->join('for_users', 'str_owners.user_id', '=', 'for_users.id')
|
|
->where('file_id', $file_id)
|
|
->get(array(
|
|
"user_id",
|
|
"title",
|
|
"version",
|
|
"views",
|
|
"downloads",
|
|
"submit_date",
|
|
"last_date",
|
|
"username",
|
|
"avatar",
|
|
"perm_id",
|
|
"gender",
|
|
"display_name",
|
|
"name_colour",
|
|
));
|
|
}
|
|
|
|
public function countFilesOfOwner($user_id) { // /api/rpc/owner/countfilesofowner/id
|
|
return DB::table('str_owners')
|
|
->where('user_id', $user_id)
|
|
->count();
|
|
}
|
|
|
|
|
|
public function getFilesOfOwner($user_id) { // /api/rpc/owner/getfilesofowner/id
|
|
return DB::table('str_owners')
|
|
->join('str_file', 'str_owners.file_id', '=', 'str_file.id')
|
|
->join('for_users', 'str_owners.user_id', '=', 'for_users.id')
|
|
->where('user_id', $user_id)
|
|
->get(array(
|
|
"user_id",
|
|
"title",
|
|
"version",
|
|
"views",
|
|
"downloads",
|
|
"submit_date",
|
|
"last_date",
|
|
"username",
|
|
"avatar",
|
|
"perm_id",
|
|
"gender",
|
|
"display_name",
|
|
"name_colour",
|
|
));
|
|
}
|
|
}
|