作者 陈志颖

fix:上期汇率丢失问题

... ... @@ -244,8 +244,6 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt
}
}
fmt.Print(currentListIntervalIndex, "\n")
if currentListIntervalIndex == 0 && len(listIntervals) > 1 { // 当前排行榜在首位,且不止一个活动
// 上一个活动开始结束时间
//lastIntervalStartTime := listIntervals[currentListIntervalIndex + 1].IntervalStartTime.Local()
... ...
... ... @@ -349,19 +349,11 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang
exchangeActivityRepository = value
}
// 时间格式化
//dd, _ := time.ParseDuration("24h")
//var deadline = createExchangeCashActivityCommand.Deadline.Add(dd)
deadline := createExchangeCashActivityCommand.Deadline.Local()
fmt.Print(deadline, "\n")
//deadline, _ := time.ParseInLocation("2006-01-02", createExchangeCashActivityCommand.Deadline, time.Local)
//deadline := todayZero.Add(dd)
t1 := time.Now().Local()
t2 := time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local)
// 获取该公司所有兑换现金活动
if _, activities, err := exchangeActivityRepository.FindAll(map[string]interface{}{
"companyId": createExchangeCashActivityCommand.CompanyId,
... ... @@ -370,7 +362,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang
} else {
for _, activity := range activities {
if t2.Format("2006-01-02") == activity.Deadline.Local().Format("2006-01-02") {
//if t2.Before(activity.Deadline.Local()) || t2.Equal(activity.Deadline.Local()) {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "兑换活动截止时间不能重合")
}
}
... ... @@ -532,12 +523,10 @@ func (cashPoolService *CashPoolService) SearchExchangeCashActivity(activityComma
"companyId": activity.CompanyId,
"exchangedCash": cash,
"exchangedSuMoney": suMoney,
//"deadline": activity.Deadline.UTC().Format("2006-01-02"),
"deadline": activity.Deadline.Local(),
"countDown": activity.CountDown,
"rate": activity.Rate,
"createTime": activity.CreateTime.Local(),
//"createTime": activity.CreateTime.UTC(),
}
activitiesFormat = append(activitiesFormat, activityFormat)
}
... ... @@ -627,8 +616,6 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas
// 兑换现金活动返回截止时间处理
var activitiesWithTs []interface{}
//currentTime := time.Now().Local()
//endTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 23, 59, 59, 0, currentTime.Location())
for _, activity := range activities {
cash, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", activity.ExchangedCash), 64)
suMoney, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", activity.ExchangedSuMoney), 64)
... ... @@ -928,6 +915,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
ExchangedSuMoney: systemExchangedSuMoney,
UnExchangeSuMoney: systemUnExchangeSuMoney,
Rate: rate,
LastRate: cashPoolsFound[0].LastRate,
Cash: cashPoolsFound[0].Cash,
}
... ... @@ -2341,6 +2329,7 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC
updateCashPoolCommand := &command.UpdateCashPoolCommand{
CashPoolId: cashPoolsFound[0].CashPoolId,
Cash: cashPoolsFound[0].Cash,
LastRate: cashPoolsFound[0].LastRate,
ExchangedCash: cashPoolsFound[0].ExchangedCash - personFoundExchangedCash,
UnExchangeCash: cashPoolsFound[0].UnExchangeCash + personFoundExchangedCash,
Rate: newRate,
... ...