Skip to content

Commit

Permalink
fix paginate
Browse files Browse the repository at this point in the history
  • Loading branch information
herojhc committed Jun 14, 2019
1 parent 91b2d9b commit 8277ecc
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function up()
$table->boolean('is_linkman')->default(0)->nullable();
$table->boolean('is_supervision')->default(0)->nullable();
$table->string('open_id', 50)->default('')->nullable();
$table->dateTime('attention_at')->nullable();
$table->timestamps();
});
}
Expand Down
14 changes: 8 additions & 6 deletions src/XinXiHua/SDK/Services/ArticleService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ class ArticleService extends BaseService
{

/**
* @param array $criteria
* @param null $corpId
* @return mixed
* @throws ApiException
*/
public function all($corpId = null)
public function all($criteria = [], $corpId = null)
{
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/articles');
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/articles', $criteria);
if ($response->isResponseSuccess()) {
return $response->getResponseData()['data'];
}
Expand All @@ -32,18 +33,19 @@ public function all($corpId = null)
/**
* @param int $page
* @param int $limit
* @param array $criteria
* @param null $corpId
* @return mixed
* @throws ApiException
*/
public function paginate($page = 1, $limit = 20, $corpId = null)
public function paginate($page = 1, $limit = 20, $criteria = [], $corpId = null)
{
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/articles', [
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/articles', array_merge([
'page' => $page,
'limit' => $limit
]);
], $criteria));
if ($response->isResponseSuccess()) {
return $response->getResponseData()['data'];
return $response->getResponseData();
}
throw new ApiException($response->getResponseMessage());
}
Expand Down
2 changes: 1 addition & 1 deletion src/XinXiHua/SDK/Services/ContactService.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function paginate($page = 1, $limit = 20, $criteria = [], $include = [],
'include' => implode(',', $include)
], $criteria));
if ($response->isResponseSuccess()) {
return $response->getResponseData()['data'];
return $response->getResponseData();
}
throw new ApiException($response->getResponseMessage());
}
Expand Down
16 changes: 9 additions & 7 deletions src/XinXiHua/SDK/Services/DepartmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ class DepartmentService extends BaseService
{

/**
* @param array $criteria
* @param array $include
* @param null $corpId
* @return mixed
* @throws ApiException
*/
public function all($include = [], $corpId = null)
public function all($criteria = [], $include = [], $corpId = null)
{
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/departments', [
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/departments', array_merge([
'include' => implode(',', $include)
]);
]), $criteria);
if ($response->isResponseSuccess()) {
return $response->getResponseData()['data'];
}
Expand All @@ -34,20 +35,21 @@ public function all($include = [], $corpId = null)
/**
* @param int $page
* @param int $limit
* @param array $criteria
* @param array $include
* @param null $corpId
* @return mixed
* @throws ApiException
*/
public function paginate($page = 1, $limit = 20, $include = [], $corpId = null)
public function paginate($page = 1, $limit = 20, $criteria = [], $include = [], $corpId = null)
{
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/departments', [
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/departments', array_merge([
'page' => $page,
'limit' => $limit,
'include' => implode(',', $include)
]);
], $criteria));
if ($response->isResponseSuccess()) {
return $response->getResponseData()['data'];
return $response->getResponseData();
}
throw new ApiException($response->getResponseMessage());
}
Expand Down
16 changes: 9 additions & 7 deletions src/XinXiHua/SDK/Services/EmployeeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ class EmployeeService extends BaseService
{

/**
* @param array $criteria
* @param array $include
* @param null $corpId
* @return mixed
* @throws ApiException
*/
public function all($include = [], $corpId = null)
public function all($criteria = [], $include = [], $corpId = null)
{
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/employees', [
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/employees', array_merge([
'include' => implode(',', $include)
]);
], $criteria));
if ($response->isResponseSuccess()) {
return $response->getResponseData()['data'];
}
Expand All @@ -34,20 +35,21 @@ public function all($include = [], $corpId = null)
/**
* @param int $page
* @param int $limit
* @param array $criteria
* @param array $include
* @param null $corpId
* @return mixed
* @throws ApiException
*/
public function paginate($page = 1, $limit = 20, $include = [], $corpId = null)
public function paginate($page = 1, $limit = 20, $criteria = [], $include = [], $corpId = null)
{
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/employees', [
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/employees', array_merge([
'page' => $page,
'limit' => $limit,
'include' => implode(',', $include)
]);
], $criteria));
if ($response->isResponseSuccess()) {
return $response->getResponseData()['data'];
return $response->getResponseData();
}
throw new ApiException($response->getResponseMessage());
}
Expand Down
16 changes: 9 additions & 7 deletions src/XinXiHua/SDK/Services/ProductService.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
class ProductService extends BaseService
{
/**
* @param array $criteria
* @param array $include
* @param null $corpId
* @return mixed
* @throws ApiException
*/
public function all($include = ['logo'], $corpId = null)
public function all($criteria = [], $include = ['logo'], $corpId = null)
{
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/products', [
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/products', array_merge([
'include' => implode(',', $include)
]);
], $criteria));
if ($response->isResponseSuccess()) {
return $response->getResponseData()['data'];
}
Expand All @@ -32,20 +33,21 @@ public function all($include = ['logo'], $corpId = null)
/**
* @param int $page
* @param int $limit
* @param array $criteria
* @param array $include
* @param null $corpId
* @return mixed
* @throws ApiException
*/
public function paginate($page = 1, $limit = 20, $include = ['logo'], $corpId = null)
public function paginate($page = 1, $limit = 20, $criteria = [], $include = ['logo'], $corpId = null)
{
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/products', [
$response = $this->accessToken->getIsvCorpClient($corpId)->get('/products', array_merge([
'page' => $page,
'limit' => $limit,
'include' => implode(',', $include)
]);
], $criteria));
if ($response->isResponseSuccess()) {
return $response->getResponseData()['data'];
return $response->getResponseData();
}
throw new ApiException($response->getResponseMessage());
}
Expand Down
2 changes: 1 addition & 1 deletion src/XinXiHua/SDK/Services/RoleService.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function paginate($page = 1, $limit = 20, $criteria = [], $include = [],
'include' => implode(',', $include)
], $criteria));
if ($response->isResponseSuccess()) {
return $response->getResponseData()['data'];
return $response->getResponseData();
}
throw new ApiException($response->getResponseMessage());
}
Expand Down

0 comments on commit 8277ecc

Please sign in to comment.