...
|
...
|
@@ -326,7 +326,6 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang |
|
|
var t1 = time.Now().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{}{
|
...
|
...
|
@@ -930,6 +929,19 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang |
|
|
if activityUpdated, err := exchangeCashActivityRepository.Save(activityFound); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
// 获取该公司所有兑换现金活动
|
|
|
if _, activities, err := exchangeCashActivityRepository.FindAll(map[string]interface{}{
|
|
|
"companyId": activityFound.CompanyId,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
for _, activity := range activities {
|
|
|
if t2.Format("2006-01-02") == activity.Deadline.Local().Format("2006-01-02") {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "兑换活动截止时间不能重合")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
|