Common.php 796 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\controller\common;
  3. use app\extra\basic\Base;
  4. use app\model\system\SystemConfig;
  5. use LinFly\Annotation\Route\Controller;
  6. use LinFly\Annotation\Route\Route;
  7. use support\Response;
  8. use Tinywan\Captcha\Captcha;
  9. /**
  10. *
  11. */
  12. #[Controller(prefix: "/api/service")]
  13. class Common extends Base
  14. {
  15. /**
  16. *
  17. */
  18. #[Route(path: "data",methods: "get")]
  19. public function getServiceData(): Response
  20. {
  21. try {
  22. $captcha = Captcha::base64();
  23. $service = (new SystemConfig)->where("type","service")->column("value","name");
  24. return successTrans("success.data",compact('captcha','service'));
  25. } catch (\Throwable $throwable) {
  26. return error($throwable->getMessage());
  27. }
  28. }
  29. }