Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c23a2806
authored
Nov 04, 2024
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
更新ws服务路径
1 parent
6f9f6034
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
config.js
ws/Ws.js
config.js
View file @
c23a280
...
@@ -14,9 +14,8 @@ module.exports = {
...
@@ -14,9 +14,8 @@ module.exports = {
TOKEN_NAME
:
'glsk-oss'
,
TOKEN_NAME
:
'glsk-oss'
,
PROTOCAL
:
'http'
,
PROTOCAL
:
'http'
,
SERVER
:
'
192.168.1.129'
,
SERVER
:
'
app-admin-server.test.glsx.com.cn'
,
SOCKET_PORT
:
'
8080
'
,
SOCKET_PORT
:
'
9081
'
,
HTTP_PORT
:
'3000'
,
HTTP_PORT
:
'3000'
,
FILE_UPLOAD_URL
:
'file/upload'
,
FILE_UPLOAD_URL
:
'file/upload'
,
}
}
ws/Ws.js
View file @
c23a280
...
@@ -13,8 +13,8 @@ export class Ws {
...
@@ -13,8 +13,8 @@ export class Ws {
onMessage
onMessage
ws
ws
constructor
()
{
constructor
()
{
this
.
wsAddress
=
`
${
config
.
PROTOCAL
}
://
${
config
.
SERVER
}
:
${
config
.
SOCKET_PORT
}
`
this
.
wsAddress
=
`
${
config
.
PROTOCAL
}
://
${
config
.
SERVER
}
`
this
.
loginAddress
=
`
${
config
.
PROTOCAL
}
://
${
config
.
SERVER
}
:
${
config
.
HTTP_PORT
}
/login`
this
.
loginAddress
=
`
${
config
.
PROTOCAL
}
://
${
config
.
SERVER
}
/login`
}
}
async
connect
()
{
async
connect
()
{
const
{
code
,
data
,
...
o
}
=
await
this
.
login
()
const
{
code
,
data
,
...
o
}
=
await
this
.
login
()
...
@@ -22,8 +22,9 @@ export class Ws {
...
@@ -22,8 +22,9 @@ export class Ws {
this
.
deviceId
=
data
.
id
this
.
deviceId
=
data
.
id
this
.
token
=
data
.
token
this
.
token
=
data
.
token
this
.
ws
=
io
(
this
.
wsAddress
,
{
this
.
ws
=
io
(
this
.
wsAddress
,
{
path
:
'/websocket/'
,
auth
:
{
token
:
this
.
token
,
deviceId
:
this
.
deviceId
},
auth
:
{
token
:
this
.
token
,
deviceId
:
this
.
deviceId
},
transports
:
[
'websocket'
],
transports
:
[
'websocket'
],
timeout
:
5000
timeout
:
5000
})
})
this
.
subscribe
()
this
.
subscribe
()
...
@@ -36,7 +37,7 @@ export class Ws {
...
@@ -36,7 +37,7 @@ export class Ws {
// const userInfo = uni.$storage.get('userInfo')
// const userInfo = uni.$storage.get('userInfo')
// ;(userInfo.name = '胡悦'), (userInfo.phone = '18754575574')
// ;(userInfo.name = '胡悦'), (userInfo.phone = '18754575574')
if
(
!
sysInfo
?.
deviceId
)
return
uni
.
$logger
.
local
.
error
(
'未获取到系统设备信息'
)
if
(
!
sysInfo
?.
deviceId
)
return
uni
.
$logger
.
local
.
error
(
'未获取到系统设备信息'
)
// sysInfo.deviceId='sn123456
'
sysInfo
.
deviceId
=
'4DF8801064461802495A2452CCD04EE4
'
// const { name: user, phone: mobile, merchantName } = userInfo
// const { name: user, phone: mobile, merchantName } = userInfo
uni
.
$logger
.
local
.
info
(
`========WS,用户登录
${
JSON
.
stringify
({
deviceId
:
sysInfo
.
deviceId
})}
========`
)
uni
.
$logger
.
local
.
info
(
`========WS,用户登录
${
JSON
.
stringify
({
deviceId
:
sysInfo
.
deviceId
})}
========`
)
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
@@ -81,6 +82,7 @@ export class Ws {
...
@@ -81,6 +82,7 @@ export class Ws {
})
})
}
}
send
(
data
,
type
=
WsTyps
.
MessageTypes
.
Private
)
{
send
(
data
,
type
=
WsTyps
.
MessageTypes
.
Private
)
{
console
.
log
(
data
)
this
.
ws
.
emit
(
type
,
{
device_id
:
this
.
deviceId
,
...
data
})
this
.
ws
.
emit
(
type
,
{
device_id
:
this
.
deviceId
,
...
data
})
}
}
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment