正在显示
4 个修改的文件
包含
23 行增加
和
11 行删除
@@ -8,9 +8,10 @@ import ( | @@ -8,9 +8,10 @@ import ( | ||
8 | // 获取兑换现金活动列表 | 8 | // 获取兑换现金活动列表 |
9 | type ListExchangeCashActivityQuery struct { | 9 | type ListExchangeCashActivityQuery struct { |
10 | CompanyId int64 `json:"companyId"` // 公司id | 10 | CompanyId int64 `json:"companyId"` // 公司id |
11 | - ExchangeCashActivityNameMatch string `json:"exchangeCashActivityNameMatch,omitempty"` | ||
12 | - Offset int `json:"offset,omitempty"` | ||
13 | - Limit int `json:"limit,omitempty"` | 11 | + ExchangeCashActivityNameMatch string `json:"exchangeCashActivityNameMatch,omitempty"` // 活动名称匹配 |
12 | + Deadline string `json:"deadline,omitempty"` // 截止时间筛选 | ||
13 | + Offset int `json:"offset,omitempty"` // 查询偏移量 | ||
14 | + Limit int `json:"limit,omitempty"` // 查询限制条目 | ||
14 | } | 15 | } |
15 | 16 | ||
16 | func (listExchangeCashActivityQuery *ListExchangeCashActivityQuery) ValidateQuery() error { | 17 | func (listExchangeCashActivityQuery *ListExchangeCashActivityQuery) ValidateQuery() error { |
@@ -264,6 +264,12 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang | @@ -264,6 +264,12 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang | ||
264 | CreateTime: time.Now(), | 264 | CreateTime: time.Now(), |
265 | } | 265 | } |
266 | 266 | ||
267 | + | ||
268 | + // 倒计时结束 | ||
269 | + if t2.Before(t1) { | ||
270 | + newActivity.CountDown = 0 | ||
271 | + } | ||
272 | + | ||
267 | var exchangeCashActivityRepository domain.ExchangeActivityRepository | 273 | var exchangeCashActivityRepository domain.ExchangeActivityRepository |
268 | if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{ | 274 | if value, err := factory.CreateExchangeCashActivityRepository(map[string]interface{}{ |
269 | "transactionContext": transactionContext, | 275 | "transactionContext": transactionContext, |
@@ -1562,10 +1568,6 @@ func (cashPoolService *CashPoolService) ListExchangeCashPersonById(exportExchang | @@ -1562,10 +1568,6 @@ func (cashPoolService *CashPoolService) ListExchangeCashPersonById(exportExchang | ||
1562 | if err := transactionContext.CommitTransaction(); err != nil { | 1568 | if err := transactionContext.CommitTransaction(); err != nil { |
1563 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 1569 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
1564 | } | 1570 | } |
1565 | - //return map[string]interface{}{ | ||
1566 | - // "count": count, | ||
1567 | - // "people": people, | ||
1568 | - //}, nil | ||
1569 | return people, nil | 1571 | return people, nil |
1570 | } | 1572 | } |
1571 | } | 1573 | } |
@@ -2,12 +2,11 @@ package repository | @@ -2,12 +2,11 @@ package repository | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | - "time" | ||
6 | - | ||
7 | "github.com/go-pg/pg" | 5 | "github.com/go-pg/pg" |
8 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | 6 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" |
9 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain" |
10 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg/models" | 8 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg/models" |
9 | + "time" | ||
11 | ) | 10 | ) |
12 | 11 | ||
13 | type ExchangeCashActivityRepository struct { | 12 | type ExchangeCashActivityRepository struct { |
@@ -88,8 +87,16 @@ func (repository *ExchangeCashActivityRepository) Find(queryOptions map[string]i | @@ -88,8 +87,16 @@ func (repository *ExchangeCashActivityRepository) Find(queryOptions map[string]i | ||
88 | if exchangeCashActivityNameMatch, ok := queryOptions["exchangeCashActivityNameMatch"]; ok && (exchangeCashActivityNameMatch != "") { | 87 | if exchangeCashActivityNameMatch, ok := queryOptions["exchangeCashActivityNameMatch"]; ok && (exchangeCashActivityNameMatch != "") { |
89 | query = query.Where(`exchange_cash_activity.activity_name LIKE ?`, fmt.Sprintf("%%%s%%", exchangeCashActivityNameMatch.(string))) | 88 | query = query.Where(`exchange_cash_activity.activity_name LIKE ?`, fmt.Sprintf("%%%s%%", exchangeCashActivityNameMatch.(string))) |
90 | } | 89 | } |
91 | - if deadline, ok := queryOptions["exchangeCashActivityDeadline"]; ok && !deadline.(time.Time).IsZero() { | ||
92 | - query = query.Where(`exchange_cash_activity.deadline < ?`, deadline) | 90 | + |
91 | + //if deadline, ok := queryOptions["deadline"]; ok && !deadline.(time.Time).IsZero() { | ||
92 | + // query = query.Where(`exchange_cash_activity.deadline > ?`, deadline) | ||
93 | + //} | ||
94 | + | ||
95 | + if deadlineStr, ok := queryOptions["deadline"]; ok && (deadlineStr.(string) != "") { | ||
96 | + var layout string = "2006-01-02" | ||
97 | + deadline, _:= time.Parse(layout, deadlineStr.(string)) | ||
98 | + var t = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 0, 0, 0, 0, time.Local) | ||
99 | + query = query.Where(`exchange_cash_activity.deadline > ?`, t) | ||
93 | } | 100 | } |
94 | if offset, ok := queryOptions["offset"]; ok { | 101 | if offset, ok := queryOptions["offset"]; ok { |
95 | offset := offset.(int) | 102 | offset := offset.(int) |
@@ -142,6 +142,8 @@ func (controller *SuMoneyController) ListExchangeActivities () { | @@ -142,6 +142,8 @@ func (controller *SuMoneyController) ListExchangeActivities () { | ||
142 | listExchangeCashActivityQuery.CompanyId = companyId | 142 | listExchangeCashActivityQuery.CompanyId = companyId |
143 | exchangeCashActivityNameMatch := controller.GetString("activityNameMatch") | 143 | exchangeCashActivityNameMatch := controller.GetString("activityNameMatch") |
144 | listExchangeCashActivityQuery.ExchangeCashActivityNameMatch = exchangeCashActivityNameMatch | 144 | listExchangeCashActivityQuery.ExchangeCashActivityNameMatch = exchangeCashActivityNameMatch |
145 | + deadline := controller.GetString("deadline") | ||
146 | + listExchangeCashActivityQuery.Deadline = deadline | ||
145 | offset, _ := controller.GetInt("offset") | 147 | offset, _ := controller.GetInt("offset") |
146 | listExchangeCashActivityQuery.Offset = offset | 148 | listExchangeCashActivityQuery.Offset = offset |
147 | limit, _ := controller.GetInt("limit") | 149 | limit, _ := controller.GetInt("limit") |
-
请 注册 或 登录 后发表评论