medal show all + fix category cache

This commit is contained in:
xiaomlove
2023-01-04 19:35:06 +08:00
parent 0b1de25999
commit 3b69425a97
7 changed files with 21 additions and 12 deletions
+2 -1
View File
@@ -95,7 +95,8 @@ class Test extends Command
*/ */
public function handle() public function handle()
{ {
$r = NexusDB::cache_get('category_content');
dd($r);
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
<?php <?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.0'); defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.0');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-12-26'); defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-01-04');
defined('IN_TRACKER') || define('IN_TRACKER', false); defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP"); defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org"); defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
+6 -1
View File
@@ -992,12 +992,17 @@ function clear_setting_cache()
} }
/** /**
* @see functions.php::get_category_row() * @see functions.php::get_category_row(), genrelist()
*/ */
function clear_category_cache() function clear_category_cache()
{ {
do_log("clear_category_cache"); do_log("clear_category_cache");
\Nexus\Database\NexusDB::cache_del('category_content'); \Nexus\Database\NexusDB::cache_del('category_content');
$searchBoxList = \App\Models\SearchBox::query()->get(['id']);
foreach ($searchBoxList as $item) {
\Nexus\Database\NexusDB::cache_del("category_list_mode_{$item->id}");
}
} }
/** /**
+9 -9
View File
@@ -1,7 +1,7 @@
<?php <?php
require "../include/bittorrent.php"; require "../include/bittorrent.php";
$query = \App\Models\Medal::query()->where('get_type', \App\Models\Medal::GET_TYPE_EXCHANGE); $query = \App\Models\Medal::query();
$q = htmlspecialchars($_REQUEST['q'] ?? ''); $q = htmlspecialchars($_REQUEST['q'] ?? '');
if (!empty($q)) { if (!empty($q)) {
$query->where('username', 'name', "%{$q}%"); $query->where('username', 'name', "%{$q}%");
@@ -51,14 +51,14 @@ $userMedals = \App\Models\UserMedal::query()->where('uid', $CURUSER['id'])
->keyBy('medal_id') ->keyBy('medal_id')
; ;
foreach ($rows as $row) { foreach ($rows as $row) {
if ($userMedals->has($row->id) || $CURUSER['seedbonus'] < $row->price) { $disabled = ' disabled';
if ($userMedals->has($row->id)) { $class = '';
$btnText = nexus_trans('medal.buy_already'); if ($userMedals->has($row->id)) {
} else { $btnText = nexus_trans('medal.buy_already');
$btnText = nexus_trans('medal.require_more_bonus'); } elseif ($row->get_type == \App\Models\Medal::GET_TYPE_GRANT) {
} $btnText = nexus_trans('medal.grant_only');
$disabled = ' disabled'; } elseif ($CURUSER['seedbonus'] < $row->price) {
$class = ''; $btnText = nexus_trans('medal.require_more_bonus');
} else { } else {
$btnText = nexus_trans('medal.buy_btn'); $btnText = nexus_trans('medal.buy_btn');
$disabled = ''; $disabled = '';
+1
View File
@@ -23,4 +23,5 @@ return [
'buy_btn' => 'Buy', 'buy_btn' => 'Buy',
'confirm_to_buy' => 'Sure you want to buy?', 'confirm_to_buy' => 'Sure you want to buy?',
'require_more_bonus' => 'Require more bonus', 'require_more_bonus' => 'Require more bonus',
'grant_only' => 'Grant only',
]; ];
+1
View File
@@ -23,4 +23,5 @@ return [
'buy_btn' => '购买', 'buy_btn' => '购买',
'confirm_to_buy' => '确定要购买吗?', 'confirm_to_buy' => '确定要购买吗?',
'require_more_bonus' => '需要更多魔力值', 'require_more_bonus' => '需要更多魔力值',
'grant_only' => '仅授予',
]; ];
+1
View File
@@ -23,4 +23,5 @@ return [
'buy_btn' => '購買', 'buy_btn' => '購買',
'confirm_to_buy' => '確定要購買嗎?', 'confirm_to_buy' => '確定要購買嗎?',
'require_more_bonus' => '需要更多魔力值', 'require_more_bonus' => '需要更多魔力值',
'grant_only' => '僅授予',
]; ];