1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-25 17:18:05 +08:00
This commit is contained in:
harveyshao 2021-11-20 17:10:16 +08:00
parent 782eccd4d0
commit 29539c492c
2 changed files with 4 additions and 2 deletions

View File

@ -92,7 +92,6 @@ func _cache_download(m *ice.Message, r *http.Response) (file, size string) {
f.Write(buf[0:n])
s := size * 100 / total
m.Debug("what %v", kit.FileLine(m.OptionCB(SPIDE), 3))
switch cb := m.OptionCB(SPIDE).(type) {
case func(int, int):
cb(size, total)
@ -103,6 +102,9 @@ func _cache_download(m *ice.Message, r *http.Response) (file, size string) {
})
default:
if s != step && s%10 == 0 {
m.Debug("what %v", m.OptionCB(SPIDE))
m.Debug("what %v", m.OptionCB(SPIDE))
m.Debug("what %v", kit.FileLine(m.OptionCB(SPIDE), 3))
m.Log_IMPORT(kit.MDB_FILE, p, kit.MDB_STEP, s,
kit.MDB_SIZE, kit.FmtSize(int64(size)), kit.MDB_TOTAL, kit.FmtSize(int64(total)))
}

View File

@ -103,7 +103,7 @@ func (m *Message) FieldsIsDetail() bool {
}
func (m *Message) OptionCB(key string, cb ...interface{}) interface{} {
if len(cb) > 0 {
return m.Optionv(kit.Keycb(key), cb)
return m.Optionv(kit.Keycb(key), cb...)
}
return m.Optionv(kit.Keycb(key))
}