Commit df7dda7e authored by 王明明's avatar 王明明

超时处理

parent 444dbcac
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"net/http" "net/http"
"strings"
"test/util" "test/util"
"time" "time"
) )
...@@ -19,9 +20,9 @@ func routeToU2(w http.ResponseWriter, r *http.Request) { ...@@ -19,9 +20,9 @@ func routeToU2(w http.ResponseWriter, r *http.Request) {
carrierType := data["type"] carrierType := data["type"]
var akm *Akm var akm *Akm
switch carrierType { switch strings.ToUpper(carrierType) {
case "U2": case "U2":
akm = EasyJet(carrierType.(string), data["proxy"].(string)) akm = EasyJet(carrierType, data["proxy"])
default: default:
util.WriteJson(w, util.ErrorJson("不支持的航司")) util.WriteJson(w, util.ErrorJson("不支持的航司"))
return return
...@@ -45,7 +46,7 @@ func routeToU2(w http.ResponseWriter, r *http.Request) { ...@@ -45,7 +46,7 @@ func routeToU2(w http.ResponseWriter, r *http.Request) {
} }
func checkPostRequire(data map[string]interface{}) bool { func checkPostRequire(data map[string]string) bool {
_, ok := data["type"] _, ok := data["type"]
if !ok { if !ok {
return false return false
......
...@@ -5,8 +5,8 @@ import ( ...@@ -5,8 +5,8 @@ import (
"net/http" "net/http"
) )
func GetPostJson(r *http.Request) map[string]interface{} { func GetPostJson(r *http.Request) map[string]string {
formData := make(map[string]interface{}) formData := make(map[string]string)
// 调用json包的解析,解析请求body // 调用json包的解析,解析请求body
json.NewDecoder(r.Body).Decode(&formData) json.NewDecoder(r.Body).Decode(&formData)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment