SettingController.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Http\Controllers\Api\Base;
  3. use App\Http\Controllers\Controller;
  4. use App\Services\Base\SettingService;
  5. use Illuminate\Http\Request;
  6. /**
  7. * Setting
  8. */
  9. class SettingController extends Controller
  10. {
  11. /**
  12. * @var SettingService
  13. */
  14. private $settingService;
  15. /**
  16. * SettingController constructor.
  17. *
  18. * @param SettingService $settingService
  19. */
  20. public function __construct(SettingService $settingService)
  21. {
  22. parent::__construct();
  23. $this->settingService = $settingService;
  24. }
  25. /**
  26. * 获取系统配置参数
  27. * @must
  28. * @param Request $request
  29. * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Resources\Json\JsonResource
  30. * @throws \Illuminate\Validation\ValidationException
  31. */
  32. public function configs(Request $request)
  33. {
  34. $this->validate($request, ['keys' => 'required|array']);
  35. $configs = $this->settingService->handleConfigs($request->get('keys'));
  36. return $this->response->success(compact('configs'));
  37. }
  38. }