作者 陈志颖

fix:app端过滤未结束兑换活动

@@ -408,7 +408,6 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivityDeadline(listExc @@ -408,7 +408,6 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivityDeadline(listExc
408 // 提取兑换现金活动截止时间 408 // 提取兑换现金活动截止时间
409 var deadlines []interface{} 409 var deadlines []interface{}
410 for _, activity := range activities { 410 for _, activity := range activities {
411 - //tmpTime := activity.Deadline.UTC().Format("2006-01-02")  
412 tmpTime := activity.Deadline.Local().Format("2006-01-02") 411 tmpTime := activity.Deadline.Local().Format("2006-01-02")
413 if !utils.IsContain(deadlines, tmpTime) { 412 if !utils.IsContain(deadlines, tmpTime) {
414 deadlines = append(deadlines, tmpTime) 413 deadlines = append(deadlines, tmpTime)
@@ -546,7 +545,13 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas @@ -546,7 +545,13 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas
546 } 545 }
547 546
548 // 查找兑换现金活动 547 // 查找兑换现金活动
549 - if count, activities, err := exchangeActivityRepository.Find(tool_funs.SimpleStructToMap(listExchangeCashActivityQuery)); err != nil { 548 + if count, activities, err := exchangeActivityRepository.Find(map[string]interface{}{
  549 + "companyId": listExchangeCashActivityQuery.CompanyId,
  550 + "activityNameMatch": listExchangeCashActivityQuery.ActivityNameMatch,
  551 + "offset": listExchangeCashActivityQuery.Offset,
  552 + "limit": listExchangeCashActivityQuery.Limit,
  553 + "countDown": 0,
  554 + }); err != nil {
550 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 555 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
551 } else { 556 } else {
552 for _, activity := range activities { 557 for _, activity := range activities {
@@ -88,6 +88,9 @@ func (repository *ExchangeCashActivityRepository) Find(queryOptions map[string]i @@ -88,6 +88,9 @@ func (repository *ExchangeCashActivityRepository) Find(queryOptions map[string]i
88 if activityNameMatch, ok := queryOptions["activityNameMatch"]; ok && (activityNameMatch != "") { 88 if activityNameMatch, ok := queryOptions["activityNameMatch"]; ok && (activityNameMatch != "") {
89 query = query.Where(`exchange_cash_activity.activity_name LIKE ?`, fmt.Sprintf("%%%s%%", activityNameMatch.(string))) 89 query = query.Where(`exchange_cash_activity.activity_name LIKE ?`, fmt.Sprintf("%%%s%%", activityNameMatch.(string)))
90 } 90 }
  91 + if countDown, ok := queryOptions["countDown"]; ok {
  92 + query = query.Where(`exchange_cash_activity.countDown = ?`, countDown)
  93 + }
91 if deadline, ok := queryOptions["deadline"]; ok && deadline != "" { 94 if deadline, ok := queryOptions["deadline"]; ok && deadline != "" {
92 t, _ := time.ParseInLocation("2006-01-02", deadline.(string), time.Local) 95 t, _ := time.ParseInLocation("2006-01-02", deadline.(string), time.Local)
93 newDeadlineStart := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, time.Local) 96 newDeadlineStart := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, time.Local)