qixinyun / huizhong-member-sdk
huizhong member sdk
0.4
2019-04-27 08:55 UTC
Requires
- qixinyun/huizhong-sdk: ~0.1
Requires (Dev)
- chloroplast/marmot-framework: ~0.3
- fzaninotto/faker: 1.7.1
- pdepend/pdepend: 2.5.2
- phploc/phploc: 4.0.1
- phpmd/phpmd: 2.6.0
- phpunit/phpunit: 6.4.4
- sebastian/phpcpd: 3.0.1
- squizlabs/php_codesniffer: 3.1
This package is not auto-updated.
Last update: 2024-11-03 11:43:51 UTC
README
概述
用于集成在内部服务间调用member
服务使用的SDK-php
服务, 减少冗余代码, 和重复代码开发.
目录
安装说明
composer
安装
使用说明
初始化
$sdk = new Sdk\Member\Sdk('接口地址', array('apikey'=>'密钥'));
错误处理
我们请求一个不存在用户
$member = $sdk->memberRepository()->scenario(array('fields'=>['members'=>'cellphone']))->fetchOne(10);
这里我们会返回一个NullMember
, 如果是搜索或者请求多个数据则会返回空数组
获取接口返回错误id
$sdk->memberRepository()->lastErrorId()
...
10
获取接口返回错误信息
$sdk->memberRepository()->lastErrorInfo()
...
array(1) {
'errors' =>
array(1) {
[0] =>
array(8) {
'id' =>
string(2) "10"
'links' =>
array(1) {
...
}
'status' =>
string(3) "404"
'code' =>
string(18) "RESOURCE_NOT_EXIST"
'title' =>
string(18) "Resource not exist"
'detail' =>
string(28) "Server can not find resource"
'source' =>
array(0) {
...
}
'meta' =>
array(0) {
...
}
}
}
}
定制参数
scenario
内使用数组格式填写jsonapi
的fields
和include
.
$member = $sdk->memberRepository()->scenario(array('fields'=>['members'=>'cellphone']))->fetchOne(1);
返回示例
- 单个获取: 返回对象
- 获取多个,搜索:
array(int $count, array $objectList)
版本
项目字典
企业, 用户等通用词汇沿用huizhonglianhe-backend-member的项目字典.
- 认证
authentication