作者 陈志颖

fix:去除重复的截止时间

... ... @@ -2,6 +2,7 @@ package service
import (
"fmt"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/utils"
"math"
"strconv"
"time"
... ... @@ -356,7 +357,10 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivityDeadline(listExc
// 提取兑换现金活动截止时间
var deadlines []interface{}
for _, activity := range activities {
deadlines = append(deadlines, activity.Deadline.Format("2006-01-02"))
tmpTime := activity.Deadline.Format("2006-01-02")
if !utils.IsContain(deadlines, tmpTime) {
deadlines = append(deadlines, tmpTime)
}
}
if len(deadlines) == 0 {
deadlines = []interface{}{}
... ...
... ... @@ -19,3 +19,12 @@ func StringSliceEqualBCE(a, b []int) bool {
return true
}
func IsContain(items []interface{}, item string) bool {
for _, eachItem := range items {
if eachItem == item {
return true
}
}
return false
}
\ No newline at end of file
... ...