Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
laravelzh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冯超鹏
laravelzh
Commits
165fe2b3
Commit
165fe2b3
authored
Jul 02, 2020
by
冯超鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户设备报警提示窗
parent
f3246426
Pipeline
#73
canceled with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
10 deletions
+21
-10
SwooleCommandController.php
app/Http/Controllers/Auth/SwooleCommandController.php
+5
-4
AuthController.php
app/Http/Controllers/AuthController.php
+8
-2
HomepageController.php
app/Http/Controllers/HomepageController.php
+6
-1
UserController.php
app/Http/Controllers/UserController.php
+1
-1
api.php
routes/api.php
+1
-2
No files found.
app/Http/Controllers/Auth/SwooleCommandController.php
View file @
165fe2b3
...
...
@@ -7,6 +7,7 @@ use App\Laravue\Models\Users;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
use
Illuminate\Support\Facades\Auth
;
use
App\Http\Controllers\DevicesController
;
class
SwooleCommandController
extends
Controller
{
//返回用户列表
...
...
@@ -63,9 +64,8 @@ class SwooleCommandController extends Controller
//监测是否设备报警
public
function
alarm
()
{
$user
=
Auth
::
user
();
//获取当前用户信息
$isadmin
=
DB
::
table
(
'users'
)
->
where
([[
'name'
,
'='
,
$user
[
'name'
]],
[
'email'
,
'='
,
$user
[
'email'
]]])
->
first
();
if
(
!
is_null
(
$isadmin
))
{
$isadmin
=
DB
::
table
(
'config'
)
->
first
();
if
(
is_null
(
$isadmin
))
{
$isalarm
=
DB
::
table
(
'reportpolice'
)
->
where
(
'status'
,
'='
,
'1'
)
->
where
(
'police'
,
'='
,
'1'
)
...
...
@@ -73,11 +73,12 @@ class SwooleCommandController extends Controller
->
select
(
'devicenumber'
)
->
get
()
->
toArray
();
}
else
{
$uid
=
get_object_vars
(
$isadmin
)[
'uid'
];
$isalarm
=
DB
::
table
(
'reportpolice'
)
->
join
(
'device as d'
,
'reportpolice.devicenumber'
,
'='
,
'd.devicenum'
)
->
where
(
'reportpolice.status'
,
'='
,
'1'
)
->
where
(
'reportpolice.police'
,
'='
,
'1'
)
->
where
(
'd.uid'
,
'='
,
Auth
::
id
()
)
->
where
(
'd.uid'
,
'='
,
$uid
)
->
groupBy
(
'reportpolice.id'
)
->
select
(
'reportpolice.devicenumber'
)
->
get
()
->
toArray
();
...
...
app/Http/Controllers/AuthController.php
View file @
165fe2b3
...
...
@@ -73,8 +73,14 @@ class AuthController extends Controller
}
public
function
logout
(
Request
$request
)
{
$request
->
user
()
->
token
()
->
revoke
();
return
response
()
->
json
((
new
JsonResponse
())
->
success
([]),
Response
::
HTTP_OK
);
$config
=
DB
::
table
(
'config'
);
$delectuser
=
$config
->
where
(
'uid'
,
'='
,
Auth
::
id
())
->
delete
();
if
(
$delectuser
){
$request
->
user
()
->
token
()
->
revoke
();
return
response
()
->
json
((
new
JsonResponse
())
->
success
([]),
Response
::
HTTP_OK
);
}
else
{
return
500
;
}
}
public
function
user
()
...
...
app/Http/Controllers/HomepageController.php
View file @
165fe2b3
...
...
@@ -79,8 +79,13 @@ class HomepageController extends Controller
}
//返回一年当前月份
public
function
userdevicemonthcount
()
public
function
userdevicemonthcount
(
Request
$request
)
{
$config
=
DB
::
table
(
'config'
);
$user
=
$config
->
where
(
'uid'
,
'='
,
Auth
::
id
())
->
first
();
if
(
!
$user
){
$config
->
insertGetId
([
'uid'
=>
Auth
::
id
(),
'userinfo'
=>
Auth
::
user
(),
'upde_time'
=>
time
()]);
}
$year_start
=
strtotime
(
date
(
"Y"
)
.
"-01-01"
);
// 获取当前的1月份的时间戳
$endThismonth
=
mktime
(
23
,
59
,
59
,
date
(
'm'
),
date
(
't'
),
date
(
'Y'
));
//获取当月的时间戳
$devicedata
=
Device
::
where
(
'uid'
,
'='
,
Auth
::
id
())
->
whereBetween
(
'deviceaddtime'
,
[
$year_start
,
$endThismonth
])
...
...
app/Http/Controllers/UserController.php
View file @
165fe2b3
...
...
@@ -552,6 +552,6 @@ class UserController extends Controller
public
function
textcountuser
()
{
var_dump
(
exec
(
"ifconfig"
,
$res
));
print_r
(
Auth
::
id
(
));
}
}
\ No newline at end of file
routes/api.php
View file @
165fe2b3
...
...
@@ -44,8 +44,6 @@ Route::group(['middleware' => 'auth:api'], function () {
Route
::
get
(
'user/paperBasketList'
,
'UserController@paperBasketList'
);
//返回废纸篓和用户状态
Route
::
get
(
'user/userLocation'
,
'UserController@userLocation'
);
//返回用户安装位置
Route
::
get
(
'user/textcountuser'
,
'UserController@textcountuser'
);
//用户测试接口
});
//上传图片路由
...
...
@@ -102,6 +100,7 @@ Route::group(['middleware'=>'auth:api'],function (){
Route
::
get
(
'devices/control'
,
'DevicesController@control'
);
//返回消防监测
Route
::
get
(
'devices/deviceLocation'
,
'DevicesController@deviceLocation'
);
//返回设备安装位置
Route
::
get
(
'devices/device_info/{id}'
,
'DevicesController@device_info'
);
//返回设备地图详情信息
Route
::
get
(
'devices/UseridOrdeviceInfo'
,
'DevicesController@UseridOrdeviceInfo'
);
//用户测试接口
});
//装维中心
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment