|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace App\Module\Game\AdminControllers;
|
|
|
|
|
|
+use App\Module\Game\AdminControllers\Actions\ViewTempDataAction;
|
|
|
use App\Module\Game\Services\FundTempService;
|
|
|
use App\Module\Game\Services\HouseTempService;
|
|
|
use App\Module\Game\Services\ItemTempService;
|
|
|
@@ -23,7 +24,6 @@ use UCore\DcatAdmin\AdminController;
|
|
|
*
|
|
|
* 用于查看用户的各种暂存数据,包括物品、土地、房屋、宠物和资金等
|
|
|
*/
|
|
|
-#[Prefix('game')]
|
|
|
class TempDataController extends AdminController
|
|
|
{
|
|
|
/**
|
|
|
@@ -60,7 +60,7 @@ class TempDataController extends AdminController
|
|
|
* @param Content $content
|
|
|
* @return Content
|
|
|
*/
|
|
|
- #[Get('temp-data', name: 'dcat.admin.game.temp-data')]
|
|
|
+ #[Get('game-temp-data', name: 'dcat.admin.game-temp-data')]
|
|
|
public function index(Content $content)
|
|
|
{
|
|
|
return $content
|
|
|
@@ -76,14 +76,14 @@ class TempDataController extends AdminController
|
|
|
* @param Content $content
|
|
|
* @return Content
|
|
|
*/
|
|
|
- #[Get('temp-data/{userId}', name: 'dcat.admin.game.temp-data.show')]
|
|
|
+ #[Get('game-temp-data/{userId}', name: 'dcat.admin.game-temp-data.show')]
|
|
|
public function show($userId, Content $content)
|
|
|
{
|
|
|
// 查找用户
|
|
|
$user = User::find($userId);
|
|
|
if (!$user) {
|
|
|
admin_error('错误', '用户不存在');
|
|
|
- return redirect()->route('dcat.admin.game.temp-data');
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data');
|
|
|
}
|
|
|
|
|
|
// 用户信息卡片
|
|
|
@@ -131,7 +131,7 @@ class TempDataController extends AdminController
|
|
|
* @param int $userId 用户ID
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
|
*/
|
|
|
- #[Get('temp-data/{userId}/clear-item', name: 'dcat.admin.game.temp-data.clear-item')]
|
|
|
+ #[Get('game-temp-data/{userId}/clear-item', name: 'dcat.admin.game-temp-data.clear-item')]
|
|
|
public function clearItem($userId)
|
|
|
{
|
|
|
try {
|
|
|
@@ -139,7 +139,7 @@ class TempDataController extends AdminController
|
|
|
$user = User::find($userId);
|
|
|
if (!$user) {
|
|
|
admin_error('错误', '用户不存在');
|
|
|
- return redirect()->route('dcat.admin.game.temp-data');
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data');
|
|
|
}
|
|
|
|
|
|
// 清除用户的物品暂存数据
|
|
|
@@ -158,7 +158,7 @@ class TempDataController extends AdminController
|
|
|
admin_error('错误', '清除用户物品暂存数据失败: ' . $e->getMessage());
|
|
|
}
|
|
|
|
|
|
- return redirect()->route('dcat.admin.game.temp-data.show', ['userId' => $userId]);
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data.show', ['userId' => $userId]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -167,7 +167,7 @@ class TempDataController extends AdminController
|
|
|
* @param int $userId 用户ID
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
|
*/
|
|
|
- #[Get('temp-data/{userId}/clear-land', name: 'dcat.admin.game.temp-data.clear-land')]
|
|
|
+ #[Get('game-temp-data/{userId}/clear-land', name: 'dcat.admin.game-temp-data.clear-land')]
|
|
|
public function clearLand($userId)
|
|
|
{
|
|
|
try {
|
|
|
@@ -175,7 +175,7 @@ class TempDataController extends AdminController
|
|
|
$user = User::find($userId);
|
|
|
if (!$user) {
|
|
|
admin_error('错误', '用户不存在');
|
|
|
- return redirect()->route('dcat.admin.game.temp-data');
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data');
|
|
|
}
|
|
|
|
|
|
// 清除用户的土地暂存数据
|
|
|
@@ -190,7 +190,7 @@ class TempDataController extends AdminController
|
|
|
admin_error('错误', '清除用户土地暂存数据失败: ' . $e->getMessage());
|
|
|
}
|
|
|
|
|
|
- return redirect()->route('dcat.admin.game.temp-data.show', ['userId' => $userId]);
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data.show', ['userId' => $userId]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -199,7 +199,7 @@ class TempDataController extends AdminController
|
|
|
* @param int $userId 用户ID
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
|
*/
|
|
|
- #[Get('temp-data/{userId}/clear-house', name: 'dcat.admin.game.temp-data.clear-house')]
|
|
|
+ #[Get('game-temp-data/{userId}/clear-house', name: 'dcat.admin.game-temp-data.clear-house')]
|
|
|
public function clearHouse($userId)
|
|
|
{
|
|
|
try {
|
|
|
@@ -207,7 +207,7 @@ class TempDataController extends AdminController
|
|
|
$user = User::find($userId);
|
|
|
if (!$user) {
|
|
|
admin_error('错误', '用户不存在');
|
|
|
- return redirect()->route('dcat.admin.game.temp-data');
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data');
|
|
|
}
|
|
|
|
|
|
// 清除用户的房屋暂存数据
|
|
|
@@ -222,7 +222,7 @@ class TempDataController extends AdminController
|
|
|
admin_error('错误', '清除用户房屋暂存数据失败: ' . $e->getMessage());
|
|
|
}
|
|
|
|
|
|
- return redirect()->route('dcat.admin.game.temp-data.show', ['userId' => $userId]);
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data.show', ['userId' => $userId]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -231,7 +231,7 @@ class TempDataController extends AdminController
|
|
|
* @param int $userId 用户ID
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
|
*/
|
|
|
- #[Get('temp-data/{userId}/clear-pet', name: 'dcat.admin.game.temp-data.clear-pet')]
|
|
|
+ #[Get('game-temp-data/{userId}/clear-pet', name: 'dcat.admin.game-temp-data.clear-pet')]
|
|
|
public function clearPet($userId)
|
|
|
{
|
|
|
try {
|
|
|
@@ -239,7 +239,7 @@ class TempDataController extends AdminController
|
|
|
$user = User::find($userId);
|
|
|
if (!$user) {
|
|
|
admin_error('错误', '用户不存在');
|
|
|
- return redirect()->route('dcat.admin.game.temp-data');
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data');
|
|
|
}
|
|
|
|
|
|
// 清除用户的宠物暂存数据
|
|
|
@@ -254,7 +254,7 @@ class TempDataController extends AdminController
|
|
|
admin_error('错误', '清除用户宠物暂存数据失败: ' . $e->getMessage());
|
|
|
}
|
|
|
|
|
|
- return redirect()->route('dcat.admin.game.temp-data.show', ['userId' => $userId]);
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data.show', ['userId' => $userId]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -263,7 +263,7 @@ class TempDataController extends AdminController
|
|
|
* @param int $userId 用户ID
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
|
*/
|
|
|
- #[Get('temp-data/{userId}/clear-fund', name: 'dcat.admin.game.temp-data.clear-fund')]
|
|
|
+ #[Get('game-temp-data/{userId}/clear-fund', name: 'dcat.admin.game-temp-data.clear-fund')]
|
|
|
public function clearFund($userId)
|
|
|
{
|
|
|
try {
|
|
|
@@ -271,7 +271,7 @@ class TempDataController extends AdminController
|
|
|
$user = User::find($userId);
|
|
|
if (!$user) {
|
|
|
admin_error('错误', '用户不存在');
|
|
|
- return redirect()->route('dcat.admin.game.temp-data');
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data');
|
|
|
}
|
|
|
|
|
|
// 清除用户的资金暂存数据
|
|
|
@@ -286,7 +286,7 @@ class TempDataController extends AdminController
|
|
|
admin_error('错误', '清除用户资金暂存数据失败: ' . $e->getMessage());
|
|
|
}
|
|
|
|
|
|
- return redirect()->route('dcat.admin.game.temp-data.show', ['userId' => $userId]);
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data.show', ['userId' => $userId]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -295,7 +295,7 @@ class TempDataController extends AdminController
|
|
|
* @param int $userId 用户ID
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
|
*/
|
|
|
- #[Get('temp-data/{userId}/clear-all', name: 'dcat.admin.game.temp-data.clear-all')]
|
|
|
+ #[Get('game-temp-data/{userId}/clear-all', name: 'dcat.admin.game-temp-data.clear-all')]
|
|
|
public function clearAll($userId)
|
|
|
{
|
|
|
try {
|
|
|
@@ -303,7 +303,7 @@ class TempDataController extends AdminController
|
|
|
$user = User::find($userId);
|
|
|
if (!$user) {
|
|
|
admin_error('错误', '用户不存在');
|
|
|
- return redirect()->route('dcat.admin.game.temp-data');
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data');
|
|
|
}
|
|
|
|
|
|
// 清除用户的所有暂存数据
|
|
|
@@ -322,7 +322,7 @@ class TempDataController extends AdminController
|
|
|
admin_error('错误', '清除用户所有暂存数据失败: ' . $e->getMessage());
|
|
|
}
|
|
|
|
|
|
- return redirect()->route('dcat.admin.game.temp-data.show', ['userId' => $userId]);
|
|
|
+ return redirect()->route('dcat.admin.game-temp-data.show', ['userId' => $userId]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -339,16 +339,20 @@ class TempDataController extends AdminController
|
|
|
$grid->column('updated_at', '更新时间');
|
|
|
|
|
|
// 添加查看暂存数据操作
|
|
|
- $grid->column('操作')->display(function ($_, $row) {
|
|
|
- return "<a href='" . admin_url("game/temp-data/{$row->id}") . "' class='btn btn-sm btn-primary'>查看暂存数据</a>";
|
|
|
+ $grid->actions(function (Grid\Displayers\Actions $actions) {
|
|
|
+ // 禁用默认操作按钮
|
|
|
+ $actions->disableDelete();
|
|
|
+ $actions->disableEdit();
|
|
|
+ $actions->disableQuickEdit();
|
|
|
+ $actions->disableView();
|
|
|
+
|
|
|
+ // 添加查看暂存数据操作
|
|
|
+ $actions->append(new ViewTempDataAction());
|
|
|
});
|
|
|
|
|
|
// 禁用创建按钮
|
|
|
$grid->disableCreateButton();
|
|
|
|
|
|
- // 禁用行操作
|
|
|
- $grid->disableActions();
|
|
|
-
|
|
|
// 禁用批量操作
|
|
|
$grid->disableBatchActions();
|
|
|
|