Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apaas-meshproxy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gzga-jzapi
apaas-meshproxy
Commits
07037c98
Commit
07037c98
authored
Nov 06, 2019
by
gaoshiyao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新路由设置
parent
c9355592
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
17 deletions
+22
-17
docs/proxy.yaml
docs/proxy.yaml
+1
-0
src/config/conf.go
src/config/conf.go
+1
-0
src/handler/counthandler.go
src/handler/counthandler.go
+12
-9
src/handler/proxyhandler.go
src/handler/proxyhandler.go
+8
-8
No files found.
docs/proxy.yaml
View file @
07037c98
{
"
uuid"
:
"
sdfasd"
,
"
url"
:
"
https://apaas.wodcloud.com/cigservice/baseservice/fillder/turnover?applyId=0419f3e1-8e16-4e5e-a187-1760364c04e2"
,
"
method"
:
"
GET"
,
"
params"
:
null
...
...
src/config/conf.go
View file @
07037c98
...
...
@@ -7,6 +7,7 @@ var (
)
var
ProxyConf
=
struct
{
UUID
string
`json:"uuid"`
Url
string
`json:"url"`
Method
string
`json:"method"`
Params
[]
Param
`json:"params"`
...
...
src/handler/counthandler.go
View file @
07037c98
package
handler
import
(
"fmt"
"github.com/gin-gonic/gin"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/client"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/config"
)
func
GetCount
(
c
*
gin
.
Context
)
{
//
redis, err := client.GetRedisClient()
//
if err != nil {
//
c.Error(err)
//
}
//ic, err := redis.Get(fmt.Sprintf("%s%s", config.ProxyHost, config.ProxyPath)
)
//
c.JSON(200, gin.H{
// "Key": fmt.Sprintf("%s%s", config.ProxyHost, config.ProxyPath
),
//
"Count": ic,
//
})
redis
,
err
:=
client
.
GetRedisClient
()
if
err
!=
nil
{
c
.
Error
(
err
)
}
ic
,
err
:=
redis
.
Get
(
"bgproxy"
+
config
.
ProxyConf
.
UUID
)
c
.
JSON
(
200
,
gin
.
H
{
"Key"
:
fmt
.
Sprintf
(
"bgproxy"
+
config
.
ProxyConf
.
UUID
),
"Count"
:
ic
,
})
}
src/handler/proxyhandler.go
View file @
07037c98
...
...
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/client"
"net/http"
"github.com/vulcand/oxy/forward"
...
...
@@ -71,12 +72,11 @@ func getRequestURI(req *http.Request) string {
计数
*/
func
count
()
error
{
//redis, err := client.GetRedisClient()
//if err != nil {
// return err
//}
//ic, err := redis.Incr(fmt.Sprintf("%s%s", config.ProxyHost, config.ProxyPath))
//_, err = ic.Result()
//return err
return
nil
redis
,
err
:=
client
.
GetRedisClient
()
if
err
!=
nil
{
return
err
}
ic
,
err
:=
redis
.
Incr
(
"bgproxy"
+
config
.
ProxyConf
.
UUID
)
_
,
err
=
ic
.
Result
()
return
err
}
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