Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2024-03-01 16:13:53 +08:00
commit 7fc80ed570
6 changed files with 144 additions and 24 deletions

View file

@ -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": ")"
}
]
}

View file

@ -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": ""
}
]
}

View file

@ -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": ""
}
]
}

View file

@ -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

View file

@ -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))
}

View file

@ -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 = ""
}
}