users

command
v0.0.0-...-8e1814b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

测试运行

服务发现

所有服务都需要服务发现。默认为多播DNS,简单不需要任何配置。

如果您需要多主机或更具弹性可以使用 Consul。

# install
$ brew install consul

# run http://localhost:8500
$ consul agent -dev

运行 srvusers 和 srvhistoryuserlogin

# run srv users
$ cd $GOPATH/src/github.com/idoall/MicroService-UserPowerManager/srv/users
$ go run main.go init.go --registry=consul

# run srv historyuserlogin
$ cd $GOPATH/src/github.com/idoall/MicroService-UserPowerManager/srv/historyuserlogin/
$ go run main.go init.go --registry=consul

运行 api users

$ cd $GOPATH/src/github.com/idoall/MicroService-UserPowerManager/api/users
$ go run main.go init.go --registry=consul

运行 micro api

$ micro --registry=consul api --address=:8080 --handler=api 

测试方法

# Post 方法,添加用户
$ curl -XPOST -H 'Content-Type: application/x-www-form-urlencoded' \
      -d 'UserName=This is a Name&PassWord=123password' \
      --url http://localhost:8080/mshk/v1/users/Users/add
{"id":"go.micro.api.mshk.api.v1","code":500,"detail":"Email 不能为空","status":"Internal Server Error"}

# Get 方法,获取用户列表
$ curl "http://localhost:8080/mshk/v1/users/Users/getList?PageSize=2&CurrentPageIndex=1&OrderBy=id%20desc"
{"rows":[{"ID":1,"UserName":"admin","RealyName":"admin","Password":"93a57b286d7f77fdce1c8e17f5c2dfb6459c739b058c85b168cdd1df599e1f35","AuthKey":"1118447772383584256","Email":"admin@mshk.top","Note":"adminnote","CreateTime":1555048377,"LastUpdateTime":1555051238}],"total":1}

# Get 方法,获取单个用户列表
$ curl "http://localhost:8080/mshk/v1/users/Users/getUser?ID=1"

# Post 方法,登录
$ curl -XPOST -H 'Content-Type: application/x-www-form-urlencoded' \
      -d 'UserName=admin&PassWord=8e24e1bd5967bb33cc80e469c2d66203d826e52d4a1ca3a561b6f132472a0210' \
      --url http://localhost:8080/mshk/v1/users/Users/userLogin

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
v1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL