fix string array unmarshal and config hikUrl
| | |
| | | pushBaseUrl = https://restapi.getui.com/v2/ |
| | | dbUrl = root:c++java123@tcp(192.168.20.173:3306)/car_yuying?charset=utf8 |
| | | redisIp = 192.168.20.10 |
| | | redisPort = 6379 |
| | | redisPort = 6379 |
| | | hikUrl = https://111.205.161.131:1443 |
| | |
| | | result.LatestVersion = sv.LatestVersion |
| | | result.Time = sv.Time |
| | | result.ForceUpgrade = sv.ForceUpgrade |
| | | mb, e1 := json.Marshal(sv.Msg) |
| | | if e1 == nil { |
| | | var msgArr []string |
| | | if e1 = json.Unmarshal(mb, &msgArr);e1 ==nil { |
| | | result.Msg = msgArr |
| | | } else { |
| | | fmt.Println("unmarshal err:", e1) |
| | | } |
| | | var msgArr []string |
| | | if e1 := json.Unmarshal([]byte(sv.Msg), &msgArr);e1 ==nil { |
| | | result.Msg = msgArr |
| | | } else { |
| | | fmt.Println("marshal err:", e1) |
| | | fmt.Println("unmarshal err:", e1) |
| | | result.Msg = []string{} |
| | | } |
| | | |
| | | } else { |
| | | result.IsUpgrade = false |
| | | } |
| | |
| | | package service |
| | | |
| | | import ( |
| | | "car-service/models" |
| | | reqUtil "car-service/extend/util" |
| | | "car-service/models" |
| | | "encoding/json" |
| | | "fmt" |
| | | "github.com/astaxie/beego" |
| | | "strconv" |
| | | ) |
| | | type CarService struct { |
| | |
| | | hikUtil: &reqUtil.HikHttpUtil{ |
| | | AppKey: hikAppKey, |
| | | AppSecret: hikAppSecret, |
| | | ReqHost: "https://172.16.35.50:1443", |
| | | ReqHost: beego.AppConfig.String("hikUrl"), |
| | | }, |
| | | } |
| | | } |