liuxiaolong
2020-07-27 1ca4109013bb07f7f55093357bf68fcfe435e0f2
fix string array unmarshal and config hikUrl
3个文件已修改
23 ■■■■ 已修改文件
conf/app.conf 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/sys.go 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/carService.go 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
conf/app.conf
@@ -18,4 +18,5 @@
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
controllers/sys.go
@@ -36,17 +36,14 @@
            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
        }
service/carService.go
@@ -1,10 +1,11 @@
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 {
@@ -16,7 +17,7 @@
        hikUtil: &reqUtil.HikHttpUtil{
            AppKey: hikAppKey,
            AppSecret: hikAppSecret,
            ReqHost: "https://172.16.35.50:1443",
            ReqHost: beego.AppConfig.String("hikUrl"),
        },
    }
}