no message
This commit is contained in:
parent
c946a580da
commit
de091a0a0a
@ -49,7 +49,7 @@ private function findValidUrlBySubKey($sSubKey, $iNum, $oFlow)
|
||||
|
||||
$iTotal = $oQuery->count();
|
||||
|
||||
if ($iTotal === 0) throw new \Exception("subkey:{$sSubKey} 旗下无任何记录");
|
||||
if ($iTotal === 0) throw new \Exception("ArticleKeyAuthorMap的{$sSubKey} 旗下无任何记录");
|
||||
|
||||
// 1. 计算当前查库的偏移量,用 % 取模是最稳的,或者用 if 但不要改 iNum 本身
|
||||
$iOffset = ($iNum - 1) % $iTotal;
|
||||
|
||||
77
app/Http/Controllers/Api/Nasa/V1/ArticleAuthormapController.php
Executable file
77
app/Http/Controllers/Api/Nasa/V1/ArticleAuthormapController.php
Executable file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers\Api\Nasa\V1;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Api\Nasa\V1\Base\ListController;
|
||||
|
||||
final class ArticleAuthormapController extends ListController
|
||||
{
|
||||
protected string $sModelPath = 'App\Models\ArticleKeyAuthorMap';
|
||||
protected array $aFilterFields = [ // 允许where的字段,不设视为全允许
|
||||
// 's_name',
|
||||
// 'i_status'
|
||||
];
|
||||
|
||||
protected string $sPageName = "article";
|
||||
|
||||
protected array $aListFields = [ // list展示的字段和名字映射
|
||||
'id' => 'id',
|
||||
'key' => 'key',
|
||||
'authors' => 'authors',
|
||||
];
|
||||
|
||||
protected array $aValueStyle = [ // 特定文字渲染样式
|
||||
'关闭' => "<span class='text-danger'>关闭</span>",
|
||||
'开启' => "<span class='text-success'>开启</span>"
|
||||
];
|
||||
|
||||
protected array $aFieldTypes = [
|
||||
// 'schema' => 'text',
|
||||
// 'schema_pro' => 'text',
|
||||
// 'cmd' => 'text',
|
||||
// 'cmd_log' => 'text',
|
||||
// 'opt' => 'text'
|
||||
// 'aOpt' => 'json',
|
||||
// 'aSchemaPro' => 'json',
|
||||
// 'aSchema' => 'array',
|
||||
];
|
||||
|
||||
protected array $aOrderBy = [
|
||||
[
|
||||
"sField" => "id",
|
||||
"sSort" => "desc",
|
||||
]
|
||||
];
|
||||
|
||||
protected array $aJsonFields = [ // json字段
|
||||
// 'schema'
|
||||
];
|
||||
|
||||
protected array $aDateFields = [ // date字段
|
||||
// 'dtUpdatedAt'
|
||||
];
|
||||
|
||||
protected array $aLenthFields = [ // 限制长度的字段
|
||||
// "xx" => 100,
|
||||
];
|
||||
|
||||
protected array $aSelectFields = [ // 作为默认select的字段
|
||||
// 'status',
|
||||
];
|
||||
|
||||
protected array $aValueFields = [ // 值映射
|
||||
'status' => [
|
||||
'1' => '开启',
|
||||
'0' => '关闭',
|
||||
]
|
||||
];
|
||||
|
||||
protected array $aCcExtFields = [
|
||||
// 'dtCreatedAt' => '创建时间'
|
||||
];
|
||||
|
||||
// protected array $aLimit = [3, 15, 40, 100]; // list长度,第一个为默认
|
||||
|
||||
}
|
||||
@ -3,6 +3,7 @@
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\Api\Nasa\V1\ArticleBaseController as NasaV1ArticleBaseController;
|
||||
use App\Http\Controllers\Api\Nasa\V1\ArticleAuthormapController as NasaV1ArticleAuthormapController;
|
||||
use App\Http\Controllers\Api\Nasa\V1\UploadimagesBaseController as NasaV1UploadimagesBaseController;
|
||||
|
||||
Route::prefix('nasa/v1')->middleware('nasa.auth')->group(function () {
|
||||
@ -18,6 +19,18 @@
|
||||
Route::put('clone/save', [NasaV1ArticleBaseController::class, 'cloneSave']);
|
||||
Route::get('hit/{id}/{field}', [NasaV1ArticleBaseController::class, 'hit']);
|
||||
});
|
||||
|
||||
Route::prefix('article/authormap')->group(function() {
|
||||
Route::get('', [NasaV1ArticleAuthormapController::class, 'index']);
|
||||
Route::get('detail/{id}', [NasaV1ArticleAuthormapController::class, 'detail']);
|
||||
Route::put('detail/save/{id}', [NasaV1ArticleAuthormapController::class, 'detailSave']);
|
||||
Route::delete('delete/{id}', [NasaV1ArticleAuthormapController::class, 'delete']);
|
||||
Route::get('add', [NasaV1ArticleAuthormapController::class, 'add']);
|
||||
Route::put('add/save', [NasaV1ArticleAuthormapController::class, 'addSave']);
|
||||
Route::get('clone/{id}', [NasaV1ArticleAuthormapController::class, 'clone']);
|
||||
Route::put('clone/save', [NasaV1ArticleAuthormapController::class, 'cloneSave']);
|
||||
Route::get('hit/{id}/{field}', [NasaV1ArticleAuthormapController::class, 'hit']);
|
||||
});
|
||||
|
||||
Route::prefix('uploadimages/base')->group(function() {
|
||||
Route::get('', [NasaV1UploadimagesBaseController::class, 'index']);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user