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
249d238d
Commit
249d238d
authored
May 27, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into map_model
parents
c0898f1b
4a69e7d0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
26 deletions
+10
-26
swoole.php
app/Console/Commands/swoole.php
+1
-1
swooleMeTcp.php
app/Console/Commands/swooleMeTcp.php
+1
-1
UserController.php
app/Http/Controllers/UserController.php
+8
-24
No files found.
app/Console/Commands/swoole.php
View file @
249d238d
...
@@ -57,7 +57,7 @@ class swoole extends Command
...
@@ -57,7 +57,7 @@ class swoole extends Command
{
{
$url
=
config
(
'public.swoolwebsocketurl'
);
$url
=
config
(
'public.swoolwebsocketurl'
);
$por
=
config
(
'public.swoolwebsocketurlpor'
);
$por
=
config
(
'public.swoolwebsocketurlpor'
);
$this
->
ws
=
new
\swoole_websocket_server
(
$url
,
$por
);
//创建一个端口
$this
->
ws
=
new
\swoole_websocket_server
(
'0.0.0.0'
,
9502
);
//创建一个端口
$this
->
ws
->
set
(
array
(
$this
->
ws
->
set
(
array
(
'reactor_num'
=>
2
,
//reactor线程数
'reactor_num'
=>
2
,
//reactor线程数
'worker_num'
=>
4
,
//worker进程数
'worker_num'
=>
4
,
//worker进程数
...
...
app/Console/Commands/swooleMeTcp.php
View file @
249d238d
...
@@ -55,7 +55,7 @@ class swooleMeTcp extends Command
...
@@ -55,7 +55,7 @@ class swooleMeTcp extends Command
public
function
start
()
public
function
start
()
{
{
$url
=
config
(
'public.swooletcpurl'
);
$url
=
config
(
'public.swooletcpurl'
);
$this
->
tcp
=
new
\swoole_server
(
$url
,
9503
);
$this
->
tcp
=
new
\swoole_server
(
'127.0.0.1'
,
9503
);
$this
->
tcp
->
addlistener
(
$url
,
9504
,
SWOOLE_SOCK_TCP
);
// 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
$url
,
9504
,
SWOOLE_SOCK_TCP
);
// 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
$url
,
9505
,
SWOOLE_SOCK_TCP
);
// 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
$url
,
9505
,
SWOOLE_SOCK_TCP
);
// 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
$url
,
9506
,
SWOOLE_SOCK_TCP
);
// 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
$url
,
9506
,
SWOOLE_SOCK_TCP
);
// 添加 TCP端口监听
...
...
app/Http/Controllers/UserController.php
View file @
249d238d
...
@@ -22,6 +22,7 @@ use Illuminate\Support\Facades\Auth;
...
@@ -22,6 +22,7 @@ use Illuminate\Support\Facades\Auth;
use
Illuminate\Http\Resources\Json\ResourceCollection
;
use
Illuminate\Http\Resources\Json\ResourceCollection
;
use
Illuminate\Support\Arr
;
use
Illuminate\Support\Arr
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Env
;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Facades\Hash
;
use
Validator
;
use
Validator
;
...
@@ -507,30 +508,13 @@ class UserController extends Controller
...
@@ -507,30 +508,13 @@ class UserController extends Controller
//返回用户的经纬度
//返回用户的经纬度
public
function
userLocation
()
public
function
userLocation
()
{
{
$davicenum
=
DB
::
table
(
'BackgroundUser'
)
$davicenum
=
DB
::
table
(
'BackgroundUser as b'
)
->
select
(
'id'
)
->
leftjoin
(
'device as d'
,
'b.id'
,
'='
,
'd.uid'
)
->
leftjoin
(
'device_type as t'
,
'd.dtype'
,
'='
,
't.tid'
)
->
selectRaw
(
'b.nickname,b.id,b.mapcenter,d.devicenum,COUNT(d.id) AS UserDaviceNum,COUNT(IF(d.devicepolice <> 1, true, null)) AS police'
)
->
groupBy
(
'b.id'
)
->
get
()
->
toArray
();
->
get
()
->
toArray
();
$data
=
[];
return
$this
->
jsonSuccessData
(
$davicenum
);
$police
=
[];
foreach
(
array_column
(
$davicenum
,
'id'
)
as
$k
=>
$value
){
$countdevice_type
=
DB
::
table
(
'device'
)
->
where
(
'uid'
,
'='
,
$value
)
->
count
();
$usernum
[
'count'
]
=
$countdevice_type
;
$usernum
[
'id'
]
=
$value
;
array_push
(
$data
,
$usernum
);
}
foreach
(
array_column
(
$davicenum
,
'id'
)
as
$k
=>
$value
){
$countdevice_type
=
DB
::
table
(
'device'
)
->
where
(
'uid'
,
'='
,
$value
)
->
where
(
'devicepolice'
,
'>'
,
'1'
)
->
count
();
$usernum
[
'count'
]
=
$countdevice_type
;
$usernum
[
'id'
]
=
$value
;
array_push
(
$police
,
$usernum
);
}
$userlist
=
DB
::
table
(
'BackgroundUser'
)
->
select
(
'id'
,
'nickname'
,
'mapcenter'
,
'company'
)
->
get
();
return
$this
->
jsonSuccessData
([
'UserDaviceNum'
=>
$data
,
'UserList'
=>
$userlist
,
'police'
=>
$police
]);
}
}
/*
/*
...
...
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