作者 陈志颖

fix:修复返回兑换活动参数错误

@@ -206,10 +206,10 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang @@ -206,10 +206,10 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang
206 CompanyId: createExchangeCashActivityCommand.CompanyId, 206 CompanyId: createExchangeCashActivityCommand.CompanyId,
207 ExchangedCash: 0, 207 ExchangedCash: 0,
208 ExchangedSuMoney: 0, 208 ExchangedSuMoney: 0,
209 - Deadline: createExchangeCashActivityCommand.Deadline, 209 + Deadline: time.Date(deadline.Year(), deadline.Month(), deadline.Day(), deadline.Hour(), deadline.Minute(), 0, 0, time.Local),
210 CountDown: int64(t2.Sub(t1).Hours() / 24), 210 CountDown: int64(t2.Sub(t1).Hours() / 24),
211 Rate: createExchangeCashActivityCommand.ExchangeRate, 211 Rate: createExchangeCashActivityCommand.ExchangeRate,
212 - CreateTime: timeNow, 212 + CreateTime: time.Now(),
213 } 213 }
214 var exchangeCashActivityRepository domain.ExchangeActivityRepository 214 var exchangeCashActivityRepository domain.ExchangeActivityRepository
215 if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{ 215 if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{
@@ -4,15 +4,15 @@ import "time" @@ -4,15 +4,15 @@ import "time"
4 4
5 // 兑换现金活动 5 // 兑换现金活动
6 type ExchangeCashActivity struct { 6 type ExchangeCashActivity struct {
7 - ActivityId int64 `json:"activityId"` // 兑换现金活动id 7 + ActivityId int64 `json:"activityId"` // 兑换现金活动id
8 ExchangeActivityName string `json:"exchangeActivityName"` // 兑换现金活动名称 8 ExchangeActivityName string `json:"exchangeActivityName"` // 兑换现金活动名称
9 CompanyId int64 `json:"companyId"` // 公司ID 9 CompanyId int64 `json:"companyId"` // 公司ID
10 ExchangedCash float64 `json:"exchangedCash"` // 已兑换的现金 10 ExchangedCash float64 `json:"exchangedCash"` // 已兑换的现金
11 ExchangedSuMoney float64 `json:"exchangedSuMoney"` // 已兑换的素币 11 ExchangedSuMoney float64 `json:"exchangedSuMoney"` // 已兑换的素币
12 - CreateTime time.Time `json:"createTime"` // 创建兑换现金活动时间  
13 Deadline time.Time `json:"deadline"` // 兑换现金活动截止时间 12 Deadline time.Time `json:"deadline"` // 兑换现金活动截止时间
14 - CountDown int64 `json:"countDown"` // 兑换现金活动结束倒计时 13 + CountDown int64 `json:"countDown"` // 兑换现金活动结束倒计时
15 Rate float64 `json:"rate"` // 兑换汇率 14 Rate float64 `json:"rate"` // 兑换汇率
  15 + CreateTime time.Time `json:"createTime"` // 创建兑换现金活动时间
16 } 16 }
17 17
18 type ExchangeActivityRepository interface { 18 type ExchangeActivityRepository interface {
@@ -18,9 +18,9 @@ func (repository *ExchangeCashActivityRepository) Save(exchangeCashActivity *dom @@ -18,9 +18,9 @@ func (repository *ExchangeCashActivityRepository) Save(exchangeCashActivity *dom
18 tx := repository.transactionContext.PgTx 18 tx := repository.transactionContext.PgTx
19 if exchangeCashActivity.Identity() == nil { 19 if exchangeCashActivity.Identity() == nil {
20 if _, err := tx.QueryOne( 20 if _, err := tx.QueryOne(
21 - pg.Scan(&exchangeCashActivity.ActivityId, &exchangeCashActivity.CompanyId, &exchangeCashActivity.ExchangeActivityName, &exchangeCashActivity.Deadline, &exchangeCashActivity.CountDown, &exchangeCashActivity.ExchangedCash, &exchangeCashActivity.ExchangedSuMoney, &exchangeCashActivity.Rate),  
22 - "INSERT INTO exchange_cash_activities ( company_id, activity_name, deadline, count_down, exchanged_cash, exchanged_su_money, exchange_rate) VALUES (?, ?, ?, ?, ?, ?, ? ) RETURNING id, company_id, activity_name, deadline, count_down, exchanged_cash, exchanged_su_money, exchange_rate" ,  
23 - exchangeCashActivity.CompanyId, exchangeCashActivity.ExchangeActivityName, exchangeCashActivity.Deadline, exchangeCashActivity.CountDown, exchangeCashActivity.ExchangedCash, exchangeCashActivity.ExchangedSuMoney, exchangeCashActivity.Rate); err != nil { 21 + pg.Scan(&exchangeCashActivity.ActivityId, &exchangeCashActivity.CompanyId, &exchangeCashActivity.ExchangeActivityName, &exchangeCashActivity.Deadline, &exchangeCashActivity.CountDown, &exchangeCashActivity.ExchangedCash, &exchangeCashActivity.ExchangedSuMoney, &exchangeCashActivity.Rate, &exchangeCashActivity.CreateTime),
  22 + "INSERT INTO exchange_cash_activities ( company_id, activity_name, deadline, count_down, exchanged_cash, exchanged_su_money, exchange_rate, create_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING id, company_id, activity_name, deadline, count_down, exchanged_cash, exchanged_su_money, exchange_rate, create_time" ,
  23 + exchangeCashActivity.CompanyId, exchangeCashActivity.ExchangeActivityName, exchangeCashActivity.Deadline, exchangeCashActivity.CountDown, exchangeCashActivity.ExchangedCash, exchangeCashActivity.ExchangedSuMoney, exchangeCashActivity.Rate, &exchangeCashActivity.CreateTime); err != nil {
24 return exchangeCashActivity, err 24 return exchangeCashActivity, err
25 } 25 }
26 } else { 26 } else {
@@ -38,7 +38,7 @@ func (repository *ExchangeCashActivityRepository) FindOne(queryOptions map[strin @@ -38,7 +38,7 @@ func (repository *ExchangeCashActivityRepository) FindOne(queryOptions map[strin
38 tx := repository.transactionContext.PgTx 38 tx := repository.transactionContext.PgTx
39 exchangeCashActivityModel := new(models.ExchangeCashActivity) 39 exchangeCashActivityModel := new(models.ExchangeCashActivity)
40 query := tx.Model(exchangeCashActivityModel) 40 query := tx.Model(exchangeCashActivityModel)
41 - if exchangeCashActivityId, ok := queryOptions["exchangeCashActivityId"]; ok { 41 + if exchangeCashActivityId, ok := queryOptions["activityId"]; ok {
42 query = query.Where("exchange_cash_activity.id = ?", exchangeCashActivityId) 42 query = query.Where("exchange_cash_activity.id = ?", exchangeCashActivityId)
43 } 43 }
44 if err := query.First(); err != nil { 44 if err := query.First(); err != nil {