抖音小程序

TestController.php 1.0KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Service\AccessTokenService;
  4. use App\Support\DouYinApi;
  5. use Illuminate\Http\Request;
  6. use App\Http\Controllers\Controller;
  7. class TestController extends Controller
  8. {
  9. public function getToken() {
  10. $appId = 'tt5a212c9cc51102a601';
  11. // $responseData = DouYinApi::getClientToken($appId);
  12. $responseData = DouYinApi::getAccessToken($appId);
  13. return self::returnValue($responseData);
  14. }
  15. public function getVideoStatus(Request $request) {
  16. $appId = 'tt5a212c9cc51102a601';
  17. $openVideoId = $request->input('open_video_id');
  18. if(!empty($openVideoId)) {
  19. $responseData = DouYinApi::queryVideo($appId, 1, $openVideoId, null);
  20. }
  21. return $responseData ?? [];
  22. }
  23. public function getAlbumStatus(Request $request) {
  24. $appId = 'tt5a212c9cc51102a601';
  25. $albumId = $request->input('album_id');
  26. if(!empty($albumId)) {
  27. $responseData = DouYinApi::queryAlbum();
  28. }
  29. }
  30. }