Skip to content

Commit

Permalink
fix:修复部分接口未指定content-type的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
XueSiLf authored and Player626 committed Feb 14, 2022
1 parent bdbaacf commit 92e2a4a
Show file tree
Hide file tree
Showing 26 changed files with 124 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/MiniProgram/Broadcast/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function create(array $goodsInfo)

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/goods/add',
Expand Down Expand Up @@ -64,6 +65,7 @@ public function resetAudit(int $auditId, int $goodsId)

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/goods/resetaudit',
Expand All @@ -89,6 +91,7 @@ public function resubmitAudit(int $goodsId)

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/goods/audit',
Expand Down Expand Up @@ -117,6 +120,7 @@ public function delete(int $goodsId)

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/goods/delete',
Expand All @@ -142,6 +146,7 @@ public function update(array $goodsInfo)

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/goods/update',
Expand All @@ -167,6 +172,7 @@ public function getGoodsWarehouse(array $goodsIdArray)

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxa/business/getgoodswarehouse',
Expand Down Expand Up @@ -217,6 +223,7 @@ public function createLiveRoom(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/create',
Expand Down Expand Up @@ -246,6 +253,7 @@ public function getRooms(int $start = 0, int $limit = 10)

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxa/business/getliveinfo',
Expand Down Expand Up @@ -278,6 +286,7 @@ public function getPlaybacks(int $roomId, int $start = 0, int $limit = 10)

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxa/business/getliveinfo',
Expand All @@ -301,6 +310,7 @@ public function addGoods(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/addgoods',
Expand All @@ -322,6 +332,7 @@ public function deleteLiveRoom(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/deleteroom',
Expand All @@ -343,6 +354,7 @@ public function updateLiveRoom(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/editroom',
Expand Down Expand Up @@ -412,6 +424,7 @@ public function addAssistant(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/addassistant',
Expand All @@ -433,6 +446,7 @@ public function updateAssistant(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/modifyassistant',
Expand All @@ -454,6 +468,7 @@ public function deleteAssistant(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/removeassistant',
Expand Down Expand Up @@ -498,6 +513,7 @@ public function addSubAnchor(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/addsubanchor',
Expand All @@ -519,6 +535,7 @@ public function updateSubAnchor(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/modifysubanchor',
Expand All @@ -540,6 +557,7 @@ public function deleteSubAnchor(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/deletesubanchor',
Expand Down Expand Up @@ -591,6 +609,7 @@ public function updateFeedPublic(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/updatefeedpublic',
Expand All @@ -612,6 +631,7 @@ public function updateReplay(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/updatereplay',
Expand All @@ -633,6 +653,7 @@ public function updateKf(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/updatekf',
Expand All @@ -654,6 +675,7 @@ public function updateComment(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/room/updatecomment',
Expand All @@ -675,6 +697,7 @@ public function updateGoodsInRoom(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/goods/onsale',
Expand All @@ -696,6 +719,7 @@ public function deleteGoodsInRoom(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/goods/deleteInRoom',
Expand All @@ -717,6 +741,7 @@ public function pushGoods(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/goods/push',
Expand All @@ -738,6 +763,7 @@ public function sortGoods(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/goods/sort',
Expand All @@ -759,6 +785,7 @@ public function downloadGoodsExplanationVideo(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/goods/getVideo',
Expand All @@ -783,6 +810,7 @@ public function addRole(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/role/addrole',
Expand All @@ -804,6 +832,7 @@ public function deleteRole(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxaapi/broadcast/role/deleterole',
Expand Down Expand Up @@ -851,6 +880,7 @@ public function getFollowers(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxa/business/get_wxa_followers',
Expand All @@ -874,6 +904,7 @@ public function pushMessage(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/wxa/business/push_message',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function register(string $ticket, float $timeout = 10)
$response = $this->getClient()
->setTimeout($timeout)
->setMethod("POST")
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream([
'ticket' => $ticket,
]))->send($this->buildUrl(
Expand Down
1 change: 1 addition & 0 deletions src/Work/Agent/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function set(int $agentId, array $attributes)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream([
array_merge(['agentid' => $agentId], $attributes)
]))
Expand Down
3 changes: 3 additions & 0 deletions src/Work/Agent/WorkbenchClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function setWorkbenchTemplate(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl('/cgi-bin/agent/set_workbench_template',
['access_token' => $this->app[ServiceProviders::AccessToken]->getToken()]
Expand All @@ -50,6 +51,7 @@ public function getWorkbenchTemplate(int $agentId)

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl('/cgi-bin/agent/get_workbench_template',
['access_token' => $this->app[ServiceProviders::AccessToken]->getToken()]
Expand All @@ -71,6 +73,7 @@ public function setWorkbenchData(array $params)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl('/cgi-bin/agent/set_workbench_data',
['access_token' => $this->app[ServiceProviders::AccessToken]->getToken()]
Expand Down
4 changes: 4 additions & 0 deletions src/Work/Calendar/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function add(array $calendar)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream(compact('calendar')))
->send($this->buildUrl(
'/cgi-bin/oa/calendar/add',
Expand Down Expand Up @@ -55,6 +56,7 @@ public function update(string $id, array $calendar)

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream(compact('calendar')))
->send($this->buildUrl(
'/cgi-bin/oa/calendar/update',
Expand All @@ -80,6 +82,7 @@ public function get($ids)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream(['cal_id_list' => (array)$ids]))
->send($this->buildUrl(
'/cgi-bin/oa/calendar/get',
Expand All @@ -106,6 +109,7 @@ public function delete(string $id)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream(['cal_id' => $id]))
->send($this->buildUrl(
'/cgi-bin/oa/calendar/del',
Expand Down
3 changes: 3 additions & 0 deletions src/Work/Chat/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function create(array $data)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($data))
->send($this->buildUrl(
'/cgi-bin/appchat/create',
Expand All @@ -79,6 +80,7 @@ public function update(string $chatId, array $data)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream(array_merge(['chatid' => $chatId], $data)))
->send($this->buildUrl(
'/cgi-bin/appchat/update',
Expand All @@ -103,6 +105,7 @@ public function send(array $message)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($message))
->send($this->buildUrl(
'/cgi-bin/appchat/send',
Expand Down
3 changes: 3 additions & 0 deletions src/Work/CorpGroup/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function getAppShareInfo(int $agentId)

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/cgi-bin/corpgroup/corp/list_app_share_info',
Expand Down Expand Up @@ -60,6 +61,7 @@ public function getToken(string $corpId, int $agentId)

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/cgi-bin/corpgroup/corp/gettoken',
Expand Down Expand Up @@ -90,6 +92,7 @@ public function getMiniProgramTransferSession(string $userId, string $sessionKey

$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($params))
->send($this->buildUrl(
'/cgi-bin/miniprogram/transfer_session',
Expand Down
2 changes: 2 additions & 0 deletions src/Work/Department/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function create(array $data)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream($data))
->send($this->buildUrl(
'/cgi-bin/department/create',
Expand All @@ -52,6 +53,7 @@ public function update(int $id, array $data)
{
$response = $this->getClient()
->setMethod('POST')
->setHeaders(['content-type' => 'application/json'])
->setBody($this->jsonDataToStream(array_merge(compact('id'), $data)))
->send($this->buildUrl(
'/cgi-bin/department/update',
Expand Down
Loading

0 comments on commit 92e2a4a

Please sign in to comment.