...
|
...
|
@@ -318,13 +318,15 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang |
|
|
}
|
|
|
|
|
|
// 时间格式化
|
|
|
dd, _ := time.ParseDuration("24h")
|
|
|
//dd, _ := time.ParseDuration("24h")
|
|
|
//var deadline = createExchangeCashActivityCommand.Deadline.Add(dd)
|
|
|
//var deadline = createExchangeCashActivityCommand.Deadline
|
|
|
todayZero, _ := time.ParseInLocation("2006-01-02", createExchangeCashActivityCommand.Deadline, time.Local)
|
|
|
deadline := todayZero.Add(dd)
|
|
|
deadline, _ := time.ParseInLocation("2006-01-02", createExchangeCashActivityCommand.Deadline, time.Local)
|
|
|
//deadline := todayZero.Add(dd)
|
|
|
var t1 = time.Now().Local()
|
|
|
var t2 = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 0, 0, 0, 0 - 1, time.Local)
|
|
|
var t2 = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, time.Local)
|
|
|
|
|
|
fmt.Print(t2, "\n")
|
|
|
|
|
|
// 获取该公司所有兑换现金活动
|
|
|
if _, activities, err := exchangeActivityRepository.FindAll(map[string]interface{}{
|
...
|
...
|
@@ -334,7 +336,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang |
|
|
} else {
|
|
|
for _, activity := range activities {
|
|
|
//if t2.Format("2006-01-02") == activity.Deadline.UTC().Format("2006-01-02") {
|
|
|
if t2.Format("2006-01-02") == activity.Deadline.Format("2006-01-02") {
|
|
|
if t2.Format("2006-01-02") == activity.Deadline.Local().Format("2006-01-02") {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "兑换活动截止时间不能重合")
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -550,13 +552,13 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas |
|
|
} else {
|
|
|
for _, activity := range activities {
|
|
|
var t1 = time.Now().Local()
|
|
|
var t2 = activity.Deadline
|
|
|
var t2 = activity.Deadline.Local()
|
|
|
|
|
|
// 更新兑换现金活动倒计时命令
|
|
|
updateExchangeCashActivity := &command.UpdateExchangeCashActivityCommand {
|
|
|
ExchangeCashActivityId: activity.ActivityId,
|
|
|
CountDown: int64(math.Ceil(t2.Sub(t1).Hours() / 24)), // 重新计算活动倒计时
|
|
|
Deadline: activity.Deadline,
|
|
|
Deadline: activity.Deadline.Local(),
|
|
|
ExchangedSuMoney: activity.ExchangedSuMoney,
|
|
|
ExchangedCash: activity.ExchangedCash,
|
|
|
ExchangeRate: activity.Rate,
|
...
|
...
|
|