Skip to content

Commit

Permalink
拉取单张会员卡数据接口 (#1294)
Browse files Browse the repository at this point in the history
* 拉取单张会员卡数据接口

* 拉取单张会员卡数据接口 $cardId 参数必填

* 修改拉取单张会员卡数据接口方法名
  • Loading branch information
WayneLiang authored and overtrue committed Jul 11, 2018
1 parent ac4b8fd commit c56f2f6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/OfficialAccount/DataCube/Client.php
Expand Up @@ -297,6 +297,24 @@ public function memberCardSummary(string $from, string $to, $condSource = 0)
return $this->query('datacube/getcardmembercardinfo', $from, $to, $ext);
}

/**
* 拉取单张会员卡数据接口.
*
* @param string $from
* @param string $to
* @param string $cardId
*
* @return mixed
*/
public function memberCardSummaryById(string $from, string $to, string $cardId)
{
$ext = [
'card_id' => $cardId,
];

return $this->query('datacube/getcardmembercarddetail', $from, $to, $ext);
}

/**
* 查询数据.
*
Expand Down
11 changes: 11 additions & 0 deletions tests/OfficialAccount/DataCube/ClientTest.php
Expand Up @@ -203,6 +203,17 @@ public function testMemberCardSummary()
$this->assertSame('mock-result', $client->memberCardSummary('2017-08-02', '2017-08-10', '67'));
}

public function testMemberCardSummaryById()
{
$client = $this->mockApiClient(Client::class, ['query']);

$client->expects()->query('datacube/getcardmembercarddetail', '2017-08-02', '2017-08-10', [
'card_id' => 'mock-card_id',
])->andReturn('mock-result')->once();

$this->assertSame('mock-result', $client->memberCardSummaryById('2017-08-02', '2017-08-10', 'mock-card_id'));
}

public function testQuery()
{
$client = $this->mockApiClient(Client::class)->makePartial();
Expand Down

0 comments on commit c56f2f6

Please sign in to comment.