初始化项目
This commit is contained in:
51
app/Http/Controllers/System/Api/Config.php
Normal file
51
app/Http/Controllers/System/Api/Config.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\System\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\System\ConfigService;
|
||||
|
||||
class Config extends Controller
|
||||
{
|
||||
protected $configService;
|
||||
|
||||
public function __construct(ConfigService $configService)
|
||||
{
|
||||
$this->configService = $configService;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$configs = $this->configService->getAllConfig();
|
||||
return response()->json([
|
||||
'code' => 200,
|
||||
'message' => 'success',
|
||||
'data' => $configs
|
||||
]);
|
||||
}
|
||||
|
||||
public function getByGroup(Request $request)
|
||||
{
|
||||
$configs = $this->configService->getByGroup($request->input('group'));
|
||||
return response()->json([
|
||||
'code' => 200,
|
||||
'message' => 'success',
|
||||
'data' => $configs
|
||||
]);
|
||||
}
|
||||
|
||||
public function getByKey(Request $request)
|
||||
{
|
||||
$key = $request->input('key');
|
||||
$value = $this->configService->getConfigValue($key);
|
||||
return response()->json([
|
||||
'code' => 200,
|
||||
'message' => 'success',
|
||||
'data' => [
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user