This commit is contained in:
xing 2023-05-01 13:34:23 +08:00
parent 2d61243ef1
commit 3ba2c02db5
2 changed files with 2 additions and 2 deletions

View File

@ -153,7 +153,7 @@ func MergeBy[K comparable, V any](fn func(k K, v1, v2 V) (V, bool), m ...map[K]V
func FilterZeroMerge[K comparable, V any](m ...map[K]V) map[K]V {
if len(m) < 1 {
panic("no map")
return nil
} else if len(m) < 2 {
return m[0]
}

View File

@ -47,7 +47,7 @@ func Archive(h *wp.Handle, id string) string {
conf := reload.GetAnyValBys("widget-archive-conf", h, func(h *wp.Handle) map[any]any {
archivesConfig := archivesConfig()
conf := wpconfig.GetPHPArrayVal("widget_archives", archivesConfig, int64(2))
return conf
return maps.FilterZeroMerge(archivesConfig, conf)
})
args := reload.GetAnyValBys("widget-archive-args", h, func(h *wp.Handle) map[string]string {