作者 陈志颖

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

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