Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wang
/
go_supplier_task
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
aa55afc5
authored
Feb 24, 2021
by
wang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
暂存
parent
43dfb990
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
6 deletions
.gitignore
cmd/http/http_server.go
controller/middleware_controller.go
controller/sku_controller.go
go.mod
.gitignore
View file @
aa55afc5
...
...
@@ -25,3 +25,5 @@ cmd.exe~
/open/redisLock
/tests
/controller/test.go
/regconfig
/cmd/http/regTest
\ No newline at end of file
cmd/http/http_server.go
View file @
aa55afc5
...
...
@@ -3,6 +3,9 @@ package main
import
(
"flag"
"github.com/gin-gonic/gin"
Iconfig
"github.com/ichunt2019/ichunt-micro-registry/config"
Iregistry
"github.com/ichunt2019/ichunt-micro-registry/registry"
_
"github.com/ichunt2019/ichunt-micro-registry/registry/etcd"
"github.com/micro/go-micro/v2/web"
"golang_open_platform/boot"
"golang_open_platform/pkg/config"
...
...
@@ -20,6 +23,7 @@ func main() {
r
:=
routes
.
InitRouter
()
port
:=
config
.
Get
(
"web.port"
)
.
String
()
//web改成micro 就是grpc,并直接注册到etcd里面
Registry
()
service
:=
web
.
NewService
(
web
.
Name
(
"go.micro.api.http.search"
),
web
.
Handler
(
r
),
...
...
@@ -33,3 +37,21 @@ func main() {
}
}
func
Registry
(){
nodes
:=
[]
*
Iregistry
.
Node
{
{
IP
:
"192.168.2.72"
,
//当前服务的ip
Port
:
60006
,
//当前服务的端口
Weight
:
2
,
//当前服务的权重
},
}
etcdConfig
:=
Iregistry
.
EtcdConfig
{
Address
:
[]
string
{
"192.168.2.232:2379"
},
//etcd的节点ip
Username
:
""
,
//etcd的节点的用户名
Password
:
""
,
//etcd的节点的密码
Path
:
"/ichuntMicroService/"
,
//网关前缀,目前固定写即可
}
Iconfig
.
Register
(
"open"
,
etcdConfig
,
nodes
)
// 第一个参数:服务名,第二个参数etcd配置,第三个参数当前注册节点信息
}
\ No newline at end of file
controller/middleware_controller.go
View file @
aa55afc5
...
...
@@ -23,6 +23,7 @@ func Check_Middleware() gin_.Middleware {
}
}
/**
@param tnterfaceName 接口别名
*/
...
...
controller/sku_controller.go
View file @
aa55afc5
...
...
@@ -21,7 +21,6 @@ func Hbsdata(ctx *gin.Context) {
用classId获取sku列表
*/
func
GetSkuListByClass
(
ctx
*
gin
.
Context
)
{
return
req
:=&
model
.
QuerySkuCreq
{}
e
.
CheckError
(
model
.
ValidateBind
(
ctx
,
req
))
rsp
,
err
:=
service
.
NewSkuService
()
.
GetSkuListByClass
(
req
)
...
...
go.mod
View file @
aa55afc5
...
...
@@ -4,6 +4,7 @@ go 1.14
require (
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/gin-gonic/gin v1.6.3
github.com/go-ini/ini v1.57.0
github.com/go-playground/validator/v10 v10.2.0
...
...
@@ -11,7 +12,6 @@ require (
github.com/go-xorm/xorm v0.7.9
github.com/gogf/gf v1.14.5
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/protobuf v1.4.2 // indirect
github.com/gomodule/redigo v2.0.1-0.20180401191855-9352ab68be13+incompatible
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/gorilla/websocket v1.4.2 // indirect
...
...
@@ -20,6 +20,7 @@ require (
github.com/guonaihong/gout v0.1.3
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 // indirect
github.com/ichunt2019/go-rabbitmq v1.0.1
github.com/ichunt2019/ichunt-micro-registry v1.0.1
github.com/ichunt2019/log v0.0.0-20201215105603-0792081d6f02
github.com/ichunt2019/logger v1.0.5
github.com/imroc/req v0.3.0
...
...
@@ -36,17 +37,13 @@ require (
github.com/stretchr/testify v1.5.1 // indirect
github.com/syyongx/php2go v0.9.4
github.com/tidwall/gjson v1.6.1
go.uber.org/zap v1.14.1 // indirect
golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect
golang.org/x/text v0.3.3 // indirect
google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece // indirect
google.golang.org/grpc v1.29.1 // indirect
gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
gopkg.in/yaml.v2 v2.4.0 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
replace google.golang.org/grpc => google.golang.org/grpc v1.26.0
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