diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20230805231614-vqn28eh/20230805231816-h1z9mpc/20230805232018-hgrq0ju.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20230805231614-vqn28eh/20230805231816-h1z9mpc/20230805232018-hgrq0ju.sy index 997f028fc..2297c6431 100644 --- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20230805231614-vqn28eh/20230805231816-h1z9mpc/20230805232018-hgrq0ju.sy +++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20230805231614-vqn28eh/20230805231816-h1z9mpc/20230805232018-hgrq0ju.sy @@ -5,7 +5,7 @@ "Properties": { "id": "20230805232018-hgrq0ju", "title": "Connect with third-party cloud storage", - "updated": "20231217111119" + "updated": "20240301091400" }, "Children": [ { @@ -55,7 +55,7 @@ "ListData": {}, "Properties": { "id": "20230805232156-kbi85az", - "updated": "20230805232156" + "updated": "20240301091400" }, "Children": [ { @@ -121,7 +121,7 @@ }, "Properties": { "id": "20230805232156-vqfp7fz", - "updated": "20230805232156" + "updated": "20240301091400" }, "Children": [ { @@ -129,7 +129,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20230805232156-tliw65p", - "updated": "20230805232156" + "updated": "20240301091400" }, "Children": [ { @@ -151,6 +151,20 @@ "TextMarkType": "a", "TextMarkAHref": "https://koofr.eu/", "TextMarkTextContent": "Koofr" + }, + { + "Type": "NodeText", + "Data": " (Nutstore WebDAV is not supported because of its " + }, + { + "Type": "NodeTextMark", + "TextMarkType": "a", + "TextMarkAHref": "https://help.jianguoyun.com/?p=2064", + "TextMarkTextContent": "interface limitations" + }, + { + "Type": "NodeText", + "Data": ")" } ] } diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20230805222417-2lj3dvk/20230805225107-qm1m2f5/20230805230131-sn7obzb.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20230805222417-2lj3dvk/20230805225107-qm1m2f5/20230805230131-sn7obzb.sy index 51e7fcbeb..cd9a5088f 100644 --- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20230805222417-2lj3dvk/20230805225107-qm1m2f5/20230805230131-sn7obzb.sy +++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20230805222417-2lj3dvk/20230805225107-qm1m2f5/20230805230131-sn7obzb.sy @@ -5,7 +5,7 @@ "Properties": { "id": "20230805230131-sn7obzb", "title": "对接第三方云端存储", - "updated": "20231217111041" + "updated": "20240301090951" }, "Children": [ { @@ -55,7 +55,7 @@ "ListData": {}, "Properties": { "id": "20230805230746-4q9cmrb", - "updated": "20230805230746" + "updated": "20240301090951" }, "Children": [ { @@ -121,7 +121,7 @@ }, "Properties": { "id": "20230805230746-zb33erf", - "updated": "20230805230746" + "updated": "20240301090951" }, "Children": [ { @@ -129,7 +129,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20230805230746-i9fzmzi", - "updated": "20230805230746" + "updated": "20240301090951" }, "Children": [ { @@ -141,6 +141,20 @@ "TextMarkType": "a", "TextMarkAHref": "https://infini-cloud.net/", "TextMarkTextContent": "InfiniCLOUD" + }, + { + "Type": "NodeText", + "Data": "(不支持坚果云 WebDAV,因为其" + }, + { + "Type": "NodeTextMark", + "TextMarkType": "a", + "TextMarkAHref": "https://help.jianguoyun.com/?p=2064", + "TextMarkTextContent": "接口存在限制" + }, + { + "Type": "NodeText", + "Data": ")" } ] } diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20230805232636-zh0adz2/20230805232719-04mqbcx/20230805232903-erdoerp.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20230805232636-zh0adz2/20230805232719-04mqbcx/20230805232903-erdoerp.sy index f5e5af7c0..68c69a129 100644 --- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20230805232636-zh0adz2/20230805232719-04mqbcx/20230805232903-erdoerp.sy +++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20230805232636-zh0adz2/20230805232719-04mqbcx/20230805232903-erdoerp.sy @@ -5,7 +5,7 @@ "Properties": { "id": "20230805232903-erdoerp", "title": "對接第三方雲端存儲", - "updated": "20231217111144" + "updated": "20240301091104" }, "Children": [ { @@ -55,7 +55,7 @@ "ListData": {}, "Properties": { "id": "20230805232945-ugjx8sl", - "updated": "20230805232945" + "updated": "20240301091104" }, "Children": [ { @@ -121,7 +121,7 @@ }, "Properties": { "id": "20230805232945-2dksutx", - "updated": "20230805232945" + "updated": "20240301091104" }, "Children": [ { @@ -129,7 +129,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20230805232945-ayx9zfr", - "updated": "20230805232945" + "updated": "20240301091104" }, "Children": [ { @@ -151,6 +151,20 @@ "TextMarkType": "a", "TextMarkAHref": "https://koofr.eu/", "TextMarkTextContent": "Koofr" + }, + { + "Type": "NodeText", + "Data": "(不支援堅果雲 WebDAV,因為其" + }, + { + "Type": "NodeTextMark", + "TextMarkType": "a", + "TextMarkAHref": "https://help.jianguoyun.com/?p=2064", + "TextMarkTextContent": "介面存在限制" + }, + { + "Type": "NodeText", + "Data": ")" } ] } diff --git a/kernel/av/filter.go b/kernel/av/filter.go index e3e6d540e..adac2ddab 100644 --- a/kernel/av/filter.go +++ b/kernel/av/filter.go @@ -42,10 +42,18 @@ const ( RelativeDateUnitYear ) +type RelativeDateDirection int + +const ( + RelativeDateDirectionBefore = -1 + RelativeDateDirectionThis = 0 + RelativeDateDirectionAfter = 1 +) + type RelativeDate struct { - Count int // 数量 - Unit RelativeDateUnit // 单位:天、周、月、年 - Direction int // 方向:前、现在、后 + Count int // 数量 + Unit RelativeDateUnit // 单位:0 天、1 周、2 月、3 年 + Direction RelativeDateDirection // 方向:-1 前、0 这、1 后 } type FilterOperator string diff --git a/kernel/av/table.go b/kernel/av/table.go index 3abe9a493..fc21bd17d 100644 --- a/kernel/av/table.go +++ b/kernel/av/table.go @@ -101,6 +101,18 @@ func (value *Value) Compare(other *Value) int { } case KeyTypeNumber: if nil != value.Number && nil != other.Number { + if value.Number.IsNotEmpty { + if !other.Number.IsNotEmpty { + return 1 + } + return 0 + } else { + if other.Number.IsNotEmpty { + return -1 + } + return 0 + } + if value.Number.Content > other.Number.Content { return 1 } else if value.Number.Content < other.Number.Content { @@ -111,6 +123,18 @@ func (value *Value) Compare(other *Value) int { } case KeyTypeDate: if nil != value.Date && nil != other.Date { + if value.Date.IsNotEmpty { + if !other.Date.IsNotEmpty { + return 1 + } + return 0 + } else { + if other.Date.IsNotEmpty { + return -1 + } + return 0 + } + if value.Date.Content > other.Date.Content { return 1 } else if value.Date.Content < other.Date.Content { @@ -384,13 +408,34 @@ func (value *Value) compareOperator(filter *ViewFilter) bool { var relativeTime time.Time switch unit { case RelativeDateUnitDay: - relativeTime = now.AddDate(0, 0, count*direction) + relativeTime = now.AddDate(0, 0, count*int(direction)) + if FilterOperatorIsBetween == operator && RelativeDateDirectionThis == direction { + // 计算今天的起始时间 + relativeTime = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) + } + case RelativeDateUnitWeek: - relativeTime = now.AddDate(0, 0, count*7*direction) + relativeTime = now.AddDate(0, 0, count*7*int(direction)) + if FilterOperatorIsBetween == operator && RelativeDateDirectionThis == direction { + // 计算本周的起始时间 + weekday := int(now.Weekday()) + if 0 == weekday { + weekday = 7 + } + relativeTime = time.Date(now.Year(), now.Month(), now.Day()-weekday+1, 0, 0, 0, 0, now.Location()) + } case RelativeDateUnitMonth: - relativeTime = now.AddDate(0, count*direction, 0) + relativeTime = now.AddDate(0, count*int(direction), 0) + if FilterOperatorIsBetween == operator && RelativeDateDirectionThis == direction { + // 计算本月的起始时间 + relativeTime = time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location()) + } case RelativeDateUnitYear: - relativeTime = now.AddDate(count*direction, 0, 0) + relativeTime = now.AddDate(count*int(direction), 0, 0) + if FilterOperatorIsBetween == operator && RelativeDateDirectionThis == direction { + // 计算今年的起始时间 + relativeTime = time.Date(now.Year(), 1, 1, 0, 0, 0, 0, now.Location()) + } } valueTime := time.UnixMilli(value.Date.Content) @@ -412,13 +457,33 @@ func (value *Value) compareOperator(filter *ViewFilter) bool { unit2 := filter.RelativeDate2.Unit switch unit2 { case RelativeDateUnitDay: - relativeTime2 = now.AddDate(0, 0, count*direction) + relativeTime2 = now.AddDate(0, 0, count*int(direction)) + if RelativeDateDirectionThis == direction { + // 计算今天的结束时间 + relativeTime2 = time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 999999999, now.Location()) + } case RelativeDateUnitWeek: - relativeTime2 = now.AddDate(0, 0, count*7*direction) + relativeTime2 = now.AddDate(0, 0, count*7*int(direction)) + if RelativeDateDirectionThis == direction { + // 计算本周的结束时间 + weekday := int(now.Weekday()) + if 0 == weekday { + weekday = 7 + } + relativeTime2 = time.Date(now.Year(), now.Month(), now.Day()-weekday+7, 23, 59, 59, 999999999, now.Location()) + } case RelativeDateUnitMonth: - relativeTime2 = now.AddDate(0, count*direction, 0) + relativeTime2 = now.AddDate(0, count*int(direction), 0) + if RelativeDateDirectionThis == direction { + // 计算本月的结束时间 + relativeTime2 = time.Date(now.Year(), now.Month()+1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond) + } case RelativeDateUnitYear: - relativeTime2 = now.AddDate(count*direction, 0, 0) + relativeTime2 = now.AddDate(count*int(direction), 0, 0) + if RelativeDateDirectionThis == direction { + // 计算今年的结束时间 + relativeTime2 = time.Date(now.Year()+1, 1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond) + } } return (valueTime.After(relativeTime) || valueTime.Equal(relativeTime)) && (valueTime.Before(relativeTime2) || valueTime.Equal(relativeTime2)) } diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 6fc65d09d..9bdc423f3 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -2534,8 +2534,13 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string, if av.KeyTypeNumber == val.Type { if nil != val.Number && !val.Number.IsNotEmpty { - // 删除内容为空值 val.Number.Content = 0 + val.Number.FormattedContent = "" + } + } else if av.KeyTypeDate == val.Type { + if nil != val.Date && !val.Date.IsNotEmpty { + val.Date.Content = 0 + val.Date.FormattedContent = "" } }