提交 c452d0a1 编写于 作者: L Liujian

修复接口删除失败问题

上级 4d89ebd7
package version package version
//Version 版本号 //Version 版本号
const Version = "3.1.1" const Version = "3.1.4"
...@@ -41,7 +41,9 @@ func (b *Layer) Send(deadline context.Context, ctx *common.Context, variables *i ...@@ -41,7 +41,9 @@ func (b *Layer) Send(deadline context.Context, ctx *common.Context, variables *i
path := b.Path.Execution(variables) path := b.Path.Execution(variables)
body := b.Body.Execution(variables) body := b.Body.Execution(variables)
method := b.Method 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) 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 { if err != nil {
......
...@@ -35,7 +35,7 @@ func (d *APIDao) AddAPI(apiName, alias, requestURL, targetURL, requestMethod, ta ...@@ -35,7 +35,7 @@ func (d *APIDao) AddAPI(apiName, alias, requestURL, targetURL, requestMethod, ta
db := d.db db := d.db
now := time.Now().Format("2006-01-02 15:04:05") now := time.Now().Format("2006-01-02 15:04:05")
Tx, _ := db.Begin() 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 { if err != nil {
Tx.Rollback() Tx.Rollback()
...@@ -57,7 +57,7 @@ func (d *APIDao) EditAPI(apiName, alias, requestURL, targetURL, requestMethod, t ...@@ -57,7 +57,7 @@ func (d *APIDao) EditAPI(apiName, alias, requestURL, targetURL, requestMethod, t
db := d.db db := d.db
now := time.Now().Format("2006-01-02 15:04:05") now := time.Now().Format("2006-01-02 15:04:05")
Tx, _ := db.Begin() 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 { if err != nil {
Tx.Rollback() Tx.Rollback()
...@@ -428,7 +428,7 @@ func (d *APIDao) BatchDeleteAPI(apiIDList string) (bool, string, error) { ...@@ -428,7 +428,7 @@ func (d *APIDao) BatchDeleteAPI(apiIDList string) (bool, string, error) {
db := d.db db := d.db
now := time.Now().Format("2006-01-02 15:04:05") now := time.Now().Format("2006-01-02 15:04:05")
Tx, _ := db.Begin() 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) _, err := Tx.Exec(sql)
if err != nil { if err != nil {
Tx.Rollback() Tx.Rollback()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册