BarcodeController.php 1012 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Services\CallApiService;
  4. use Illuminate\Http\Request;
  5. class BarcodeController extends Controller
  6. {
  7. private $callApiService;
  8. public function __construct(CallApiService $callApiService)
  9. {
  10. $this->callApiService = $callApiService;
  11. }
  12. public function index($listToken)
  13. {
  14. $response = $this->callApiService->callApi([
  15. 'url' => 'list-type1-page',
  16. 'data' => [
  17. 'ListType1Vars' => [
  18. 'ListToken' => $listToken,
  19. 'IsDownloadList' => true,
  20. ],
  21. 'PageVars' => [
  22. 'Limit' => 1000000,
  23. 'Offset' => 0
  24. ]
  25. ]
  26. ]);
  27. if ($this->callApiService->verifyApiError($response)) {
  28. notify()->error($response['body'], 'Error', 'bottomRight');
  29. return redirect()->back();
  30. }
  31. return view('barcode', compact('response'));
  32. }
  33. }