|
|
6 months ago | |
|---|---|---|
| .. | ||
| Docs | 6 months ago | |
| Dto | 6 months ago | |
| Request | 6 months ago | |
| Services | 6 months ago | |
| Util | 6 months ago | |
| Webhook | 6 months ago | |
| UrsServiceProvider.php | 6 months ago | |
| readme.md | 6 months ago | |
URS(User Referral System)用户推广系统第三方包,用于对接URS生态系统的API接口。
重要更新:本包已重构为遵循"一个Request类只完成一种请求"的原则,每个API操作都有对应的专用Request类。
Urs/
├── readme.md # 本说明文件
├── UrsServiceProvider.php # 服务提供者
├── Request/ # 请求类目录
│ ├── UrsGetUserInfoRequest.php # 获取用户信息请求类
│ ├── UrsGetUserTeamRequest.php # 获取用户团队关系请求类
│ └── UrsGetUserLevelCountRequest.php # 获取用户下级统计请求类
├── Services/ # 服务类目录
│ └── UrsService.php # URS统一服务类
├── Webhook/ # Webhook处理器目录
│ ├── UrsRegisterWebhook.php # 注册通知处理器
│ ├── UrsDepositWebhook.php # 充值通知处理器
│ ├── UrsWithdrawWebhook.php # 提取通知处理器
│ └── UrsCheckWebhook.php # 检查通知处理器
├── Util/ # 工具类目录
│ └── CryptoService.php # 加密服务类
└── Docs/ # 文档目录
├── Api.md # API文档
├── URS对接建议.md # 对接建议
├── urs对接.md # 对接说明
└── urs对接ThirdParty文档.md # ThirdParty对接文档
UrsRequest类使用switch语句处理多种操作本包包含URS实际提供的业务接口对应的Request类。
UrsLoginRequestmobile(手机号码)、password(登录密码)UrsGetUserInfoRequestuserKey(用户密钥)UrsGetUserTeamRequestuserId(用户ID)UrsGetUserLevelCountRequestuserId(用户ID)、level(1或3)use ThirdParty\Urs\Request\UrsGetUserInfoRequest;
$request = new UrsGetUserInfoRequest();
$result = $request->request(['userKey' => 'user_key_here']);
use ThirdParty\Urs\Services\UrsService;
// 用户登录
$loginResult = UrsService::login('18600648353', 'a123123');
// 获取用户信息
$userInfo = UrsService::getUserInfo('user_key_here');
// 获取用户团队关系
$userTeam = UrsService::getUserTeam(12345);
// 获取用户下级统计
$levelCount = UrsService::getUserLevelCount(12345, 1);
POST /thirdParty/webhook/urs/registerPOST /thirdParty/webhook/urs/depositPOST /thirdParty/webhook/urs/withdrawPOST /thirdParty/webhook/urs/check设计资金系统操作,需要创建专属充值资金操作用户ID,充值的资金如钻石从这个专属用户账户转移到用户账户;提取钻石专属操作用户ID,提取钻石从用户账户转移到这个专属用户账户
在thirdparty_services表中注册URS服务配置:
{
"api_url": "https://urs.example.com",
"app_key": "your_app_key_here",
"ecology_id": 1,
"app_id": "your_app_id",
"app_secret": "your_app_secret"
}
Api通讯 Key : Hy0LmLKJSbDQY2oaaZOZKR1XKpFHSY8Y ecology_id 生态ID: 1 用户Key (测试用,实际通过客户端传递) ukey : $2y$10$i.h97m13olfIaU.ZTYiyeeXFl8xqn48w2bFiAhcoQsJdU6K3w.Lgu