From 3a60db372996824d0b70210d8b93881c06ccef84 Mon Sep 17 00:00:00 2001 From: "a624669980@163.com" Date: Fri, 22 Jul 2022 15:24:13 +0800 Subject: [PATCH] solve the first time app store opening failure problem --- service/casa.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/service/casa.go b/service/casa.go index f628c77..a0f03e9 100644 --- a/service/casa.go +++ b/service/casa.go @@ -127,13 +127,13 @@ func (o *casaService) GetServerList(index, size, tp, categoryId, key string) (mo func (o *casaService) AsyncGetServerList() (collection model.ServerAppListCollection, err error) { results := file.ReadFullFile(config.AppInfo.DBPath + "/app_list.json") - err = json2.Unmarshal(results, &collection) - if err != nil { + errr := json2.Unmarshal(results, &collection) + if errr != nil { loger.Error("marshal error", zap.Any("err", err), zap.Any("content", string(results))) - } - - if collection.Version == o.GetCasaosVersion().Version { - return collection, err + } else { + if collection.Version == o.GetCasaosVersion().Version { + return collection, err + } } head := make(map[string]string) @@ -153,7 +153,8 @@ func (o *casaService) AsyncGetServerList() (collection model.ServerAppListCollec collection.List = listModel collection.Recommend = recommendModel collection.Version = o.GetCasaosVersion().Version - by, err := json.Marshal(collection) + var by []byte + by, err = json.Marshal(collection) if err != nil { loger.Error("marshal error", zap.Any("err", err)) }