Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SooonerHotel
Project
Project
Details
Activity
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
吴贤德
SooonerHotel
Commits
8132e21f
Commit
8132e21f
authored
Jul 17, 2019
by
吴贤德
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
service
parent
2cbb998f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
10 deletions
+38
-10
Common_test.go
Services/CenterService/Common/Common_test.go
+23
-7
go.mod
Services/CenterService/go.mod
+2
-1
go.sum
Services/CenterService/go.sum
+4
-2
readme.txt
Services/CenterService/readme.txt
+9
-0
No files found.
Services/CenterService/Common/Common_test.go
View file @
8132e21f
...
...
@@ -2,8 +2,9 @@ package Common
import
(
"fmt"
"src/Common/DateTime"
//
"src/Common/DateTime"
"testing"
"github.com/vmihailenco/msgpack"
)
//func Test_ValidMobile(t *testing.T) {
...
...
@@ -42,11 +43,25 @@ import (
// }
//}
func
Test_fmtdate
(
t
*
testing
.
T
)
{
strTime
:=
"2019-07-01 12:00:00"
time
,
err
:=
DateTime
.
ParseDateTime
(
strTime
)
if
err
==
nil
{
str
:=
DateTime
.
Format
(
"YYYYMMDDhhmmss"
,
time
)
fmt
.
Println
(
strTime
,
"-->"
,
str
)
//func Test_fmtdate(t *testing.T) {
// strTime:="2019-07-01 12:00:00"
// time,err:=DateTime.ParseDateTime(strTime)
// if err==nil {
// str:=DateTime.Format("YYYYMMDDhhmmss",time)
// fmt.Println(strTime,"-->",str)
// }
//}
func
Test_msgpack
(
t
*
testing
.
T
)
{
str
:=
"
\x84\xa1
t
\xce
].}
\x16\xa1
o
\x95\x92\xa3
cpu
\xa6
0.0100
\x92\xa4
avg1
\xa6
0.0200
\x92\xa4
avg5
\xa6
0.0400
\x92\xa5
avg15
\xa6
0.0500
\x92\xa3
mem
\xa6
0.4455
\xa1
c
\x91\xa6
0.0100
\xa1
n
\x92\x91\x92\xa4
eth0
\xa6
0.0000
\x91\x92\xa4
eth0
\xa6
0.0000"
fmt
.
Println
(
str
)
type
Obj
interface
{
}
obj
:=
new
(
Obj
)
err
:=
msgpack
.
Unmarshal
([]
byte
(
str
),
&
obj
)
if
err
!=
nil
{
fmt
.
Println
(
"err : "
,
err
.
Error
())
}
fmt
.
Errorf
(
"obj : %v"
,
obj
)
}
\ No newline at end of file
Services/CenterService/go.mod
View file @
8132e21f
...
...
@@ -3,7 +3,6 @@ module src
go 1.12
require (
github.com/araddon/dateparse v0.0.0-20190510211750-d2ba70357e92
github.com/bitly/go-simplejson v0.5.0
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
...
...
@@ -21,5 +20,7 @@ require (
github.com/sirupsen/logrus v1.4.2
github.com/stretchr/testify v1.3.0 // indirect
github.com/tebeka/strftime v0.0.0-20140926081919-3f9c7761e312 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible
golang.org/x/net v0.0.0-20190603091049-60506f45cf65 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)
Services/CenterService/go.sum
View file @
8132e21f
github.com/araddon/dateparse v0.0.0-20190510211750-d2ba70357e92 h1:29yos9+rhKruIXuhBeY/jCvz0jZ/JndeIL/K6SFS90M=
github.com/araddon/dateparse v0.0.0-20190510211750-d2ba70357e92/go.mod h1:SLqhdZcd+dF3TEVL2RMoob5bBP5R1P1qkox+HtCBgGI=
github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
...
...
@@ -47,6 +45,8 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/tebeka/strftime v0.0.0-20140926081919-3f9c7761e312 h1:frNEkk4P8mq+47LAMvj9LvhDq01kFDUhpJZzzei8IuM=
github.com/tebeka/strftime v0.0.0-20140926081919-3f9c7761e312/go.mod h1:o6CrSUtupq/A5hylbvAsdydn0d5yokJExs8VVdx4wwI=
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65 h1:+rhAzEzT3f4JtomfC371qB+0Ola2caSKcY69NUBZrRQ=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
...
...
@@ -54,3 +54,5 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Services/CenterService/readme.txt
View file @
8132e21f
监控数据
设备信息:
127.0.0.1:6000> eval 'local d = redis.call("hget", "LDR", "F1") return cjson.encode(cmsgpack.unpack(d))' 0
"{\"c\":[\"0.0100\"],\"t\":1563327766,\"o\":[[\"cpu\",\"0.0100\"],[\"avg1\",\"0.0200\"],[\"avg5\",\"0.0400\"],[\"avg15\",\"0.0500\"],[\"mem\",\"0.4455\"]],\"n\":[[[\"eth0\",\"0.0000\"]],[[\"eth0\",\"0.0000\"]]]}"
服务信息:
127.0.0.1:6000> eval 'local d = redis.call("hget", "LSR", "F1") return cjson.encode(cmsgpack.unpack(d))' 0
"{\"a\":{},\"t\":1563327759.687}"
\ No newline at end of file
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