Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
iMactool committed Jun 14, 2022
0 parents commit f402e7b
Show file tree
Hide file tree
Showing 45 changed files with 2,180 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
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
11 changes: 11 additions & 0 deletions .gitattributes
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
8 changes: 8 additions & 0 deletions .gitignore
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
27 changes: 27 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
$header = <<<EOF
This file is part of the imactool/hikcloud.
(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__)
)
;
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<h1 align="center"> hikcloud </h1>

<p align="center"> 企业内部应用开发-社区.</p>


## 安装

```shell
$ composer require imactool/hikcloud -vvv
```

## 使用

```php

require __DIR__ .'/vendor/autoload.php';

use Imactool\Hikcloud\HikCloud;


$config = [
'client_id' => '客户端ID',
'client_secret' => '访问密钥'
];

$hikCloud = new HikCloud($config);

//开始使用
$params = [
'communityName' =>'龙湖社区',
'provinceCode' =>'130002',
'addressDetail' =>'玉兰大道与黄山路交叉口192号'
];
$res = $hik->Communit->communities($params);
var_dump($res);
```

`client_id` 使用云眸系统管理员账号登录开放平台门户网站 [open2.hik-cloud.com](https://www.hik-cloud.com/poseidon/index.html#/) ,进入密钥管理页面查看获取

`client_secret` 使用云眸账号登录开放平台门户网站 [open2.hik-cloud.com](https://www.hik-cloud.com/poseidon/index.html#/) ,进入密钥管理页面查看获取

更多用法请参考源码

## 参考文档
> 请熟悉和参考文档的参数要求
[企业内部应用开发-社区 ](https://pic.hik-cloud.com/opencustom/apidoc/online/neptune/4cb4c4f2147e4624bc29408ac70e92c4.html?timestamp=1653966047558)

#### 典型使用场景
- 访客邀请:通过云眸社区 API实现住户邀请访客以二维码开门的方式出入社区场景。
- 社区管理:通过云眸社区 API实现社区、楼栋、单元、户室信息的增、删、改、查操作,应用于智慧社区管理场景。
- 门禁管理:通过云眸社区 API远程操控海康门禁对讲设备,实现人员权限下发,远程一键开门等业务场景。
- 可视对讲:通过云眸社区 API接入海康可视对讲设备,第三方通过集成可视对讲SDK,实现单元门口机/围墙机的APP呼叫功能,应用于智慧社区场景。

## Contributing

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/imactool/hikcloud/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/imactool/hikcloud/issues).
3. Contribute new features or update the wiki.

_The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable._

## License

MIT
20 changes: 20 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "imactool\/hikcloud",
"description": "企业内部应用开发-社区",
"license": "MIT",
"authors": [
{
"name": "weslee",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Imactool\\Hikcloud\\": "src"
}
},
"require": {
"guzzlehttp/guzzle": "^6.5",
"symfony/cache": "^4.4"
}
}
21 changes: 21 additions & 0 deletions phpunit.xml.dist
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 added src/.gitkeep
Empty file.
26 changes: 26 additions & 0 deletions src/Ad/Ad.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* ======================================================
* Author: cc
* Created by PhpStorm.
* Copyright (c) cc Inc. All rights reserved.
* Desc: 代码功能描述
* ======================================================
*/

namespace Imactool\Hikcloud\Ad;

use Imactool\Hikcloud\Core\BaseService;

class Ad extends BaseService
{
public function publishProgram(array $params)
{
return $this->postJosn('api/v1/estate/publish/actions/publishProgram',$params);
}

public function deleteProgram($deviceIds)
{
return $this->postJosn('api/v1/estate/publish/actions/deleteProgram',['deviceIds'=>$deviceIds]);
}
}
24 changes: 24 additions & 0 deletions src/Ad/AdProvider.php
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\Hikcloud\Ad;

use Imactool\Hikcloud\Core\Container;
use Imactool\Hikcloud\Interfaces\Provider;

class AdProvider implements Provider
{
public function serviceProvider (Container $container)
{
$container['Ad'] = function ($container){
return new Ad($container);
};
}
}
42 changes: 42 additions & 0 deletions src/Ai/Ai.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* ======================================================
* Author: cc
* Created by PhpStorm.
* Copyright (c) cc Inc. All rights reserved.
* Desc: 代码功能描述
* ======================================================
*/

namespace Imactool\Hikcloud\Ai;

use Imactool\Hikcloud\Core\BaseService;

class Ai extends BaseService
{
public function getModels(array $params)
{
return $this->getJson('api/v1/ai/intelligence/models',$params);
}

public function trainVersions(array $params)
{
return $this->getJson('api/v1/ai/intelligence/models/trainVersions',$params);
}

public function analysis(array $params)
{
return $this->postJosn('api/v1/ai/intelligence/models/trainVersions/actions/analysi',$params);
}

public function trainVersionInfo($versionid)
{
$endpoint = 'api/v1/ai/intelligence/models/trainVersions/'.$versionid;
return $this->getJson($endpoint,['versionId'=>$versionid]);
}

public function feedbackByTraceId($traceId)
{
return $this->postJosn('api/v1/ai/intelligence/actions/feedbackByTraceId',['traceId'=>$traceId]);
}
}
24 changes: 24 additions & 0 deletions src/Ai/AiProvider.php
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\Hikcloud\Ai;

use Imactool\Hikcloud\Core\Container;
use Imactool\Hikcloud\Interfaces\Provider;

class AiProvider implements Provider
{
public function serviceProvider (Container $container)
{
$container['Ai'] = function ($container){
return new Ai($container);
};
}
}
Loading

0 comments on commit f402e7b

Please sign in to comment.