BaseConfigController.php 719 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Http\Controllers\V1;
  3. use App\Models\BaseConfig;
  4. class BaseConfigController extends Controller
  5. {
  6. /**
  7. * UserController constructor.
  8. */
  9. public function __construct()
  10. {
  11. $this->middleware('check', ['except' => ['index']]);
  12. }
  13. /**
  14. * 获取配置.
  15. *
  16. * @return \Illuminate\Http\JsonResponse
  17. */
  18. public function index()
  19. {
  20. $lang = request('lang', 'cn');
  21. $group = request('group');
  22. if (!$group) {
  23. return json(201, trans('api.Parameter', [], $lang));
  24. }
  25. $key = request('key', '');
  26. $arr = BaseConfig::get($group, $key, '');
  27. return json(200, 'BaseConfig Info', $arr);
  28. }
  29. }