From ce09ffce1bc8a0a2f8547d270397284c8091a5d9 Mon Sep 17 00:00:00 2001 From: guzeng Date: Wed, 3 Mar 2021 17:26:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E7=94=A8=E6=96=B9=E6=B3=95=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=94=A8=E6=88=B7=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- user/go.mod | 8 ++++++++ user/go.sum | 8 ++++++++ user/user.client.go | 2 ++ user/user.client_test.go | 10 +++++----- 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 user/go.mod create mode 100644 user/go.sum diff --git a/user/go.mod b/user/go.mod new file mode 100644 index 0000000..8478138 --- /dev/null +++ b/user/go.mod @@ -0,0 +1,8 @@ +module git.tetele.net/tgo/rpc/user + +go 1.14 + +require ( + github.com/chai2010/protorpc v1.0.0 // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect +) diff --git a/user/go.sum b/user/go.sum new file mode 100644 index 0000000..0a0e052 --- /dev/null +++ b/user/go.sum @@ -0,0 +1,8 @@ +github.com/chai2010/protorpc v1.0.0 h1:aJ45G9sl1utSKo35EqnBSTs5jqTpdJDJAuZMMYPAtFo= +github.com/chai2010/protorpc v1.0.0/go.mod h1:woR3WwjaQDqFjlzdVsFEKiK5Ur12QL8mYxVPjfr5z54= +github.com/golang/protobuf v1.0.0 h1:lsek0oXi8iFE9L+EXARyHIjU5rlWIhhTkjDz3vHhWWQ= +github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.0-20170215233205-553a64147049 h1:K9KHZbXKpGydfDN0aZrsoHpLJlZsBrGMFWbgLDGnPZk= +github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/user/user.client.go b/user/user.client.go index e616e24..9a3cd19 100644 --- a/user/user.client.go +++ b/user/user.client.go @@ -40,6 +40,7 @@ func GetUserByToken(dbname, token string, url ...string) (map[string]string, err "IsVip": res.GetIsVip(), "Usercode": res.GetUsercode(), "GroupId": res.GetGroupId(), + "Type": res.GetType(), }, nil } @@ -84,6 +85,7 @@ func Login(dbname, account, password string, url ...string) (map[string]string, "Token": res.GetToken(), "Usercode": res.GetUsercode(), "GroupId": res.GetGroupId(), + "Type": res.GetType(), }, nil } diff --git a/user/user.client_test.go b/user/user.client_test.go index 9136c05..f154741 100644 --- a/user/user.client_test.go +++ b/user/user.client_test.go @@ -12,15 +12,15 @@ func Test_GetUserByToken(t *testing.T) { t.Log(res["UserId"]) t.Log(err) - res, err = GetUserById(dbname, "114") - t.Log(res) - t.Log(res["UserId"]) - t.Log(err) + // res, err = GetUserById(dbname, "114") + // t.Log(res) + // t.Log(res["UserId"]) + // t.Log(err) } func Test_Login(t *testing.T) { dbname := "dev_tetele_net" - account := "adminw" + account := "admin" password := "e10adc3949ba59abbe56e057f20f883e" res, err := Login(dbname, account, password) t.Log(res)