locale file & thank api

This commit is contained in:
xiaomlove
2022-02-21 00:14:52 +08:00
parent 3a357f1534
commit 7409e90875
14 changed files with 60 additions and 8 deletions
+5 -1
View File
@@ -17,7 +17,11 @@ class CommentController extends Controller
{ {
$torrentId = $request->torrent_id; $torrentId = $request->torrent_id;
$with = ['create_user', 'update_user']; $with = ['create_user', 'update_user'];
$comments = Comment::query()->with($with)->where('torrent', $torrentId)->paginate(); $comments = Comment::query()
->with($with)
->where('torrent', $torrentId)
->whereHas('create_user')
->paginate();
$resource = CommentResource::collection($comments); $resource = CommentResource::collection($comments);
$resource->additional([ $resource->additional([
'page_title' => nexus_trans('comment.index.page_title'), 'page_title' => nexus_trans('comment.index.page_title'),
+3
View File
@@ -19,6 +19,9 @@ class FileController extends Controller
$torrentId = $request->torrent_id; $torrentId = $request->torrent_id;
$files = File::query()->where('torrent', $torrentId)->get(); $files = File::query()->where('torrent', $torrentId)->get();
$resource = FileResource::collection($files); $resource = FileResource::collection($files);
$resource->additional([
'page_title' => nexus_trans('file.index.page_title'),
]);
return $this->success($resource); return $this->success($resource);
} }
+8 -1
View File
@@ -16,8 +16,15 @@ class ThankController extends Controller
public function index(Request $request) public function index(Request $request)
{ {
$torrentId = $request->torrent_id; $torrentId = $request->torrent_id;
$thanks = Thank::query()->where('torrentid', $torrentId)->with(['user'])->paginate(); $thanks = Thank::query()
->where('torrentid', $torrentId)
->whereHas('user')
->with(['user'])
->paginate();
$resource = ThankResource::collection($thanks); $resource = ThankResource::collection($thanks);
$resource->additional([
'page_title' => nexus_trans('thank.index.page_title'),
]);
return $this->success($resource); return $this->success($resource);
} }
+1
View File
@@ -29,6 +29,7 @@ class UserResource extends JsonResource
'downloaded' => $this->downloaded, 'downloaded' => $this->downloaded,
'downloaded_text' => mksize($this->downloaded), 'downloaded_text' => mksize($this->downloaded),
'bonus' => $this->seedbonus, 'bonus' => $this->seedbonus,
'seed_points' => $this->seed_points,
'seedtime' => $this->seedtime, 'seedtime' => $this->seedtime,
'seedtime_text' => mkprettytime($this->seedtime), 'seedtime_text' => mkprettytime($this->seedtime),
'leechtime' => $this->leechtime, 'leechtime' => $this->leechtime,
+4 -3
View File
@@ -72,10 +72,11 @@ class User extends Authenticatable
public static $cardTitles = [ public static $cardTitles = [
'uploaded_human' => '上传', 'uploaded_human' => '上传',
'downloaded_human' => '下载', 'downloaded_human' => '下载',
'share_ratio' => '分享率', // 'share_ratio' => '分享率',
'seed_time' => '做种时间', // 'seed_time' => '做种时间',
'seed_bonus' => '魔力值', 'seed_bonus' => '魔力值',
'invites' => '邀请', 'seed_points' => '做种积分',
// 'invites' => '邀请',
]; ];
public function getClassTextAttribute(): string public function getClassTextAttribute(): string
@@ -14,7 +14,7 @@ class AddSeedPointsToUsersTable extends Migration
public function up() public function up()
{ {
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table) {
$table->decimal('seed_points', 20, 1)->nullable(); $table->decimal('seed_points', 20, 1)->default(0);
}); });
} }
+1 -1
View File
@@ -290,7 +290,7 @@ function docleanup($forceAll = 0, $printProgress = false) {
if ($is_donor == 'yes' && $donortimes_bonus > 0) if ($is_donor == 'yes' && $donortimes_bonus > 0)
$all_bonus = $all_bonus * $donortimes_bonus; $all_bonus = $all_bonus * $donortimes_bonus;
KPS("+",$all_bonus,$arr["userid"]); KPS("+",$all_bonus,$arr["userid"]);
sql_query("update users set seed_points = seed_points + $seedPoints where id = {$arr["userid"]}"); sql_query("update users set seed_points = ifnull(seed_points, 0) + $seedPoints where id = {$arr["userid"]}");
} }
} }
$log = 'calculate seeding bonus'; $log = 'calculate seeding bonus';
+1 -1
View File
@@ -2933,7 +2933,7 @@ function commenttable($rows, $type, $parent_id, $review = false)
{ {
// $userRow = get_user_row($row['user']); // $userRow = get_user_row($row['user']);
$userInfo = $userInfoArr->get($row['user']); $userInfo = $userInfoArr->get($row['user']);
$userRow = $userInfo->toArray(); $userRow = empty($userInfo) ? [] : $userInfo->toArray();
if ($count>=1) if ($count>=1)
{ {
if ($Advertisement->enable_ad()){ if ($Advertisement->enable_ad()){
+6
View File
@@ -0,0 +1,6 @@
<?php
return [
'index' => [
'page_title' => 'Files',
],
];
+6
View File
@@ -0,0 +1,6 @@
<?php
return [
'index' => [
'page_title' => 'Thanks',
],
];
+6
View File
@@ -0,0 +1,6 @@
<?php
return [
'index' => [
'page_title' => '文件列表',
],
];
+6
View File
@@ -0,0 +1,6 @@
<?php
return [
'index' => [
'page_title' => '感谢者',
],
];
+6
View File
@@ -0,0 +1,6 @@
<?php
return [
'index' => [
'page_title' => '文件列表',
],
];
+6
View File
@@ -0,0 +1,6 @@
<?php
return [
'index' => [
'page_title' => '感謝者',
],
];