作者 陈志颖

test:上期汇率

... ... @@ -131,3 +131,57 @@
BodyData:{}
2020/11/23 11:06:28.378 [D] [server.go:2843] <====Send RequestId:GET./cash-pool/cash-pool?companyId=358.1606100788340467000 BodyData:{"code":0,"data":{"cashPoolId":10,"cash":2001,"companyId":358,"exchangedCash":4,"unExchangeCash":1997,"exchangedSuMoney":3,"unExchangeSuMoney":3498567.67,"rate":1.33,"lastRate":0,"createTime":"2020-11-17T11:02:21.013016+08:00"},"msg":"ok"}
2020/11/23 11:06:28.378 [D] [server.go:1925] | 127.0.0.1| 200 | 38.134513ms| match| GET  /cash-pool/cash-pool r:/cash-pool/cash-pool
2020/11/23 11:07:52.593 [I] [???:0] http server Running on http://:8082
2020/11/23 11:07:57.777 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./cash-pool/cash-pool?companyId=358.1606100877777207000
Auth=
BodyData:{}
2020/11/23 11:07:57.922 [D] [server.go:2843] <====Send RequestId:GET./cash-pool/cash-pool?companyId=358.1606100877777207000 BodyData:{"code":0,"data":{"cashPoolId":10,"cash":2001,"companyId":358,"exchangedCash":4,"unExchangeCash":1997,"exchangedSuMoney":3,"unExchangeSuMoney":3498567.67,"rate":1.33,"lastRate":0,"createTime":"2020-11-17T11:02:21.013016+08:00"},"msg":"ok"}
2020/11/23 11:07:57.922 [D] [server.go:1925] | 127.0.0.1| 200 | 145.563659ms| match| GET  /cash-pool/cash-pool r:/cash-pool/cash-pool
2020/11/23 11:08:23.230 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./cash-pool/activity.1606100903230741000
Auth=
BodyData:{
"companyId": 358,
"exchangeActivityName": "这是公司311的兑换活动7",
"deadline": "2021-01-05T16:00:00.000Z",
"exchangeRate": 5.1
}
2020/11/23 11:08:23.355 [D] [server.go:2843] <====Send RequestId:POST./cash-pool/activity.1606100903230741000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是公司311的兑换活动7","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2021-01-06T23:59:59+08:00","countDown":45,"rate":5.1,"createTime":"2020-11-23T11:08:23.237467+08:00"},"msg":"ok"}
2020/11/23 11:08:23.355 [D] [server.go:1925] | 127.0.0.1| 200 | 124.391819ms| match| POST  /cash-pool/activity r:/cash-pool/activity
2020/11/23 11:08:33.758 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./cash-pool/activity/?companyId=358&offset=0&limit=20&isEnd=false.1606100913758174000
Auth=
BodyData:{}
2020/11/23 11:08:33.863 [D] [server.go:2843] <====Send RequestId:GET./cash-pool/activity/?companyId=358&offset=0&limit=20&isEnd=false.1606100913758174000 BodyData:{"code":0,"data":{"activities":[{"activityId":41,"companyId":358,"countDown":7,"createTime":"2020-11-17T13:21:41.997891+08:00","deadline":1606665599001,"exchangeActivityName":"12","exchangedCash":0,"exchangedSuMoney":0,"rate":3},{"activityId":95,"companyId":358,"countDown":45,"createTime":"2020-11-23T11:08:23.237467+08:00","deadline":1609948799000,"exchangeActivityName":"这是公司311的兑换活动7","exchangedCash":0,"exchangedSuMoney":0,"rate":5.1}],"count":2},"msg":"ok"}
2020/11/23 11:08:33.863 [D] [server.go:1925] | 127.0.0.1| 200 | 105.253309ms| match| GET  /cash-pool/activity/ r:/cash-pool/activity/
2020/11/23 11:08:50.399 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./cash-pool/cash-pool?companyId=358.1606100930399371000
Auth=
BodyData:{}
2020/11/23 11:08:50.433 [D] [server.go:2843] <====Send RequestId:GET./cash-pool/cash-pool?companyId=358.1606100930399371000 BodyData:{"code":0,"data":{"cashPoolId":10,"cash":2001,"companyId":358,"exchangedCash":4,"unExchangeCash":1997,"exchangedSuMoney":3,"unExchangeSuMoney":3498567.67,"rate":1.33,"lastRate":3,"createTime":"2020-11-17T11:02:21.013016+08:00"},"msg":"ok"}
2020/11/23 11:08:50.434 [D] [server.go:1925] | 127.0.0.1| 200 | 35.068243ms| match| GET  /cash-pool/cash-pool r:/cash-pool/cash-pool
2020/11/23 11:38:17.877 [I] [???:0] http server Running on http://:8082
2020/11/23 11:38:26.022 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./cash-pool/cash-pool?companyId=358.1606102706022033000
Auth=
BodyData:{}
2020/11/23 11:38:27.133 [D] [server.go:2843] <====Send RequestId:GET./cash-pool/cash-pool?companyId=358.1606102706022033000 BodyData:{"code":0,"data":{"cashPoolId":10,"cash":2001,"companyId":358,"exchangedCash":4,"unExchangeCash":1997,"exchangedSuMoney":3,"unExchangeSuMoney":3498567.67,"rate":1.33,"lastRate":3,"createTime":"2020-11-17T11:02:21.013016+08:00"},"msg":"ok"}
2020/11/23 11:38:27.134 [D] [server.go:1925] | 127.0.0.1| 200 | 1.112025373s| match| GET  /cash-pool/cash-pool r:/cash-pool/cash-pool
2020/11/23 11:38:30.677 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./cash-pool/cash-pool?companyId=358.1606102710677272000
Auth=
BodyData:{}
2020/11/23 11:38:30.760 [D] [server.go:2843] <====Send RequestId:GET./cash-pool/cash-pool?companyId=358.1606102710677272000 BodyData:{"code":0,"data":{"cashPoolId":10,"cash":2001,"companyId":358,"exchangedCash":4,"unExchangeCash":1997,"exchangedSuMoney":3,"unExchangeSuMoney":3498567.67,"rate":1.33,"lastRate":3,"createTime":"2020-11-17T11:02:21.013016+08:00"},"msg":"ok"}
2020/11/23 11:38:30.760 [D] [server.go:1925] | 127.0.0.1| 200 | 83.453461ms| match| GET  /cash-pool/cash-pool r:/cash-pool/cash-pool
2020/11/23 11:41:07.866 [I] [???:0] http server Running on http://:8082
2020/11/23 11:41:14.678 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./cash-pool/cash-pool?companyId=358.1606102874678381000
Auth=
BodyData:{}
2020/11/23 11:41:14.858 [D] [server.go:2843] <====Send RequestId:GET./cash-pool/cash-pool?companyId=358.1606102874678381000 BodyData:{"code":0,"data":{"cashPoolId":10,"cash":2001,"companyId":358,"exchangedCash":4,"unExchangeCash":1997,"exchangedSuMoney":3,"unExchangeSuMoney":3498567.67,"rate":1.33,"lastRate":3,"createTime":"2020-11-17T11:02:21.013016+08:00"},"msg":"ok"}
2020/11/23 11:41:14.858 [D] [server.go:1925] | 127.0.0.1| 200 | 180.639118ms| match| GET  /cash-pool/cash-pool r:/cash-pool/cash-pool
2020/11/23 11:43:00.648 [I] [???:0] http server Running on http://:8082
2020/11/23 11:43:09.903 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./cash-pool/cash-pool?companyId=358.1606102989903536000
Auth=
BodyData:{}
2020/11/23 11:43:10.158 [D] [server.go:2843] <====Send RequestId:GET./cash-pool/cash-pool?companyId=358.1606102989903536000 BodyData:{"code":0,"data":{"cashPoolId":10,"cash":2001,"companyId":358,"exchangedCash":4,"unExchangeCash":1997,"exchangedSuMoney":3,"unExchangeSuMoney":3498567.67,"rate":1.33,"lastRate":0,"createTime":"2020-11-17T11:02:21.013016+08:00"},"msg":"ok"}
2020/11/23 11:43:10.158 [D] [server.go:1925] | 127.0.0.1| 200 | 255.02557ms| match| GET  /cash-pool/cash-pool r:/cash-pool/cash-pool
2020/11/23 11:43:13.946 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./cash-pool/cash-pool?companyId=358.1606102993946891000
Auth=
BodyData:{}
2020/11/23 11:43:14.139 [D] [server.go:2843] <====Send RequestId:GET./cash-pool/cash-pool?companyId=358.1606102993946891000 BodyData:{"code":0,"data":{"cashPoolId":10,"cash":2001,"companyId":358,"exchangedCash":4,"unExchangeCash":1997,"exchangedSuMoney":3,"unExchangeSuMoney":3498567.67,"rate":1.33,"lastRate":0,"createTime":"2020-11-17T11:02:21.013016+08:00"},"msg":"ok"}
2020/11/23 11:43:14.139 [D] [server.go:1925] | 127.0.0.1| 200 | 192.55553ms| match| GET  /cash-pool/cash-pool r:/cash-pool/cash-pool
... ...
... ... @@ -141,7 +141,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
listExchangeCashActivityQuery := map[string]interface{}{
"companyId": createCashPoolCommand.CompanyId,
"order": "deadline DESC",
"offset": 1,
"nearest": true,
"limit": 1,
}
if count, activities, err := exchangeActivityRepository.Find(listExchangeCashActivityQuery); err != nil {
... ... @@ -257,7 +257,7 @@ func (cashPoolService *CashPoolService) GetCashPool(getCashPoolQuery *query.GetC
listExchangeCashActivityQuery := map[string]interface{}{
"companyId": getCashPoolQuery.CompanyId,
"order": "deadline DESC",
"offset": 1,
"nearest": true,
"limit": 1,
}
if count, activities, err := exchangeActivityRepository.Find(listExchangeCashActivityQuery); err != nil {
... ...
... ... @@ -98,6 +98,12 @@ func (repository *ExchangeCashActivityRepository) Find(queryOptions map[string]i
query = query.Where(`exchange_cash_activity.count_down > ?`, 0)
}
}
if nearest, ok := queryOptions["nearest"]; ok && nearest.(bool) != false {
t := time.Now().Local()
//endTime := time.Date(t.Year(), t.Month(), t.Day(), 23, 59, 59, 0, time.Local)
query = query.Where(`exchange_cash_activity.deadline <= ?`, t)
query = query.Where(`exchange_cash_activity.count_down = ?`, 0)
}
if deadline, ok := queryOptions["deadline"]; ok && deadline != "" {
t, _ := time.ParseInLocation("2006-01-02", deadline.(string), time.Local)
newDeadlineStart := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, time.Local)
... ...