module
Version:
v0.1.7
Opens a new window with list of versions in this module.
Published: Dec 20, 2021
License: MIT
Opens a new window with license information.
README
¶
Introduction
Go SDK of china national video game anti-addiction system.
Status
alpha
TestSuite
testcase01~08(Chinese)
Usages
-
idcard check
c := auth.NewClient(appId, bizId, secretKey)
req := idcard.CheckRequest{IDNum:"xx", Name:"xx", AI:"xx"}
resp, err := req.Do(c)
-
idcard query
req := idcard.QueryRequest{AI:"xx"}
resp, err := req.Do(c)
-
behavior upload
events := []behavior.LoginOutEvent{{}, {}}
req := behavior.LoginOutRequest{Collection: events}
resp, err := req.Do(c)
-
message queue and producer, consumer
c := auth.NewClient(appId, bizId, secretKey)
queue, err := redisstream.New(redisUrl, "behavior")
// producer
obj := behavior.NewLogin(...) // or NewLogout(...)
data, _ := json.Marshal(obj)
err = queue.Write(data)
// consumer
c := auth.NewClient(appId, bizId, secretKey)
consumerFunc := behavior.ConsumerFunc(c, 128, 100)
consumer := consumer.New(queue, consumerFunc)
consumer.Start()
// consumer(manually)
msgList, err := queue.Read(1024, 1*time.Second)
reqList, err := behavior.DecodeLoginOutRequest(msgList, 128)
for _, req := range reqList {
resp, err := req.Do(c)
}
More Usages
out-of-box way
c := auth.NewClient(appId, bizId, secretKey)
gaa, err := outofbox.New(c, redisUrl)
gaa.Start(nil)
gaa.PushBehavior(xxx)
gaa.PushQueryRequest(xxx)
License
MIT License
About video game anti-addiction (Chinese)
Directories
¶
_examples
|
|
|
|
|
|
|
|
|
|
|
|
services
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.