BaseConfigController.php 709 B

123456789101112131415161718192021222324252627282930313233
  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. * @return \Illuminate\Http\JsonResponse
  16. */
  17. public function index()
  18. {
  19. $lang = request('lang', 'cn');
  20. $group = request('group');
  21. if (!$group) {
  22. return json(201, trans("api.Parameter", [], $lang));
  23. }
  24. $key = request('key', '');
  25. $arr = BaseConfig::get($group, $key, "");
  26. return json(200,'BaseConfig Info', $arr);
  27. }
  28. }