-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3d23b5e
Showing
41 changed files
with
3,191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = false | ||
|
||
[*.{vue,js,scss}] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
* text=auto | ||
|
||
/tests export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
.scrutinizer.yml export-ignore | ||
.travis.yml export-ignore | ||
phpunit.php export-ignore | ||
phpunit.xml.dist export-ignore | ||
phpunit.xml export-ignore | ||
.php_cs export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.idea | ||
*.DS_Store | ||
/vendor | ||
/coverage | ||
sftp-config.json | ||
composer.lock | ||
.subsplit | ||
.php_cs.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
$header = <<<EOF | ||
This file is part of the imactool/jinritemai. | ||
(c) weslee <[email protected]> | ||
This source file is subject to the MIT license that is bundled. | ||
EOF; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRiskyAllowed(true) | ||
->setRules(array( | ||
'@Y' => true, | ||
'header_comment' => array('header' => $header), | ||
'array_syntax' => array('syntax' => 'short'), | ||
'ordered_imports' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'php_unit_construct' => true, | ||
'php_unit_strict' => true, | ||
)) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->exclude('vendor') | ||
->in(__DIR__) | ||
) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<h1 align="center"> dahuacloud </h1> | ||
|
||
<p align="center"> <a href="https://www.cloud-dahua.com/wiki" target="_blank">大华云睿开放平台</a> </p> | ||
|
||
> 需要先熟悉大华云睿开放平台的文档 https://www.cloud-dahua.com/wiki | ||
> 没有特别说明的接口,则需按照文档传递 | ||
## Installing | ||
|
||
```shell | ||
$ composer require imactool/dahuacloud -vvv | ||
``` | ||
|
||
|
||
## Usage | ||
|
||
```php | ||
|
||
require __DIR__ .'/vendor/autoload.php'; | ||
|
||
use Imactool\DahuaCloud\Cloud; | ||
|
||
$config = [ | ||
'client_id' => '平台的client_id', | ||
'client_secret' => '平台的client_secret' | ||
]; | ||
|
||
$cloud = new Cloud($config); | ||
|
||
//获取场所管理 的场所列表 | ||
$params = [ | ||
'pageSize' => 10, | ||
'pageNum' => 1 | ||
]; | ||
$res = $cloud->Org->getPlaceList($params); | ||
var_dump($res); | ||
|
||
//获取业主二维码 | ||
$personFileId = '550970137048096768'; | ||
$res = $dh->Asc->getQrcode($personFileId); | ||
var_dump($res); | ||
|
||
|
||
//社区-混合云三方接口 | ||
$communityCode = '60bd440488654354bc78f46d657ab91b'; | ||
$mixSer = $dh->Mix->mixHeader($communityCode); | ||
$params = [ | ||
'pageNum' => 1, | ||
'pageSize' => 20 | ||
]; | ||
//查询开门记录 | ||
$res = $mixSer->doorOpenRecord($params); | ||
var_dump($res); | ||
|
||
|
||
//云存储 -> 查询通道是否开通云存储 | ||
$params = ['0','1','2']; //设备序列号$通道id 列表 | ||
$res = $dh->Mixed->getStorageStrategy($params); | ||
var_dump($res); | ||
|
||
|
||
//同步人员授权 | ||
$params =[ | ||
'channelId' => 0, | ||
'deviceId' => '11dsdsse23432', | ||
'operateType'=>1, | ||
'personFileId' => '7634076932312329168' | ||
]; | ||
$res = $dh->Asc->syncAuthPersonToDevice($params); | ||
var_dump($res); | ||
|
||
//远程开门 | ||
$params =[ | ||
'accessSource' => 0, | ||
'type' => 'remote', | ||
'deviceId' => '11dsdsse23432', | ||
]; | ||
$res = $dh->Asc->remoteOpenDoor($params); | ||
var_dump($res); | ||
|
||
|
||
|
||
//查询单个设备详情 | ||
$params = [ | ||
'deviceId' =>'11dsdsse23432' | ||
]; | ||
$res = $dh->Device->getDeviceInfo($params); | ||
var_dump($res); | ||
|
||
//获取开门计划 | ||
$res = $dh->Asc->getDoorTimePlan(); | ||
var_dump($res); | ||
|
||
|
||
//添加设备 | ||
$params = [ | ||
'storeId' => '2323232323232', //要添加的组织场所id | ||
'name' => '监控摄像测试', | ||
'deviceId' => '11dsdsse23432', | ||
'devUsername'=>'admin', //设备用户名(使用Base64编码传入,默认为admin) --> 不需要额外处理 | ||
'devPassword' =>'lc888888' //设备密码(使用Base64编码传入,默认为admin123)--> 不需要额外处理 | ||
]; | ||
$res = $dh->Device->addDevice($params); | ||
var_dump($res); | ||
|
||
//删除设备 | ||
$deviceId = '11dsdsse23432'; | ||
$res = $dh->Device->deleteDevice($deviceId); | ||
var_dump($res); | ||
|
||
|
||
|
||
``` | ||
|
||
更多方法,请看源文件(可以使用 请求地址进行搜索匹配接口) | ||
|
||
|
||
|
||
## License | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "imactool\/dahuaCloud", | ||
"description": "大华云睿", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "weslee", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"guzzlehttp/guzzle": "^6.5", | ||
"symfony/cache": "^4.4" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Imactool\\DahuaCloud\\": "src" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="Application Test Suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">src/</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?php | ||
/** | ||
* ====================================================== | ||
* Author: cc | ||
* Created by PhpStorm. | ||
* Copyright (c) cc Inc. All rights reserved. | ||
* Desc: 代码功能描述 | ||
* ====================================================== | ||
*/ | ||
|
||
namespace Imactool\DahuaCloud\Account; | ||
|
||
use Imactool\DahuaCloud\Core\BaseService; | ||
|
||
class Account extends BaseService | ||
{ | ||
|
||
/** | ||
* 删除用户或管理员 | ||
*/ | ||
public function deleteUser($userId) | ||
{ | ||
$params = [ | ||
'userId' => $userId | ||
]; | ||
return $this->deleteJson('/gateway/membership/api/user/delete/'.$userId,$params); | ||
} | ||
|
||
/** | ||
* 启用用户或管理员账号 | ||
*/ | ||
public function isEnableUser(array $params) | ||
{ | ||
return $this->postJosn('/gateway/membership/api/user/setIsEnable',$params); | ||
} | ||
|
||
/** | ||
* 根据ID查询用户或管理员详情 | ||
*/ | ||
public function getUserInfoById($userId) | ||
{ | ||
$params = [ | ||
'userId' => $userId | ||
]; | ||
return $this->getJson('/gateway/membership/api/user/getUserInfo/'.$userId,$params); | ||
} | ||
|
||
/** | ||
* 查询用户或管理员信息 | ||
*/ | ||
public function getUserInfo(array $params) | ||
{ | ||
return $this->getJson('/gateway/membership/api/user/page',$params); | ||
} | ||
|
||
/** | ||
* 根据手机号查询用户或管理员详情 | ||
*/ | ||
public function getUserInfoByPhone($telephone) | ||
{ | ||
$params = [ | ||
'telephone' => $telephone | ||
]; | ||
return $this->getJson('/gateway/membership/api/user/getUser/'.$telephone,$params); | ||
} | ||
|
||
/** | ||
* 新增用户或管理员 | ||
*/ | ||
public function addUser(array $params) | ||
{ | ||
return $this->postJosn('/gateway/membership/api/user/add',$params); | ||
} | ||
|
||
/** | ||
* 查询所有角色信息 | ||
*/ | ||
public function getAllUser() | ||
{ | ||
return $this->getJson('/gateway/membership/api/user/position/getCurList'); | ||
} | ||
|
||
/** | ||
* 修改用户或管理员基本信息 | ||
* @param array $params | ||
* | ||
* @return mixed | ||
* @author cc | ||
*/ | ||
public function updateUser(array $params) | ||
{ | ||
return $this->postJosn('/gateway/membership/api/user/update',$params); | ||
} | ||
|
||
/** | ||
* 修改用户或管理员场所权限 | ||
* @param array $params | ||
* | ||
* @return mixed | ||
* @author cc | ||
*/ | ||
public function updateUserPlaceAuthority(array $params) | ||
{ | ||
return $this->postJosn('/gateway/membership/api/user/storeAuthority',$params); | ||
} | ||
|
||
/** | ||
* 修改用户或管理员角色权限 | ||
* @param array $params | ||
* | ||
* @return mixed | ||
* @author cc | ||
*/ | ||
public function updateUserRoleAuthority(array $params) | ||
{ | ||
return $this->postJosn('/gateway/membership/api/user/postion',$params); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* ====================================================== | ||
* Author: cc | ||
* Created by PhpStorm. | ||
* Copyright (c) cc Inc. All rights reserved. | ||
* Desc: 代码功能描述 | ||
* ====================================================== | ||
*/ | ||
|
||
namespace Imactool\DahuaCloud\Account; | ||
|
||
use Imactool\DahuaCloud\Core\Container; | ||
use Imactool\DahuaCloud\Interfaces\Provider; | ||
|
||
class AccountProvider implements Provider | ||
{ | ||
public function serviceProvider(Container $container) | ||
{ | ||
$container['Account'] = function ($container) { | ||
return new Account($container); | ||
}; | ||
} | ||
} |
Oops, something went wrong.