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
0acbb4e6
Commit
0acbb4e6
authored
Sep 23, 2022
by
sven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加监控数据获取
parent
98b17b50
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
473 additions
and
27 deletions
+473
-27
config.yaml
server/config.yaml
+7
-1
go.mod
server/go.mod
+5
-7
go.sum
server/go.sum
+422
-19
fn.go
server/utils/fn.go
+39
-0
No files found.
server/config.yaml
View file @
0acbb4e6
...
...
@@ -172,4 +172,10 @@ oss:
# dtu设备配置
dtuServer
:
addr
:
0.0.0.0:9804
enable
:
false
\ No newline at end of file
enable
:
false
# 莹石云帐号
yinShiYun
:
13625717783
:
appKey
:
e910fbb3530f4385b8758f1ab268a5f7
secret
:
11d99e61b7a0998c18a7fcb557bdaa87
\ No newline at end of file
server/go.mod
View file @
0acbb4e6
...
...
@@ -3,11 +3,12 @@ module github.com/flipped-aurora/gin-vue-admin/server
go 1.16
require (
gitee.com/zjlsliupei/ghelp v0.0.16
// indirect
gitee.com/zjlsliupei/ghelp v0.0.16
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/aliyun/aliyun-oss-go-sdk v2.1.6+incompatible
github.com/aws/aws-sdk-go v1.42.27
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
github.com/beego/beego/v2 v2.0.5
github.com/casbin/casbin/v2 v2.11.0
github.com/casbin/gorm-adapter/v3 v3.0.2
github.com/flipped-aurora/ws v1.0.2
...
...
@@ -18,20 +19,17 @@ require (
github.com/go-openapi/spec v0.20.3 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-redis/redis/v8 v8.11.0
github.com/go-sql-driver/mysql v1.
5
.0
github.com/go-sql-driver/mysql v1.
6
.0
github.com/golang-jwt/jwt/v4 v4.3.0
github.com/gookit/color v1.3.1
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.21.8+incompatible
github.com/jackc/pgx/v4 v4.15.0 // indirect
github.com/jordan-wright/email v0.0.0-20200824153738-3f5bafa1cd84
github.com/json-iterator/go v1.1.10 // indirect
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
github.com/lestrrat-go/strftime v1.0.6 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/mapstructure v1.2.2 // indirect
github.com/mojocn/base64Captcha v1.3.1
github.com/otiai10/copy v1.7.0
github.com/pelletier/go-toml v1.6.0 // indirect
github.com/pkg/errors v0.9.1
github.com/qiniu/api.v7/v7 v7.4.1
github.com/robfig/cron/v3 v3.0.1
...
...
@@ -43,13 +41,13 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.
7.1
github.com/stretchr/testify v1.
8.0
github.com/swaggo/gin-swagger v1.3.0
github.com/swaggo/swag v1.7.0
github.com/tencentyun/cos-go-sdk-v5 v0.7.19
github.com/unrolled/secure v1.0.7
github.com/xuri/excelize/v2 v2.4.1
go.uber.org/zap v1.1
6
.0
go.uber.org/zap v1.1
7
.0
golang.org/x/crypto v0.0.0-20220213190939-1e6e3497d506
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/text v0.3.7
...
...
server/go.sum
View file @
0acbb4e6
This source diff could not be displayed because it is too large. You can
view the blob
instead.
server/utils/fn.go
View file @
0acbb4e6
package
utils
import
(
"context"
"errors"
"fmt"
"github.com/beego/beego/v2/client/httplib"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/songzhibin97/gkit/tools/gjson"
"time"
)
type
PageInfo
struct
{
Page
int
`json:"page" form:"page"`
// 页码
PageSize
int
`json:"page_size" form:"page_size"`
// 每页大小
}
// GetYinShiAccessToken 获取指定帐号下accessToken
// example: utils.GetYinShiAccessToken("13625717783")
func
GetYinShiAccessToken
(
userName
string
)
(
string
,
error
)
{
key
:=
fmt
.
Sprintf
(
"%syinshui_accesstoken_%s"
,
global
.
GVA_VP
.
GetString
(
"redis.prefix"
),
userName
)
if
accessToken
:=
global
.
GVA_REDIS
.
Get
(
context
.
Background
(),
key
)
.
Val
();
accessToken
!=
""
{
return
accessToken
,
nil
}
req
:=
httplib
.
Post
(
"https://open.ys7.com/api/lapp/token/get"
)
req
.
Param
(
"appKey"
,
global
.
GVA_VP
.
GetString
(
fmt
.
Sprintf
(
"yinShiYun.%s.appKey"
,
userName
)))
req
.
Param
(
"appSecret"
,
global
.
GVA_VP
.
GetString
(
fmt
.
Sprintf
(
"yinShiYun.%s.secret"
,
userName
)))
res
,
err
:=
req
.
String
()
if
err
!=
nil
{
return
""
,
err
}
resJson
:=
gjson
.
Parse
(
res
)
if
resJson
.
Get
(
"code"
)
.
Exists
()
&&
resJson
.
Get
(
"code"
)
.
Int
()
==
200
{
_accessToken
:=
resJson
.
Get
(
"data.accessToken"
)
.
String
()
global
.
GVA_REDIS
.
Set
(
context
.
Background
(),
key
,
_accessToken
,
6
*
24
*
time
.
Hour
)
return
_accessToken
,
nil
}
else
{
return
""
,
errors
.
New
(
"获取accessToken失败"
)
}
}
// GetCameraUrl 获取监控播放地址
func
GetCameraUrl
(
deviceId
string
)
string
{
return
fmt
.
Sprintf
(
"ezopen://open.ys7.com/%s/1.hd.live"
,
deviceId
)
}
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