PostTrait.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2019/6/11
  6. * Time: 17:50
  7. */
  8. namespace App\Traits;
  9. use Tymon\JWTAuth\Facades\JWTAuth;
  10. trait PostTrait
  11. {
  12. public function getPostType($id) {
  13. try {
  14. $url = config("customer.manage_service_url").'/community/post/getType';
  15. $array = [
  16. 'json' => ['id' => $id], 'query' => [], 'http_errors' => false,'headers'=>['Authorization'=>"Bearer ".JWTAuth::getToken()]
  17. ];
  18. return http($url,$array, 'get');
  19. } catch (\Exception $e) {
  20. return [];
  21. }
  22. }
  23. public function getCategoryUids($category) {
  24. try {
  25. $url = config("customer.manage_service_url").'/community/post/getCategoryUids';
  26. $array = [
  27. 'json' => ['category' => $category], 'query' => [], 'http_errors' => false,'headers'=>['Authorization'=>"Bearer ".JWTAuth::getToken()]
  28. ];
  29. return http($url,$array, 'get');
  30. } catch (\Exception $e) {
  31. return [];
  32. }
  33. }
  34. }