Compare commits
3 Commits
734d8fe0ce
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 62bfd279be | |||
| 096516ba33 | |||
| ec6bd3ede5 |
@@ -802,8 +802,8 @@ class Helper
|
||||
$indexVueData['defaultItems'] = self::getJsonFromArray($indexVueData['defaultItems'] ?? []);
|
||||
$indexVueData['tableColumn'] = self::buildTableColumn($indexVueData['tableColumn'] ?? []);
|
||||
$indexVueData['dblClickNotEditColumn'] = self::buildSimpleArray($indexVueData['dblClickNotEditColumn'] ?? ['undefined']);
|
||||
$controllerFile['path'][] = $controllerFile['originalLastName'];
|
||||
$indexVueData['controllerUrl'] = '\'/admin/' . ($controllerFile['path'] ? implode('.', $controllerFile['path']) : '') . '/\'';
|
||||
$urlSegments = array_merge($controllerFile['path'], [$controllerFile['originalLastName']]);
|
||||
$indexVueData['controllerUrl'] = '\'/admin/' . ($urlSegments ? implode('.', array_map('strtolower', $urlSegments)) : '') . '/\'';
|
||||
$indexVueData['componentName'] = ($webViewsDir['path'] ? implode('/', $webViewsDir['path']) . '/' : '') . $webViewsDir['originalLastName'];
|
||||
$indexVueContent = self::assembleStub('html/index', $indexVueData);
|
||||
self::writeFile(root_path() . $webViewsDir['views'] . '/' . 'index.vue', $indexVueContent);
|
||||
|
||||
@@ -11,12 +11,15 @@ use Exception;
|
||||
*/
|
||||
class TokenExpirationException extends Exception
|
||||
{
|
||||
protected array $data = [];
|
||||
|
||||
public function __construct(
|
||||
protected string $message = '',
|
||||
protected int $code = 409,
|
||||
protected array $data = [],
|
||||
string $message = '',
|
||||
int $code = 409,
|
||||
array $data = [],
|
||||
?\Throwable $previous = null
|
||||
) {
|
||||
$this->data = $data;
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
|
||||
@@ -245,6 +245,34 @@ Route::get('/admin/security/dataRecycleLog/index', [\app\admin\controller\securi
|
||||
Route::post('/admin/security/dataRecycleLog/restore', [\app\admin\controller\security\DataRecycleLog::class, 'restore']);
|
||||
Route::get('/admin/security/dataRecycleLog/info', [\app\admin\controller\security\DataRecycleLog::class, 'info']);
|
||||
|
||||
// ==================== CRUD 生成的根级控制器(/admin/item/index 或 /admin/Item/index,无子目录、无点号) ====================
|
||||
// 显式路由在上,此处作为兜底;与 /admin/module.controller/action 互补
|
||||
Route::add(
|
||||
['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'],
|
||||
'/admin/{controller:[a-zA-Z][a-zA-Z0-9]*}/{action}',
|
||||
function (\Webman\Http\Request $request, string $controller, string $action) {
|
||||
$class = '\\app\\admin\\controller\\' . ucfirst(strtolower($controller));
|
||||
if (!class_exists($class)) {
|
||||
return new Response(404, ['Content-Type' => 'application/json'], json_encode(['code' => 404, 'msg' => '404 Not Found', 'data' => []], JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
if (!method_exists($class, $action)) {
|
||||
return new Response(404, ['Content-Type' => 'application/json'], json_encode(['code' => 404, 'msg' => '404 Not Found', 'data' => []], JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
$request->controller = $class;
|
||||
try {
|
||||
$instance = new $class();
|
||||
return $instance->$action($request);
|
||||
} catch (\Throwable $e) {
|
||||
return new Response(500, ['Content-Type' => 'application/json'], json_encode([
|
||||
'code' => 0,
|
||||
'msg' => $e->getMessage(),
|
||||
'time' => time(),
|
||||
'data' => null,
|
||||
], JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// ==================== 兼容 ThinkPHP 风格 URL(module.Controller/action) ====================
|
||||
// 前端使用 /admin/user.Rule/index 格式,需转换为控制器调用
|
||||
Route::add(
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
/**
|
||||
* game_user:档位权重、中大奖权重、抽奖券数量(JSON 文本)
|
||||
*/
|
||||
class GameUserTierBigwinTicket extends AbstractMigration
|
||||
{
|
||||
public function change(): void
|
||||
{
|
||||
if (!$this->hasTable('game_user')) {
|
||||
return;
|
||||
}
|
||||
$table = $this->table('game_user');
|
||||
if (!$table->hasColumn('tier_weight')) {
|
||||
$table->addColumn('tier_weight', 'text', [
|
||||
'null' => true,
|
||||
'default' => null,
|
||||
'comment' => '档位权重 JSON,如 [{"T1":"5"},{"T2":"20"}]',
|
||||
]);
|
||||
}
|
||||
if (!$table->hasColumn('bigwin_weight')) {
|
||||
$table->addColumn('bigwin_weight', 'text', [
|
||||
'null' => true,
|
||||
'default' => null,
|
||||
'comment' => '中大奖权重 JSON',
|
||||
]);
|
||||
}
|
||||
if (!$table->hasColumn('ticket_count')) {
|
||||
$table->addColumn('ticket_count', 'text', [
|
||||
'null' => true,
|
||||
'default' => null,
|
||||
'comment' => '抽奖券 JSON,如 [{"ante":1,"count":1}]',
|
||||
]);
|
||||
}
|
||||
$table->update();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user