作者 陈志颖

fix:上期汇率丢失问题

@@ -244,8 +244,6 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt @@ -244,8 +244,6 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt
244 } 244 }
245 } 245 }
246 246
247 - fmt.Print(currentListIntervalIndex, "\n")  
248 -  
249 if currentListIntervalIndex == 0 && len(listIntervals) > 1 { // 当前排行榜在首位,且不止一个活动 247 if currentListIntervalIndex == 0 && len(listIntervals) > 1 { // 当前排行榜在首位,且不止一个活动
250 // 上一个活动开始结束时间 248 // 上一个活动开始结束时间
251 //lastIntervalStartTime := listIntervals[currentListIntervalIndex + 1].IntervalStartTime.Local() 249 //lastIntervalStartTime := listIntervals[currentListIntervalIndex + 1].IntervalStartTime.Local()
@@ -349,19 +349,11 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang @@ -349,19 +349,11 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang
349 exchangeActivityRepository = value 349 exchangeActivityRepository = value
350 } 350 }
351 351
352 - // 时间格式化  
353 - //dd, _ := time.ParseDuration("24h")  
354 - //var deadline = createExchangeCashActivityCommand.Deadline.Add(dd)  
355 deadline := createExchangeCashActivityCommand.Deadline.Local() 352 deadline := createExchangeCashActivityCommand.Deadline.Local()
356 353
357 - fmt.Print(deadline, "\n")  
358 -  
359 - //deadline, _ := time.ParseInLocation("2006-01-02", createExchangeCashActivityCommand.Deadline, time.Local)  
360 - //deadline := todayZero.Add(dd)  
361 t1 := time.Now().Local() 354 t1 := time.Now().Local()
362 t2 := time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local) 355 t2 := time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local)
363 356
364 -  
365 // 获取该公司所有兑换现金活动 357 // 获取该公司所有兑换现金活动
366 if _, activities, err := exchangeActivityRepository.FindAll(map[string]interface{}{ 358 if _, activities, err := exchangeActivityRepository.FindAll(map[string]interface{}{
367 "companyId": createExchangeCashActivityCommand.CompanyId, 359 "companyId": createExchangeCashActivityCommand.CompanyId,
@@ -370,7 +362,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang @@ -370,7 +362,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang
370 } else { 362 } else {
371 for _, activity := range activities { 363 for _, activity := range activities {
372 if t2.Format("2006-01-02") == activity.Deadline.Local().Format("2006-01-02") { 364 if t2.Format("2006-01-02") == activity.Deadline.Local().Format("2006-01-02") {
373 - //if t2.Before(activity.Deadline.Local()) || t2.Equal(activity.Deadline.Local()) {  
374 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "兑换活动截止时间不能重合") 365 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "兑换活动截止时间不能重合")
375 } 366 }
376 } 367 }
@@ -532,12 +523,10 @@ func (cashPoolService *CashPoolService) SearchExchangeCashActivity(activityComma @@ -532,12 +523,10 @@ func (cashPoolService *CashPoolService) SearchExchangeCashActivity(activityComma
532 "companyId": activity.CompanyId, 523 "companyId": activity.CompanyId,
533 "exchangedCash": cash, 524 "exchangedCash": cash,
534 "exchangedSuMoney": suMoney, 525 "exchangedSuMoney": suMoney,
535 - //"deadline": activity.Deadline.UTC().Format("2006-01-02"),  
536 "deadline": activity.Deadline.Local(), 526 "deadline": activity.Deadline.Local(),
537 "countDown": activity.CountDown, 527 "countDown": activity.CountDown,
538 "rate": activity.Rate, 528 "rate": activity.Rate,
539 "createTime": activity.CreateTime.Local(), 529 "createTime": activity.CreateTime.Local(),
540 - //"createTime": activity.CreateTime.UTC(),  
541 } 530 }
542 activitiesFormat = append(activitiesFormat, activityFormat) 531 activitiesFormat = append(activitiesFormat, activityFormat)
543 } 532 }
@@ -627,8 +616,6 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas @@ -627,8 +616,6 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas
627 616
628 // 兑换现金活动返回截止时间处理 617 // 兑换现金活动返回截止时间处理
629 var activitiesWithTs []interface{} 618 var activitiesWithTs []interface{}
630 - //currentTime := time.Now().Local()  
631 - //endTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 23, 59, 59, 0, currentTime.Location())  
632 for _, activity := range activities { 619 for _, activity := range activities {
633 cash, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", activity.ExchangedCash), 64) 620 cash, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", activity.ExchangedCash), 64)
634 suMoney, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", activity.ExchangedSuMoney), 64) 621 suMoney, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", activity.ExchangedSuMoney), 64)
@@ -928,6 +915,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang @@ -928,6 +915,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
928 ExchangedSuMoney: systemExchangedSuMoney, 915 ExchangedSuMoney: systemExchangedSuMoney,
929 UnExchangeSuMoney: systemUnExchangeSuMoney, 916 UnExchangeSuMoney: systemUnExchangeSuMoney,
930 Rate: rate, 917 Rate: rate,
  918 + LastRate: cashPoolsFound[0].LastRate,
931 Cash: cashPoolsFound[0].Cash, 919 Cash: cashPoolsFound[0].Cash,
932 } 920 }
933 921
@@ -2341,6 +2329,7 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC @@ -2341,6 +2329,7 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC
2341 updateCashPoolCommand := &command.UpdateCashPoolCommand{ 2329 updateCashPoolCommand := &command.UpdateCashPoolCommand{
2342 CashPoolId: cashPoolsFound[0].CashPoolId, 2330 CashPoolId: cashPoolsFound[0].CashPoolId,
2343 Cash: cashPoolsFound[0].Cash, 2331 Cash: cashPoolsFound[0].Cash,
  2332 + LastRate: cashPoolsFound[0].LastRate,
2344 ExchangedCash: cashPoolsFound[0].ExchangedCash - personFoundExchangedCash, 2333 ExchangedCash: cashPoolsFound[0].ExchangedCash - personFoundExchangedCash,
2345 UnExchangeCash: cashPoolsFound[0].UnExchangeCash + personFoundExchangedCash, 2334 UnExchangeCash: cashPoolsFound[0].UnExchangeCash + personFoundExchangedCash,
2346 Rate: newRate, 2335 Rate: newRate,