Client.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Libs\TikTok\MiniProgram\Order;
  3. use App\Libs\TikTok\Kernel\BaseClient;
  4. use App\Libs\TikTok\Kernel\Exceptions\HttpException;
  5. use App\Libs\TikTok\Kernel\Exceptions\InvalidConfigException;
  6. use GuzzleHttp\Exception\GuzzleException;
  7. /**
  8. * 订单
  9. * Class Client
  10. * @package App\Libs\TikTok\MiniProgram\Order
  11. */
  12. class Client extends BaseClient
  13. {
  14. /**
  15. * 订单同步
  16. * @param string $open_id
  17. * @param int $order_status
  18. * @param array $order_detail
  19. * @param string $extra
  20. * @return array
  21. * @throws GuzzleException
  22. * @throws HttpException
  23. * @throws InvalidConfigException
  24. */
  25. public function push(string $open_id, int $order_status, array $order_detail, string $extra = ''): array
  26. {
  27. $app_name = 'douyin';
  28. $order_type = 0;
  29. $update_time = intval(microtime(true));
  30. $order_detail = json_encode($order_detail);
  31. $params = compact('open_id', 'order_status', 'order_detail', 'extra', 'app_name', 'order_type', 'update_time');
  32. return $this->httpPostJson('apps/order/v2/push', $params);
  33. }
  34. }