QrcodeMediasController.php 1000 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Http\Controllers\Common;
  3. use App\Http\Controllers\Controller;
  4. use App\Services\App\KfService;
  5. use Illuminate\Http\Request;
  6. /**
  7. * Class QrcodeMediasController
  8. * @package App\Http\Controllers\Common
  9. */
  10. class QrcodeMediasController extends Controller
  11. {
  12. /**
  13. * 获取原始资源
  14. * @param Request $request
  15. * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
  16. */
  17. public function getQrcode(Request $request)
  18. {
  19. $key = $request->get("key", null);
  20. $kfs = new KfService();
  21. if ($boolUrl = $kfs->getOriginMedia($key)) {
  22. return response(array(
  23. 'code' => 200,
  24. 'message' => 'success',
  25. 'data' => [
  26. 'url' => $boolUrl
  27. ]
  28. ));
  29. } else {
  30. return response(array(
  31. 'code' => 404,
  32. 'message' => 'no media'
  33. ));
  34. }
  35. }
  36. }