Test.php 629 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace app\controller\common;
  3. use app\extra\basic\Base;
  4. use app\extra\tools\CodeExtend;
  5. use LinFly\Annotation\Route\Controller;
  6. use LinFly\Annotation\Route\Route;
  7. #[Controller(prefix: "/test")]
  8. class Test extends Base
  9. {
  10. #[Route(path: "index",methods: "get")]
  11. public function test()
  12. {
  13. try {
  14. $code = strtoupper(CodeExtend::random(12,3));
  15. $passwd = md5(md5("111111").$code);
  16. return success("ok",compact("code",'passwd'));
  17. } catch (\Throwable $throwable) {
  18. return error($throwable->getMessage());
  19. }
  20. }
  21. }