Browse Source

调用方法增加用户类型

master v0.1.4
guzeng 3 years ago
parent
commit
ce09ffce1b
4 changed files with 23 additions and 5 deletions
  1. +8
    -0
      user/go.mod
  2. +8
    -0
      user/go.sum
  3. +2
    -0
      user/user.client.go
  4. +5
    -5
      user/user.client_test.go

+ 8
- 0
user/go.mod View File

@ -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
)

+ 8
- 0
user/go.sum View File

@ -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=

+ 2
- 0
user/user.client.go View File

@ -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
}


+ 5
- 5
user/user.client_test.go View File

@ -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)


Loading…
Cancel
Save