Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8cfd9f4a
authored
Nov 27, 2019
by
patpat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加uat环境
parent
2e3386be
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
24 deletions
+26
-24
app/src/main/java/com/bgycc/smartcanteen/AppConfig.java
+0
-19
app/src/main/java/com/bgycc/smartcanteen/AppConfig.kt
+23
-0
app/src/main/java/com/bgycc/smartcanteen/activity/MainActivity.kt
+1
-1
app/src/main/java/com/bgycc/smartcanteen/server/websocket/MainWebSocket.java
+2
-4
No files found.
app/src/main/java/com/bgycc/smartcanteen/AppConfig.java
deleted
100644 → 0
View file @
2e3386be
package
com
.
bgycc
.
smartcanteen
;
public
class
AppConfig
{
public
enum
Server
{
DEV
,
TEST
,
PROD
}
public
static
final
Server
SERVER
=
Server
.
PROD
;
public
static
String
getMainWebSocketServerUrl
()
{
switch
(
SERVER
)
{
case
DEV:
return
"ws://10.187.17.22:9001/websocket/%s"
;
case
TEST:
return
"ws://diningservicetest.bgy.com.cn:9001/websocket/%s"
;
default
:
case
PROD:
return
"wss://diningservice.bgy.com.cn/websocket/%s"
;
}
}
}
app/src/main/java/com/bgycc/smartcanteen/AppConfig.kt
0 → 100644
View file @
8cfd9f4a
package
com.bgycc.smartcanteen
object
AppConfig
{
enum
class
Server
{
DEV
,
TEST
,
UAT
,
PROD
}
val
SERVER
=
Server
.
PROD
fun
getMainWebSocketServerUrl
(
id
:
String
,
version
:
String
):
String
{
when
(
SERVER
)
{
AppConfig
.
Server
.
DEV
->
return
"ws://10.187.37.226:9001/websocket/$id/V$version"
AppConfig
.
Server
.
TEST
->
return
"ws://diningservicetest.bgy.com.cn:9001/websocket/$id/V$version"
AppConfig
.
Server
.
UAT
->
return
"wss://diningserviceuat.bgy.com.cn/websocket/$id"
else
->
return
"wss://diningservice.bgy.com.cn/websocket/$id"
}
}
}
\ No newline at end of file
app/src/main/java/com/bgycc/smartcanteen/activity/MainActivity.kt
View file @
8cfd9f4a
...
...
@@ -194,7 +194,7 @@ class MainActivity : BaseActivity() {
@Subscribe
(
threadMode
=
ThreadMode
.
MAIN
)
fun
onMessageEvent
(
event
:
ConnectStateEvent
)
{
val
base
=
"Server: "
+
String
.
format
(
AppConfig
.
getMainWebSocketServerUrl
(),
App
.
getDeviceSN
()
)
+
" "
val
base
=
"Server: "
+
AppConfig
.
getMainWebSocketServerUrl
(
App
.
getDeviceSN
(),
BuildConfig
.
VERSION_NAME
)
+
" "
if
(
event
.
state
==
ConnectStateEvent
.
OFFLINE
)
_server
.
text
=
base
+
"${NetworkManager.currentTypeString} 未连接"
else
if
(
event
.
state
==
ConnectStateEvent
.
CONNECTING
)
_server
.
text
=
base
+
"${NetworkManager.currentTypeString} 正在连接..."
else
if
(
event
.
state
==
ConnectStateEvent
.
CONNECTED
)
_server
.
text
=
base
+
"${NetworkManager.currentTypeString} 已连接"
...
...
app/src/main/java/com/bgycc/smartcanteen/server/websocket/MainWebSocket.java
View file @
8cfd9f4a
package
com
.
bgycc
.
smartcanteen
.
server
.
websocket
;
import
android.util.LongSparseArray
;
import
android.util.SparseArray
;
import
com.bgycc.smartcanteen.App
;
import
com.bgycc.smartcanteen.AppConfig
;
import
com.bgycc.smartcanteen.BuildConfig
;
import
com.bgycc.smartcanteen.action.ActionEnum
;
import
com.bgycc.smartcanteen.action.PayOfflineAction
;
import
com.bgycc.smartcanteen.action.UpdateAction
;
import
com.bgycc.smartcanteen.helper.TimerHelper
;
import
com.bgycc.smartcanteen.manager.NetworkManager
;
import
com.bgycc.smartcanteen.server.websocket.event.ConnectStateEvent
;
import
com.bgycc.smartcanteen.server.websocket.event.RecvMessageEvent
;
import
com.bgycc.smartcanteen.server.websocket.event.SendMessageEvent
;
...
...
@@ -56,7 +54,7 @@ public class MainWebSocket extends WebSocketClient {
if
(
sDeviceSN
.
isEmpty
())
return
;
EventBus
.
getDefault
().
post
(
new
ConnectStateEvent
(
ConnectStateEvent
.
CONNECTING
));
sInstance
=
new
MainWebSocket
(
new
URI
(
String
.
format
(
AppConfig
.
getMainWebSocketServerUrl
(),
sDeviceSN
)));
sInstance
=
new
MainWebSocket
(
new
URI
(
AppConfig
.
INSTANCE
.
getMainWebSocketServerUrl
(
sDeviceSN
,
BuildConfig
.
VERSION_NAME
)));
sInstance
.
connect
();
TimerHelper
.
INSTANCE
.
loop
(
new
TimerHelper
.
LoopTask
()
{
@Override
...
...
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