未验证 提交 ef566599 编写于 作者: E Eolink 提交者: GitHub

Merge pull request #74 from Dot-Liu/master

修复接口删除失败问题
......@@ -12,7 +12,7 @@ OUTPATH="${BasePath}/out/console-${VERSION}"
buildApp console $VERSION
mkdir ${OUTPATH}/static
cp -a ${BasePath}/app/console/static/* ${OUTPATH}/static/
#cp -a ${BasePath}/app/console/static/* ${OUTPATH}/static/
cp -a ${BasePath}/build/console/resources/* ${OUTPATH}/
chmod +x ${OUTPATH}/install.sh ${OUTPATH}/run.sh
......
package version
//Version 版本号
const Version = "3.1.1"
const Version = "3.1.4"
module github.com/eolinker/goku-api-gateway
go 1.12
go 1.15
require (
github.com/cosiner/argv v0.0.1 // indirect
......
......@@ -41,7 +41,9 @@ func (b *Layer) Send(deadline context.Context, ctx *common.Context, variables *i
path := b.Path.Execution(variables)
body := b.Body.Execution(variables)
method := b.Method
if method == "FOLLOW" {
method = ctx.ProxyRequest.Method
}
r, finalTargetServer, retryTargetServers, err := b.Balance.Send(ctx, b.Protocol, method, path, ctx.ProxyRequest.Querys(), ctx.ProxyRequest.Headers(), []byte(body), b.TimeOut, b.Retry)
if err != nil {
......
......@@ -35,7 +35,7 @@ func (d *APIDao) AddAPI(apiName, alias, requestURL, targetURL, requestMethod, ta
db := d.db
now := time.Now().Format("2006-01-02 15:04:05")
Tx, _ := db.Begin()
res, err := Tx.Exec("INSERT INTO goku_gateway_api (projectID,groupID,apiName,alias,requestURL,targetURL,requestMethod,targetMethod,protocol,linkAPIs,staticResponse,responseDataType,balanceName,isFollow,timeout,retryCount,alertValve,createTime,updateTime,managerID,lastUpdateUserID,createUserID,apiType) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);", projectID, groupID, apiName, alias, requestURL, targetURL, requestMethod, targetMethod, protocol, linkAPIs, staticResponse, responseDataType, balanceName, isFollow, timeout, retryCount, alertValve, now, now, managerID, userID, userID, apiType)
res, err := Tx.Exec("INSERT INTO goku_gateway_api (projectID,groupID,apiName,requestURL,targetURL,requestMethod,targetMethod,protocol,linkAPIs,staticResponse,responseDataType,balanceName,isFollow,timeout,retryCount,alertValve,createTime,updateTime,managerID,lastUpdateUserID,createUserID,apiType) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);", projectID, groupID, apiName, requestURL, targetURL, requestMethod, targetMethod, protocol, linkAPIs, staticResponse, responseDataType, balanceName, isFollow, timeout, retryCount, alertValve, now, now, managerID, userID, userID, apiType)
if err != nil {
Tx.Rollback()
......@@ -57,7 +57,7 @@ func (d *APIDao) EditAPI(apiName, alias, requestURL, targetURL, requestMethod, t
db := d.db
now := time.Now().Format("2006-01-02 15:04:05")
Tx, _ := db.Begin()
_, err := Tx.Exec("UPDATE goku_gateway_api SET projectID = ?,groupID = ?,apiName = ?,alias = ?,requestURL = ?,targetURL = ?,requestMethod = ?,protocol = ?,balanceName = ?,targetMethod = ?,isFollow = ?,linkAPIs = ?,staticResponse = ?,responseDataType = ?,timeout = ?,retryCount = ?,alertValve = ?,updateTime = ?,managerID = ?,lastUpdateUserID = ? WHERE apiID = ?", projectID, groupID, apiName, alias, requestURL, targetURL, requestMethod, protocol, balanceName, targetMethod, isFollow, linkAPIs, staticResponse, responseDataType, timeout, retryCount, alertValve, now, managerID, userID, apiID)
_, err := Tx.Exec("UPDATE goku_gateway_api SET projectID = ?,groupID = ?,apiName = ?,requestURL = ?,targetURL = ?,requestMethod = ?,protocol = ?,balanceName = ?,targetMethod = ?,isFollow = ?,linkAPIs = ?,staticResponse = ?,responseDataType = ?,timeout = ?,retryCount = ?,alertValve = ?,updateTime = ?,managerID = ?,lastUpdateUserID = ? WHERE apiID = ?", projectID, groupID, apiName, requestURL, targetURL, requestMethod, protocol, balanceName, targetMethod, isFollow, linkAPIs, staticResponse, responseDataType, timeout, retryCount, alertValve, now, managerID, userID, apiID)
if err != nil {
Tx.Rollback()
......@@ -428,7 +428,7 @@ func (d *APIDao) BatchDeleteAPI(apiIDList string) (bool, string, error) {
db := d.db
now := time.Now().Format("2006-01-02 15:04:05")
Tx, _ := db.Begin()
sql := "DELETE FROM goku_gateway_api A WHERE apiID IN (" + apiIDList + ");"
sql := "DELETE FROM goku_gateway_api WHERE apiID IN (" + apiIDList + ");"
_, err := Tx.Exec(sql)
if err != nil {
Tx.Rollback()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册