针对前端打包时候切换开发和生产环境的ws url
continuous-integration/drone/push Build is passing Details

This commit is contained in:
giaogiao 2023-09-14 10:09:08 +08:00
parent 86414244a8
commit 300ac78672
3 changed files with 6 additions and 6 deletions

View File

@ -28,7 +28,7 @@ steps:
- npm install yarn
- yarn config set registry https://registry.npm.taobao.org --global
- yarn
- yarn run eject
- sed -i 's?(dev_ws_url)?(dev_ws_url)?g' ./src/api/websocket.js
- yarn build
- name: build

View File

@ -35,7 +35,7 @@ func Hello(c echo.Context) error {
msg := ""
err := websocket.Message.Receive(ws, &msg)
if err != nil {
c.Logger().Error(err)
c.Logger().Error(err.Error())
break
}
//暂时不解析的json
@ -45,13 +45,13 @@ func Hello(c echo.Context) error {
}
json.Unmarshal([]byte(msg), &wsValue)
if err := json.Unmarshal([]byte(msg), &wsValue); err != nil {
fmt.Println(err)
fmt.Println(err.Error())
}
switch wsValue.Method {
case "start":
var startdata MacData
if err := json.Unmarshal(json_data, &startdata); err != nil {
c.Logger().Error(err)
c.Logger().Error(err.Error())
return
}
Send_start(startdata.Mac, &ws, wsValue.Uuid)
@ -61,14 +61,14 @@ func Hello(c echo.Context) error {
case "del":
var DelData DelData
if err := json.Unmarshal(json_data, &DelData); err != nil {
c.Logger().Error(err)
c.Logger().Error(err.Error())
return
}
Del(&ws, wsValue.Uuid, DelData.ID)
case "add":
var AddData AddData
if err := json.Unmarshal(json_data, &AddData); err != nil {
c.Logger().Error(err)
c.Logger().Error(err.Error())
return
}
Add(&ws, wsValue.Uuid, AddData.Nmae, AddData.Mac)

BIN
wol.db

Binary file not shown.