HeiMaUtil.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\Http\Utils;
  3. use App\Exceptions\CommonException;
  4. use App\Http\Enum\ErrorEnum;
  5. use Tool\ShanTaoTool\HttpCurl;
  6. /**
  7. * 黑马淘客工具类
  8. * Class HeiMaUtil
  9. * @package App\Http\Utils
  10. */
  11. class HeiMaUtil extends BaseUtil
  12. {
  13. //基础链接
  14. static $baseUrl = "https://www.heimataoke.com/";
  15. /**
  16. * 根据商品ID获取商品的佣金信息
  17. * @param $goodsId
  18. */
  19. public static function gaoYongZhuanLian($goodsId)
  20. {
  21. $url = self::$baseUrl."api-zhuanlian";
  22. $params = [
  23. "appkey"=>"611653348",
  24. "appsecret"=>"4f660e85e93bc45012591d0a314997d6",
  25. "sid"=>"4463",
  26. "pid"=>"mm_101807570_250550471_102348550452",
  27. // "pid"=>"mm_34231311_452000065_108585250029",
  28. "num_iid"=>$goodsId,
  29. "signurl"=>1
  30. ];
  31. $res = HttpCurl::getCurl($url,$params);
  32. $url = $res["url"];
  33. $response = HttpCurl::getCurl($url);
  34. if(isset($response["tbk_privilege_get_response"])){
  35. return $response["tbk_privilege_get_response"]["result"]["data"];
  36. }
  37. $instance = new LoggerFactoryUtil(HeiMaUtil::class);
  38. $instance->info("上游返回信息:".json_encode($response));
  39. throw new CommonException(ErrorEnum::ERROR_SYSTEM);
  40. }
  41. /**
  42. * 获取订单列表
  43. */
  44. public static function getOrderList()
  45. {
  46. $url = self::$baseUrl."api-order";
  47. $params = [
  48. "appkey"=>"",
  49. "appsecret"=>"",
  50. "sid"=>"",
  51. "start_time"=>"mm_34231311_452000065_108585250029",
  52. "end_time"=>"",
  53. "page_no"=>1,
  54. "page_size"=>100,
  55. "signurl"=>1,
  56. "query_type"=>2
  57. ];
  58. }
  59. }