Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qsh-wc
Project
Project
Details
Activity
Releases
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
honghuiliu
qsh-wc
Commits
6ba1547f
Commit
6ba1547f
authored
Sep 23, 2022
by
honghuiliu
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日常提交
parent
b8cbf386
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
toilet.go
server/api/v1/web/toilet.go
+14
-2
web.go
server/router/web.go
+1
-0
toiletService.go
server/service/web/toiletService.go
+19
-0
No files found.
server/api/v1/web/toilet.go
View file @
6ba1547f
package
web
import
(
"fmt"
"gitee.com/zjlsliupei/ghelp"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/request"
...
...
@@ -30,10 +29,23 @@ func GetToiletList(c *gin.Context) {
func
GetToiletDetail
(
c
*
gin
.
Context
)
{
var
arg
request
.
GetId
_
=
c
.
ShouldBindJSON
(
&
arg
)
fmt
.
Println
(
c
.
ShouldBindJSON
(
&
arg
))
if
data
,
err
:=
toiletService
.
GetToiletDetail
(
arg
);
err
!=
nil
{
response
.
FailWithMessage
(
err
.
Error
(),
c
)
}
else
{
response
.
OkWithData
(
data
,
c
)
}
}
func
GetMonitorInfo
(
c
*
gin
.
Context
)
{
var
arg
request
.
GetId
_
=
c
.
ShouldBindJSON
(
&
arg
)
accessToken
,
cameraUrl
,
err
:=
toiletService
.
GetMonitorInfo
(
arg
)
if
err
!=
nil
{
response
.
FailWithMessage
(
err
.
Error
(),
c
)
return
}
response
.
OkWithData
(
ghelp
.
MAP
{
"access_token"
:
accessToken
,
"camera_url"
:
cameraUrl
,
},
c
)
}
server/router/web.go
View file @
6ba1547f
...
...
@@ -17,6 +17,7 @@ func InitWebRouter(router *gin.Engine) {
{
toilet
.
POST
(
"/toiletList"
,
web
.
GetToiletList
)
toilet
.
POST
(
"/getToiletDetail"
,
web
.
GetToiletDetail
)
toilet
.
POST
(
"/getMonitorInfo"
,
web
.
GetMonitorInfo
)
}
patrol
:=
webRouter
.
Group
(
"patrol"
)
{
...
...
server/service/web/toiletService.go
View file @
6ba1547f
...
...
@@ -4,6 +4,7 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/admin"
"github.com/flipped-aurora/gin-vue-admin/server/request"
"github.com/flipped-aurora/gin-vue-admin/server/utils"
)
type
ToiletService
struct
{
...
...
@@ -33,3 +34,21 @@ func (l *ToiletService) GetToiletDetail(toilet request.GetId) (admin.QshToilet,
}
return
toiletInfo
,
nil
}
//GetMonitorInfo 获取设备信息
func
(
l
*
ToiletService
)
GetMonitorInfo
(
toilet
request
.
GetId
)
(
string
,
string
,
error
)
{
var
toiletInfo
admin
.
QshToilet
err
:=
global
.
GVA_DB
.
Model
(
toiletInfo
)
.
Where
(
"id = ?"
,
toilet
.
ID
)
.
First
(
&
toiletInfo
)
.
Error
if
err
!=
nil
{
return
""
,
""
,
err
}
accessToken
,
err
:=
utils
.
GetYinShiAccessToken
(
toiletInfo
.
MonitorAc
)
if
err
!=
nil
{
return
""
,
""
,
err
}
cameraUrl
:=
utils
.
GetCameraUrl
(
toiletInfo
.
MonitorId
)
return
accessToken
,
cameraUrl
,
nil
}
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