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

View File

@@ -95,7 +95,8 @@ class Test extends Command
*/
public function handle()
{
$r = NexusDB::cache_get('category_content');
dd($r);
}
}

View File

@@ -1,6 +1,6 @@
<?php
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('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");

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()
{
do_log("clear_category_cache");
\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}");
}
}
/**

View File

@@ -1,7 +1,7 @@
<?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'] ?? '');
if (!empty($q)) {
$query->where('username', 'name', "%{$q}%");
@@ -51,14 +51,14 @@ $userMedals = \App\Models\UserMedal::query()->where('uid', $CURUSER['id'])
->keyBy('medal_id')
;
foreach ($rows as $row) {
if ($userMedals->has($row->id) || $CURUSER['seedbonus'] < $row->price) {
if ($userMedals->has($row->id)) {
$btnText = nexus_trans('medal.buy_already');
} else {
$btnText = nexus_trans('medal.require_more_bonus');
}
$disabled = ' disabled';
$class = '';
$disabled = ' disabled';
$class = '';
if ($userMedals->has($row->id)) {
$btnText = nexus_trans('medal.buy_already');
} elseif ($row->get_type == \App\Models\Medal::GET_TYPE_GRANT) {
$btnText = nexus_trans('medal.grant_only');
} elseif ($CURUSER['seedbonus'] < $row->price) {
$btnText = nexus_trans('medal.require_more_bonus');
} else {
$btnText = nexus_trans('medal.buy_btn');
$disabled = '';

View File

@@ -23,4 +23,5 @@ return [
'buy_btn' => 'Buy',
'confirm_to_buy' => 'Sure you want to buy?',
'require_more_bonus' => 'Require more bonus',
'grant_only' => 'Grant only',
];

View File

@@ -23,4 +23,5 @@ return [
'buy_btn' => '购买',
'confirm_to_buy' => '确定要购买吗?',
'require_more_bonus' => '需要更多魔力值',
'grant_only' => '仅授予',
];

View File

@@ -23,4 +23,5 @@ return [
'buy_btn' => '購買',
'confirm_to_buy' => '確定要購買嗎?',
'require_more_bonus' => '需要更多魔力值',
'grant_only' => '僅授予',
];