...
|
...
|
@@ -485,6 +485,12 @@ func (cashPoolService *CashPoolService) GetExchangeCashActivity(getExchangeCashA |
|
|
Deadline: activity.Deadline,
|
|
|
}
|
|
|
|
|
|
// 倒计时结束
|
|
|
if t2.Before(t1) {
|
|
|
updateExchangeCashActivity.CountDown = 0
|
|
|
updateExchangeCashActivity.Deadline = activity.Deadline
|
|
|
}
|
|
|
|
|
|
if err := activity.Update(tool_funs.SimpleStructToMap(updateExchangeCashActivity)); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -681,6 +687,20 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
|
|
updateExchangeCashActivityCommand.ExchangedCash = updateExchangeCashActivityCommand.ExchangeRate * activity.ExchangedSuMoney
|
|
|
}
|
|
|
|
|
|
var timeNow = time.Now()
|
|
|
var deadline = updateExchangeCashActivityCommand.Deadline
|
|
|
var t1 = time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, time.Local)
|
|
|
var t2 = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 0, 0, 0, 0, time.Local)
|
|
|
|
|
|
// 计算倒计时
|
|
|
updateExchangeCashActivityCommand.CountDown = int64(t2.Sub(t1).Hours() / 24)
|
|
|
|
|
|
// 倒计时结束
|
|
|
if t2.Before(t1) {
|
|
|
updateExchangeCashActivityCommand.CountDown = 0
|
|
|
updateExchangeCashActivityCommand.Deadline = activity.Deadline
|
|
|
}
|
|
|
|
|
|
if err := activity.Update(tool_funs.SimpleStructToMap(updateExchangeCashActivityCommand)); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
|