作者 陈志颖

fix:去除重复的截止时间

@@ -2,6 +2,7 @@ package service @@ -2,6 +2,7 @@ package service
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/utils"
5 "math" 6 "math"
6 "strconv" 7 "strconv"
7 "time" 8 "time"
@@ -356,7 +357,10 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivityDeadline(listExc @@ -356,7 +357,10 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivityDeadline(listExc
356 // 提取兑换现金活动截止时间 357 // 提取兑换现金活动截止时间
357 var deadlines []interface{} 358 var deadlines []interface{}
358 for _, activity := range activities { 359 for _, activity := range activities {
359 - deadlines = append(deadlines, activity.Deadline.Format("2006-01-02")) 360 + tmpTime := activity.Deadline.Format("2006-01-02")
  361 + if !utils.IsContain(deadlines, tmpTime) {
  362 + deadlines = append(deadlines, tmpTime)
  363 + }
360 } 364 }
361 if len(deadlines) == 0 { 365 if len(deadlines) == 0 {
362 deadlines = []interface{}{} 366 deadlines = []interface{}{}
@@ -19,3 +19,12 @@ func StringSliceEqualBCE(a, b []int) bool { @@ -19,3 +19,12 @@ func StringSliceEqualBCE(a, b []int) bool {
19 19
20 return true 20 return true
21 } 21 }
  22 +
  23 +func IsContain(items []interface{}, item string) bool {
  24 + for _, eachItem := range items {
  25 + if eachItem == item {
  26 + return true
  27 + }
  28 + }
  29 + return false
  30 +}