From ad26fc8430187197a41631ff11c5233ed94ed09d Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Thu, 27 Feb 2020 16:02:13 +0800 Subject: [PATCH 01/60] update --- .example.env | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .example.env diff --git a/.example.env b/.example.env deleted file mode 100644 index c27f74c..0000000 --- a/.example.env +++ /dev/null @@ -1 +0,0 @@ -APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = test USERNAME = username PASSWORD = password HOSTPORT = 3306 CHARSET = utf8 DEBUG = true [LANG] default_lang = zh-cn \ No newline at end of file From ef011f34deb026c84495022ccc471f314bfcac5c Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Thu, 27 Feb 2020 16:13:56 +0800 Subject: [PATCH 02/60] v1.0 --- view/README.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 view/README.md diff --git a/view/README.md b/view/README.md deleted file mode 100644 index 360eb24..0000000 --- a/view/README.md +++ /dev/null @@ -1 +0,0 @@ -如果不使用模板,可以删除该目录 \ No newline at end of file From eba1385b94fe5d0db005aa067ca29d9a4a8e10da Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Thu, 19 Mar 2020 21:02:27 +0800 Subject: [PATCH 03/60] =?UTF-8?q?=E4=BA=91=E5=BC=80=E5=8F=91=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3&=E6=95=B0=E6=8D=AE=E5=BA=93=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 7 ++++ app/controller/Member.php | 65 ++++++++++++++++++++++++++++++++++++++ app/controller/Miniapp.php | 57 +++++++++++++++++++++++++++++++++ app/controller/Role.php | 42 ++++++++++++++++++++++++ app/controller/User.php | 39 +++++++++++++++++++++++ app/model/Role.php | 15 +++++++++ app/service/CloudApi.php | 17 ++++++++++ config/database.php | 4 +-- config/miniapp.php | 10 ++++++ 9 files changed, 254 insertions(+), 2 deletions(-) create mode 100644 app/controller/Member.php create mode 100644 app/controller/Miniapp.php create mode 100644 app/controller/Role.php create mode 100644 app/controller/User.php create mode 100644 app/model/Role.php create mode 100644 app/service/CloudApi.php create mode 100644 config/miniapp.php diff --git a/app/common.php b/app/common.php index 57cb6d8..2b83519 100644 --- a/app/common.php +++ b/app/common.php @@ -1,2 +1,9 @@ getAccessToken(); + $obj = new class{}; + $obj->env = $env; + $obj->query = $query; + $data = json_encode($obj); + + return $this->http_request($url,$data); + + } + + public function http_request($url, $data = null) + { + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); + if (! empty($data)) { + curl_setopt($curl, CURLOPT_POST, 1); + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + } + curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); + $output = curl_exec($curl); + curl_close($curl); + return $output; + } + +} diff --git a/app/controller/Miniapp.php b/app/controller/Miniapp.php new file mode 100644 index 0000000..0a3d734 --- /dev/null +++ b/app/controller/Miniapp.php @@ -0,0 +1,57 @@ +getAccessToken(); + $obj = new class{}; + $obj->env = 'test-87exc'; + $obj->query = $query; + $data = json_encode($obj); + + return $this->http_request($url,$data); + + } + + public function http_request($url, $data = null) + { + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); + if (! empty($data)) { + curl_setopt($curl, CURLOPT_POST, 1); + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + } + curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); + $output = curl_exec($curl); + curl_close($curl); + return json($output); + } + +} diff --git a/app/controller/Role.php b/app/controller/Role.php new file mode 100644 index 0000000..fb42389 --- /dev/null +++ b/app/controller/Role.php @@ -0,0 +1,42 @@ +select(); + + return $this->ok($list); + + } + + private function ok($data) { + $code = 20000; + $message = 'success'; + $result=array( + 'code' => $code, + 'message' => $message, + 'data' => $data + ); + + return json_encode($result); + } + + private function fail($data) { + $code = 10000; + $message = 'fail'; + $result=array( + 'code' => $code, + 'message' => $message, + 'data' => $data + ); + + return json_encode($result); + } + +} + diff --git a/app/controller/User.php b/app/controller/User.php new file mode 100644 index 0000000..c44b01c --- /dev/null +++ b/app/controller/User.php @@ -0,0 +1,39 @@ + 'admin-token']; + $data = ['data' => $token, 'code' => 20000]; + return json($data); + } + + public function info() + { + //1 根据token查询用户信息 + $roles=array(0=>"admin"); + $result = ['roles' => $roles, 'name' => 'Super Admin',"introduction" => '',"avatar" =>'']; + $data = ['code' => 20000, 'msg' => 'success', 'data' => $result]; + + return json($data); + } + + public function logout() + { + //1 清除token + session('token',null); + $data = ['code' => 20000, 'msg' => 'success']; + + return json($data); + + } + +} diff --git a/app/model/Role.php b/app/model/Role.php new file mode 100644 index 0000000..54d5924 --- /dev/null +++ b/app/model/Role.php @@ -0,0 +1,15 @@ + 'int', + 'name' => 'string', + 'create_time' => 'datetime', + 'update_time' => 'datetime', + ]; +} diff --git a/app/service/CloudApi.php b/app/service/CloudApi.php new file mode 100644 index 0000000..5592e77 --- /dev/null +++ b/app/service/CloudApi.php @@ -0,0 +1,17 @@ +*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

:) 2020新春快乐

ThinkPHP V' . \think\facade\App::version() . '
14载初心不改 - 你值得信赖的PHP框架

[ V6.0 版本由 亿速云 独家赞助发布 ]
'; + } + + public function hello($name = 'ThinkPHP6') + { + return 'hello,' . $name; + } +} diff --git a/config/database.php b/config/database.php index 7b94ac1..bb2ffc3 100644 --- a/config/database.php +++ b/config/database.php @@ -23,11 +23,11 @@ // 服务器地址 'hostname' => env('database.hostname', '127.0.0.1'), // 数据库名 - 'database' => env('database.database', ''), + 'database' => env('database.database', 'jxhhyq'), // 用户名 'username' => env('database.username', 'root'), // 密码 - 'password' => env('database.password', ''), + 'password' => env('database.password', 'dys114818'), // 端口 'hostport' => env('database.hostport', '3306'), // 数据库连接参数 diff --git a/config/miniapp.php b/config/miniapp.php new file mode 100644 index 0000000..a905b7a --- /dev/null +++ b/config/miniapp.php @@ -0,0 +1,10 @@ + 'wxc429fdf05d591605', + // 用户唯一凭证密钥 + 'secret' => '6d92b57ad1d5137a1c4a3cc7c34f7705' +]; From 3e1c9d7fc5af67177697d657f5910a4949cd72ef Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sat, 11 Apr 2020 17:22:38 +0800 Subject: [PATCH 04/60] update --- app/AppService.php | 4 + app/common.php | 128 +- app/controller/Device.php | 21 + app/controller/Index.php | 3 +- app/controller/Member.php | 64 +- app/controller/Role.php | 26 +- app/controller/User.php | 6 + app/model/DeviceModel.php | 28 + app/model/{Role.php => RoleModel.php} | 2 +- app/model/UserModel.php | 28 + app/service/CloudApi.php | 17 - app/service/CloudApiService.php | 44 + app/service/DeviceService.php | 30 + app/service/UserService.php | 33 + composer.json | 7 +- composer.lock | 1874 +++++++++++++++++++++---- config/smsconfig.php | 17 + config/wxconfig.php | 18 + 18 files changed, 1960 insertions(+), 390 deletions(-) create mode 100644 app/controller/Device.php create mode 100644 app/model/DeviceModel.php rename app/model/{Role.php => RoleModel.php} (87%) create mode 100644 app/model/UserModel.php delete mode 100644 app/service/CloudApi.php create mode 100644 app/service/CloudApiService.php create mode 100644 app/service/DeviceService.php create mode 100644 app/service/UserService.php create mode 100644 config/smsconfig.php create mode 100644 config/wxconfig.php diff --git a/app/AppService.php b/app/AppService.php index 96556e8..f58f7e2 100644 --- a/app/AppService.php +++ b/app/AppService.php @@ -3,6 +3,8 @@ namespace app; +use app\service\CloudApiService; +use app\service\UserService; use think\Service; /** @@ -13,6 +15,8 @@ class AppService extends Service public function register() { // 服务注册 + $this->app->bind('cloudService',CloudApiService::class); + $this->app->bind('userService',UserService::class); } public function boot() diff --git a/app/common.php b/app/common.php index 2b83519..1b23e09 100644 --- a/app/common.php +++ b/app/common.php @@ -1,9 +1,127 @@ regionId('cn-hangzhou') + ->asDefaultClient(); + + try { + $result = AlibabaCloud::rpc() + ->product('Dysmsapi') + // ->scheme('https') // https | http + ->version('2017-05-25') + ->action('SendSms') + ->method('POST') + ->host($smsConfig['host']) + ->options([ + 'query' => [ + 'RegionId' => "cn-hangzhou", + 'PhoneNumbers' => $phone, + 'SignName' => $smsConfig['SignName'], + 'TemplateCode' => $smsConfig['TemplateCode'], + 'TemplateParam' => "{\"code\":$code}", + 'SmsUpExtendCode' => "2", + 'OutId' => "1", + ], + ]) + ->request(); + print_r($result->toArray()); + } catch (ClientException $e) { + echo $e->getErrorMessage() . PHP_EOL; + } catch (ServerException $e) { + echo $e->getErrorMessage() . PHP_EOL; + } +} + +/** + * 获取token + * Author: daiysh + * DateTime: 2020-03-30 15:25 + * @return mixed + */ +function getAccessToken() { + $wxConfig = Config::get('wxconfig'); + // 将token放到缓存中 + $token = Cache::get('access_token'); + if (!$token) { + $res = file_get_contents($wxConfig['getTokenUrl'].'&appid='.$wxConfig['appid'].'&secret='.$wxConfig['secret']); + $res = json_decode($res, true); + $token = $res['access_token']; + $time = $res['expires_in']; + if($token){ + // 缓存在3600秒之后过期 + Cache::set('access_token', $token, $time); + } + } + return $token; + +} + +/** + * http 请求公共方法 + * Author: daiysh + * DateTime: 2020-03-30 15:27 + * @param $url + * @param null $data + * @return bool|string + */ +function httpRequest($url, $data = null) +{ + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); + if (! empty($data)) { + curl_setopt($curl, CURLOPT_POST, 1); + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + } + curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); + $output = curl_exec($curl); + curl_close($curl); + return $output; +} + +function ok($data) { + $code = 20000; + $message = 'success'; + $result=array( + 'code' => $code, + 'message' => $message, + 'data' => $data + ); + + return json_encode($result); +} + +function fail($data) { + $code = 10000; + $message = 'fail'; + $result=array( + 'code' => $code, + 'message' => $message, + 'data' => $data + ); + + return json_encode($result); +} + diff --git a/app/controller/Device.php b/app/controller/Device.php new file mode 100644 index 0000000..c6e927d --- /dev/null +++ b/app/controller/Device.php @@ -0,0 +1,21 @@ +app->deviceService->findList($request->param()); + } + + public function sync() { + + } +} diff --git a/app/controller/Index.php b/app/controller/Index.php index a0c83ce..88f59d1 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -7,11 +7,12 @@ class Index extends BaseController { public function index() { - return '

:) 2020新春快乐

ThinkPHP V' . \think\facade\App::version() . '
14载初心不改 - 你值得信赖的PHP框架

[ V6.0 版本由 亿速云 独家赞助发布 ]
'; + return '

:) 2020新春快乐

ThinkPHP V' . \think\facade\App::version() . '
14载初心不改 - 你值得信赖的PHP框架

[ V6.0 版本由 亿速云 独家赞助发布 ]
'; } public function hello($name = 'ThinkPHP6') { + sendSms('15179140800','567890'); return 'hello,' . $name; } } diff --git a/app/controller/Member.php b/app/controller/Member.php index 9d687c5..80d8b2e 100644 --- a/app/controller/Member.php +++ b/app/controller/Member.php @@ -3,63 +3,29 @@ use app\BaseController; use app\Request; -use think\facade\Cache; + /** - * Created by PhpStorm. - * User: daiyunshan - * Date: 2020-03-18 - * Time: 10:22 + * Class Member + * @package app\controller + * Author: daiysh + * CreateTime: 2020-03-30 17:30 */ - class Member extends BaseController { - public function getAccessToken() { - $appid = 'wxc429fdf05d591605'; //获取用户唯一凭证 - $secret = '6d92b57ad1d5137a1c4a3cc7c34f7705'; //用户唯一凭证密钥 - // 将token放到缓存中 - $token = Cache::get('access_token'); - if (!$token) { - $res = file_get_contents('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' .$appid.'&secret='. $secret); - $res = json_decode($res, true); - $token = $res['access_token']; - $time = $res['expires_in']; - if($token){ - // 缓存在3600秒之后过期 - Cache::set('access_token', $token, $time); - } - } - return $token; - + /** + * 会员列表 + * Author: daiysh + * DateTime: 2020-03-30 17:28 + * @param Request $request + * @return mixed + */ + public function list(Request $request) { + return $this->app->cloudService->databaseQuery($request->param()); } - public function list($env,$query,Request $request) { -// $query = 'db.collection(\"member\").get()'; -// $env = 'test-87exc'; - $url = 'https://api.weixin.qq.com/tcb/databasequery?access_token=' . $this->getAccessToken(); - $obj = new class{}; - $obj->env = $env; - $obj->query = $query; - $data = json_encode($obj); - - return $this->http_request($url,$data); - - } + public function sync() { - public function http_request($url, $data = null) - { - $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); - if (! empty($data)) { - curl_setopt($curl, CURLOPT_POST, 1); - curl_setopt($curl, CURLOPT_POSTFIELDS, $data); - } - curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); - $output = curl_exec($curl); - curl_close($curl); - return $output; } } diff --git a/app/controller/Role.php b/app/controller/Role.php index fb42389..2235c7b 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -10,33 +10,9 @@ public function list() { $list = Db::name('sys_role')->select(); - return $this->ok($list); + return ok($list); } - private function ok($data) { - $code = 20000; - $message = 'success'; - $result=array( - 'code' => $code, - 'message' => $message, - 'data' => $data - ); - - return json_encode($result); - } - - private function fail($data) { - $code = 10000; - $message = 'fail'; - $result=array( - 'code' => $code, - 'message' => $message, - 'data' => $data - ); - - return json_encode($result); - } - } diff --git a/app/controller/User.php b/app/controller/User.php index c44b01c..005bb36 100644 --- a/app/controller/User.php +++ b/app/controller/User.php @@ -36,4 +36,10 @@ public function logout() } + public function add(Request $request) + { + $returnvalue = $this->app->userService->insert($request->param()); + return ok(json($returnvalue)); + } + } diff --git a/app/model/DeviceModel.php b/app/model/DeviceModel.php new file mode 100644 index 0000000..7d8e277 --- /dev/null +++ b/app/model/DeviceModel.php @@ -0,0 +1,28 @@ + 'int', + 'name' => 'string', + 'model_type' => 'string', + 'unit' => 'string', + 'manufacturer' => 'string', + 'manufact_number' => 'string', + 'manufact_date' => 'datetime', + 'use_date' => 'string', + 'purpose' => 'string', + 'remark' => 'string', + 'create_time' => 'datetime', + 'update_time' => 'datetime' + ]; +} diff --git a/app/model/Role.php b/app/model/RoleModel.php similarity index 87% rename from app/model/Role.php rename to app/model/RoleModel.php index 54d5924..ec3e3be 100644 --- a/app/model/Role.php +++ b/app/model/RoleModel.php @@ -3,7 +3,7 @@ use think\Model; -class Role extends Model +class RoleModel extends Model { protected $schema = [ diff --git a/app/model/UserModel.php b/app/model/UserModel.php new file mode 100644 index 0000000..ec80535 --- /dev/null +++ b/app/model/UserModel.php @@ -0,0 +1,28 @@ + 'int', + 'phone' => 'int', + 'name' => 'string', + 'user_id' => 'string', + 'create_time' => 'datetime', + 'update_time' => 'datetime', + ]; +} diff --git a/app/service/CloudApi.php b/app/service/CloudApi.php deleted file mode 100644 index 5592e77..0000000 --- a/app/service/CloudApi.php +++ /dev/null @@ -1,17 +0,0 @@ -*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

:) 2020新春快乐

ThinkPHP V' . \think\facade\App::version() . '
14载初心不改 - 你值得信赖的PHP框架

[ V6.0 版本由 亿速云 独家赞助发布 ]
'; - } - - public function hello($name = 'ThinkPHP6') - { - return 'hello,' . $name; - } -} diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php new file mode 100644 index 0000000..a3d6f47 --- /dev/null +++ b/app/service/CloudApiService.php @@ -0,0 +1,44 @@ +env = self::$env; + $obj->query = $param['query']; + $data = json_encode($obj); + + return httpRequest($url,$data); + + } + + public static function databaseAdd($param) { + + } + + public static function syncTable($table) { + $url = self::$http_api_url . getAccessToken(); + $query = 'db.collection('.$table.').get()'; + $obj = new class{}; + $obj->env = self::$env; + $obj->query = $query; + + $data = json_encode($obj); + $output = httpRequest($url,$data); + + // TODO:保存到数据库中 + + } +} diff --git a/app/service/DeviceService.php b/app/service/DeviceService.php new file mode 100644 index 0000000..dc166b4 --- /dev/null +++ b/app/service/DeviceService.php @@ -0,0 +1,30 @@ +save(); + } + + public static function findList() + { + $list = DeviceModel::find(1); + + return $list; + + } + +} diff --git a/app/service/UserService.php b/app/service/UserService.php new file mode 100644 index 0000000..d462102 --- /dev/null +++ b/app/service/UserService.php @@ -0,0 +1,33 @@ +save(); + } + + public static function delete() + { + Db::name('sys_user')->where('id', 1)->delete(); + + } + + public static function findList() + { + $user = UserModel::find(1); + + } + +} diff --git a/composer.json b/composer.json index 387c8b6..ac0cda6 100644 --- a/composer.json +++ b/composer.json @@ -17,12 +17,15 @@ { "name": "yunwuxin", "email": "448901948@qq.com" - } + } ], "require": { "php": ">=7.1.0", "topthink/framework": "^6.0.0", - "topthink/think-orm": "^2.0" + "topthink/think-orm": "^2.0", + "endroid/qrcode": "^3.7", + "alibabacloud/client": "^1.5", + "endroid/qr-code": "^3.7" }, "require-dev": { "symfony/var-dumper": "^4.2", diff --git a/composer.lock b/composer.lock index bdec3cf..5e78476 100644 --- a/composer.lock +++ b/composer.lock @@ -4,172 +4,1529 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "74a749574e0f40df27b0061a71e2b878", + "content-hash": "dc73c86f83fe84fea36812ecc232cc62", "packages": [ + { + "name": "adbario/php-dot-notation", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/adbario/php-dot-notation.git", + "reference": "eee4fc81296531e6aafba4c2bbccfc5adab1676e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/adbario/php-dot-notation/zipball/eee4fc81296531e6aafba4c2bbccfc5adab1676e", + "reference": "eee4fc81296531e6aafba4c2bbccfc5adab1676e", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.0|^5.0|^6.0", + "squizlabs/php_codesniffer": "^3.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Adbar\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Riku Särkinen", + "email": "riku@adbar.io" + } + ], + "description": "PHP dot notation access to arrays", + "homepage": "https://github.com/adbario/php-dot-notation", + "keywords": [ + "ArrayAccess", + "dotnotation" + ], + "time": "2019-01-01T23:59:15+00:00" + }, + { + "name": "alibabacloud/client", + "version": "1.5.21", + "source": { + "type": "git", + "url": "https://github.com/aliyun/openapi-sdk-php-client.git", + "reference": "a11d68d90d50d2bde46c3a656eef5e0563c08b69" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aliyun/openapi-sdk-php-client/zipball/a11d68d90d50d2bde46c3a656eef5e0563c08b69", + "reference": "a11d68d90d50d2bde46c3a656eef5e0563c08b69", + "shasum": "" + }, + "require": { + "adbario/php-dot-notation": "^2.2", + "clagiordano/weblibs-configmanager": "^1.0", + "danielstjules/stringy": "^3.1", + "ext-curl": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "ext-simplexml": "*", + "ext-xmlwriter": "*", + "guzzlehttp/guzzle": "^6.3", + "mtdowling/jmespath.php": "^2.4", + "php": ">=5.5" + }, + "require-dev": { + "composer/composer": "^1.8", + "drupal/coder": "^8.3", + "ext-dom": "*", + "ext-pcre": "*", + "ext-sockets": "*", + "ext-spl": "*", + "league/climate": "^3.2.4", + "mikey179/vfsstream": "^1.6", + "monolog/monolog": "^1.24", + "phpunit/phpunit": "^4.8.35|^5.4.3", + "psr/cache": "^1.0", + "symfony/dotenv": "^3.4", + "symfony/var-dumper": "^3.4" + }, + "suggest": { + "ext-sockets": "To use client-side monitoring" + }, + "type": "library", + "autoload": { + "psr-4": { + "AlibabaCloud\\Client\\": "src" + }, + "files": [ + "src/Functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alibaba Cloud SDK", + "email": "sdk-team@alibabacloud.com", + "homepage": "http://www.alibabacloud.com" + } + ], + "description": "Alibaba Cloud Client for PHP - Use Alibaba Cloud in your PHP project", + "homepage": "https://www.alibabacloud.com/", + "keywords": [ + "alibaba", + "alibabacloud", + "aliyun", + "client", + "cloud", + "library", + "sdk", + "tool" + ], + "time": "2020-02-26T04:39:45+00:00" + }, + { + "name": "bacon/bacon-qr-code", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/Bacon/BaconQrCode.git", + "reference": "eaac909da3ccc32b748a65b127acd8918f58d9b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/eaac909da3ccc32b748a65b127acd8918f58d9b0", + "reference": "eaac909da3ccc32b748a65b127acd8918f58d9b0", + "shasum": "" + }, + "require": { + "dasprid/enum": "^1.0", + "ext-iconv": "*", + "php": "^7.1" + }, + "require-dev": { + "phly/keep-a-changelog": "^1.4", + "phpunit/phpunit": "^6.4", + "squizlabs/php_codesniffer": "^3.1" + }, + "suggest": { + "ext-imagick": "to generate QR code images" + }, + "type": "library", + "autoload": { + "psr-4": { + "BaconQrCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Ben Scholzen 'DASPRiD'", + "email": "mail@dasprids.de", + "homepage": "http://www.dasprids.de", + "role": "Developer" + } + ], + "description": "BaconQrCode is a QR code generator for PHP.", + "homepage": "https://github.com/Bacon/BaconQrCode", + "time": "2018-04-25T17:53:56+00:00" + }, + { + "name": "clagiordano/weblibs-configmanager", + "version": "v1.0.7", + "source": { + "type": "git", + "url": "https://github.com/clagiordano/weblibs-configmanager.git", + "reference": "6ef4c27354368deb2f54b39bbe06601da8c873a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clagiordano/weblibs-configmanager/zipball/6ef4c27354368deb2f54b39bbe06601da8c873a0", + "reference": "6ef4c27354368deb2f54b39bbe06601da8c873a0", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "require-dev": { + "clagiordano/phpunit-result-printer": "^1", + "phpunit/phpunit": "^4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "clagiordano\\weblibs\\configmanager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Claudio Giordano", + "email": "claudio.giordano@autistici.org", + "role": "Developer" + } + ], + "description": "weblibs-configmanager is a tool library for easily read and access to php config array file and direct read/write configuration file / object", + "keywords": [ + "clagiordano", + "configuration", + "manager", + "tool", + "weblibs" + ], + "time": "2019-09-25T22:10:10+00:00" + }, + { + "name": "danielstjules/stringy", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/danielstjules/Stringy.git", + "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/danielstjules/Stringy/zipball/df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", + "reference": "df24ab62d2d8213bbbe88cc36fc35a4503b4bd7e", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Stringy\\": "src/" + }, + "files": [ + "src/Create.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel St. Jules", + "email": "danielst.jules@gmail.com", + "homepage": "http://www.danielstjules.com" + } + ], + "description": "A string manipulation library with multibyte support", + "homepage": "https://github.com/danielstjules/Stringy", + "keywords": [ + "UTF", + "helpers", + "manipulation", + "methods", + "multibyte", + "string", + "utf-8", + "utility", + "utils" + ], + "time": "2017-06-12T01:10:27+00:00" + }, + { + "name": "dasprid/enum", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/DASPRiD/Enum.git", + "reference": "631ef6e638e9494b0310837fa531bedd908fc22b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/631ef6e638e9494b0310837fa531bedd908fc22b", + "reference": "631ef6e638e9494b0310837fa531bedd908fc22b", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^6.4", + "squizlabs/php_codesniffer": "^3.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DASPRiD\\Enum\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Ben Scholzen 'DASPRiD'", + "email": "mail@dasprids.de", + "homepage": "https://dasprids.de/" + } + ], + "description": "PHP 7.1 enum implementation", + "keywords": [ + "enum", + "map" + ], + "time": "2017-10-25T22:45:27+00:00" + }, + { + "name": "endroid/qr-code", + "version": "3.7.7", + "source": { + "type": "git", + "url": "https://github.com/endroid/qr-code.git", + "reference": "bfb64f163628b59ba250a6a1da95b6252b5718c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/endroid/qr-code/zipball/bfb64f163628b59ba250a6a1da95b6252b5718c3", + "reference": "bfb64f163628b59ba250a6a1da95b6252b5718c3", + "shasum": "" + }, + "require": { + "bacon/bacon-qr-code": "^2.0", + "ext-gd": "*", + "khanamiryan/qrcode-detector-decoder": "^1.0.2", + "myclabs/php-enum": "^1.5", + "php": ">=7.2", + "symfony/http-foundation": "^3.4||^4.2.12||^5.0", + "symfony/options-resolver": "^3.4||^4.0||^5.0", + "symfony/property-access": "^3.4||^4.0||^5.0" + }, + "require-dev": { + "endroid/test": "dev-master" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Endroid\\QrCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeroen van den Enden", + "email": "info@endroid.nl" + } + ], + "description": "Endroid QR Code", + "homepage": "https://github.com/endroid/qr-code", + "keywords": [ + "bundle", + "code", + "endroid", + "php", + "qr", + "qrcode" + ], + "time": "2020-03-10T08:32:43+00:00" + }, + { + "name": "endroid/qrcode", + "version": "3.7.7", + "source": { + "type": "git", + "url": "https://github.com/endroid/qr-code.git", + "reference": "bfb64f163628b59ba250a6a1da95b6252b5718c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/endroid/qr-code/zipball/bfb64f163628b59ba250a6a1da95b6252b5718c3", + "reference": "bfb64f163628b59ba250a6a1da95b6252b5718c3", + "shasum": "" + }, + "require": { + "bacon/bacon-qr-code": "^2.0", + "ext-gd": "*", + "khanamiryan/qrcode-detector-decoder": "^1.0.2", + "myclabs/php-enum": "^1.5", + "php": ">=7.2", + "symfony/http-foundation": "^3.4||^4.2.12||^5.0", + "symfony/options-resolver": "^3.4||^4.0||^5.0", + "symfony/property-access": "^3.4||^4.0||^5.0" + }, + "require-dev": { + "endroid/test": "dev-master" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Endroid\\QrCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeroen van den Enden", + "email": "info@endroid.nl" + } + ], + "description": "Endroid QR Code", + "homepage": "https://github.com/endroid/qr-code", + "keywords": [ + "bundle", + "code", + "endroid", + "php", + "qr", + "qrcode" + ], + "abandoned": "endroid/qr-code", + "time": "2020-03-10T08:32:43+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.5.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.6.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.1" + }, + "suggest": { + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.5-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2019-12-23T11:57:10+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2019-07-01T23:21:34+00:00" + }, + { + "name": "khanamiryan/qrcode-detector-decoder", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/khanamiryan/php-qrcode-detector-decoder.git", + "reference": "a75482d3bc804e3f6702332bfda6cccbb0dfaa76" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/a75482d3bc804e3f6702332bfda6cccbb0dfaa76", + "reference": "a75482d3bc804e3f6702332bfda6cccbb0dfaa76", + "shasum": "" + }, + "require": { + "php": "^5.6|^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Zxing\\": "lib/" + }, + "files": [ + "lib/Common/customFunctions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ashot Khanamiryan", + "email": "a.khanamiryan@gmail.com", + "homepage": "https://github.com/khanamiryan", + "role": "Developer" + } + ], + "description": "QR code decoder / reader", + "homepage": "https://github.com/khanamiryan/php-qrcode-detector-decoder/", + "keywords": [ + "barcode", + "qr", + "zxing" + ], + "time": "2018-04-26T11:41:33+00:00" + }, { "name": "league/flysystem", - "version": "1.0.64", + "version": "1.0.66", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "021569195e15f8209b1c4bebb78bd66aa4f08c21" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/021569195e15f8209b1c4bebb78bd66aa4f08c21", + "reference": "021569195e15f8209b1c4bebb78bd66aa4f08c21", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": ">=5.5.9" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "require-dev": { + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.26" + }, + "suggest": { + "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ], + "time": "2020-03-17T18:58:12+00:00" + }, + { + "name": "league/flysystem-cached-adapter", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-cached-adapter.git", + "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f", + "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f", + "shasum": "" + }, + "require": { + "league/flysystem": "~1.0", + "psr/cache": "^1.0.0" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7", + "predis/predis": "~1.0", + "tedivm/stash": "~0.12" + }, + "suggest": { + "ext-phpredis": "Pure C implemented extension for PHP" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Flysystem\\Cached\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "frankdejonge", + "email": "info@frenky.net" + } + ], + "description": "An adapter decorator to enable meta-data caching.", + "time": "2018-07-09T20:51:04+00:00" + }, + { + "name": "mtdowling/jmespath.php", + "version": "2.5.0", + "source": { + "type": "git", + "url": "https://github.com/jmespath/jmespath.php.git", + "reference": "52168cb9472de06979613d365c7f1ab8798be895" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/52168cb9472de06979613d365c7f1ab8798be895", + "reference": "52168cb9472de06979613d365c7f1ab8798be895", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "symfony/polyfill-mbstring": "^1.4" + }, + "require-dev": { + "composer/xdebug-handler": "^1.2", + "phpunit/phpunit": "^4.8.36|^7.5.15" + }, + "bin": [ + "bin/jp.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "JmesPath\\": "src/" + }, + "files": [ + "src/JmesPath.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Declaratively specify how to extract elements from a JSON document", + "keywords": [ + "json", + "jsonpath" + ], + "time": "2019-12-30T18:03:34+00:00" + }, + { + "name": "myclabs/php-enum", + "version": "1.7.6", + "source": { + "type": "git", + "url": "https://github.com/myclabs/php-enum.git", + "reference": "5f36467c7a87e20fbdc51e524fd8f9d1de80187c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/php-enum/zipball/5f36467c7a87e20fbdc51e524fd8f9d1de80187c", + "reference": "5f36467c7a87e20fbdc51e524fd8f9d1de80187c", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7", + "squizlabs/php_codesniffer": "1.*", + "vimeo/psalm": "^3.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "MyCLabs\\Enum\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP Enum contributors", + "homepage": "https://github.com/myclabs/php-enum/graphs/contributors" + } + ], + "description": "PHP Enum implementation", + "homepage": "http://github.com/myclabs/php-enum", + "keywords": [ + "enum" + ], + "time": "2020-02-14T08:15:52+00:00" + }, + { + "name": "opis/closure", + "version": "3.5.1", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/93ebc5712cdad8d5f489b500c59d122df2e53969", + "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0" + }, + "require-dev": { + "jeremeamia/superclosure": "^2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.5.x-dev" + } + }, + "autoload": { + "psr-4": { + "Opis\\Closure\\": "src/" + }, + "files": [ + "functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", + "homepage": "https://opis.io/closure", + "keywords": [ + "anonymous functions", + "closure", + "function", + "serializable", + "serialization", + "serialize" + ], + "time": "2019-11-29T22:36:02+00:00" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06T20:24:11+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/log", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2020-03-23T09:12:05+00:00" + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "d13c43dbd4b791f815215959105a008515d1a2e0" + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d13c43dbd4b791f815215959105a008515d1a2e0", - "reference": "d13c43dbd4b791f815215959105a008515d1a2e0", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", "shasum": "" }, "require": { - "ext-fileinfo": "*", - "php": ">=5.5.9" + "php": ">=5.3.0" }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-10-23T01:57:42+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" }, "require-dev": { - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7.26" + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v5.0.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "2da08283c33cfa34d6e332a01436931e318f5f80" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/2da08283c33cfa34d6e332a01436931e318f5f80", + "reference": "2da08283c33cfa34d6e332a01436931e318f5f80", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "symfony/mime": "^4.4|^5.0", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "predis/predis": "~1.0", + "symfony/expression-language": "^4.4|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "5.0-dev" } }, "autoload": { "psr-4": { - "League\\Flysystem\\": "src/" + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2020-03-23T12:42:46+00:00" + }, + { + "name": "symfony/inflector", + "version": "v5.0.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/inflector.git", + "reference": "e375603b6bd12e8e3aec3fc1b640ac18a4ef4cb2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/inflector/zipball/e375603b6bd12e8e3aec3fc1b640ac18a4ef4cb2", + "reference": "e375603b6bd12e8e3aec3fc1b640ac18a4ef4cb2", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" } }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Inflector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { - "name": "Frank de Jonge", - "email": "info@frenky.net" + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Filesystem abstraction: Many filesystems, one API.", + "description": "Symfony Inflector Component", + "homepage": "https://symfony.com", "keywords": [ - "Cloud Files", - "WebDAV", - "abstraction", - "aws", - "cloud", - "copy.com", - "dropbox", - "file systems", - "files", - "filesystem", - "filesystems", - "ftp", - "rackspace", - "remote", - "s3", - "sftp", - "storage" + "inflection", + "pluralize", + "singularize", + "string", + "symfony", + "words" ], - "time": "2020-02-05T18:14:17+00:00" + "time": "2020-01-04T14:08:26+00:00" }, { - "name": "league/flysystem-cached-adapter", - "version": "1.0.9", + "name": "symfony/mime", + "version": "v5.0.6", "source": { "type": "git", - "url": "https://github.com/thephpleague/flysystem-cached-adapter.git", - "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f" + "url": "https://github.com/symfony/mime.git", + "reference": "e9927cabc1519d2498d02b743f2cab6e4722ad3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f", - "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f", + "url": "https://api.github.com/repos/symfony/mime/zipball/e9927cabc1519d2498d02b743f2cab6e4722ad3d", + "reference": "e9927cabc1519d2498d02b743f2cab6e4722ad3d", "shasum": "" }, "require": { - "league/flysystem": "~1.0", - "psr/cache": "^1.0.0" + "php": "^7.2.5", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0" }, - "require-dev": { - "mockery/mockery": "~0.9", - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7", - "predis/predis": "~1.0", - "tedivm/stash": "~0.12" + "conflict": { + "symfony/mailer": "<4.4" }, - "suggest": { - "ext-phpredis": "Pure C implemented extension for PHP" + "require-dev": { + "egulias/email-validator": "^2.1.10", + "symfony/dependency-injection": "^4.4|^5.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, "autoload": { "psr-4": { - "League\\Flysystem\\Cached\\": "src/" + "Symfony\\Component\\Mime\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A library to manipulate MIME messages", + "homepage": "https://symfony.com", + "keywords": [ + "mime", + "mime-type" + ], + "time": "2020-03-16T12:10:54+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v5.0.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "b1ab86ce52b0c0abe031367a173005a025e30e04" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b1ab86ce52b0c0abe031367a173005a025e30e04", + "reference": "b1ab86ce52b0c0abe031367a173005a025e30e04", + "shasum": "" + }, + "require": { + "php": "^7.2.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" } }, + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { - "name": "frankdejonge", - "email": "info@frenky.net" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "An adapter decorator to enable meta-data caching.", - "time": "2018-07-09T20:51:04+00:00" + "description": "Symfony OptionsResolver Component", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "time": "2020-01-04T14:08:26+00:00" }, { - "name": "opis/closure", - "version": "3.5.1", + "name": "symfony/polyfill-ctype", + "version": "v1.15.0", "source": { "type": "git", - "url": "https://github.com/opis/closure.git", - "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/93ebc5712cdad8d5f489b500c59d122df2e53969", - "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0" + "php": ">=5.3.3" }, - "require-dev": { - "jeremeamia/superclosure": "^2.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "suggest": { + "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.5.x-dev" + "dev-master": "1.15-dev" } }, "autoload": { "psr-4": { - "Opis\\Closure\\": "src/" + "Symfony\\Polyfill\\Ctype\\": "" }, "files": [ - "functions.php" + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -178,53 +1535,59 @@ ], "authors": [ { - "name": "Marius Sarca", - "email": "marius.sarca@gmail.com" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { - "name": "Sorin Sarca", - "email": "sarca_sorin@hotmail.com" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", - "homepage": "https://opis.io/closure", + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", "keywords": [ - "anonymous functions", - "closure", - "function", - "serializable", - "serialization", - "serialize" + "compatibility", + "ctype", + "polyfill", + "portable" ], - "time": "2019-11-29T22:36:02+00:00" + "time": "2020-02-27T09:26:54+00:00" }, { - "name": "psr/cache", - "version": "1.0.1", + "name": "symfony/polyfill-intl-idn", + "version": "v1.15.0", "source": { "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf", + "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=5.3.3", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.15-dev" } }, "autoload": { "psr-4": { - "Psr\\Cache\\": "src/" - } + "Symfony\\Polyfill\\Intl\\Idn\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -232,45 +1595,59 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Common interface for caching libraries", + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", "keywords": [ - "cache", - "psr", - "psr-6" + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" ], - "time": "2016-08-06T20:24:11+00:00" + "time": "2020-03-09T19:04:49+00:00" }, { - "name": "psr/container", - "version": "1.0.0", + "name": "symfony/polyfill-mbstring", + "version": "v1.15.0", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.15-dev" } }, "autoload": { "psr-4": { - "Psr\\Container\\": "src/" - } + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -278,48 +1655,55 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" ], - "time": "2017-02-14T16:28:37+00:00" + "time": "2020-03-09T19:04:49+00:00" }, { - "name": "psr/log", - "version": "1.1.2", + "name": "symfony/polyfill-php72", + "version": "v1.15.0", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "37b0976c78b94856543260ce09b460a7bc852747" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747", + "reference": "37b0976c78b94856543260ce09b460a7bc852747", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.15-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -327,46 +1711,61 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", "keywords": [ - "log", - "psr", - "psr-3" + "compatibility", + "polyfill", + "portable", + "shim" ], - "time": "2019-11-01T11:05:21+00:00" + "time": "2020-02-27T09:26:54+00:00" }, { - "name": "psr/simple-cache", - "version": "1.0.1", + "name": "symfony/property-access", + "version": "v5.0.6", "source": { "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + "url": "https://github.com/symfony/property-access.git", + "reference": "778be1fa3dba63a241970bb9f79ff1849b2506ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "url": "https://api.github.com/repos/symfony/property-access/zipball/778be1fa3dba63a241970bb9f79ff1849b2506ff", + "reference": "778be1fa3dba63a241970bb9f79ff1849b2506ff", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2.5", + "symfony/inflector": "^4.4|^5.0" + }, + "require-dev": { + "symfony/cache": "^4.4|^5.0" + }, + "suggest": { + "psr/cache-implementation": "To cache access methods." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "5.0-dev" } }, "autoload": { "psr-4": { - "Psr\\SimpleCache\\": "src/" - } + "Symfony\\Component\\PropertyAccess\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -374,19 +1773,28 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Common interfaces for simple caching", + "description": "Symfony PropertyAccess Component", + "homepage": "https://symfony.com", "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" + "access", + "array", + "extraction", + "index", + "injection", + "object", + "property", + "property path", + "reflection" ], - "time": "2017-10-23T01:57:42+00:00" + "time": "2020-03-16T16:38:48+00:00" }, { "name": "topthink/framework", @@ -536,132 +1944,18 @@ } ], "packages-dev": [ - { - "name": "symfony/polyfill-mbstring", - "version": "v1.14.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2020-01-13T11:15:53+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.14.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf", - "reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2020-01-13T11:15:53+00:00" - }, { "name": "symfony/var-dumper", - "version": "v4.4.4", + "version": "v4.4.6", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "46b53fd714568af343953c039ff47b67ce8af8d6" + "reference": "6dae4692ac91230b33b70d9a48882ff5c838d67a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/46b53fd714568af343953c039ff47b67ce8af8d6", - "reference": "46b53fd714568af343953c039ff47b67ce8af8d6", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/6dae4692ac91230b33b70d9a48882ff5c838d67a", + "reference": "6dae4692ac91230b33b70d9a48882ff5c838d67a", "shasum": "" }, "require": { @@ -724,7 +2018,7 @@ "debug", "dump" ], - "time": "2020-01-25T12:44:29+00:00" + "time": "2020-03-18T07:15:43+00:00" }, { "name": "topthink/think-trace", diff --git a/config/smsconfig.php b/config/smsconfig.php new file mode 100644 index 0000000..e4cb23f --- /dev/null +++ b/config/smsconfig.php @@ -0,0 +1,17 @@ + 'dysmsapi.aliyuncs.com', + // accessKeyId + 'accessKeyId' => 'LTAI4Fs3dT55kRZWnoNps5Yr', + // accessSecret + 'accessSecret' => '4aIgEwn8TqQJMrnkqNdDzAKaZYrk0a', + // SignName + 'SignName' => '智慧猪', + // TemplateCode + 'TemplateCode' => 'SMS_183766457' +]; diff --git a/config/wxconfig.php b/config/wxconfig.php new file mode 100644 index 0000000..0dd051a --- /dev/null +++ b/config/wxconfig.php @@ -0,0 +1,18 @@ + 'wxc429fdf05d591605', + // secret + 'secret' => '6d92b57ad1d5137a1c4a3cc7c34f7705', + // getTokenUrl + 'getTokenUrl' => 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential', + // HTTP API 接口地址 + 'httpApiUrl' => 'https://api.weixin.qq.com/tcb', + // Cloud 云环境test + 'env' => 'test-87exc' +]; + From 3fd5e9fd888460b63f0c634f7c36a162f50f4062 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sun, 12 Apr 2020 17:59:33 +0800 Subject: [PATCH 05/60] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/database.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/database.php b/config/database.php index bb2ffc3..2972e43 100644 --- a/config/database.php +++ b/config/database.php @@ -23,11 +23,11 @@ // 服务器地址 'hostname' => env('database.hostname', '127.0.0.1'), // 数据库名 - 'database' => env('database.database', 'jxhhyq'), + 'database' => env('database.database', 'database'), // 用户名 - 'username' => env('database.username', 'root'), + 'username' => env('database.username', 'daiysh'), // 密码 - 'password' => env('database.password', 'dys114818'), + 'password' => env('database.password', 'dys11481890'), // 端口 'hostport' => env('database.hostport', '3306'), // 数据库连接参数 From 6580b25d17130c3a39f27c3e7223ef72941c9058 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sun, 12 Apr 2020 22:20:28 +0800 Subject: [PATCH 06/60] update --- config/database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/database.php b/config/database.php index 2972e43..f11efe1 100644 --- a/config/database.php +++ b/config/database.php @@ -21,7 +21,7 @@ // 数据库类型 'type' => env('database.type', 'mysql'), // 服务器地址 - 'hostname' => env('database.hostname', '127.0.0.1'), + 'hostname' => env('database.hostname', 'www.innerbboy.cn'), // 数据库名 'database' => env('database.database', 'database'), // 用户名 From 7d6ceaf05cc294f9b8f6ed2d253a85749c2b1f4b Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sun, 12 Apr 2020 22:27:56 +0800 Subject: [PATCH 07/60] update --- app/controller/Role.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/controller/Role.php b/app/controller/Role.php index 2235c7b..ecfd7c1 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -14,5 +14,14 @@ public function list() } + + public function test() + { + $token = ['token' => 'admin-token']; + $data = ['data' => $token, 'code' => 20000]; + return json($data); + + } + } From 3e4d195c6f6f05be98d52483fc9b998e79a6d1b6 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sun, 12 Apr 2020 23:04:03 +0800 Subject: [PATCH 08/60] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Member.php | 4 ++++ app/service/CloudApiService.php | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/app/controller/Member.php b/app/controller/Member.php index 80d8b2e..1495b9e 100644 --- a/app/controller/Member.php +++ b/app/controller/Member.php @@ -24,6 +24,10 @@ public function list(Request $request) { return $this->app->cloudService->databaseQuery($request->param()); } + public function test(Request $request) { + return $this->app->cloudService->test(); + } + public function sync() { } diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index a3d6f47..b593f40 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -24,6 +24,12 @@ public static function databaseQuery($param) { } + public static function test() { + $token = ['token' => 'admin-token']; + $data = ['data' => $token, 'code' => 20000]; + return json($data); + } + public static function databaseAdd($param) { } From c7779ec2a17987141f68073261b62bc577b7134f Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 14:30:21 +0800 Subject: [PATCH 09/60] update --- app/service/CloudApiService.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index b593f40..b2a7419 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -25,9 +25,8 @@ public static function databaseQuery($param) { } public static function test() { - $token = ['token' => 'admin-token']; - $data = ['data' => $token, 'code' => 20000]; - return json($data); + $url = self::$http_api_url . getAccessToken(); + return json($url); } public static function databaseAdd($param) { From d6415d1457c6b746624596868ec221195eb63558 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 14:35:55 +0800 Subject: [PATCH 10/60] update --- app/controller/Member.php | 4 ++++ app/service/CloudApiService.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/controller/Member.php b/app/controller/Member.php index 1495b9e..a6c3634 100644 --- a/app/controller/Member.php +++ b/app/controller/Member.php @@ -28,6 +28,10 @@ public function test(Request $request) { return $this->app->cloudService->test(); } + public function test2(Request $request) { + return $this->app->cloudService->test2(); + } + public function sync() { } diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index b2a7419..c931775 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -28,6 +28,10 @@ public static function test() { $url = self::$http_api_url . getAccessToken(); return json($url); } + public static function test2() { + $url = self::$http_api_url; + return json($url); + } public static function databaseAdd($param) { From 610677bb593a228cf829467b57b777ebd494ec64 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 14:37:22 +0800 Subject: [PATCH 11/60] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/common.php b/app/common.php index 1b23e09..ea35b2a 100644 --- a/app/common.php +++ b/app/common.php @@ -63,16 +63,16 @@ function getAccessToken() { $wxConfig = Config::get('wxconfig'); // 将token放到缓存中 $token = Cache::get('access_token'); - if (!$token) { - $res = file_get_contents($wxConfig['getTokenUrl'].'&appid='.$wxConfig['appid'].'&secret='.$wxConfig['secret']); - $res = json_decode($res, true); - $token = $res['access_token']; - $time = $res['expires_in']; - if($token){ - // 缓存在3600秒之后过期 - Cache::set('access_token', $token, $time); - } - } +// if (!$token) { +// $res = file_get_contents($wxConfig['getTokenUrl'].'&appid='.$wxConfig['appid'].'&secret='.$wxConfig['secret']); +// $res = json_decode($res, true); +// $token = $res['access_token']; +// $time = $res['expires_in']; +// if($token){ +// // 缓存在3600秒之后过期 +// Cache::set('access_token', $token, $time); +// } +// } return $token; } From 8063df4df235897e7f736e7bcb65a527704843e1 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 14:39:21 +0800 Subject: [PATCH 12/60] update --- app/common.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/common.php b/app/common.php index ea35b2a..9ecb373 100644 --- a/app/common.php +++ b/app/common.php @@ -63,16 +63,16 @@ function getAccessToken() { $wxConfig = Config::get('wxconfig'); // 将token放到缓存中 $token = Cache::get('access_token'); -// if (!$token) { -// $res = file_get_contents($wxConfig['getTokenUrl'].'&appid='.$wxConfig['appid'].'&secret='.$wxConfig['secret']); -// $res = json_decode($res, true); + if (!$token) { + $res = file_get_contents($wxConfig['getTokenUrl'].'&appid='.$wxConfig['appid'].'&secret='.$wxConfig['secret']); + $res = json_decode($res, true); // $token = $res['access_token']; // $time = $res['expires_in']; // if($token){ // // 缓存在3600秒之后过期 // Cache::set('access_token', $token, $time); // } -// } + } return $token; } From 1b0768686dbbaa443583e6bb017ee92282ef67fb Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 14:42:12 +0800 Subject: [PATCH 13/60] update --- app/common.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/common.php b/app/common.php index 9ecb373..8ca05d9 100644 --- a/app/common.php +++ b/app/common.php @@ -63,6 +63,7 @@ function getAccessToken() { $wxConfig = Config::get('wxconfig'); // 将token放到缓存中 $token = Cache::get('access_token'); + $res = 'test dai'; if (!$token) { $res = file_get_contents($wxConfig['getTokenUrl'].'&appid='.$wxConfig['appid'].'&secret='.$wxConfig['secret']); $res = json_decode($res, true); @@ -73,7 +74,7 @@ function getAccessToken() { // Cache::set('access_token', $token, $time); // } } - return $token; + return $res; } From 3e5b004a6071c5178c50d9a83676e428c779a2c4 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 14:43:33 +0800 Subject: [PATCH 14/60] update --- app/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common.php b/app/common.php index 8ca05d9..e21989a 100644 --- a/app/common.php +++ b/app/common.php @@ -66,7 +66,7 @@ function getAccessToken() { $res = 'test dai'; if (!$token) { $res = file_get_contents($wxConfig['getTokenUrl'].'&appid='.$wxConfig['appid'].'&secret='.$wxConfig['secret']); - $res = json_decode($res, true); +// $res = json_decode($res, true); // $token = $res['access_token']; // $time = $res['expires_in']; // if($token){ From d06611afd5947c0a02644bcb55feea618f537cb2 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 14:44:58 +0800 Subject: [PATCH 15/60] update --- app/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common.php b/app/common.php index e21989a..85b9b88 100644 --- a/app/common.php +++ b/app/common.php @@ -111,7 +111,7 @@ function ok($data) { 'data' => $data ); - return json_encode($result); + return $result; } function fail($data) { From 6aca6fa6e6b8a10db5a7b34505179a237164e198 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 14:46:58 +0800 Subject: [PATCH 16/60] updae --- app/controller/Role.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controller/Role.php b/app/controller/Role.php index ecfd7c1..cc95cd3 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -10,7 +10,7 @@ public function list() { $list = Db::name('sys_role')->select(); - return ok($list); + return $list; } From e48b004021af8053f18d3bf237724e01a53fb14a Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 14:52:50 +0800 Subject: [PATCH 17/60] update --- app/common.php | 15 ++++++++------- app/controller/Role.php | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/common.php b/app/common.php index 85b9b88..2fcef99 100644 --- a/app/common.php +++ b/app/common.php @@ -66,13 +66,14 @@ function getAccessToken() { $res = 'test dai'; if (!$token) { $res = file_get_contents($wxConfig['getTokenUrl'].'&appid='.$wxConfig['appid'].'&secret='.$wxConfig['secret']); + // json_decode接受一个 JSON 格式的字符串并且把它转换为 PHP 变量 // $res = json_decode($res, true); -// $token = $res['access_token']; -// $time = $res['expires_in']; -// if($token){ -// // 缓存在3600秒之后过期 -// Cache::set('access_token', $token, $time); -// } + $token = $res['access_token']; + $time = $res['expires_in']; + if($token){ + // 缓存在3600秒之后过期 + Cache::set('access_token', $token, $time); + } } return $res; @@ -111,7 +112,7 @@ function ok($data) { 'data' => $data ); - return $result; + return json($result); } function fail($data) { diff --git a/app/controller/Role.php b/app/controller/Role.php index cc95cd3..22a4caf 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -10,7 +10,7 @@ public function list() { $list = Db::name('sys_role')->select(); - return $list; + return json($list); } From 20cef6e36983259dce026ab1c66e8aaa8b7bab81 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 14:57:19 +0800 Subject: [PATCH 18/60] updare --- app/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/common.php b/app/common.php index 2fcef99..2c4eb24 100644 --- a/app/common.php +++ b/app/common.php @@ -68,8 +68,8 @@ function getAccessToken() { $res = file_get_contents($wxConfig['getTokenUrl'].'&appid='.$wxConfig['appid'].'&secret='.$wxConfig['secret']); // json_decode接受一个 JSON 格式的字符串并且把它转换为 PHP 变量 // $res = json_decode($res, true); - $token = $res['access_token']; - $time = $res['expires_in']; +// $token = $res['access_token']; +// $time = $res['expires_in']; if($token){ // 缓存在3600秒之后过期 Cache::set('access_token', $token, $time); From 1170942d721d3d0d8381fad84c046e70e78d1a51 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 14:59:50 +0800 Subject: [PATCH 19/60] update --- app/common.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/common.php b/app/common.php index 2c4eb24..7472e23 100644 --- a/app/common.php +++ b/app/common.php @@ -67,13 +67,13 @@ function getAccessToken() { if (!$token) { $res = file_get_contents($wxConfig['getTokenUrl'].'&appid='.$wxConfig['appid'].'&secret='.$wxConfig['secret']); // json_decode接受一个 JSON 格式的字符串并且把它转换为 PHP 变量 -// $res = json_decode($res, true); + $res = json_decode($res, true); // $token = $res['access_token']; // $time = $res['expires_in']; - if($token){ - // 缓存在3600秒之后过期 - Cache::set('access_token', $token, $time); - } +// if($token){ +// // 缓存在3600秒之后过期 +// Cache::set('access_token', $token, $time); +// } } return $res; From 2284b5302411704365492c2861d1ed15387dc8e8 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 15:04:44 +0800 Subject: [PATCH 20/60] update --- app/common.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/app/common.php b/app/common.php index 7472e23..4752dc5 100644 --- a/app/common.php +++ b/app/common.php @@ -63,19 +63,23 @@ function getAccessToken() { $wxConfig = Config::get('wxconfig'); // 将token放到缓存中 $token = Cache::get('access_token'); - $res = 'test dai'; - if (!$token) { - $res = file_get_contents($wxConfig['getTokenUrl'].'&appid='.$wxConfig['appid'].'&secret='.$wxConfig['secret']); - // json_decode接受一个 JSON 格式的字符串并且把它转换为 PHP 变量 - $res = json_decode($res, true); -// $token = $res['access_token']; -// $time = $res['expires_in']; -// if($token){ -// // 缓存在3600秒之后过期 -// Cache::set('access_token', $token, $time); -// } + try { + if (!$token) { + $res = file_get_contents($wxConfig['getTokenUrl'].'&appid='.$wxConfig['appid'].'&secret='.$wxConfig['secret']); + // json_decode接受一个 JSON 格式的字符串并且把它转换为 PHP 变量 + $res = json_decode($res, true); + $token = $res['access_token']; + $time = $res['expires_in']; + if($token){ + // 缓存在3600秒之后过期 + Cache::set('access_token', $token, $time); + } + } + } catch (Exception $e) { + echo $e->getMessage(); } - return $res; + + return $token; } From 6eecac772b06c5133423a18105d9d9427cc51927 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 15:15:02 +0800 Subject: [PATCH 21/60] update --- app/common.php | 1 + app/controller/Role.php | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/common.php b/app/common.php index 4752dc5..bbb6699 100644 --- a/app/common.php +++ b/app/common.php @@ -77,6 +77,7 @@ function getAccessToken() { } } catch (Exception $e) { echo $e->getMessage(); + echo $token; } return $token; diff --git a/app/controller/Role.php b/app/controller/Role.php index 22a4caf..7b805e7 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -8,7 +8,12 @@ class Role extends BaseController { public function list() { - $list = Db::name('sys_role')->select(); + $list = '角色列表'; + try { + $list = Db::name('sys_role')->select(); + } catch (Exception $e) { + echo $e->getMessage(); + } return json($list); From e177aa3e229929444a112e00e47705b5150379b1 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 15:16:30 +0800 Subject: [PATCH 22/60] update --- app/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common.php b/app/common.php index bbb6699..406bc86 100644 --- a/app/common.php +++ b/app/common.php @@ -129,6 +129,6 @@ function fail($data) { 'data' => $data ); - return json_encode($result); + return json($result); } From 8ff152f508f1b35ad1d873e4473949ffae75afda Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 15:23:26 +0800 Subject: [PATCH 23/60] update --- app/controller/Role.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controller/Role.php b/app/controller/Role.php index 7b805e7..0088393 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -2,6 +2,7 @@ namespace app\controller; use app\BaseController; +use think\db\exception\DbException; use think\Facade\Db; class Role extends BaseController @@ -11,7 +12,7 @@ public function list() $list = '角色列表'; try { $list = Db::name('sys_role')->select(); - } catch (Exception $e) { + } catch (DbException $e) { echo $e->getMessage(); } From 2d5a8e9ced4ed71846bf0bf15a83a9deec1c7854 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 15:39:58 +0800 Subject: [PATCH 24/60] update --- app/controller/Role.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controller/Role.php b/app/controller/Role.php index 0088393..985e4e4 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -2,7 +2,7 @@ namespace app\controller; use app\BaseController; -use think\db\exception\DbException; +use think\Exception; use think\Facade\Db; class Role extends BaseController @@ -12,7 +12,7 @@ public function list() $list = '角色列表'; try { $list = Db::name('sys_role')->select(); - } catch (DbException $e) { + } catch (Exception $e) { echo $e->getMessage(); } From 523f032bc401d67f4941fe39cc1f2868ca065f31 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 20:45:37 +0800 Subject: [PATCH 25/60] update --- .22env1 | 1 + app/common.php | 1 - app/controller/Role.php | 4 ++-- config/app.php | 2 +- config/log.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 .22env1 diff --git a/.22env1 b/.22env1 new file mode 100644 index 0000000..5f00c6e --- /dev/null +++ b/.22env1 @@ -0,0 +1 @@ +APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = jxhhyq USERNAME = root PASSWORD = dys114818 HOSTPORT = 3306 CHARSET = utf8 DEBUG = true [LANG] default_lang = zh-cn \ No newline at end of file diff --git a/app/common.php b/app/common.php index 406bc86..7888e5e 100644 --- a/app/common.php +++ b/app/common.php @@ -77,7 +77,6 @@ function getAccessToken() { } } catch (Exception $e) { echo $e->getMessage(); - echo $token; } return $token; diff --git a/app/controller/Role.php b/app/controller/Role.php index 985e4e4..0088393 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -2,7 +2,7 @@ namespace app\controller; use app\BaseController; -use think\Exception; +use think\db\exception\DbException; use think\Facade\Db; class Role extends BaseController @@ -12,7 +12,7 @@ public function list() $list = '角色列表'; try { $list = Db::name('sys_role')->select(); - } catch (Exception $e) { + } catch (DbException $e) { echo $e->getMessage(); } diff --git a/config/app.php b/config/app.php index 1cfaf5c..98a51f6 100644 --- a/config/app.php +++ b/config/app.php @@ -30,5 +30,5 @@ // 错误显示信息,非调试模式有效 'error_message' => '页面错误!请稍后再试~', // 显示错误信息 - 'show_error_msg' => false, + 'show_error_msg' => true, ]; diff --git a/config/log.php b/config/log.php index ea24ff9..238bf07 100644 --- a/config/log.php +++ b/config/log.php @@ -37,7 +37,7 @@ // 日志输出格式化 'format' => '[%s][%s] %s', // 是否实时写入 - 'realtime_write' => false, + 'realtime_write' => true, ], // 其它日志通道配置 ], From 3bcbb989574185e53bcc8884e8a23aa2ebdefe18 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 20:57:12 +0800 Subject: [PATCH 26/60] update --- app/service/CloudApiService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index c931775..b8b1bde 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -13,11 +13,11 @@ public static function setEnv($envId){ } public static function databaseQuery($param) { -// $query = 'db.collection(\"member\").get()'; + $query = 'db.collection(\"member\").get()'; $url = self::$http_api_url . getAccessToken(); $obj = new class{}; $obj->env = self::$env; - $obj->query = $param['query']; + $obj->query = $query;// $param['query']; $data = json_encode($obj); return httpRequest($url,$data); From c40dcbe7a4dbdc9978cf9c3aa67040f4f8ddc5ba Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 13 Apr 2020 23:15:43 +0800 Subject: [PATCH 27/60] update --- app/common.php | 2 +- app/controller/Role.php | 3 +++ app/service/CloudApiService.php | 4 ---- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/common.php b/app/common.php index 7888e5e..fc8b0b2 100644 --- a/app/common.php +++ b/app/common.php @@ -76,7 +76,7 @@ function getAccessToken() { } } } catch (Exception $e) { - echo $e->getMessage(); +// echo $e->getMessage(); } return $token; diff --git a/app/controller/Role.php b/app/controller/Role.php index 0088393..92d861f 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -4,6 +4,7 @@ use app\BaseController; use think\db\exception\DbException; use think\Facade\Db; +use think\Facade\Cache; class Role extends BaseController { @@ -11,6 +12,8 @@ public function list() { $list = '角色列表'; try { + $token = Cache::get('access_token'); + echo $token; $list = Db::name('sys_role')->select(); } catch (DbException $e) { echo $e->getMessage(); diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index b8b1bde..f29c6ea 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -28,10 +28,6 @@ public static function test() { $url = self::$http_api_url . getAccessToken(); return json($url); } - public static function test2() { - $url = self::$http_api_url; - return json($url); - } public static function databaseAdd($param) { From d29b0ffadfcf2e53c46fd5651ed371c4a1800b71 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Tue, 14 Apr 2020 07:06:53 +0800 Subject: [PATCH 28/60] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 14 ++++++++++++++ app/controller/Role.php | 21 +++++++++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/app/common.php b/app/common.php index fc8b0b2..d8ba4ae 100644 --- a/app/common.php +++ b/app/common.php @@ -131,3 +131,17 @@ function fail($data) { return json($result); } +function testDb() { + $list = '角色列表'; + try { + $token = Cache::get('access_token'); + echo $token; + $list = Db::name('sys_role')->select(); + } catch (DbException $e) { + echo $e->getMessage(); + } + + return json($list); +} + + diff --git a/app/controller/Role.php b/app/controller/Role.php index 92d861f..cd7bffd 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -10,16 +10,17 @@ class Role extends BaseController { public function list() { - $list = '角色列表'; - try { - $token = Cache::get('access_token'); - echo $token; - $list = Db::name('sys_role')->select(); - } catch (DbException $e) { - echo $e->getMessage(); - } - - return json($list); +// $list = '角色列表'; +// try { +// $token = Cache::get('access_token'); +// echo $token; +// $list = Db::name('sys_role')->select(); +// } catch (DbException $e) { +// echo $e->getMessage(); +// } +// +// return json($list); + testDb(); } From 0c3fe5206722acbeafec91df45c3a11c297063e4 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Tue, 14 Apr 2020 07:08:04 +0800 Subject: [PATCH 29/60] update --- app/common.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/common.php b/app/common.php index d8ba4ae..e71ac27 100644 --- a/app/common.php +++ b/app/common.php @@ -6,6 +6,7 @@ use AlibabaCloud\Client\Exception\ServerException; use think\facade\Cache; use think\facade\Config; +use think\Facade\Db; // Download:https://github.com/aliyun/openapi-sdk-php // Usage:https://github.com/aliyun/openapi-sdk-php/blob/master/README.md From 64aebb798e5bb02e694b9688bb0f34f7793f0cae Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Tue, 14 Apr 2020 07:09:45 +0800 Subject: [PATCH 30/60] update --- app/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common.php b/app/common.php index e71ac27..ad10ce5 100644 --- a/app/common.php +++ b/app/common.php @@ -6,7 +6,7 @@ use AlibabaCloud\Client\Exception\ServerException; use think\facade\Cache; use think\facade\Config; -use think\Facade\Db; +use think\facade\Db; // Download:https://github.com/aliyun/openapi-sdk-php // Usage:https://github.com/aliyun/openapi-sdk-php/blob/master/README.md From e43b182dd6601f79f4a66977e6c4cb9f89fed66d Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Tue, 14 Apr 2020 07:23:42 +0800 Subject: [PATCH 31/60] update --- app/controller/Role.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controller/Role.php b/app/controller/Role.php index cd7bffd..e5ee838 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -20,7 +20,7 @@ public function list() // } // // return json($list); - testDb(); + return testDb(); } From ac4a27911d34231427b054fe26867a80967d6a2a Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Tue, 14 Apr 2020 07:26:09 +0800 Subject: [PATCH 32/60] update --- app/controller/Role.php | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/app/controller/Role.php b/app/controller/Role.php index e5ee838..17aace4 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -3,25 +3,20 @@ use app\BaseController; use think\db\exception\DbException; -use think\Facade\Db; -use think\Facade\Cache; +use think\facade\Db; class Role extends BaseController { public function list() { -// $list = '角色列表'; -// try { -// $token = Cache::get('access_token'); -// echo $token; -// $list = Db::name('sys_role')->select(); -// } catch (DbException $e) { -// echo $e->getMessage(); -// } -// -// return json($list); - return testDb(); - + $list = '角色列表'; + try { + $list = Db::name('sys_role')->select(); + } catch (DbException $e) { + echo $e->getMessage(); + } + + return json($list); } From fed39f9cc161eae76e6d2f814b277bac07318c8f Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Tue, 14 Apr 2020 09:12:43 +0800 Subject: [PATCH 33/60] update --- app/controller/Role.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controller/Role.php b/app/controller/Role.php index 17aace4..938c683 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -9,14 +9,9 @@ class Role extends BaseController { public function list() { - $list = '角色列表'; - try { - $list = Db::name('sys_role')->select(); - } catch (DbException $e) { - echo $e->getMessage(); - } - - return json($list); + $list = Db::name('sys_role')->select(); + + return ok($list); } From 1d90d53caaadbc6f901fd2b9c3876e57906a2236 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Tue, 14 Apr 2020 12:45:05 +0800 Subject: [PATCH 34/60] update --- app/controller/Role.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controller/Role.php b/app/controller/Role.php index 938c683..77d7e42 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -2,7 +2,6 @@ namespace app\controller; use app\BaseController; -use think\db\exception\DbException; use think\facade\Db; class Role extends BaseController From cd50b94ac1457c2facd0c100f7b4c286636794e9 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sat, 18 Apr 2020 16:26:06 +0800 Subject: [PATCH 35/60] update --- app/AppService.php | 2 + app/api/libs/Aliyun.php | 66 +++++++++++++++++++++++++ app/api/libs/Auth.php | 81 +++++++++++++++++++++++++++++++ app/common.php | 16 +++--- app/controller/Device.php | 9 +++- app/controller/User.php | 31 +++++++++++- app/exception/ExceptionHandle.php | 35 +++++++++++++ app/exception/HttpExceptions.php | 31 ++++++++++++ app/middleware/CheckApiLogin.php | 12 +++++ app/model/DeviceModel.php | 1 + app/model/UserModel.php | 21 ++++++++ app/service/DeviceService.php | 18 +++++-- config/api/Aliyun.php | 10 ++++ config/middleware.php | 4 +- route/app.php | 3 ++ 15 files changed, 322 insertions(+), 18 deletions(-) create mode 100644 app/api/libs/Aliyun.php create mode 100644 app/api/libs/Auth.php create mode 100644 app/exception/ExceptionHandle.php create mode 100644 app/exception/HttpExceptions.php create mode 100644 app/middleware/CheckApiLogin.php create mode 100644 config/api/Aliyun.php diff --git a/app/AppService.php b/app/AppService.php index f58f7e2..df69c82 100644 --- a/app/AppService.php +++ b/app/AppService.php @@ -5,6 +5,7 @@ use app\service\CloudApiService; use app\service\UserService; +use app\service\DeviceService; use think\Service; /** @@ -17,6 +18,7 @@ public function register() // 服务注册 $this->app->bind('cloudService',CloudApiService::class); $this->app->bind('userService',UserService::class); + $this->app->bind('deviceService',DeviceService::class); } public function boot() diff --git a/app/api/libs/Aliyun.php b/app/api/libs/Aliyun.php new file mode 100644 index 0000000..590c629 --- /dev/null +++ b/app/api/libs/Aliyun.php @@ -0,0 +1,66 @@ +AccessKeyId = config("Aliyun.Sms.AccessKeyId"); + $this->AccessKeySecret = config("Aliyun.Sms.AccessKeySecret"); + $this->SignName = config("Aliyun.Sms.SignName"); + $this->TemplateCode = config("Aliyun.Sms.TemplateCode"); + } + + + public function sendSms($phone, $code) + { + AlibabaCloud::accessKeyClient($this->AccessKeyId, $this->AccessKeySecret) + ->regionId('cn-hangzhou') + ->asDefaultClient(); + + try { + $result = AlibabaCloud::rpc() + ->product('Dysmsapi') + // ->scheme('https') // https | http + ->version('2017-05-25') + ->action('SendSms') + ->method('POST') + ->host('dysmsapi.aliyuncs.com') + ->options([ + 'query' => [ + 'RegionId' => "cn-hangzhou", + 'PhoneNumbers' => $phone, + 'SignName' => $this->SignName, + 'TemplateCode' => $this->TemplateCode, + 'TemplateParam' => json_encode(['code' => $code]) + ], + ]) + ->request(); + $result = $result->toArray(); + if ($result["Code"] == "OK") { + return true; + } else { + throw new HttpExceptions(403, $result['Message'], 19999); + } + } catch (ClientException $e) { + throw new HttpExceptions(403, "短信服务异常", 19999); + } catch (ServerException $e) { + throw new HttpExceptions(403, "短信服务异常", 19999); + } + } +} diff --git a/app/api/libs/Auth.php b/app/api/libs/Auth.php new file mode 100644 index 0000000..832f151 --- /dev/null +++ b/app/api/libs/Auth.php @@ -0,0 +1,81 @@ +username = $request->post('username'); + $this->token = $request->param('token'); + } + + private function __clone() + { + // TODO: Implement __clone() method. + } + //统一的入口 + public static function getInstance(){ + if(!self::$instance instanceof self){ + self::$instance = new self(); + } + return self::$instance; + } + + //获取token + public function getToken(){ + return $this->token; + } + + //生成token + private function createToken(){ + $this->token = md5($this->username.time().rand(100000,999999)); + } + + //设置token 保持登录状态 + public function setToken(){ + $this->createToken(); + //写入数据表 + $user = (new User())->where('username','=',$this->username)->find(); + $user->login_code = $this->token; + $user->expiration_time = time()+config('auth.expire_time'); + $user->save(); + return $this; + } + + //验证,10006:无权限 + public function checkLogin(){ + //1.到数据库中查询用户信息,token + $user = (new UserModel())->where('login_code','=',$this->token)->find(); + if(!$user){ + throw new HttpExceptions(403,"无权限",10006); + } + //2. 登录是否过期 10007:超时 + if($user['expiration_time']expiration_time-time())<5){ + $user->expiration_time = time()+config('auth.expire_time'); + $user->save(); + } + // echo $user->expiration_time."\n"; + return true; + } +} diff --git a/app/common.php b/app/common.php index ad10ce5..7cc846e 100644 --- a/app/common.php +++ b/app/common.php @@ -132,17 +132,13 @@ function fail($data) { return json($result); } -function testDb() { - $list = '角色列表'; - try { - $token = Cache::get('access_token'); - echo $token; - $list = Db::name('sys_role')->select(); - } catch (DbException $e) { - echo $e->getMessage(); - } +function return_msg($code,$msg) { + $result=array( + 'code' => $code, + 'msg' => $msg + ); - return json($list); + return json($result); } diff --git a/app/controller/Device.php b/app/controller/Device.php index c6e927d..1d949d3 100644 --- a/app/controller/Device.php +++ b/app/controller/Device.php @@ -2,6 +2,9 @@ namespace app\controller; +use app\BaseController; +use app\Request; + /** * Class Device * @package app\controller @@ -12,7 +15,11 @@ class Device extends BaseController { public function list(Request $request) { - return $this->app->deviceService->findList($request->param()); + return ok($this->app->deviceService->findList($request->param())); + } + + public function create(Request $request) { + return ok($this->app->deviceService->insert($request->param())); } public function sync() { diff --git a/app/controller/User.php b/app/controller/User.php index 005bb36..5f49e69 100644 --- a/app/controller/User.php +++ b/app/controller/User.php @@ -1,19 +1,48 @@ setToken(); + $token = Auth::getInstance()->getToken(); + $data = ['data' => $token, 'code' => 20000]; + return json($data); + + } public function login(Request $request) { //1 校验参数 //2 生成token //3 存储token - $token = ['token' => 'admin-token']; + $data = $request::post(); + // 把数据交由模型层来进行处理 + UserModel::checkLogin($data); + + // 如果验证成功 + // 1 设置token + // 2 返回token到前端 + Auth::getInstance()->setToken(); + $token = Auth::getInstance()->getToken(); $data = ['data' => $token, 'code' => 20000]; return json($data); + +// $token = ['token' => 'admin-token']; +// $data = ['data' => $token, 'code' => 20000]; +// return json($data); } public function info() diff --git a/app/exception/ExceptionHandle.php b/app/exception/ExceptionHandle.php new file mode 100644 index 0000000..344da52 --- /dev/null +++ b/app/exception/ExceptionHandle.php @@ -0,0 +1,35 @@ +msg = $e->getMessage()?:$this->msg; + if($e instanceof HttpExceptions){ + $this->httpcode = $e->getStatusCode()?:$this->httpcode; + } + $this->errorcode = $e->getCode()?:$this->errorcode; + $result_data = [ + 'message'=>$this->msg, + 'data'=>[], + 'errorcode'=>$this->errorcode + ]; + return json($result_data,$this->httpcode); + } + +} diff --git a/app/exception/HttpExceptions.php b/app/exception/HttpExceptions.php new file mode 100644 index 0000000..8095ff5 --- /dev/null +++ b/app/exception/HttpExceptions.php @@ -0,0 +1,31 @@ +statusCode = $statusCode; + $this->headers = $headers; + + parent::__construct($message, $code, $previous); + } + + public function getStatusCode() + { + return $this->statusCode; + } + + public function getHeaders() + { + return $this->headers; + } +} diff --git a/app/middleware/CheckApiLogin.php b/app/middleware/CheckApiLogin.php new file mode 100644 index 0000000..bec6fba --- /dev/null +++ b/app/middleware/CheckApiLogin.php @@ -0,0 +1,12 @@ +checkLogin(); + return $next($request); + } +} diff --git a/app/model/DeviceModel.php b/app/model/DeviceModel.php index 7d8e277..19f76a6 100644 --- a/app/model/DeviceModel.php +++ b/app/model/DeviceModel.php @@ -2,6 +2,7 @@ namespace app\model; +use think\Model; class DeviceModel extends Model { diff --git a/app/model/UserModel.php b/app/model/UserModel.php index ec80535..6eb41e9 100644 --- a/app/model/UserModel.php +++ b/app/model/UserModel.php @@ -25,4 +25,25 @@ class UserModel extends Model 'create_time' => 'datetime', 'update_time' => 'datetime', ]; + + public static function checkLogin($data){ + //1. 验证验证数据,这里要注意和之前版本的验证上是有区别的 +// try { +// $result = validate(ManagerValidate::class)->scene('login')->check($data); +// } catch (ValidateException $e) { +// // 验证失败 输出错误信息 +// return return_msg(0,$e->getError()); +// } + //2.验证密码和用户名 + $m = self::where('user_id', $data['username'])->find(); + if(!$m){ + return return_msg(0,"用户名不存在"); + } + //验证密码是否正确 + if(password_verify($data['password'],$m['password']) !==true) return return_msg(0,"密码输入错误"); + //记录用户登录的状态 + session('username',$data['username']); + session('userid',$m['id']); + return return_msg(1,"登录成功"); + } } diff --git a/app/service/DeviceService.php b/app/service/DeviceService.php index dc166b4..7ff0550 100644 --- a/app/service/DeviceService.php +++ b/app/service/DeviceService.php @@ -7,7 +7,8 @@ namespace app\service; use app\model\DeviceModel; -use app\model\UserModel; +use think\facade\Db; + class DeviceService @@ -15,14 +16,21 @@ class DeviceService public static function insert(array $data) { - $user = new UserModel($data); - return $user->save(); + $device = new DeviceModel($data); + // TODO: 推送到云端 + return $device->save(); } public static function findList() { - $list = DeviceModel::find(1); - + //TODO:分页查询 构造分页数据 定义一个分页类 +// $list = DeviceModel::find(1)->paginate(1,10); + $list = Db::table('bs_device')->page(1,10)->select(); //Db::find(1)->paginate(1,10); +// $list = Db::table('bs_device')->paginate(1)->each(function ($item,$key){ +// $item['name'] = explode('dai', $item['name']); +// }); //Db::find(1)->paginate(1,10); + +// $count = $list->total(); return $list; } diff --git a/config/api/Aliyun.php b/config/api/Aliyun.php new file mode 100644 index 0000000..a7d2536 --- /dev/null +++ b/config/api/Aliyun.php @@ -0,0 +1,10 @@ +[ + 'AccessKeyId'=>'LTAI4Fs3dT55kRZWnoNps5Yr', + 'AccessKeySecret'=>'4aIgEwn8TqQJMrnkqNdDzAKaZYrk0a', + 'SignName'=>'智慧猪', + 'TemplateCode'=>'SMS_183766457', + ], + "expire_time"=>300 +]; diff --git a/config/middleware.php b/config/middleware.php index 7e1972f..870cad6 100644 --- a/config/middleware.php +++ b/config/middleware.php @@ -2,7 +2,9 @@ // 中间件配置 return [ // 别名或分组 - 'alias' => [], + 'alias' => [ + 'check' => \app\middleware\CheckApiLogin::class + ], // 优先级设置,此数组中的中间件会按照数组中的顺序优先执行 'priority' => [], ]; diff --git a/route/app.php b/route/app.php index d8e09e3..c38f89d 100644 --- a/route/app.php +++ b/route/app.php @@ -15,3 +15,6 @@ }); Route::get('hello/:name', 'index/hello'); + +// ----- 需要token 验证的接口 +//Route::post('user/login',"User/doLogin")->middleware('check'); From 39b79dddfa93dc6d171984848d1c14613b7b9b95 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sat, 18 Apr 2020 17:59:02 +0800 Subject: [PATCH 36/60] update --- app/controller/Device.php | 8 ++++++++ app/controller/User.php | 27 +++++++++++++++------------ app/service/DeviceService.php | 17 +++++++++++++++++ app/service/UserService.php | 6 ++++-- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/app/controller/Device.php b/app/controller/Device.php index 1d949d3..8836911 100644 --- a/app/controller/Device.php +++ b/app/controller/Device.php @@ -18,6 +18,14 @@ public function list(Request $request) { return ok($this->app->deviceService->findList($request->param())); } + public function userlist(Request $request) { + return ok($this->app->deviceService->findUserList($request->param())); + } + + public function companylist(Request $request) { + return ok($this->app->deviceService->findCompanyList($request->param())); + } + public function create(Request $request) { return ok($this->app->deviceService->insert($request->param())); } diff --git a/app/controller/User.php b/app/controller/User.php index 5f49e69..11bef2e 100644 --- a/app/controller/User.php +++ b/app/controller/User.php @@ -9,6 +9,9 @@ class User extends BaseController { + public function list(Request $request) { + return ok($this->app->userService->findList($request->param())); + } public function doLogin(Request $request) { $data = $request::post(); // 把数据交由模型层来进行处理 @@ -28,21 +31,21 @@ public function login(Request $request) //1 校验参数 //2 生成token //3 存储token - $data = $request::post(); - // 把数据交由模型层来进行处理 - UserModel::checkLogin($data); +// $data = $request::post(); +// // 把数据交由模型层来进行处理 +// UserModel::checkLogin($data); +// +// // 如果验证成功 +// // 1 设置token +// // 2 返回token到前端 +// Auth::getInstance()->setToken(); +// $token = Auth::getInstance()->getToken(); +// $data = ['data' => $token, 'code' => 20000]; +// return json($data); - // 如果验证成功 - // 1 设置token - // 2 返回token到前端 - Auth::getInstance()->setToken(); - $token = Auth::getInstance()->getToken(); + $token = ['token' => 'admin-token']; $data = ['data' => $token, 'code' => 20000]; return json($data); - -// $token = ['token' => 'admin-token']; -// $data = ['data' => $token, 'code' => 20000]; -// return json($data); } public function info() diff --git a/app/service/DeviceService.php b/app/service/DeviceService.php index 7ff0550..54c1459 100644 --- a/app/service/DeviceService.php +++ b/app/service/DeviceService.php @@ -34,5 +34,22 @@ public static function findList() return $list; } + public static function findUserList() + { + //TODO:分页查询 构造分页数据 定义一个分页类 + $list = Db::table('sys_user')->page(1,10)->select(); //Db::find(1)->paginate(1,10); + + return $list; + + } + + public static function findCompanyList() + { + //TODO:分页查询 构造分页数据 定义一个分页类 + $list = Db::table('bs_company')->page(1,10)->select(); //Db::find(1)->paginate(1,10); + + return $list; + + } } diff --git a/app/service/UserService.php b/app/service/UserService.php index d462102..31886d2 100644 --- a/app/service/UserService.php +++ b/app/service/UserService.php @@ -24,10 +24,12 @@ public static function delete() } + public static function findList() { - $user = UserModel::find(1); - + //TODO:分页查询 构造分页数据 定义一个分页类 + $list = Db::table('sys_user')->page(1, 10)->select(); //Db::find(1)->paginate(1,10); + return $list; } } From 7e5b9b785a7e74527158b35b6f0ce9dc4b3442b8 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Tue, 21 Apr 2020 09:05:02 +0800 Subject: [PATCH 37/60] update --- app/common.php | 2 +- app/controller/Device.php | 4 +++- app/service/CloudApiService.php | 37 +++++++++++++++------------------ app/service/DeviceService.php | 3 ++- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/common.php b/app/common.php index 7cc846e..242b416 100644 --- a/app/common.php +++ b/app/common.php @@ -62,7 +62,7 @@ function sendSms($phone,$code) { */ function getAccessToken() { $wxConfig = Config::get('wxconfig'); - // 将token放到缓存中 + // 将token放到缓存中,检查token是否失效 $token = Cache::get('access_token'); try { if (!$token) { diff --git a/app/controller/Device.php b/app/controller/Device.php index 8836911..2395ca8 100644 --- a/app/controller/Device.php +++ b/app/controller/Device.php @@ -27,7 +27,9 @@ public function companylist(Request $request) { } public function create(Request $request) { - return ok($this->app->deviceService->insert($request->param())); + // 推送到云端 + $this->app->cloudService->databaseAdd('bs_device',$request->param()); +// return ok($this->app->deviceService->insert($request->param())); } public function sync() { diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index f29c6ea..f7e259a 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -6,6 +6,7 @@ class CloudApiService //定义一个静态成员变量 protected static $env = 'test-87exc'; protected static $http_api_url = 'https://api.weixin.qq.com/tcb/databasequery?access_token='; + protected static $HTTPAPI_DATABASE_ADD = 'https://api.weixin.qq.com/tcb/databaseadd?access_token='; // 设置云环境Id的值 public static function setEnv($envId){ @@ -24,26 +25,22 @@ public static function databaseQuery($param) { } - public static function test() { - $url = self::$http_api_url . getAccessToken(); - return json($url); - } - - public static function databaseAdd($param) { - + public static function databaseAdd($collection,array $dataObj) { + $url = self::$HTTPAPI_DATABASE_ADD . getAccessToken(); + try { + $modelObj = new class{}; + $modelObj->data = $dataObj; + $query = "db.collection(\"bs_device\").add(" . json_encode($modelObj) . ")"; + + $obj = new class{}; + $obj->env = self::$env; + $obj->query = $query;// $param['query']; + $data = json_encode($obj); + } catch (Exception $e) { + echo $e->getMessage(); + } + + httpRequest($url,$data); } - public static function syncTable($table) { - $url = self::$http_api_url . getAccessToken(); - $query = 'db.collection('.$table.').get()'; - $obj = new class{}; - $obj->env = self::$env; - $obj->query = $query; - - $data = json_encode($obj); - $output = httpRequest($url,$data); - - // TODO:保存到数据库中 - - } } diff --git a/app/service/DeviceService.php b/app/service/DeviceService.php index 54c1459..a79bf4d 100644 --- a/app/service/DeviceService.php +++ b/app/service/DeviceService.php @@ -17,7 +17,8 @@ class DeviceService public static function insert(array $data) { $device = new DeviceModel($data); - // TODO: 推送到云端 + + return $device->save(); } From ddf07d24d44924b75ee850f78fc28513e2b604c3 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Tue, 21 Apr 2020 10:14:15 +0800 Subject: [PATCH 38/60] update --- app/controller/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controller/User.php b/app/controller/User.php index 11bef2e..930aeaa 100644 --- a/app/controller/User.php +++ b/app/controller/User.php @@ -52,7 +52,7 @@ public function info() { //1 根据token查询用户信息 $roles=array(0=>"admin"); - $result = ['roles' => $roles, 'name' => 'Super Admin',"introduction" => '',"avatar" =>'']; + $result = ['roles' => $roles, 'name' => 'Super Admin', 'avatar' =>'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif']; $data = ['code' => 20000, 'msg' => 'success', 'data' => $result]; return json($data); From 6ec433c10ed2aa83311406617b44bc299b1a43b6 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Tue, 21 Apr 2020 17:58:29 +0800 Subject: [PATCH 39/60] update --- app/controller/Company.php | 36 +++++++++++++++++++++++++++ app/controller/Device.php | 18 +++++++++++++- app/controller/Identity.php | 36 +++++++++++++++++++++++++++ app/controller/Member.php | 2 +- app/service/CloudApiService.php | 43 ++++++++++++++++++++++++++++++--- app/service/CompanyService.php | 22 +++++++++++++++++ composer.json | 3 ++- 7 files changed, 154 insertions(+), 6 deletions(-) create mode 100644 app/controller/Company.php create mode 100644 app/controller/Identity.php create mode 100644 app/service/CompanyService.php diff --git a/app/controller/Company.php b/app/controller/Company.php new file mode 100644 index 0000000..2899a54 --- /dev/null +++ b/app/controller/Company.php @@ -0,0 +1,36 @@ +app->cloudService->databaseQuery('bs_company',$request->param()); + } + + public function create(Request $request) { + // 推送到云端 + $this->app->cloudService->databaseAdd('bs_company',$request->param()); +// return ok($this->app->deviceService->insert($request->param())); + } + + public function update(Request $request) { + // 更新云端数据 + $this->app->cloudService->databaseUpdate('bs_company',$request->param()); + } + + public function delete(Request $request) { + // 更新云端数据 + $this->app->cloudService->databaseDelete('bs_company',$request->param()); + } + +} diff --git a/app/controller/Device.php b/app/controller/Device.php index 2395ca8..76c3793 100644 --- a/app/controller/Device.php +++ b/app/controller/Device.php @@ -15,7 +15,9 @@ class Device extends BaseController { public function list(Request $request) { - return ok($this->app->deviceService->findList($request->param())); +// return ok($this->app->deviceService->findList($request->param())); + // 从小程序端获取 + return $this->app->cloudService->databaseQuery('bs_device',$request->param()); } public function userlist(Request $request) { @@ -26,12 +28,26 @@ public function companylist(Request $request) { return ok($this->app->deviceService->findCompanyList($request->param())); } + public function identityList(Request $request) { + return $this->app->cloudService->databaseQuery('bs_identity',$request->param()); + } + public function create(Request $request) { // 推送到云端 $this->app->cloudService->databaseAdd('bs_device',$request->param()); // return ok($this->app->deviceService->insert($request->param())); } + public function update(Request $request) { + // 更新云端数据 + $this->app->cloudService->databaseUpdate('bs_device',$request->param()); + } + + public function delete(Request $request) { + // 更新云端数据 + $this->app->cloudService->databaseDelete('bs_device',$request->param()); + } + public function sync() { } diff --git a/app/controller/Identity.php b/app/controller/Identity.php new file mode 100644 index 0000000..5ec2033 --- /dev/null +++ b/app/controller/Identity.php @@ -0,0 +1,36 @@ +app->cloudService->databaseQuery('bs_identity',$request->param()); + } + + public function create(Request $request) { + // 推送到云端 + $this->app->cloudService->databaseAdd('bs_identity',$request->param()); +// return ok($this->app->deviceService->insert($request->param())); + } + + public function update(Request $request) { + // 更新云端数据 + $this->app->cloudService->databaseUpdate('bs_identity',$request->param()); + } + + public function delete(Request $request) { + // 更新云端数据 + $this->app->cloudService->databaseDelete('bs_identity',$request->param()); + } +} diff --git a/app/controller/Member.php b/app/controller/Member.php index a6c3634..a52295e 100644 --- a/app/controller/Member.php +++ b/app/controller/Member.php @@ -21,7 +21,7 @@ class Member extends BaseController * @return mixed */ public function list(Request $request) { - return $this->app->cloudService->databaseQuery($request->param()); + return $this->app->cloudService->databaseQuery('cloud_member',$request->param()); } public function test(Request $request) { diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index f7e259a..3fde510 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -7,14 +7,16 @@ class CloudApiService protected static $env = 'test-87exc'; protected static $http_api_url = 'https://api.weixin.qq.com/tcb/databasequery?access_token='; protected static $HTTPAPI_DATABASE_ADD = 'https://api.weixin.qq.com/tcb/databaseadd?access_token='; + protected static $HTTPAPI_DATABASE_UPDATE = 'https://api.weixin.qq.com/tcb/databaseupdate?access_token='; + protected static $HTTPAPI_DATABASE_DELETE = 'https://api.weixin.qq.com/tcb/databasedelete?access_token='; // 设置云环境Id的值 public static function setEnv($envId){ self::$env = $envId; } - public static function databaseQuery($param) { - $query = 'db.collection(\"member\").get()'; + public static function databaseQuery($collection,$param) { + $query = "db.collection('" . $collection . "').get()"; $url = self::$http_api_url . getAccessToken(); $obj = new class{}; $obj->env = self::$env; @@ -30,7 +32,42 @@ public static function databaseAdd($collection,array $dataObj) { try { $modelObj = new class{}; $modelObj->data = $dataObj; - $query = "db.collection(\"bs_device\").add(" . json_encode($modelObj) . ")"; + $query = "db.collection('" . $collection . "').add(" . json_encode($modelObj) . ")"; + + $obj = new class{}; + $obj->env = self::$env; + $obj->query = $query;// $param['query']; + $data = json_encode($obj); + } catch (Exception $e) { + echo $e->getMessage(); + } + + httpRequest($url,$data); + } + public static function databaseUpdate($collection,array $dataObj) { + $url = self::$HTTPAPI_DATABASE_UPDATE . getAccessToken(); + try { + $modelObj = new class{}; + $modelObj->data = $dataObj; + $query = "db.collection('" . $collection . "').where({_id:'" . $dataObj['_id'] . "'}).update(" . json_encode($modelObj) . ")"; + + $obj = new class{}; + $obj->env = self::$env; + $obj->query = $query;// $param['query']; + $data = json_encode($obj); + } catch (Exception $e) { + echo $e->getMessage(); + } + + httpRequest($url,$data); + } + + public static function databaseDelete($collection,array $dataObj) { + $url = self::$HTTPAPI_DATABASE_UPDATE . getAccessToken(); + try { + $modelObj = new class{}; + $modelObj->data = $dataObj; + $query = "db.collection('" . $collection . "').where({_id:'" . $dataObj['_id'] . "'}).remove()"; $obj = new class{}; $obj->env = self::$env; diff --git a/app/service/CompanyService.php b/app/service/CompanyService.php new file mode 100644 index 0000000..78aa927 --- /dev/null +++ b/app/service/CompanyService.php @@ -0,0 +1,22 @@ +page(1,10)->select(); //Db::find(1)->paginate(1,10); + + return $list; + + } +} diff --git a/composer.json b/composer.json index ac0cda6..6c5a230 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,8 @@ "topthink/think-orm": "^2.0", "endroid/qrcode": "^3.7", "alibabacloud/client": "^1.5", - "endroid/qr-code": "^3.7" + "endroid/qr-code": "^3.7", + "qcloud/cos-sdk-v5": ">=2.0" }, "require-dev": { "symfony/var-dumper": "^4.2", From a997f3eb417bbf409aea6ab914f27f2620ed3f65 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Wed, 22 Apr 2020 11:26:30 +0800 Subject: [PATCH 40/60] =?UTF-8?q?=E6=81=A2=E5=A4=8D.env=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .22env1 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .22env1 diff --git a/.22env1 b/.22env1 deleted file mode 100644 index 5f00c6e..0000000 --- a/.22env1 +++ /dev/null @@ -1 +0,0 @@ -APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = jxhhyq USERNAME = root PASSWORD = dys114818 HOSTPORT = 3306 CHARSET = utf8 DEBUG = true [LANG] default_lang = zh-cn \ No newline at end of file From d751431dd2bcf8ea1f12dcd068c3cc43ae2c6bd1 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Wed, 22 Apr 2020 17:20:00 +0800 Subject: [PATCH 41/60] =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Miniapp.php | 57 -------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 app/controller/Miniapp.php diff --git a/app/controller/Miniapp.php b/app/controller/Miniapp.php deleted file mode 100644 index 0a3d734..0000000 --- a/app/controller/Miniapp.php +++ /dev/null @@ -1,57 +0,0 @@ -getAccessToken(); - $obj = new class{}; - $obj->env = 'test-87exc'; - $obj->query = $query; - $data = json_encode($obj); - - return $this->http_request($url,$data); - - } - - public function http_request($url, $data = null) - { - $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); - if (! empty($data)) { - curl_setopt($curl, CURLOPT_POST, 1); - curl_setopt($curl, CURLOPT_POSTFIELDS, $data); - } - curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); - $output = curl_exec($curl); - curl_close($curl); - return json($output); - } - -} From ac019e22a8e841e04f704637097237f2f77f2d58 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Wed, 22 Apr 2020 22:03:31 +0800 Subject: [PATCH 42/60] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E6=BA=90=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readMe.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 readMe.txt diff --git a/readMe.txt b/readMe.txt new file mode 100644 index 0000000..ece3b86 --- /dev/null +++ b/readMe.txt @@ -0,0 +1,2 @@ +// 增加origin 地址 +https://gitee.com/inner_boy/tp6-basic.git From fb5b41dc0ed581ab1e558f0021876ad8b049677c Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Wed, 22 Apr 2020 22:10:16 +0800 Subject: [PATCH 43/60] update --- readMe.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readMe.txt b/readMe.txt index ece3b86..f0dc98b 100644 --- a/readMe.txt +++ b/readMe.txt @@ -1,2 +1,3 @@ // 增加origin 地址 https://gitee.com/inner_boy/tp6-basic.git +// 增加行数测试 From 45ec3017170e515f873c5d7825f965a42efdd02f Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sat, 25 Apr 2020 21:32:51 +0800 Subject: [PATCH 44/60] update --- .envbak | 1 + app/controller/File.php | 64 ++++++++++ composer.json | 6 + composer.lock | 276 +++++++++++++++++++++++++++++++--------- 4 files changed, 289 insertions(+), 58 deletions(-) create mode 100644 .envbak create mode 100644 app/controller/File.php diff --git a/.envbak b/.envbak new file mode 100644 index 0000000..5f00c6e --- /dev/null +++ b/.envbak @@ -0,0 +1 @@ +APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = jxhhyq USERNAME = root PASSWORD = dys114818 HOSTPORT = 3306 CHARSET = utf8 DEBUG = true [LANG] default_lang = zh-cn \ No newline at end of file diff --git a/app/controller/File.php b/app/controller/File.php new file mode 100644 index 0000000..21604c4 --- /dev/null +++ b/app/controller/File.php @@ -0,0 +1,64 @@ +upload2cloud($_FILES['file'])); + + + } + + private function upload2cloud($file) { + // 0 从数据库中取值 + $config = Db::table('sys_config')->where('type','tencentYun')->findOrEmpty();//->where('type', tencentYun)->find(); + // 初始化 + $secretId = $config['app_id'];//"AKIDUn13vcDWRRHvMarib1NISQH3agUAnBQQ"; //"云 API 密钥 SecretId"; + $secretKey = $config['app_secret'];//"wjPq42uo5HOXG7rKgjtjR4gCrQyQqAYn"; //"云 API 密钥 SecretKey"; + $region = "ap-guangzhou"; //设置一个默认的存储桶地域 + $cosClient = new Client( + array( + 'region' => $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); + // 上传文件流 + try { + //存储桶名称 格式:BucketName-APPID + $bucket = "upload-1300792747"; + + $fileName = $file['name']; + // 文件名+时间戳生成唯一的文件名 + $key = "jxshhkj/device/" . time() . substr($fileName,strpos($fileName, '.'),strlen($fileName)); + $fileObj = fopen($file['tmp_name'], "rb"); + if ($fileObj) { + $result = $cosClient->putObject(array( + 'Bucket' => $bucket, + 'Key' => $key, + 'Body' => $fileObj + )); + + return "https://" . $result['Location']; + } + } catch (\Exception $e) { + echo "$e\n"; + } + + return null; + } + +} diff --git a/composer.json b/composer.json index 6c5a230..6fee5a2 100644 --- a/composer.json +++ b/composer.json @@ -48,5 +48,11 @@ "@php think service:discover", "@php think vendor:publish" ] + }, + "repositories": { + "packagist": { + "type": "composer", + "url": "https://packagist.phpcomposer.com" + } } } diff --git a/composer.lock b/composer.lock index 5e78476..001844a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "dc73c86f83fe84fea36812ecc232cc62", + "content-hash": "714e490b67f212d3bda8ec1ca416b517", "packages": [ { "name": "adbario/php-dot-notation", @@ -452,25 +452,79 @@ "abandoned": "endroid/qr-code", "time": "2020-03-10T08:32:43+00:00" }, + { + "name": "guzzlehttp/command", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/command.git", + "reference": "2aaa2521a8f8269d6f5dfc13fe2af12c76921034" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/command/zipball/2aaa2521a8f8269d6f5dfc13fe2af12c76921034", + "reference": "2aaa2521a8f8269d6f5dfc13fe2af12c76921034", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.2", + "guzzlehttp/promises": "~1.3", + "guzzlehttp/psr7": "~1.0", + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.9-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Command\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + } + ], + "description": "Provides the foundation for building command-based web service clients", + "time": "2016-11-24T13:34:15+00:00" + }, { "name": "guzzlehttp/guzzle", - "version": "6.5.2", + "version": "6.5.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "43ece0e75098b7ecd8d13918293029e555a50f82" + "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82", - "reference": "43ece0e75098b7ecd8d13918293029e555a50f82", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/aab4ebd862aa7d04f01a4b51849d657db56d882e", + "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.0", "guzzlehttp/psr7": "^1.6.1", - "php": ">=5.5" + "php": ">=5.5", + "symfony/polyfill-intl-idn": "^1.11" }, "require-dev": { "ext-curl": "*", @@ -478,7 +532,6 @@ "psr/log": "^1.1" }, "suggest": { - "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", @@ -517,7 +570,67 @@ "rest", "web service" ], - "time": "2019-12-23T11:57:10+00:00" + "time": "2020-04-18T10:38:46+00:00" + }, + { + "name": "guzzlehttp/guzzle-services", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle-services.git", + "reference": "9e3abf20161cbf662d616cbb995f2811771759f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle-services/zipball/9e3abf20161cbf662d616cbb995f2811771759f7", + "reference": "9e3abf20161cbf662d616cbb995f2811771759f7", + "shasum": "" + }, + "require": { + "guzzlehttp/command": "~1.0", + "guzzlehttp/guzzle": "^6.2", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "gimler/guzzle-description-loader": "^0.0.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Command\\Guzzle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "Stefano Kowalke", + "email": "blueduck@mail.org", + "homepage": "https://github.com/konafets" + } + ], + "description": "Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.", + "time": "2017-10-06T14:32:02+00:00" }, { "name": "guzzlehttp/promises", @@ -643,16 +756,16 @@ }, { "name": "khanamiryan/qrcode-detector-decoder", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/khanamiryan/php-qrcode-detector-decoder.git", - "reference": "a75482d3bc804e3f6702332bfda6cccbb0dfaa76" + "reference": "89b57f2d9939dd57394b83f6ccbd3e1a74659e34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/a75482d3bc804e3f6702332bfda6cccbb0dfaa76", - "reference": "a75482d3bc804e3f6702332bfda6cccbb0dfaa76", + "url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/89b57f2d9939dd57394b83f6ccbd3e1a74659e34", + "reference": "89b57f2d9939dd57394b83f6ccbd3e1a74659e34", "shasum": "" }, "require": { @@ -689,20 +802,20 @@ "qr", "zxing" ], - "time": "2018-04-26T11:41:33+00:00" + "time": "2020-04-19T16:18:51+00:00" }, { "name": "league/flysystem", - "version": "1.0.66", + "version": "1.0.67", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "021569195e15f8209b1c4bebb78bd66aa4f08c21" + "reference": "5b1f36c75c4bdde981294c2a0ebdb437ee6f275e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/021569195e15f8209b1c4bebb78bd66aa4f08c21", - "reference": "021569195e15f8209b1c4bebb78bd66aa4f08c21", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/5b1f36c75c4bdde981294c2a0ebdb437ee6f275e", + "reference": "5b1f36c75c4bdde981294c2a0ebdb437ee6f275e", "shasum": "" }, "require": { @@ -773,7 +886,7 @@ "sftp", "storage" ], - "time": "2020-03-17T18:58:12+00:00" + "time": "2020-04-16T13:21:26+00:00" }, { "name": "league/flysystem-cached-adapter", @@ -1226,6 +1339,53 @@ ], "time": "2017-10-23T01:57:42+00:00" }, + { + "name": "qcloud/cos-sdk-v5", + "version": "v2.0.8", + "source": { + "type": "git", + "url": "https://github.com/tencentyun/cos-php-sdk-v5.git", + "reference": "9d9471397fd4712e9b35adf819a9f2e28b91d079" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/9d9471397fd4712e9b35adf819a9f2e28b91d079", + "reference": "9d9471397fd4712e9b35adf819a9f2e28b91d079", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "~6.3", + "guzzlehttp/guzzle-services": "~1.1", + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Qcloud\\Cos\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "yaozongyou", + "email": "yaozongyou@vip.qq.com" + }, + { + "name": "lewzylu", + "email": "327874225@qq.com" + } + ], + "description": "PHP SDK for QCloud COS", + "keywords": [ + "cos", + "php", + "qcloud" + ], + "time": "2020-04-21T01:45:23+00:00" + }, { "name": "ralouphie/getallheaders", "version": "3.0.3", @@ -1268,16 +1428,16 @@ }, { "name": "symfony/http-foundation", - "version": "v5.0.6", + "version": "v5.0.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "2da08283c33cfa34d6e332a01436931e318f5f80" + "reference": "26fb006a2c7b6cdd23d52157b05f8414ffa417b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/2da08283c33cfa34d6e332a01436931e318f5f80", - "reference": "2da08283c33cfa34d6e332a01436931e318f5f80", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/26fb006a2c7b6cdd23d52157b05f8414ffa417b6", + "reference": "26fb006a2c7b6cdd23d52157b05f8414ffa417b6", "shasum": "" }, "require": { @@ -1319,20 +1479,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2020-03-23T12:42:46+00:00" + "time": "2020-03-30T14:14:32+00:00" }, { "name": "symfony/inflector", - "version": "v5.0.6", + "version": "v5.0.7", "source": { "type": "git", "url": "https://github.com/symfony/inflector.git", - "reference": "e375603b6bd12e8e3aec3fc1b640ac18a4ef4cb2" + "reference": "70c25c66427e2bb6ba0827d668366d60b0a90cbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/inflector/zipball/e375603b6bd12e8e3aec3fc1b640ac18a4ef4cb2", - "reference": "e375603b6bd12e8e3aec3fc1b640ac18a4ef4cb2", + "url": "https://api.github.com/repos/symfony/inflector/zipball/70c25c66427e2bb6ba0827d668366d60b0a90cbf", + "reference": "70c25c66427e2bb6ba0827d668366d60b0a90cbf", "shasum": "" }, "require": { @@ -1377,20 +1537,20 @@ "symfony", "words" ], - "time": "2020-01-04T14:08:26+00:00" + "time": "2020-03-27T16:56:45+00:00" }, { "name": "symfony/mime", - "version": "v5.0.6", + "version": "v5.0.7", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "e9927cabc1519d2498d02b743f2cab6e4722ad3d" + "reference": "481b7d6da88922fb1e0d86a943987722b08f3955" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/e9927cabc1519d2498d02b743f2cab6e4722ad3d", - "reference": "e9927cabc1519d2498d02b743f2cab6e4722ad3d", + "url": "https://api.github.com/repos/symfony/mime/zipball/481b7d6da88922fb1e0d86a943987722b08f3955", + "reference": "481b7d6da88922fb1e0d86a943987722b08f3955", "shasum": "" }, "require": { @@ -1439,20 +1599,20 @@ "mime", "mime-type" ], - "time": "2020-03-16T12:10:54+00:00" + "time": "2020-03-27T16:56:45+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.0.6", + "version": "v5.0.7", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "b1ab86ce52b0c0abe031367a173005a025e30e04" + "reference": "09dccfffd24b311df7f184aa80ee7b61ad61ed8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b1ab86ce52b0c0abe031367a173005a025e30e04", - "reference": "b1ab86ce52b0c0abe031367a173005a025e30e04", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/09dccfffd24b311df7f184aa80ee7b61ad61ed8d", + "reference": "09dccfffd24b311df7f184aa80ee7b61ad61ed8d", "shasum": "" }, "require": { @@ -1493,7 +1653,7 @@ "configuration", "options" ], - "time": "2020-01-04T14:08:26+00:00" + "time": "2020-03-27T16:56:45+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1731,16 +1891,16 @@ }, { "name": "symfony/property-access", - "version": "v5.0.6", + "version": "v5.0.7", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "778be1fa3dba63a241970bb9f79ff1849b2506ff" + "reference": "6b14bd5e184fc3bbbd35e378692c61af765515b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/778be1fa3dba63a241970bb9f79ff1849b2506ff", - "reference": "778be1fa3dba63a241970bb9f79ff1849b2506ff", + "url": "https://api.github.com/repos/symfony/property-access/zipball/6b14bd5e184fc3bbbd35e378692c61af765515b8", + "reference": "6b14bd5e184fc3bbbd35e378692c61af765515b8", "shasum": "" }, "require": { @@ -1794,7 +1954,7 @@ "property path", "reflection" ], - "time": "2020-03-16T16:38:48+00:00" + "time": "2020-03-27T16:56:45+00:00" }, { "name": "topthink/framework", @@ -1860,16 +2020,16 @@ }, { "name": "topthink/think-helper", - "version": "v3.1.3", + "version": "v3.1.4", "source": { "type": "git", "url": "https://github.com/top-think/think-helper.git", - "reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4" + "reference": "c28d37743bda4a0455286ca85b17b5791d626e10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-helper/zipball/4d85dfd3778623bbb1de3648f1dcd0c82f4439f4", - "reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4", + "url": "https://api.github.com/repos/top-think/think-helper/zipball/c28d37743bda4a0455286ca85b17b5791d626e10", + "reference": "c28d37743bda4a0455286ca85b17b5791d626e10", "shasum": "" }, "require": { @@ -1895,7 +2055,7 @@ } ], "description": "The ThinkPHP6 Helper Package", - "time": "2019-09-30T02:36:48+00:00" + "time": "2019-11-08T08:01:10+00:00" }, { "name": "topthink/think-orm", @@ -1946,16 +2106,16 @@ "packages-dev": [ { "name": "symfony/var-dumper", - "version": "v4.4.6", + "version": "v4.4.7", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "6dae4692ac91230b33b70d9a48882ff5c838d67a" + "reference": "5a0c2d93006131a36cf6f767d10e2ca8333b0d4a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/6dae4692ac91230b33b70d9a48882ff5c838d67a", - "reference": "6dae4692ac91230b33b70d9a48882ff5c838d67a", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/5a0c2d93006131a36cf6f767d10e2ca8333b0d4a", + "reference": "5a0c2d93006131a36cf6f767d10e2ca8333b0d4a", "shasum": "" }, "require": { @@ -2018,20 +2178,20 @@ "debug", "dump" ], - "time": "2020-03-18T07:15:43+00:00" + "time": "2020-03-27T16:54:36+00:00" }, { "name": "topthink/think-trace", - "version": "v1.2", + "version": "v1.3", "source": { "type": "git", "url": "https://github.com/top-think/think-trace.git", - "reference": "4589d06a07945d57478cc2236f4b23d51ff919cc" + "reference": "d8da2e39df268ab8775013de699f0c3012e51318" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-trace/zipball/4589d06a07945d57478cc2236f4b23d51ff919cc", - "reference": "4589d06a07945d57478cc2236f4b23d51ff919cc", + "url": "https://api.github.com/repos/top-think/think-trace/zipball/d8da2e39df268ab8775013de699f0c3012e51318", + "reference": "d8da2e39df268ab8775013de699f0c3012e51318", "shasum": "" }, "require": { @@ -2065,7 +2225,7 @@ } ], "description": "thinkphp debug trace", - "time": "2019-10-17T02:14:09+00:00" + "time": "2020-03-18T07:59:53+00:00" } ], "aliases": [], From a34bcd77b32108c5284f30a772071c01dd4d8431 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Tue, 5 May 2020 00:18:42 +0800 Subject: [PATCH 45/60] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=9A=84=E5=AE=8C=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/libs/Auth.php | 19 ++++++---- app/common.php | 4 +- app/controller/DailyCheck.php | 34 +++++++++++++++++ app/controller/Device.php | 13 ++----- app/controller/Role.php | 11 ++---- app/controller/User.php | 59 +++++++++++++----------------- app/middleware/CheckAdminLogin.php | 19 ++++++++++ app/model/UserModel.php | 22 +++++++---- app/service/CloudApiService.php | 26 ++++++++++++- app/service/CompanyService.php | 7 ---- app/service/DeviceService.php | 43 ---------------------- app/service/UserService.php | 13 +++++-- config/auth.php | 9 +++++ config/middleware.php | 3 +- config/route.php | 3 ++ route/app.php | 16 +++++++- 16 files changed, 176 insertions(+), 125 deletions(-) create mode 100644 app/controller/DailyCheck.php create mode 100644 app/middleware/CheckAdminLogin.php create mode 100644 config/auth.php diff --git a/app/api/libs/Auth.php b/app/api/libs/Auth.php index 832f151..869b87e 100644 --- a/app/api/libs/Auth.php +++ b/app/api/libs/Auth.php @@ -5,6 +5,8 @@ use app\model\UserModel; use think\facade\Request; +use app\exception\HttpExceptions; +use think\facade\Config; /** * 1.生成令牌 @@ -22,8 +24,8 @@ class Auth private function __construct() { $request = Request::instance(); - $this->username = $request->post('username'); - $this->token = $request->param('token'); + $this->username = $request->param('username'); + $this->token = $request->header('token'); } private function __clone() @@ -52,9 +54,9 @@ private function createToken(){ public function setToken(){ $this->createToken(); //写入数据表 - $user = (new User())->where('username','=',$this->username)->find(); - $user->login_code = $this->token; - $user->expiration_time = time()+config('auth.expire_time'); + $user = UserModel::where('user_name','=',$this->username)->find(); + $user->token = $this->token; + $user->expire_time = time() +Config::get('auth.expire_time'); $user->save(); return $this; } @@ -62,17 +64,18 @@ public function setToken(){ //验证,10006:无权限 public function checkLogin(){ //1.到数据库中查询用户信息,token - $user = (new UserModel())->where('login_code','=',$this->token)->find(); + $user = UserModel::where('token','=',$this->token)->find(); if(!$user){ throw new HttpExceptions(403,"无权限",10006); } //2. 登录是否过期 10007:超时 - if($user['expiration_time']expiration_time-time())<5){ - $user->expiration_time = time()+config('auth.expire_time'); + $user->expiration_time = time()+3600; +// config('auth.expire_time'); $user->save(); } // echo $user->expiration_time."\n"; diff --git a/app/common.php b/app/common.php index 242b416..066efaf 100644 --- a/app/common.php +++ b/app/common.php @@ -135,10 +135,10 @@ function fail($data) { function return_msg($code,$msg) { $result=array( 'code' => $code, - 'msg' => $msg + 'message' => $msg ); - return json($result); + return $result; } diff --git a/app/controller/DailyCheck.php b/app/controller/DailyCheck.php new file mode 100644 index 0000000..ba5a94f --- /dev/null +++ b/app/controller/DailyCheck.php @@ -0,0 +1,34 @@ +app->cloudService->databaseQuery('bs_daily_check',$request->param()); + } + + public function create(Request $request) { + $this->app->cloudService->databaseAdd('bs_daily_check',$request->param()); + } + + public function update(Request $request) { + $this->app->cloudService->databaseUpdate('bs_daily_check',$request->param()); + } + + public function delete(Request $request) { + $this->app->cloudService->databaseDelete('bs_daily_check',$request->param()); + } + +} diff --git a/app/controller/Device.php b/app/controller/Device.php index 76c3793..d42d5d4 100644 --- a/app/controller/Device.php +++ b/app/controller/Device.php @@ -15,27 +15,22 @@ class Device extends BaseController { public function list(Request $request) { -// return ok($this->app->deviceService->findList($request->param())); // 从小程序端获取 return $this->app->cloudService->databaseQuery('bs_device',$request->param()); } - public function userlist(Request $request) { - return ok($this->app->deviceService->findUserList($request->param())); + public function deviceList(Request $request) { + return $this->app->cloudService->findDeviceList($request->param()); } - public function companylist(Request $request) { - return ok($this->app->deviceService->findCompanyList($request->param())); + public function companylist() { + return $this->app->cloudService->findCompanyList(); } - public function identityList(Request $request) { - return $this->app->cloudService->databaseQuery('bs_identity',$request->param()); - } public function create(Request $request) { // 推送到云端 $this->app->cloudService->databaseAdd('bs_device',$request->param()); -// return ok($this->app->deviceService->insert($request->param())); } public function update(Request $request) { diff --git a/app/controller/Role.php b/app/controller/Role.php index 77d7e42..940551f 100644 --- a/app/controller/Role.php +++ b/app/controller/Role.php @@ -2,18 +2,15 @@ namespace app\controller; use app\BaseController; -use think\facade\Db; +use app\Request; class Role extends BaseController { - public function list() - { - $list = Db::name('sys_role')->select(); - - return ok($list); + public function list(Request $request) { + // 从小程序端获取 + return $this->app->cloudService->databaseQuery('sys_role',$request->param()); } - public function test() { $token = ['token' => 'admin-token']; diff --git a/app/controller/User.php b/app/controller/User.php index 930aeaa..f1ee7d3 100644 --- a/app/controller/User.php +++ b/app/controller/User.php @@ -12,41 +12,20 @@ class User extends BaseController public function list(Request $request) { return ok($this->app->userService->findList($request->param())); } - public function doLogin(Request $request) { - $data = $request::post(); - // 把数据交由模型层来进行处理 + public function login(Request $request) { + $data = $request->param(); + // 0 校验参数,把数据交由模型层来进行处理 UserModel::checkLogin($data); - // 如果验证成功 // 1 设置token // 2 返回token到前端 Auth::getInstance()->setToken(); $token = Auth::getInstance()->getToken(); - $data = ['data' => $token, 'code' => 20000]; - return json($data); + $data = ['token' => $token]; + $result = ['data' => $data, 'code' => 20000]; + return json($result); } - public function login(Request $request) - { - //1 校验参数 - //2 生成token - //3 存储token -// $data = $request::post(); -// // 把数据交由模型层来进行处理 -// UserModel::checkLogin($data); -// -// // 如果验证成功 -// // 1 设置token -// // 2 返回token到前端 -// Auth::getInstance()->setToken(); -// $token = Auth::getInstance()->getToken(); -// $data = ['data' => $token, 'code' => 20000]; -// return json($data); - - $token = ['token' => 'admin-token']; - $data = ['data' => $token, 'code' => 20000]; - return json($data); - } public function info() { @@ -58,19 +37,31 @@ public function info() return json($data); } - public function logout() + public function logout(Request $request) { - //1 清除token - session('token',null); - $data = ['code' => 20000, 'msg' => 'success']; + $token = $request->param()['token']; + //1 根据用户名,清除token+过期时间 + $user = UserModel::where('token','=',$token)->find(); + $user->token = null; + $user->expire_time = 0; + $user->save(); + } - return json($data); + public function create(Request $request) + { + $returnvalue = $this->app->userService->insert($request->param()); + return ok(json($returnvalue)); + } + public function update(Request $request) + { + $returnvalue = $this->app->userService->update($request->param()); + return ok(json($returnvalue)); } - public function add(Request $request) + public function delete(Request $request) { - $returnvalue = $this->app->userService->insert($request->param()); + $returnvalue = $this->app->userService->delete($request->param()); return ok(json($returnvalue)); } diff --git a/app/middleware/CheckAdminLogin.php b/app/middleware/CheckAdminLogin.php new file mode 100644 index 0000000..ab4237b --- /dev/null +++ b/app/middleware/CheckAdminLogin.php @@ -0,0 +1,19 @@ + 'int', 'phone' => 'int', - 'name' => 'string', - 'user_id' => 'string', + 'user_name' => 'string', + 'nick_name' => 'string', + 'password' => 'string', + 'token' => 'string', + 'expire_time' => 'int', 'create_time' => 'datetime', - 'update_time' => 'datetime', + 'last_login_time' => 'int', ]; public static function checkLogin($data){ - //1. 验证验证数据,这里要注意和之前版本的验证上是有区别的 + //1. 验证数据,这里要注意和之前版本的验证上是有区别的 // try { // $result = validate(ManagerValidate::class)->scene('login')->check($data); // } catch (ValidateException $e) { @@ -35,15 +38,18 @@ public static function checkLogin($data){ // return return_msg(0,$e->getError()); // } //2.验证密码和用户名 - $m = self::where('user_id', $data['username'])->find(); + $m = self::where('user_name', $data['username'])->find(); if(!$m){ - return return_msg(0,"用户名不存在"); + return return_msg(1,"用户名不存在"); } //验证密码是否正确 - if(password_verify($data['password'],$m['password']) !==true) return return_msg(0,"密码输入错误"); + $hash = password_hash("111111", PASSWORD_DEFAULT); // $m['password'] + if(password_verify($data['password'],$m['password'])) { + return return_msg(1,"密码输入错误"); + } //记录用户登录的状态 session('username',$data['username']); session('userid',$m['id']); - return return_msg(1,"登录成功"); + return return_msg(0,"登录成功"); } } diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index 3fde510..3590c0b 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -27,6 +27,28 @@ public static function databaseQuery($collection,$param) { } + public static function findCompanyList() { + $query = "db.collection('bs_company').get()"; + $url = self::$http_api_url . getAccessToken(); + $obj = new class{}; + $obj->env = self::$env; + $obj->query = $query; + $data = json_encode($obj); + + return httpRequest($url,$data); + } + + public static function findDeviceList() { + $query = "db.collection('bs_device').get()"; + $url = self::$http_api_url . getAccessToken(); + $obj = new class{}; + $obj->env = self::$env; + $obj->query = $query; + $data = json_encode($obj); + + return httpRequest($url,$data); + } + public static function databaseAdd($collection,array $dataObj) { $url = self::$HTTPAPI_DATABASE_ADD . getAccessToken(); try { @@ -63,7 +85,7 @@ public static function databaseUpdate($collection,array $dataObj) { } public static function databaseDelete($collection,array $dataObj) { - $url = self::$HTTPAPI_DATABASE_UPDATE . getAccessToken(); + $url = self::$HTTPAPI_DATABASE_DELETE . getAccessToken(); try { $modelObj = new class{}; $modelObj->data = $dataObj; @@ -71,7 +93,7 @@ public static function databaseDelete($collection,array $dataObj) { $obj = new class{}; $obj->env = self::$env; - $obj->query = $query;// $param['query']; + $obj->query = $query; $data = json_encode($obj); } catch (Exception $e) { echo $e->getMessage(); diff --git a/app/service/CompanyService.php b/app/service/CompanyService.php index 78aa927..f298b61 100644 --- a/app/service/CompanyService.php +++ b/app/service/CompanyService.php @@ -11,12 +11,5 @@ class CompanyService { - public static function findList() - { - //TODO:分页查询 构造分页数据 定义一个分页类 - $list = Db::table('bs_company')->page(1,10)->select(); //Db::find(1)->paginate(1,10); - return $list; - - } } diff --git a/app/service/DeviceService.php b/app/service/DeviceService.php index a79bf4d..865474c 100644 --- a/app/service/DeviceService.php +++ b/app/service/DeviceService.php @@ -1,9 +1,4 @@ save(); - } - - public static function findList() - { - //TODO:分页查询 构造分页数据 定义一个分页类 -// $list = DeviceModel::find(1)->paginate(1,10); - $list = Db::table('bs_device')->page(1,10)->select(); //Db::find(1)->paginate(1,10); -// $list = Db::table('bs_device')->paginate(1)->each(function ($item,$key){ -// $item['name'] = explode('dai', $item['name']); -// }); //Db::find(1)->paginate(1,10); - -// $count = $list->total(); - return $list; - - } - public static function findUserList() - { - //TODO:分页查询 构造分页数据 定义一个分页类 - $list = Db::table('sys_user')->page(1,10)->select(); //Db::find(1)->paginate(1,10); - - return $list; - - } - - public static function findCompanyList() - { - //TODO:分页查询 构造分页数据 定义一个分页类 - $list = Db::table('bs_company')->page(1,10)->select(); //Db::find(1)->paginate(1,10); - - return $list; - - } } diff --git a/app/service/UserService.php b/app/service/UserService.php index 31886d2..174710a 100644 --- a/app/service/UserService.php +++ b/app/service/UserService.php @@ -7,6 +7,7 @@ namespace app\service; use app\model\UserModel; +use think\facade\Db; class UserService @@ -18,16 +19,22 @@ public static function insert(array $data) return $user->save(); } - public static function delete() + public static function update(array $data) { - Db::name('sys_user')->where('id', 1)->delete(); + $user = UserModel::find($data['id']); + return $user->save($data); + } + + public static function delete(array $data) + { + Db::name('sys_user')->where('id', $data['id'])->delete(); } public static function findList() { - //TODO:分页查询 构造分页数据 定义一个分页类 + //分页查询 构造分页数据 定义一个分页类 $list = Db::table('sys_user')->page(1, 10)->select(); //Db::find(1)->paginate(1,10); return $list; } diff --git a/config/auth.php b/config/auth.php new file mode 100644 index 0000000..24f33c2 --- /dev/null +++ b/config/auth.php @@ -0,0 +1,9 @@ + env('auth.expire_time', '3600') +]; diff --git a/config/middleware.php b/config/middleware.php index 870cad6..f23a0ec 100644 --- a/config/middleware.php +++ b/config/middleware.php @@ -3,7 +3,8 @@ return [ // 别名或分组 'alias' => [ - 'check' => \app\middleware\CheckApiLogin::class + 'checkApiLogin' => \app\middleware\CheckApiLogin::class, + 'checkAdminLogin' => \app\middleware\CheckAdminLogin::class ], // 优先级设置,此数组中的中间件会按照数组中的顺序优先执行 'priority' => [], diff --git a/config/route.php b/config/route.php index 955eeec..489afb0 100644 --- a/config/route.php +++ b/config/route.php @@ -42,4 +42,7 @@ 'default_jsonp_handler' => 'jsonpReturn', // 默认JSONP处理方法 'var_jsonp_handler' => 'callback', +// 'middleware' => [ +// app\api\libs\Auth::class +// ], ]; diff --git a/route/app.php b/route/app.php index c38f89d..5aba08f 100644 --- a/route/app.php +++ b/route/app.php @@ -15,6 +15,20 @@ }); Route::get('hello/:name', 'index/hello'); +// +//Route::group('admin',function(){ +// Route::get('device/list','/Device/list'); +//})->middleware('checkApiLogin'); // ----- 需要token 验证的接口 -//Route::post('user/login',"User/doLogin")->middleware('check'); +Route::get('device/list','/Device/list')->middleware('checkApiLogin'); + + + +// ----- 需要验证admin登录的接口 +//Route::group('admin',function(){ +// Route::get('/Device/list'); +//})->middleware('checkAdminLogin'); + +//Route::post('device/index','Device/list')->middleware('checkApiLogin'); + From 8133a4c5a1c265e9258dd8199baa40f06d590859 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Wed, 6 May 2020 09:27:08 +0800 Subject: [PATCH 46/60] update --- app/controller/DailyCheck.php | 2 +- app/service/CloudApiService.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/controller/DailyCheck.php b/app/controller/DailyCheck.php index ba5a94f..60625cf 100644 --- a/app/controller/DailyCheck.php +++ b/app/controller/DailyCheck.php @@ -16,7 +16,7 @@ class DailyCheck extends BaseController { public function list(Request $request) { - return $this->app->cloudService->databaseQuery('bs_daily_check',$request->param()); + return $this->app->cloudService->findDailyCheckList('bs_daily_check',$request->param()); } public function create(Request $request) { diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index 3590c0b..46c3867 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -27,6 +27,18 @@ public static function databaseQuery($collection,$param) { } + public static function findDailyCheckList($collection,$param) { + $query = "db.collection('" . $collection . "').where({kind_type:" . $param['kindType'] . "}).get()"; + $url = self::$http_api_url . getAccessToken(); + $obj = new class{}; + $obj->env = self::$env; + $obj->query = $query;// $param['query']; + $data = json_encode($obj); + + return httpRequest($url,$data); + + } + public static function findCompanyList() { $query = "db.collection('bs_company').get()"; $url = self::$http_api_url . getAccessToken(); From 3dd995804725b2e6bc8ae75bbc0272984b699879 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sat, 9 May 2020 01:52:47 +0800 Subject: [PATCH 47/60] update --- route/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/route/app.php b/route/app.php index 5aba08f..7184b54 100644 --- a/route/app.php +++ b/route/app.php @@ -21,7 +21,7 @@ //})->middleware('checkApiLogin'); // ----- 需要token 验证的接口 -Route::get('device/list','/Device/list')->middleware('checkApiLogin'); +// Route::get('device/list','/Device/list')->middleware('checkApiLogin'); From 54c347001a15275dd9fbc4c05f7169839a9379b5 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 11 May 2020 22:18:53 +0800 Subject: [PATCH 48/60] update --- app/controller/DeviceType.php | 41 +++++++++++++++++++++++++++++++++ app/controller/Identity.php | 1 - app/service/CloudApiService.php | 12 ++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 app/controller/DeviceType.php diff --git a/app/controller/DeviceType.php b/app/controller/DeviceType.php new file mode 100644 index 0000000..efafc8d --- /dev/null +++ b/app/controller/DeviceType.php @@ -0,0 +1,41 @@ +app->cloudService->databaseQuery('bs_device_type',$request->param()); + } + + public function typeList(Request $request) { + return $this->app->cloudService->findTypeList($request->param()); + } + + public function create(Request $request) { + // 推送到云端 + $this->app->cloudService->databaseAdd('bs_device_type',$request->param()); + } + + public function update(Request $request) { + // 更新云端数据 + $this->app->cloudService->databaseUpdate('bs_device_type',$request->param()); + } + + public function delete(Request $request) { + // 更新云端数据 + $this->app->cloudService->databaseDelete('bs_device_type',$request->param()); + } + +} diff --git a/app/controller/Identity.php b/app/controller/Identity.php index 5ec2033..b26f43d 100644 --- a/app/controller/Identity.php +++ b/app/controller/Identity.php @@ -21,7 +21,6 @@ public function list(Request $request) { public function create(Request $request) { // 推送到云端 $this->app->cloudService->databaseAdd('bs_identity',$request->param()); -// return ok($this->app->deviceService->insert($request->param())); } public function update(Request $request) { diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index 46c3867..68ae1f5 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -61,6 +61,18 @@ public static function findDeviceList() { return httpRequest($url,$data); } + public static function findTypeList() { + $query = "db.collection('bs_device_type').get()"; + $url = self::$http_api_url . getAccessToken(); + $obj = new class{}; + $obj->env = self::$env; + $obj->query = $query; + $data = json_encode($obj); + + return httpRequest($url,$data); + } + + public static function databaseAdd($collection,array $dataObj) { $url = self::$HTTPAPI_DATABASE_ADD . getAccessToken(); try { From 2b30bdb936c96550de9f6a5447fd3db79a4a3528 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sun, 17 May 2020 10:56:58 +0800 Subject: [PATCH 49/60] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/User.php | 5 ++++- app/model/UserModel.php | 17 ++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/controller/User.php b/app/controller/User.php index f1ee7d3..7c79a55 100644 --- a/app/controller/User.php +++ b/app/controller/User.php @@ -15,7 +15,10 @@ public function list(Request $request) { public function login(Request $request) { $data = $request->param(); // 0 校验参数,把数据交由模型层来进行处理 - UserModel::checkLogin($data); + $checkData = UserModel::checkLogin($data); + if ($checkData['code'] == 1) { + return $checkData; + } // 1 设置token // 2 返回token到前端 diff --git a/app/model/UserModel.php b/app/model/UserModel.php index 16a3a67..0333bf3 100644 --- a/app/model/UserModel.php +++ b/app/model/UserModel.php @@ -43,13 +43,16 @@ public static function checkLogin($data){ return return_msg(1,"用户名不存在"); } //验证密码是否正确 - $hash = password_hash("111111", PASSWORD_DEFAULT); // $m['password'] - if(password_verify($data['password'],$m['password'])) { - return return_msg(1,"密码输入错误"); + $hash = password_hash($data['password'], PASSWORD_DEFAULT); // $m['password'] +// $hash = '$2y$07$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq'; + if(password_verify($m['password'],$hash)) { + //记录用户登录的状态 + session('username',$data['username']); + session('userid',$m['id']); + return return_msg(0,"登录成功"); } - //记录用户登录的状态 - session('username',$data['username']); - session('userid',$m['id']); - return return_msg(0,"登录成功"); + + return return_msg(1,"密码输入错误"); + } } From 371dccf6c300161a2723d7e77512f9ff145072f8 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sat, 23 May 2020 12:51:25 +0800 Subject: [PATCH 50/60] update --- app/service/CloudApiService.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index 68ae1f5..e91f5f8 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -5,6 +5,8 @@ class CloudApiService { //定义一个静态成员变量 protected static $env = 'test-87exc'; + // 开发环境 +// protected static $env = 'dev-jxhh-20200306'; protected static $http_api_url = 'https://api.weixin.qq.com/tcb/databasequery?access_token='; protected static $HTTPAPI_DATABASE_ADD = 'https://api.weixin.qq.com/tcb/databaseadd?access_token='; protected static $HTTPAPI_DATABASE_UPDATE = 'https://api.weixin.qq.com/tcb/databaseupdate?access_token='; @@ -17,6 +19,10 @@ public static function setEnv($envId){ public static function databaseQuery($collection,$param) { $query = "db.collection('" . $collection . "').get()"; + if (strcmp($collection ,'bs_device') == 0) { + $query = self::getDeviceTypeQuery($collection,$param); + } + $url = self::$http_api_url . getAccessToken(); $obj = new class{}; $obj->env = self::$env; @@ -27,6 +33,22 @@ public static function databaseQuery($collection,$param) { } + private static function getDeviceTypeQuery($collection,$param) { + $query = "db.collection('" . $collection . "')"; + $where = ""; + if ($param['company_code']) { + $where = ".where({company_code:'" . $param['company_code'] . "'})"; + } + + if ($where) { + $query = $query . $where; + } + + $query = $query . ".get()"; + + return $query; + } + public static function findDailyCheckList($collection,$param) { $query = "db.collection('" . $collection . "').where({kind_type:" . $param['kindType'] . "}).get()"; $url = self::$http_api_url . getAccessToken(); From fdd1cc2f8f5ddc3455d31d8b993ac2d352e31443 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 1 Jun 2020 20:31:05 +0800 Subject: [PATCH 51/60] update --- app/service/CloudApiService.php | 41 +++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index e91f5f8..b5e1a54 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -18,11 +18,23 @@ public static function setEnv($envId){ } public static function databaseQuery($collection,$param) { - $query = "db.collection('" . $collection . "').get()"; + $query = "db.collection('" . $collection . "')"; // .skip(" . $skipSize . ").limit(" . $limitSize . ").orderBy('createTime', 'desc').get()"; if (strcmp($collection ,'bs_device') == 0) { - $query = self::getDeviceTypeQuery($collection,$param); + $query = $query . self::getDeviceQuery($param); + $query = $query . self:: wrapPage($param); + $query = $query . ".orderBy('createTime', 'desc')"; + } + if (strcmp($collection ,'bs_device_type') == 0) { + $query = $query . self::getDeviceTypeQuery($param); + $query = $query . self:: wrapPage($param); + $query = $query . ".orderBy('createTime', 'desc')"; + } + if (strcmp($collection ,'bs_identity') == 0) { + $query = $query . self:: wrapPage($param); + $query = $query . ".orderBy('createTime', 'desc')"; } + $query = $query . ".get()"; $url = self::$http_api_url . getAccessToken(); $obj = new class{}; $obj->env = self::$env; @@ -33,20 +45,31 @@ public static function databaseQuery($collection,$param) { } - private static function getDeviceTypeQuery($collection,$param) { - $query = "db.collection('" . $collection . "')"; + private static function wrapPage($param) { + $skipSize = ($param['page'] - 1) * $param['limit']; + $limitSize = $param['limit']; + $pageStr = ".skip(" . $skipSize . ").limit(" . $limitSize . ")"; + + return $pageStr; + + } + + private static function getDeviceQuery($param) { $where = ""; if ($param['company_code']) { $where = ".where({company_code:'" . $param['company_code'] . "'})"; } - if ($where) { - $query = $query . $where; - } + return $where; + } - $query = $query . ".get()"; + private static function getDeviceTypeQuery($param) { + $where = ""; + if ($param['name']) { + $where = ".where({name:'" . $param['name'] . "'})"; + } - return $query; + return $where; } public static function findDailyCheckList($collection,$param) { From bedfb97fc59c9ea44a24542d322ce8f7b47368f3 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Mon, 1 Jun 2020 22:49:55 +0800 Subject: [PATCH 52/60] update --- app/service/CloudApiService.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index b5e1a54..692adc0 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -85,7 +85,7 @@ public static function findDailyCheckList($collection,$param) { } public static function findCompanyList() { - $query = "db.collection('bs_company').get()"; + $query = "db.collection('bs_company').limit(100).get()"; $url = self::$http_api_url . getAccessToken(); $obj = new class{}; $obj->env = self::$env; @@ -107,7 +107,8 @@ public static function findDeviceList() { } public static function findTypeList() { - $query = "db.collection('bs_device_type').get()"; + // limit 默认10条,这里设置为100条 + $query = "db.collection('bs_device_type').limit(100).orderBy('createTime', 'desc').get()"; $url = self::$http_api_url . getAccessToken(); $obj = new class{}; $obj->env = self::$env; From f9a57e8c88f73d743d77ec4dbec87f14557b5441 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Thu, 4 Jun 2020 23:14:59 +0800 Subject: [PATCH 53/60] update --- app/controller/DeviceType.php | 5 + app/service/CloudApiService.php | 157 +++++++++++++++++++++++--------- 2 files changed, 121 insertions(+), 41 deletions(-) diff --git a/app/controller/DeviceType.php b/app/controller/DeviceType.php index efafc8d..541355b 100644 --- a/app/controller/DeviceType.php +++ b/app/controller/DeviceType.php @@ -33,6 +33,11 @@ public function update(Request $request) { $this->app->cloudService->databaseUpdate('bs_device_type',$request->param()); } + public function updateCompany(Request $request) { + // 批量更新公司 + $this->app->cloudService->batchUpdateCompany('bs_device_type',$request->param()); + } + public function delete(Request $request) { // 更新云端数据 $this->app->cloudService->databaseDelete('bs_device_type',$request->param()); diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index 692adc0..20c2915 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -1,4 +1,5 @@ env = self::$env; $obj->query = $query;// $param['query']; $data = json_encode($obj); - return httpRequest($url,$data); + return httpRequest($url, $data); } - private static function wrapPage($param) { + private static function wrapPage($param) + { $skipSize = ($param['page'] - 1) * $param['limit']; $limitSize = $param['limit']; $pageStr = ".skip(" . $skipSize . ").limit(" . $limitSize . ")"; @@ -54,7 +60,8 @@ private static function wrapPage($param) { } - private static function getDeviceQuery($param) { + private static function getDeviceQuery($param) + { $where = ""; if ($param['company_code']) { $where = ".where({company_code:'" . $param['company_code'] . "'})"; @@ -63,65 +70,89 @@ private static function getDeviceQuery($param) { return $where; } - private static function getDeviceTypeQuery($param) { + private static function getDeviceTypeQuery($param) + { $where = ""; - if ($param['name']) { - $where = ".where({name:'" . $param['name'] . "'})"; + if ($param['name'] || $param['company_code'] || $param['device_code']) { + $condition = array(); + if ($param['name']) { + $condition['name'] = $param['name']; + } + if ($param['company_code']) { + $condition['company_code'] = $param['company_code']; + } + if ($param['device_code']) { + $condition['device_code'] = $param['device_code']; + } + $where = ".where(" . json_encode($condition) . ")"; } return $where; } - public static function findDailyCheckList($collection,$param) { + public static function findDailyCheckList($collection, $param) + { $query = "db.collection('" . $collection . "').where({kind_type:" . $param['kindType'] . "}).get()"; $url = self::$http_api_url . getAccessToken(); - $obj = new class{}; + $obj = new class + { + }; $obj->env = self::$env; $obj->query = $query;// $param['query']; $data = json_encode($obj); - return httpRequest($url,$data); + return httpRequest($url, $data); } - public static function findCompanyList() { + public static function findCompanyList() + { $query = "db.collection('bs_company').limit(100).get()"; $url = self::$http_api_url . getAccessToken(); - $obj = new class{}; + $obj = new class + { + }; $obj->env = self::$env; $obj->query = $query; $data = json_encode($obj); - return httpRequest($url,$data); + return httpRequest($url, $data); } - public static function findDeviceList() { + public static function findDeviceList() + { $query = "db.collection('bs_device').get()"; $url = self::$http_api_url . getAccessToken(); - $obj = new class{}; + $obj = new class + { + }; $obj->env = self::$env; $obj->query = $query; $data = json_encode($obj); - return httpRequest($url,$data); + return httpRequest($url, $data); } - public static function findTypeList() { + public static function findTypeList() + { // limit 默认10条,这里设置为100条 $query = "db.collection('bs_device_type').limit(100).orderBy('createTime', 'desc').get()"; $url = self::$http_api_url . getAccessToken(); - $obj = new class{}; + $obj = new class + { + }; $obj->env = self::$env; $obj->query = $query; $data = json_encode($obj); - return httpRequest($url,$data); + return httpRequest($url, $data); } - public static function databaseAdd($collection,array $dataObj) { + public static function databaseAdd($collection, array $dataObj) + { $url = self::$HTTPAPI_DATABASE_ADD . getAccessToken(); - try { + try { $modelObj = new class{}; $modelObj->data = $dataObj; $query = "db.collection('" . $collection . "').add(" . json_encode($modelObj) . ")"; @@ -134,11 +165,13 @@ public static function databaseAdd($collection,array $dataObj) { echo $e->getMessage(); } - httpRequest($url,$data); + httpRequest($url, $data); } - public static function databaseUpdate($collection,array $dataObj) { + + public static function databaseUpdate($collection, $dataObj) + { $url = self::$HTTPAPI_DATABASE_UPDATE . getAccessToken(); - try { + try { $modelObj = new class{}; $modelObj->data = $dataObj; $query = "db.collection('" . $collection . "').where({_id:'" . $dataObj['_id'] . "'}).update(" . json_encode($modelObj) . ")"; @@ -151,19 +184,38 @@ public static function databaseUpdate($collection,array $dataObj) { echo $e->getMessage(); } - httpRequest($url,$data); + httpRequest($url, $data); } - public static function databaseDelete($collection,array $dataObj) { - $url = self::$HTTPAPI_DATABASE_DELETE . getAccessToken(); + + public static function batchUpdateCompany($collection, $param) + { + $ids = $param['ids']; + $idsLength = count($ids); + $company_code = $param['company_code']; + $company_name = $param['company_name']; + // TODO:遍历ids,更新公司 + for ($x = 0; $x < $idsLength; $x++) { + $id = $ids[$x]; + $obj = array(); + $obj['id'] = $id; + $obj['company_code'] = $company_code; + $obj['company_name'] = $company_name; + self::updateDeviceType($collection,$obj); + } + + + } + public static function updateDeviceType($collection, $dataObj) { + $url = self::$HTTPAPI_DATABASE_UPDATE . getAccessToken(); try { $modelObj = new class{}; $modelObj->data = $dataObj; - $query = "db.collection('" . $collection . "').where({_id:'" . $dataObj['_id'] . "'}).remove()"; + $query = "db.collection('" . $collection . "').where({_id:'" . $dataObj['id'] . "'}).update(" . json_encode($modelObj) . ")"; $obj = new class{}; $obj->env = self::$env; - $obj->query = $query; + $obj->query = $query;// $param['query']; $data = json_encode($obj); } catch (Exception $e) { echo $e->getMessage(); @@ -172,4 +224,27 @@ public static function databaseDelete($collection,array $dataObj) { httpRequest($url,$data); } + public static function databaseDelete($collection, array $dataObj) + { + $url = self::$HTTPAPI_DATABASE_DELETE . getAccessToken(); + try { + $modelObj = new class + { + }; + $modelObj->data = $dataObj; + $query = "db.collection('" . $collection . "').where({_id:'" . $dataObj['_id'] . "'}).remove()"; + + $obj = new class + { + }; + $obj->env = self::$env; + $obj->query = $query; + $data = json_encode($obj); + } catch (Exception $e) { + echo $e->getMessage(); + } + + httpRequest($url, $data); + } + } From 635271305a88dbb9983589fb67b7d69ed53458f0 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Fri, 5 Jun 2020 13:57:39 +0800 Subject: [PATCH 54/60] update --- app/controller/DeviceType.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controller/DeviceType.php b/app/controller/DeviceType.php index 541355b..c67f927 100644 --- a/app/controller/DeviceType.php +++ b/app/controller/DeviceType.php @@ -16,7 +16,7 @@ class DeviceType extends BaseController public function list(Request $request) { // 从小程序端获取 - return $this->app->cloudService->databaseQuery('bs_device_type',$request->param()); + return $this->app->cloudService->databaseQuery('bs_device',$request->param()); } public function typeList(Request $request) { @@ -25,22 +25,22 @@ public function typeList(Request $request) { public function create(Request $request) { // 推送到云端 - $this->app->cloudService->databaseAdd('bs_device_type',$request->param()); + $this->app->cloudService->databaseAdd('bs_device',$request->param()); } public function update(Request $request) { // 更新云端数据 - $this->app->cloudService->databaseUpdate('bs_device_type',$request->param()); + $this->app->cloudService->databaseUpdate('bs_device',$request->param()); } public function updateCompany(Request $request) { // 批量更新公司 - $this->app->cloudService->batchUpdateCompany('bs_device_type',$request->param()); + $this->app->cloudService->batchUpdateCompany('bs_device',$request->param()); } public function delete(Request $request) { // 更新云端数据 - $this->app->cloudService->databaseDelete('bs_device_type',$request->param()); + $this->app->cloudService->databaseDelete('bs_device',$request->param()); } } From 99197ce43383f60e0452b0cd6ee7b2f39fd5cbf7 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Fri, 5 Jun 2020 14:00:47 +0800 Subject: [PATCH 55/60] update --- app/service/CloudApiService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index 20c2915..de02e41 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -121,7 +121,7 @@ public static function findCompanyList() public static function findDeviceList() { - $query = "db.collection('bs_device').get()"; + $query = "db.collection('bs_device').limit(100).orderBy('createTime', 'desc').get()"; $url = self::$http_api_url . getAccessToken(); $obj = new class { From 66f03c0978f3645c9ead22f21b87a8eba6731481 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sun, 12 Jul 2020 16:25:45 +0800 Subject: [PATCH 56/60] update --- app/controller/Member.php | 8 ---- app/service/CloudApiService.php | 67 +++++++++++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 12 deletions(-) diff --git a/app/controller/Member.php b/app/controller/Member.php index a52295e..741e5f8 100644 --- a/app/controller/Member.php +++ b/app/controller/Member.php @@ -24,14 +24,6 @@ public function list(Request $request) { return $this->app->cloudService->databaseQuery('cloud_member',$request->param()); } - public function test(Request $request) { - return $this->app->cloudService->test(); - } - - public function test2(Request $request) { - return $this->app->cloudService->test2(); - } - public function sync() { } diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index de02e41..f6b166d 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -21,7 +21,7 @@ public static function setEnv($envId) public static function databaseQuery($collection, $param) { - $query = "db.collection('" . $collection . "')"; // .skip(" . $skipSize . ").limit(" . $limitSize . ").orderBy('createTime', 'desc').get()"; + $query = "db.collection('" . $collection . "')"; if (strcmp($collection, 'bs_device') == 0) { $query = $query . self::getDeviceQuery($param); $query = $query . self:: wrapPage($param); @@ -36,6 +36,16 @@ public static function databaseQuery($collection, $param) $query = $query . self:: wrapPage($param); $query = $query . ".orderBy('createTime', 'desc')"; } + if (strcmp($collection, 'cloud_member') == 0) { + $query = $query . self::getMemberQuery($param); + $query = $query . self:: wrapPage($param); + $query = $query . ".orderBy('createTime', 'desc')"; + } + if (strcmp($collection, 'bs_identity') == 0) { + $query = $query . self::getIdentityQuery($param); + $query = $query . self:: wrapPage($param); + $query = $query . ".orderBy('createTime', 'desc')"; + } $query = $query . ".get()"; $url = self::$http_api_url . getAccessToken(); @@ -60,11 +70,59 @@ private static function wrapPage($param) } + private static function getIdentityQuery($param) + { + $where = ""; + if ($param['name']) { + $condition = array(); + if ($param['name']) { + $condition['real_name'] = $param['name']; + } + if ($param['phone']) { + $condition['phone'] = $param['phone']; + } + + $where = ".where(" . json_encode($condition) . ")"; + } + + return $where; + } + + private static function getMemberQuery($param) + { + $where = ""; + if ($param['nickname'] || $param['phone']) { + $condition = array(); + if ($param['nickname']) { + $condition['nickname'] = $param['nickname']; + } + if ($param['phone']) { + $condition['phone'] = $param['phone']; + } + $where = ".where(" . json_encode($condition) . ")"; + } + + return $where; + } + private static function getDeviceQuery($param) { $where = ""; - if ($param['company_code']) { - $where = ".where({company_code:'" . $param['company_code'] . "'})"; + if ($param['name'] || $param['model_type'] || $param['company_code'] || $param['device_code']) { + $condition = array(); + if ($param['name']) { + $condition['name'] = $param['name']; + } + if ($param['model_type']) { + $condition['model_type'] = $param['model_type']; + } + if ($param['company_code']) { + $condition['company_code'] = $param['company_code']; + } + if ($param['device_code']) { + $condition['device_code'] = $param['device_code']; + } + $where = ".where(" . json_encode($condition) . ")"; } return $where; @@ -121,7 +179,8 @@ public static function findCompanyList() public static function findDeviceList() { - $query = "db.collection('bs_device').limit(100).orderBy('createTime', 'desc').get()"; + // limit 默认10条,这里设置为1000条 + $query = "db.collection('bs_device').limit(1000).orderBy('createTime', 'desc').get()"; $url = self::$http_api_url . getAccessToken(); $obj = new class { From 23abe8b6dc6a79986281611dbaa9a31add2797db Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sun, 12 Jul 2020 16:47:28 +0800 Subject: [PATCH 57/60] update --- app/controller/DailyCheck.php | 2 +- app/service/CloudApiService.php | 50 ++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/app/controller/DailyCheck.php b/app/controller/DailyCheck.php index 60625cf..ba5a94f 100644 --- a/app/controller/DailyCheck.php +++ b/app/controller/DailyCheck.php @@ -16,7 +16,7 @@ class DailyCheck extends BaseController { public function list(Request $request) { - return $this->app->cloudService->findDailyCheckList('bs_daily_check',$request->param()); + return $this->app->cloudService->databaseQuery('bs_daily_check',$request->param()); } public function create(Request $request) { diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index f6b166d..1cb55cb 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -46,6 +46,11 @@ public static function databaseQuery($collection, $param) $query = $query . self:: wrapPage($param); $query = $query . ".orderBy('createTime', 'desc')"; } + if (strcmp($collection, 'bs_daily_check') == 0) { + $query = $query . self::getDailyCheckQuery($param); + $query = $query . self:: wrapPage($param); + $query = $query . ".orderBy('createTime', 'desc')"; + } $query = $query . ".get()"; $url = self::$http_api_url . getAccessToken(); @@ -105,6 +110,23 @@ private static function getMemberQuery($param) return $where; } + private static function getDailyCheckQuery($param) + { + $where = ""; + if ($param['company_code'] || $param['kindType']) { + $condition = array(); + if ($param['company_code']) { + $condition['company_code'] = $param['company_code']; + } + if ($param['kindType']) { + $condition['kind_type'] = intval($param['kindType']); + } + $where = ".where(" . json_encode($condition) . ")"; + } + + return $where; + } + private static function getDeviceQuery($param) { $where = ""; @@ -148,20 +170,20 @@ private static function getDeviceTypeQuery($param) return $where; } - public static function findDailyCheckList($collection, $param) - { - $query = "db.collection('" . $collection . "').where({kind_type:" . $param['kindType'] . "}).get()"; - $url = self::$http_api_url . getAccessToken(); - $obj = new class - { - }; - $obj->env = self::$env; - $obj->query = $query;// $param['query']; - $data = json_encode($obj); - - return httpRequest($url, $data); - - } +// public static function findDailyCheckList($collection, $param) +// { +// $query = "db.collection('" . $collection . "').where({kind_type:" . $param['kindType'] . "}).get()"; +// $url = self::$http_api_url . getAccessToken(); +// $obj = new class +// { +// }; +// $obj->env = self::$env; +// $obj->query = $query;// $param['query']; +// $data = json_encode($obj); +// +// return httpRequest($url, $data); +// +// } public static function findCompanyList() { From b6f62e801907c0e024a6dd40bfea9a985e37da21 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sun, 12 Jul 2020 17:02:35 +0800 Subject: [PATCH 58/60] update --- app/controller/Device.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controller/Device.php b/app/controller/Device.php index d42d5d4..603a29b 100644 --- a/app/controller/Device.php +++ b/app/controller/Device.php @@ -23,6 +23,10 @@ public function deviceList(Request $request) { return $this->app->cloudService->findDeviceList($request->param()); } + public function typeList(Request $request) { + return $this->app->cloudService->findTypeList($request->param()); + } + public function companylist() { return $this->app->cloudService->findCompanyList(); } @@ -37,13 +41,14 @@ public function update(Request $request) { // 更新云端数据 $this->app->cloudService->databaseUpdate('bs_device',$request->param()); } + public function updateCompany(Request $request) { + // 批量更新公司 + $this->app->cloudService->batchUpdateCompany('bs_device',$request->param()); + } public function delete(Request $request) { // 更新云端数据 $this->app->cloudService->databaseDelete('bs_device',$request->param()); } - public function sync() { - - } } From cb70a2582646f32d042fdfeaf9aac8abb0be232b Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sun, 26 Jul 2020 21:12:56 +0800 Subject: [PATCH 59/60] update --- app/controller/DailyCheck.php | 2 +- app/controller/DeviceType.php | 46 --------------- app/service/CloudApiService.php | 100 ++++++++++++++++++++++++++------ 3 files changed, 84 insertions(+), 64 deletions(-) delete mode 100644 app/controller/DeviceType.php diff --git a/app/controller/DailyCheck.php b/app/controller/DailyCheck.php index ba5a94f..0e60831 100644 --- a/app/controller/DailyCheck.php +++ b/app/controller/DailyCheck.php @@ -20,7 +20,7 @@ public function list(Request $request) { } public function create(Request $request) { - $this->app->cloudService->databaseAdd('bs_daily_check',$request->param()); + $this->app->cloudService->dailyCheckAdd('bs_daily_check',$request->param()); } public function update(Request $request) { diff --git a/app/controller/DeviceType.php b/app/controller/DeviceType.php deleted file mode 100644 index c67f927..0000000 --- a/app/controller/DeviceType.php +++ /dev/null @@ -1,46 +0,0 @@ -app->cloudService->databaseQuery('bs_device',$request->param()); - } - - public function typeList(Request $request) { - return $this->app->cloudService->findTypeList($request->param()); - } - - public function create(Request $request) { - // 推送到云端 - $this->app->cloudService->databaseAdd('bs_device',$request->param()); - } - - public function update(Request $request) { - // 更新云端数据 - $this->app->cloudService->databaseUpdate('bs_device',$request->param()); - } - - public function updateCompany(Request $request) { - // 批量更新公司 - $this->app->cloudService->batchUpdateCompany('bs_device',$request->param()); - } - - public function delete(Request $request) { - // 更新云端数据 - $this->app->cloudService->databaseDelete('bs_device',$request->param()); - } - -} diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index 1cb55cb..0bcbfb3 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -113,10 +113,10 @@ private static function getMemberQuery($param) private static function getDailyCheckQuery($param) { $where = ""; - if ($param['company_code'] || $param['kindType']) { + if ($param['deviceId'] || $param['kindType']) { $condition = array(); - if ($param['company_code']) { - $condition['company_code'] = $param['company_code']; + if ($param['deviceId']) { + $condition['device_id'] = $param['deviceId']; } if ($param['kindType']) { $condition['kind_type'] = intval($param['kindType']); @@ -170,20 +170,6 @@ private static function getDeviceTypeQuery($param) return $where; } -// public static function findDailyCheckList($collection, $param) -// { -// $query = "db.collection('" . $collection . "').where({kind_type:" . $param['kindType'] . "}).get()"; -// $url = self::$http_api_url . getAccessToken(); -// $obj = new class -// { -// }; -// $obj->env = self::$env; -// $obj->query = $query;// $param['query']; -// $data = json_encode($obj); -// -// return httpRequest($url, $data); -// -// } public static function findCompanyList() { @@ -237,6 +223,15 @@ public static function databaseAdd($collection, array $dataObj) $modelObj = new class{}; $modelObj->data = $dataObj; $query = "db.collection('" . $collection . "').add(" . json_encode($modelObj) . ")"; + // TODO: 如果是巡检计划 & 保养计划的表,则更新设备状态值 + if (strcmp($collection, 'bs_daily_check') == 0) { + // 1 更加设备Id 查询设备记录 + // 2 检查是否存在字段dailyCheckState,不存在则添加,否则更新。 + $collection = "bs_device"; + $id = $dataObj['device_id']; + $kindType = $dataObj['kind_type']; + self::updateDeviceDailyCheckState($collection,$id,$kindType); + } $obj = new class{}; $obj->env = self::$env; @@ -249,6 +244,77 @@ public static function databaseAdd($collection, array $dataObj) httpRequest($url, $data); } + public static function dailyCheckAdd($collection, array $dataObj) + { + $ids = $dataObj['device_id']; + $idsLength = count($ids); + for ($x = 0; $x < $idsLength; $x++) { + $id = $ids[$x]; + $dataObj['device_id'] = $id; + + self::dailyCheckAddOne($collection,$dataObj); + } + } + + public static function dailyCheckAddOne($collection, array $dataObj) + { + $url = self::$HTTPAPI_DATABASE_ADD . getAccessToken(); + try { + $modelObj = new class{}; + $modelObj->data = $dataObj; + $query = "db.collection('" . $collection . "').add(" . json_encode($modelObj) . ")"; + /* + * 如果是巡检计划 & 保养计划的表,则更新设备状态值 + * 1 更加设备Id 查询设备记录 + * 2 检查是否存在字段dailyCheckState,不存在则添加,否则更新。 + */ + $collection = "bs_device"; + $id = $dataObj['device_id']; + $kindType = $dataObj['kind_type']; + self::updateDeviceDailyCheckState($collection,$id,$kindType); + + $obj = new class{}; + $obj->env = self::$env; + $obj->query = $query;// $param['query']; + $data = json_encode($obj); + } catch (Exception $e) { + echo $e->getMessage(); + } + + httpRequest($url, $data); + } + + + + private static function updateDeviceDailyCheckState($collection,$id,$kindType) { + $url = self::$HTTPAPI_DATABASE_UPDATE . getAccessToken(); + $dataObj = array( + 'daily_check_1_state' => 1, + 'daily_check1_num' => 1 + ); + if ($kindType == 2) { + $dataObj = array( + 'daily_check_2_state' => 1, + 'daily_check2_num' => 1 + ); + } + try { + $modelObj = new class{}; + $modelObj->data = $dataObj; + $query = "db.collection('" . $collection . "').where({_id:'" . $id . "'}).update(" . json_encode($modelObj) . ")"; + + $obj = new class{}; + $obj->env = self::$env; + $obj->query = $query;// $param['query']; + $data = json_encode($obj); + } catch (Exception $e) { + echo $e->getMessage(); + } + + httpRequest($url, $data); + + } + public static function databaseUpdate($collection, $dataObj) { $url = self::$HTTPAPI_DATABASE_UPDATE . getAccessToken(); From 6f41f07c485ffddde1a9330d375bdef4d9fa1206 Mon Sep 17 00:00:00 2001 From: daiysh <569527318@qq.com> Date: Sun, 23 Aug 2020 23:09:09 +0800 Subject: [PATCH 60/60] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=B7=A1=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/CloudApiService.php | 46 ++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/app/service/CloudApiService.php b/app/service/CloudApiService.php index 0bcbfb3..d4ba842 100644 --- a/app/service/CloudApiService.php +++ b/app/service/CloudApiService.php @@ -375,15 +375,11 @@ public static function databaseDelete($collection, array $dataObj) { $url = self::$HTTPAPI_DATABASE_DELETE . getAccessToken(); try { - $modelObj = new class - { - }; + $modelObj = new class{}; $modelObj->data = $dataObj; $query = "db.collection('" . $collection . "').where({_id:'" . $dataObj['_id'] . "'}).remove()"; - $obj = new class - { - }; + $obj = new class{}; $obj->env = self::$env; $obj->query = $query; $data = json_encode($obj); @@ -392,6 +388,44 @@ public static function databaseDelete($collection, array $dataObj) } httpRequest($url, $data); + + // 更新设备表中的状态 + if (strcmp($collection, 'bs_daily_check') == 0) { + $collection = "bs_device"; + $id = $dataObj['device_id']; + $kindType = $dataObj['kind_type']; + self::updateDeviceDailyCheckState2($collection,$id,$kindType); + } + + } + + private static function updateDeviceDailyCheckState2($collection,$id,$kindType) { + $url = self::$HTTPAPI_DATABASE_UPDATE . getAccessToken(); + $dataObj = array( + 'daily_check_1_state' => 0, + 'daily_check1_num' => 1 + ); + if ($kindType == 2) { + $dataObj = array( + 'daily_check_2_state' => 0, + 'daily_check2_num' => 1 + ); + } + try { + $modelObj = new class{}; + $modelObj->data = $dataObj; + $query = "db.collection('" . $collection . "').where({_id:'" . $id . "'}).update(" . json_encode($modelObj) . ")"; + + $obj = new class{}; + $obj->env = self::$env; + $obj->query = $query;// $param['query']; + $data = json_encode($obj); + } catch (Exception $e) { + echo $e->getMessage(); + } + + httpRequest($url, $data); + } }