feat: 增加自定义头像上传、自动压缩与自动清理功能,统一全站头像路径读取逻辑
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
* 3. 设定定时关闭任务(windows_seconds 秒后过期)
|
||||
*
|
||||
* @author ChatRoom Laravel
|
||||
*
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
@@ -32,8 +33,8 @@ class DropMysteryBoxJob implements ShouldQueue
|
||||
public int $tries = 1;
|
||||
|
||||
/**
|
||||
* @param string $boxType 箱子类型:normal | rare | trap
|
||||
* @param int|null $roomId 投放目标房间,null 时默认 1
|
||||
* @param string $boxType 箱子类型:normal | rare | trap
|
||||
* @param int|null $roomId 投放目标房间,null 时默认 1
|
||||
* @param string|null $passcode 手动指定暗号(null=自动生成)
|
||||
* @param int|null $droppedBy 投放者用户ID(null=系统自动)
|
||||
*/
|
||||
@@ -79,11 +80,11 @@ class DropMysteryBoxJob implements ShouldQueue
|
||||
|
||||
// 创建箱子记录
|
||||
$box = MysteryBox::create([
|
||||
'box_type' => $this->boxType,
|
||||
'passcode' => $passcode,
|
||||
'box_type' => $this->boxType,
|
||||
'passcode' => $passcode,
|
||||
'reward_min' => $rewardMin,
|
||||
'reward_max' => $rewardMax,
|
||||
'status' => 'open',
|
||||
'status' => 'open',
|
||||
'expires_at' => now()->addSeconds($claimWindow),
|
||||
'dropped_by' => $this->droppedBy,
|
||||
]);
|
||||
@@ -94,22 +95,22 @@ class DropMysteryBoxJob implements ShouldQueue
|
||||
$source = $this->droppedBy ? '管理员' : '系统';
|
||||
|
||||
$content = "{$emoji}【{$typeName}】{$source}投放了一个神秘箱子!"
|
||||
. "发送暗号「{$passcode}」即可开箱!限时 {$claimWindow} 秒,先到先得!";
|
||||
."发送暗号「{$passcode}」即可开箱!限时 {$claimWindow} 秒,先到先得!";
|
||||
|
||||
$msg = [
|
||||
'id' => $chatState->nextMessageId($targetRoom),
|
||||
'room_id' => $targetRoom,
|
||||
'from_user' => '系统传音',
|
||||
'to_user' => '大家',
|
||||
'content' => $content,
|
||||
'is_secret' => false,
|
||||
'id' => $chatState->nextMessageId($targetRoom),
|
||||
'room_id' => $targetRoom,
|
||||
'from_user' => '系统传音',
|
||||
'to_user' => '大家',
|
||||
'content' => $content,
|
||||
'is_secret' => false,
|
||||
'font_color' => match ($this->boxType) {
|
||||
'rare' => '#c4b5fd',
|
||||
'trap' => '#f87171',
|
||||
'rare' => '#c4b5fd',
|
||||
'trap' => '#f87171',
|
||||
default => '#34d399',
|
||||
},
|
||||
'action' => '大声宣告',
|
||||
'sent_at' => now()->toDateTimeString(),
|
||||
'action' => '大声宣告',
|
||||
'sent_at' => now()->toDateTimeString(),
|
||||
];
|
||||
|
||||
$chatState->pushMessage($targetRoom, $msg);
|
||||
|
||||
Reference in New Issue
Block a user