Commit 5ac89650 authored by Administrator's avatar Administrator

Merge branch 'master' into feature/monitor

parents 1ab3dc95 a000decf
......@@ -91,9 +91,9 @@ class ZehongTcpController extends Controller
{
if ($data != []) {
// 报警提醒
// $meTcp = new SwooleCommandMeTcpController();
// $alarmData = $data['id'] . '/' . $data['status'] . '/' . $data['np'];
// $meTcp->swooletcplist($alarmData);
$meTcp = new SwooleCommandMeTcpController();
$alarmData = $data['id'] . '/' . $data['status'] . '/' . $data['np'];
$meTcp->swooletcplist($alarmData);
$this->smsphone($data);
$datainfo = DB::table('device')
->where('devicenum', '=', $data['id'])
......@@ -115,7 +115,7 @@ class ZehongTcpController extends Controller
public function smsphone($data)
{
if (Redis::get($data['id']) == '') {
if ($data['status'] != 1 || $data['status'] != 0) {
if ($data['status'] > 1) {
$sms = new SmsailiyunController();
$code1 = json_encode($sms->sendSms());
$code = json_decode($code1,true);
......@@ -127,6 +127,7 @@ class ZehongTcpController extends Controller
}
} else {
if ($data['status'] == 1 || $data['status'] == 0) {
Log::channel('slack')->info('设备正常 =>' . '' . '设备号=>' . $data['id']);
Redis::del($data['id']);
}
}
......
......@@ -44,7 +44,7 @@ class AuthController extends Controller
$tokenResult = $user->createToken('Personal Access Token');
$token = $tokenResult->token;
$token->save();
return response()->json(new UserResource($user), Response::HTTP_OK)->header('Authorization', $tokenResult->accessToken);
return response()->json(new UserResource($user), Response::HTTP_OK)->header('authorization', $tokenResult->accessToken);
}else{
return response()->json(new JsonResponse([], '请用管理员窗口登入'), Response::HTTP_UNAUTHORIZED);
}
......@@ -68,7 +68,7 @@ class AuthController extends Controller
$tokenResult = $user->createToken('Personal Access Token');
$token = $tokenResult->token;
$token->save();
return response()->json(new UserResource($user), Response::HTTP_OK)->header('Authorization', $tokenResult->accessToken);
return response()->json(new UserResource($user), Response::HTTP_OK)->header('authorization', $tokenResult->accessToken);
}
}
public function logout(Request $request)
......
......@@ -19,6 +19,7 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\Fruitcake\Cors\HandleCors::class,
];
/**
......@@ -63,6 +64,7 @@ class Kernel extends HttpKernel
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
'cors' => \Fruitcake\Cors\HandleCors::class,
];
/**
......
......@@ -22,6 +22,7 @@
"php": "^7.2",
"emadadly/laravel-uuid": "^1.3",
"fideloper/proxy": "^4.0",
"fruitcake/laravel-cors": "^2.0",
"ibrand/laravel-sms": "~1.0",
"influxdb/influxdb-php": "^1.15",
"laravel/framework": "^7.0",
......
......@@ -4,8 +4,60 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "24958d49156f51e819a800192edafa32",
"content-hash": "157e3dc0b8973b691a5f8303f61da5e7",
"packages": [
{
"name": "asm89/stack-cors",
"version": "v2.0.2",
"source": {
"type": "git",
"url": "https://github.com/asm89/stack-cors.git",
"reference": "8d8f88b3b3830916be94292c1fbce84433efb1aa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/asm89/stack-cors/zipball/8d8f88b3b3830916be94292c1fbce84433efb1aa",
"reference": "8d8f88b3b3830916be94292c1fbce84433efb1aa",
"shasum": ""
},
"require": {
"php": "^7.0|^8.0",
"symfony/http-foundation": "~2.7|~3.0|~4.0|~5.0",
"symfony/http-kernel": "~2.7|~3.0|~4.0|~5.0"
},
"require-dev": {
"phpunit/phpunit": "^6|^7|^8|^9",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"psr-4": {
"Asm89\\Stack\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Alexander",
"email": "iam.asm89@gmail.com"
}
],
"description": "Cross-origin resource sharing library and stack middleware",
"homepage": "https://github.com/asm89/stack-cors",
"keywords": [
"cors",
"stack"
],
"time": "2020-10-29T16:03:21+00:00"
},
{
"name": "aws/aws-sdk-php",
"version": "3.134.7",
......@@ -893,6 +945,73 @@
],
"time": "2020-03-25T18:49:23+00:00"
},
{
"name": "fruitcake/laravel-cors",
"version": "v2.0.3",
"source": {
"type": "git",
"url": "https://github.com/fruitcake/laravel-cors.git",
"reference": "01de0fe5f71c70d1930ee9a80385f9cc28e0f63a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/01de0fe5f71c70d1930ee9a80385f9cc28e0f63a",
"reference": "01de0fe5f71c70d1930ee9a80385f9cc28e0f63a",
"shasum": ""
},
"require": {
"asm89/stack-cors": "^2.0.1",
"illuminate/contracts": "^6|^7|^8|^9",
"illuminate/support": "^6|^7|^8|^9",
"php": ">=7.2",
"symfony/http-foundation": "^4|^5",
"symfony/http-kernel": "^4.3.4|^5"
},
"require-dev": {
"laravel/framework": "^6|^7|^8",
"orchestra/testbench-dusk": "^4|^5|^6",
"phpunit/phpunit": "^6|^7|^8",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
},
"laravel": {
"providers": [
"Fruitcake\\Cors\\CorsServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Fruitcake\\Cors\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fruitcake",
"homepage": "https://fruitcake.nl"
},
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application",
"keywords": [
"api",
"cors",
"crossdomain",
"laravel"
],
"time": "2020-10-22T13:57:20+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "6.5.2",
......@@ -2151,6 +2270,90 @@
],
"time": "2019-12-20T14:22:59+00:00"
},
{
"name": "mrgoon/aliyun-sms",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/MissMyCat/aliyun-sms.git",
"reference": "64e6e4cb4ae9678dfdc5c46cf759c5e21e9f6a35"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MissMyCat/aliyun-sms/zipball/64e6e4cb4ae9678dfdc5c46cf759c5e21e9f6a35",
"reference": "64e6e4cb4ae9678dfdc5c46cf759c5e21e9f6a35",
"shasum": ""
},
"require": {
"mrgoon/aliyun-sms-sdk": ">=1.1.2",
"php": ">5.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Mrgoon\\AliSms\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "mrgoon",
"email": "mrgoon@foxmail.com"
}
],
"description": "阿里云短信服务php调用代码",
"keywords": [
"Aliyun-Sms",
"aliyun",
"sdk"
],
"time": "2017-10-19T08:02:14+00:00"
},
{
"name": "mrgoon/aliyun-sms-sdk",
"version": "v1.2.1",
"source": {
"type": "git",
"url": "https://github.com/MissMyCat/aliyun-sms-sdk.git",
"reference": "5c8863dce9643fb46180520586bb8d1362e52d7f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MissMyCat/aliyun-sms-sdk/zipball/5c8863dce9643fb46180520586bb8d1362e52d7f",
"reference": "5c8863dce9643fb46180520586bb8d1362e52d7f",
"shasum": ""
},
"require": {
"php": ">5.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Mrgoon\\AliyunSmsSdk\\": "aliyun-php-sdk-core/",
"Mrgoon\\Dysmsapi\\Request\\V20170525\\": "Dysmsapi/Request/V20170525"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "mrgoon",
"email": "mrgoon@foxmail.com"
}
],
"description": "阿里云短信服务核心代码",
"keywords": [
"Aliyun-Sms",
"aliyun",
"sdk"
],
"time": "2017-10-19T08:33:11+00:00"
},
{
"name": "mtdowling/jmespath.php",
"version": "2.5.0",
......@@ -7375,7 +7578,9 @@
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"stability-flags": {
"mrgoon/aliyun-sms": 20
},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
......
......@@ -179,6 +179,7 @@ return [
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
\Fruitcake\Cors\CorsServiceProvider::class,
],
/*
......
<?php
return [
/*
|--------------------------------------------------------------------------
| Laravel CORS Options
|--------------------------------------------------------------------------
|
| The allowed_methods and allowed_headers options are case-insensitive.
|
| You don't need to provide both allowed_origins and allowed_origins_patterns.
| If one of the strings passed matches, it is considered a valid origin.
|
| If ['*'] is provided to allowed_methods, allowed_origins or allowed_headers
| all methods / origins / headers are allowed.
|
*/
/*
* You can enable CORS for 1 or multiple paths.
* Example: ['api/*']
*/
'paths' => ['api/*'],
/*
* Matches the request method. `['*']` allows all methods.
*/
'allowed_methods' => ['*'],
/*
* Matches the request origin. `['*']` allows all origins. Wildcards can be used, eg `*.mydomain.com`
*/
'allowed_origins' => ['*'],
/*
* Patterns that can be used with `preg_match` to match the origin.
*/
'allowed_origins_patterns' => ['*'],
/*
* Sets the Access-Control-Allow-Headers response header. `['*']` allows all headers.
*/
'allowed_headers' => ['*'],
/*
* Sets the Access-Control-Expose-Headers response header with these headers.
*/
'exposed_headers' => ['authorization'],
/*
* Sets the Access-Control-Max-Age response header when > 0.
*/
'max_age' => 0,
/*
* Sets the Access-Control-Allow-Credentials header.
*/
'supports_credentials' => false,
];
......@@ -76,7 +76,7 @@
width="35%"
:modal="false"
top="20vh"
custom-class="zero-dialog"
:custom-class="dialogClass"
>
<el-table :data="gridData" :show-header="false">
<el-table-column property="title" width="180px"></el-table-column>
......@@ -209,6 +209,7 @@ export default {
data(){
const _this = this;
return {
dialogClass: 'zero-dialog',
leftDeviceListVisible: true,
markersGoodsVisible: false,
markersGoods: [{
......@@ -388,12 +389,17 @@ export default {
},
// 获取设备详细信息
getUserDeviceInfo(id) {
this.dialogClass = 'zero-dialog';
deviceinfo(id)
.then(res => {
const deviceInfo = res.data;
console.log(deviceInfo);
this.center = deviceInfo.devicecoord.replace(/\s*/g, '').split(',');
this.dialogTableVisible = true;
this.markersDeviceVisible = true;
if (deviceInfo.devicepolice === 4 || deviceInfo.devicepolice === 5 || deviceInfo.devicepolice === 6) {
this.dialogClass += ' device-box-fade-alarm';
}
this.gridData = [
{
title: '设备编号',
......@@ -596,4 +602,34 @@ export default {
right: 1px;
bottom: 1px;
}
@keyframes fade {
from {
opacity: 1.0;
}
50% {
opacity: 1.0;
background-color: red;
}
to {
opacity: 1.0;
}
}
@-webkit-keyframes fade {
from {
opacity: 1.0;
}
50% {
opacity: 1.0;
background-color: red;
}
to {
opacity: 1.0;
}
}
.device-box-fade-alarm .el-dialog__header {
animation: fade 600ms infinite;
-webkit-animation: fade 600ms infinite;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment