mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-03-14 08:48:13 -04:00
Merge branch 'cedar2025:master' into master
This commit is contained in:
commit
e59e5f71a3
@ -19,7 +19,8 @@ class Handler extends ExceptionHandler
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $dontReport = [
|
protected $dontReport = [
|
||||||
ApiException::class
|
ApiException::class,
|
||||||
|
InterceptResponseException::class
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,9 +55,10 @@ class TicketController extends Controller
|
|||||||
if (!$ticket) {
|
if (!$ticket) {
|
||||||
return $this->fail([400202, '工单不存在']);
|
return $this->fail([400202, '工单不存在']);
|
||||||
}
|
}
|
||||||
|
$ticket->user = UserController::transformUserData($ticket->user);
|
||||||
$ticket->messages->each(function ($message) use ($ticket) {
|
$ticket->messages->each(function ($message) use ($ticket) {
|
||||||
$message->is_me = $message->user_id !== $ticket->user_id;
|
$message->is_me = $message->user_id !== $ticket->user_id;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this->success($ticket);
|
return $this->success($ticket);
|
||||||
@ -84,13 +85,20 @@ class TicketController extends Controller
|
|||||||
});
|
});
|
||||||
|
|
||||||
$this->applyFiltersAndSorts($request, $ticketModel);
|
$this->applyFiltersAndSorts($request, $ticketModel);
|
||||||
|
$tickets = $ticketModel
|
||||||
return response()->json($ticketModel
|
|
||||||
->latest('updated_at')
|
->latest('updated_at')
|
||||||
->paginate(
|
->paginate(
|
||||||
perPage: $request->integer('pageSize', 10),
|
perPage: $request->integer('pageSize', 10),
|
||||||
page: $request->integer('current', 1)
|
page: $request->integer('current', 1)
|
||||||
));
|
);
|
||||||
|
$tickets->getCollection()->transform(function ($ticket) {
|
||||||
|
$ticket->user = UserController::transformUserData($ticket->user);
|
||||||
|
return $ticket;
|
||||||
|
});
|
||||||
|
return response([
|
||||||
|
'data' => $tickets->items(),
|
||||||
|
'total' => $tickets->total()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reply(Request $request)
|
public function reply(Request $request)
|
||||||
|
@ -160,7 +160,7 @@ class UserController extends Controller
|
|||||||
->paginate($pageSize, ['*'], 'page', $current);
|
->paginate($pageSize, ['*'], 'page', $current);
|
||||||
|
|
||||||
$users->getCollection()->transform(function ($user) {
|
$users->getCollection()->transform(function ($user) {
|
||||||
return $this->transformUserData($user);
|
return self::transformUserData($user);
|
||||||
});
|
});
|
||||||
|
|
||||||
return response([
|
return response([
|
||||||
@ -175,7 +175,7 @@ class UserController extends Controller
|
|||||||
* @param User $user
|
* @param User $user
|
||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
private function transformUserData(User $user): User
|
public static function transformUserData(User $user): User
|
||||||
{
|
{
|
||||||
$user->subscribe_url = Helper::getSubscribeUrl($user->token);
|
$user->subscribe_url = Helper::getSubscribeUrl($user->token);
|
||||||
$user->balance = $user->balance / 100;
|
$user->balance = $user->balance / 100;
|
||||||
|
@ -7,6 +7,7 @@ use App\Services\Plugin\PluginManager;
|
|||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class PluginServiceProvider extends ServiceProvider
|
class PluginServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@ -19,23 +20,8 @@ class PluginServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!file_exists(base_path('plugins'))) {
|
if (!file_exists(base_path('plugins'))) {
|
||||||
mkdir(base_path('plugins'), 0755, true);
|
mkdir(base_path('plugins'), 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
$plugins = Plugin::query()
|
|
||||||
->where('is_enabled', true)
|
|
||||||
->get();
|
|
||||||
|
|
||||||
foreach ($plugins as $plugin) {
|
|
||||||
$manager = $this->app->make(PluginManager::class);
|
|
||||||
$manager->enable($plugin->code);
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
\Log::error('Failed to load plugins: ' . $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
2
theme/Xboard/assets/umi.js
vendored
2
theme/Xboard/assets/umi.js
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user