inbox count cache etc.

This commit is contained in:
xiaomlove
2023-02-08 13:33:25 +08:00
parent e9c48e89b1
commit cf4a9207d8
14 changed files with 41 additions and 20 deletions
@@ -57,6 +57,7 @@ class BonusLogResource extends Resource
->label(__('bonus-log.fields.old_total_value'))
,
Tables\Columns\TextColumn::make('value')
->formatStateUsing(fn ($record) => $record->old_total_value > $record->new_total_value ? "-" . $record->value : "+" . $record->value)
->label(__('bonus-log.fields.value'))
,
Tables\Columns\TextColumn::make('new_total_value')
@@ -46,7 +46,7 @@ class UserMetaResource extends Resource
{
return $table
->columns([
Tables\Columns\TextColumn::make('id'),
Tables\Columns\TextColumn::make('id')->sortable(),
Tables\Columns\TextColumn::make('uid')
->searchable()
->label(__('label.username'))
@@ -63,6 +63,7 @@ class UserMetaResource extends Resource
->formatStateUsing(fn ($state) => format_datetime($state))
,
])
->defaultSort('id', 'desc')
->filters([
Tables\Filters\Filter::make('uid')
->form([
+4
View File
@@ -34,6 +34,8 @@ class BonusLogs extends NexusModel
const BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD = 17;
const BUSINESS_TYPE_GIFT_MEDAL = 18;
const BUSINESS_TYPE_ROLE_WORK_SALARY = 1000;
public static array $businessTypes = [
self::BUSINESS_TYPE_CANCEL_HIT_AND_RUN => ['text' => 'Cancel H&R'],
self::BUSINESS_TYPE_BUY_MEDAL => ['text' => 'Buy medal'],
@@ -53,6 +55,8 @@ class BonusLogs extends NexusModel
self::BUSINESS_TYPE_BUY_RAINBOW_ID => ['text' => 'Buy rainbow ID'],
self::BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD => ['text' => 'Buy change username card'],
self::BUSINESS_TYPE_GIFT_MEDAL => ['text' => 'Gift medal to someone'],
self::BUSINESS_TYPE_ROLE_WORK_SALARY => ['text' => 'Role work salary'],
];
public function getBusinessTypeTextAttribute()
+1 -2
View File
@@ -28,8 +28,7 @@ class Message extends NexusModel
public static function add(array $data): bool
{
NexusDB::cache_del('user_'.$data["receiver"].'_inbox_count');
NexusDB::cache_del('user_'.$data["receiver"].'_unread_message_count');
clear_inbox_count_cache($data["receiver"]);
return self::query()->insert($data);
}
+1 -1
View File
@@ -259,7 +259,7 @@ class ClaimRepository extends BaseRepository
}
//Send message
Message::query()->insert($message);
Message::add($message);
});
do_log("[DONE], cost time: " . (time() - $now->timestamp) . " seconds");
return true;