From 73c678755bd0b66b0bdee9dd7511ef7bf2655963 Mon Sep 17 00:00:00 2001 From: cdle Date: Wed, 14 Jun 2023 23:09:42 +0800 Subject: [PATCH] x --- core/plugin_subscribe.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/plugin_subscribe.go b/core/plugin_subscribe.go index 041178a..3647f03 100644 --- a/core/plugin_subscribe.go +++ b/core/plugin_subscribe.go @@ -130,6 +130,9 @@ func initWebPluginList() { rr.Page = current rr.Data = []*common.Function{} if current != 0 { + if current == 1 && init != "false" { + initPluginList() + } var list []*common.Function if keyword == "" { list = append(list, plugin_list...) @@ -140,9 +143,6 @@ func initWebPluginList() { } } } - if current == 1 && init != "false" { - initPluginList() - } rr.Total = len(list) tab1 := []*common.Function{} tab2 := []*common.Function{} @@ -183,6 +183,9 @@ func initWebPluginList() { rr.Tab3 = len(tab3) } rr.Total = len(list) + if last := (rr.Total + pageSize - 1) / pageSize; current > last { + current = last + } begin := (current - 1) * pageSize end := (current) * pageSize if end > rr.Total { @@ -192,7 +195,6 @@ func initWebPluginList() { begin = end } rr.Data = append(rr.Data, list[begin:end]...) - publics := []string{} for _, f := range Functions { if f.Public && f.UUID != "" {