Client.php 977 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Libs\TikTok\OpenPlatform\Im;
  3. use App\Libs\TikTok\Kernel\BaseClient;
  4. class Client extends BaseClient
  5. {
  6. protected $headerAccessToken = true;
  7. /**
  8. * @param string $serviceOpenId 客服号 openid
  9. * @param array $param
  10. * @return array
  11. * @throws \App\Libs\TikTok\Kernel\Exceptions\HttpException
  12. * @throws \App\Libs\TikTok\Kernel\Exceptions\InvalidConfigException
  13. * @throws \GuzzleHttp\Exception\GuzzleException
  14. */
  15. public function sendMsg(string $serviceOpenId, array $param = []): array
  16. {
  17. $data = [
  18. 'conversion_id' => getProp($param, 'conversion_id'),
  19. 'send_url' => getProp($param, 'send_url'),
  20. 'to_user_id' => getProp($param, 'to_user_id'),
  21. 'msg_type' => (int)getProp($param, 'msg_type'),
  22. ];
  23. return $this->httpPostJson('/im/send/customer/service/msg/', $data, [
  24. 'open_id' => $serviceOpenId
  25. ]);
  26. }
  27. }