作者 陈志颖

fix:年榜时间重合

@@ -483,3 +483,182 @@ @@ -483,3 +483,182 @@
483 BodyData: 483 BodyData:
484 2020/11/22 17:34:08.225 [D] [server.go:2843] <====Send RequestId:POST./cash-pool/activity/exchange-list/import.1606037648026939000 BodyData:{"code":0,"data":{"fail":null,"successCount":1},"msg":"ok"} 484 2020/11/22 17:34:08.225 [D] [server.go:2843] <====Send RequestId:POST./cash-pool/activity/exchange-list/import.1606037648026939000 BodyData:{"code":0,"data":{"fail":null,"successCount":1},"msg":"ok"}
485 2020/11/22 17:34:08.225 [D] [server.go:1925] | 127.0.0.1| 200 | 198.53039ms| match| POST  /cash-pool/activity/exchange-list/import r:/cash-pool/activity/exchange-list/import 485 2020/11/22 17:34:08.225 [D] [server.go:1925] | 127.0.0.1| 200 | 198.53039ms| match| POST  /cash-pool/activity/exchange-list/import r:/cash-pool/activity/exchange-list/import
  486 +2020/11/22 18:17:10.614 [I] [???:0] http server Running on http://:8082
  487 +2020/11/22 18:17:14.084 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./cash-pool/activity/?companyId=311&offset=0&limit=20&isEnd=true.1606040234084726000
  488 + Auth=
  489 + BodyData:{}
  490 +2020/11/22 18:17:14.261 [D] [server.go:2843] <====Send RequestId:GET./cash-pool/activity/?companyId=311&offset=0&limit=20&isEnd=true.1606040234084726000 BodyData:{"code":501,"msg":"内部服务出错:ERROR #42703 column exchange_cash_activity.countdown does not exist"}
  491 +2020/11/22 18:17:14.263 [D] [server.go:1925] | 127.0.0.1| 200 | 177.978134ms| match| GET  /cash-pool/activity/ r:/cash-pool/activity/
  492 +2020/11/22 19:12:19.790 [I] [???:0] http server Running on http://:8082
  493 +2020/11/22 19:14:49.683 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./statistics/person-su-money.1606043689683352000
  494 + Auth=
  495 + BodyData:{
  496 + "uid": 3248817613892608
  497 +}
  498 +2020/11/22 19:14:50.198 [D] [server.go:2843] <====Send RequestId:POST./statistics/person-su-money.1606043689683352000 BodyData:{"code":0,"data":{"currentSuMoney":16757.219999999998,"incomeSuMoney":15357.22,"incomeSuMoneyOfYesterday":0},"msg":"ok"}
  499 +2020/11/22 19:14:50.198 [D] [server.go:1925] | 127.0.0.1| 200 | 515.560355ms| match| POST  /statistics/person-su-money r:/statistics/person-su-money
  500 +2020/11/22 19:36:08.871 [I] [???:0] http server Running on http://:8082
  501 +2020/11/22 19:36:29.733 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./list-interval/?companyId=381&offset=0&limit=20.1606044989733527000
  502 + Auth=
  503 + BodyData:{}
  504 +2020/11/22 19:36:29.832 [D] [server.go:2843] <====Send RequestId:GET./list-interval/?companyId=381&offset=0&limit=20.1606044989733527000 BodyData:{"code":0,"data":{"count":1,"listIntervals":[{"listIntervalId":7,"companyId":381,"intervalStartTime":"2020-11-16T00:00:00+08:00","intervalEndTime":"2020-11-17T00:00:00+08:00"}]},"msg":"ok"}
  505 +2020/11/22 19:36:29.832 [D] [server.go:1925] | 127.0.0.1| 200 | 98.964301ms| match| GET  /list-interval/ r:/list-interval/
  506 +2020/11/22 19:38:04.075 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./list-interval/7.1606045084074929000
  507 + Auth=
  508 + BodyData:{
  509 + "listIntervalStartTime": "2020-11-10T12:01:54.851528+08:00",
  510 + "listIntervalEndTime": "2020-11-16T12:01:54.851528+08:00"
  511 +}
  512 +2020/11/22 19:38:04.138 [D] [server.go:2843] <====Send RequestId:PUT./list-interval/7.1606045084074929000 BodyData:{"code":0,"data":{"listIntervalId":7,"companyId":381,"intervalStartTime":"2020-11-10T12:01:54.851528+08:00","intervalEndTime":"2020-11-16T12:01:54.851528+08:00"},"msg":"ok"}
  513 +2020/11/22 19:38:04.138 [D] [server.go:1925] | 127.0.0.1| 200 | 63.625988ms| match| PUT  /list-interval/7 r:/list-interval/:listId
  514 +2020/11/22 19:38:30.814 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./list-interval/.1606045110814442000
  515 + Auth=
  516 + BodyData:{
  517 + "companyId": 381,
  518 + "listIntervalStartTime": "2020-11-09T12:02:55.851528+08:00",
  519 + "listIntervalEndTime": "2020-12-16T12:01:54.851528+08:00"
  520 +}
  521 +2020/11/22 19:38:30.819 [D] [server.go:2843] <====Send RequestId:POST./list-interval/.1606045110814442000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  522 +2020/11/22 19:38:30.819 [D] [server.go:1925] | 127.0.0.1| 200 | 6.050307ms| match| POST  /list-interval/ r:/list-interval/
  523 +2020/11/22 19:38:36.510 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./list-interval/.1606045116510866000
  524 + Auth=
  525 + BodyData:{
  526 + "companyId": 381,
  527 + "listIntervalStartTime": "2020-11-10T12:02:55.851528+08:00",
  528 + "listIntervalEndTime": "2020-12-16T12:01:54.851528+08:00"
  529 +}
  530 +2020/11/22 19:38:36.541 [D] [server.go:2843] <====Send RequestId:POST./list-interval/.1606045116510866000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  531 +2020/11/22 19:38:36.541 [D] [server.go:1925] | 127.0.0.1| 200 | 30.741996ms| match| POST  /list-interval/ r:/list-interval/
  532 +2020/11/22 19:38:40.976 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./list-interval/.1606045120976236000
  533 + Auth=
  534 + BodyData:{
  535 + "companyId": 381,
  536 + "listIntervalStartTime": "2020-11-11T12:02:55.851528+08:00",
  537 + "listIntervalEndTime": "2020-12-16T12:01:54.851528+08:00"
  538 +}
  539 +2020/11/22 19:38:40.995 [D] [server.go:2843] <====Send RequestId:POST./list-interval/.1606045120976236000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  540 +2020/11/22 19:38:40.996 [D] [server.go:1925] | 127.0.0.1| 200 | 19.840269ms| match| POST  /list-interval/ r:/list-interval/
  541 +2020/11/22 19:38:47.358 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./list-interval/?companyId=381&offset=0&limit=20.1606045127358409000
  542 + Auth=
  543 + BodyData:{}
  544 +2020/11/22 19:38:47.370 [D] [server.go:2843] <====Send RequestId:GET./list-interval/?companyId=381&offset=0&limit=20.1606045127358409000 BodyData:{"code":0,"data":{"count":1,"listIntervals":[{"listIntervalId":7,"companyId":381,"intervalStartTime":"2020-11-10T12:01:54.851528+08:00","intervalEndTime":"2020-11-16T12:01:54.851528+08:00"}]},"msg":"ok"}
  545 +2020/11/22 19:38:47.370 [D] [server.go:1925] | 127.0.0.1| 200 | 11.991998ms| match| GET  /list-interval/ r:/list-interval/
  546 +2020/11/22 19:39:00.524 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./list-interval/.1606045140524533000
  547 + Auth=
  548 + BodyData:{
  549 + "companyId": 381,
  550 + "listIntervalStartTime": "2020-11-12T12:02:55.851528+08:00",
  551 + "listIntervalEndTime": "2020-12-16T12:01:54.851528+08:00"
  552 +}
  553 +2020/11/22 19:39:00.531 [D] [server.go:2843] <====Send RequestId:POST./list-interval/.1606045140524533000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  554 +2020/11/22 19:39:00.531 [D] [server.go:1925] | 127.0.0.1| 200 | 7.235681ms| match| POST  /list-interval/ r:/list-interval/
  555 +2020/11/22 19:39:03.901 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./list-interval/.1606045143901405000
  556 + Auth=
  557 + BodyData:{
  558 + "companyId": 381,
  559 + "listIntervalStartTime": "2020-11-13T12:02:55.851528+08:00",
  560 + "listIntervalEndTime": "2020-12-16T12:01:54.851528+08:00"
  561 +}
  562 +2020/11/22 19:39:03.908 [D] [server.go:2843] <====Send RequestId:POST./list-interval/.1606045143901405000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  563 +2020/11/22 19:39:03.908 [D] [server.go:1925] | 127.0.0.1| 200 | 7.322637ms| match| POST  /list-interval/ r:/list-interval/
  564 +2020/11/22 19:39:06.970 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./list-interval/.1606045146970949000
  565 + Auth=
  566 + BodyData:{
  567 + "companyId": 381,
  568 + "listIntervalStartTime": "2020-11-14T12:02:55.851528+08:00",
  569 + "listIntervalEndTime": "2020-12-16T12:01:54.851528+08:00"
  570 +}
  571 +2020/11/22 19:39:07.065 [D] [server.go:2843] <====Send RequestId:POST./list-interval/.1606045146970949000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  572 +2020/11/22 19:39:07.065 [D] [server.go:1925] | 127.0.0.1| 200 | 94.807223ms| match| POST  /list-interval/ r:/list-interval/
  573 +2020/11/22 19:39:10.726 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./list-interval/.1606045150726957000
  574 + Auth=
  575 + BodyData:{
  576 + "companyId": 381,
  577 + "listIntervalStartTime": "2020-11-15T12:02:55.851528+08:00",
  578 + "listIntervalEndTime": "2020-12-16T12:01:54.851528+08:00"
  579 +}
  580 +2020/11/22 19:39:10.740 [D] [server.go:2843] <====Send RequestId:POST./list-interval/.1606045150726957000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  581 +2020/11/22 19:39:10.740 [D] [server.go:1925] | 127.0.0.1| 200 | 13.756698ms| match| POST  /list-interval/ r:/list-interval/
  582 +2020/11/22 19:39:14.447 [D] [server.go:2843] ====>Recv User:<nil> RequestId:POST./list-interval/.1606045154447071000
  583 + Auth=
  584 + BodyData:{
  585 + "companyId": 381,
  586 + "listIntervalStartTime": "2020-11-16T12:02:55.851528+08:00",
  587 + "listIntervalEndTime": "2020-12-16T12:01:54.851528+08:00"
  588 +}
  589 +2020/11/22 19:39:14.706 [D] [server.go:2843] <====Send RequestId:POST./list-interval/.1606045154447071000 BodyData:{"code":0,"data":{"listIntervalId":20,"companyId":381,"intervalStartTime":"2020-11-16T12:02:55.851528+08:00","intervalEndTime":"2020-12-16T12:01:54.851528+08:00"},"msg":"ok"}
  590 +2020/11/22 19:39:14.706 [D] [server.go:1925] | 127.0.0.1| 200 | 259.405323ms| match| POST  /list-interval/ r:/list-interval/
  591 +2020/11/22 19:39:24.546 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./list-interval/?companyId=381&offset=0&limit=20.1606045164546223000
  592 + Auth=
  593 + BodyData:{}
  594 +2020/11/22 19:39:24.551 [D] [server.go:2843] <====Send RequestId:GET./list-interval/?companyId=381&offset=0&limit=20.1606045164546223000 BodyData:{"code":0,"data":{"count":2,"listIntervals":[{"listIntervalId":20,"companyId":381,"intervalStartTime":"2020-11-16T12:02:55.851528+08:00","intervalEndTime":"2020-12-16T12:01:54.851528+08:00"},{"listIntervalId":7,"companyId":381,"intervalStartTime":"2020-11-10T12:01:54.851528+08:00","intervalEndTime":"2020-11-16T12:01:54.851528+08:00"}]},"msg":"ok"}
  595 +2020/11/22 19:39:24.551 [D] [server.go:1925] | 127.0.0.1| 200 | 5.530137ms| match| GET  /list-interval/ r:/list-interval/
  596 +2020/11/22 19:39:58.983 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./list-interval/20.1606045198983054000
  597 + Auth=
  598 + BodyData:{
  599 + "listIntervalStartTime": "2020-11-10T12:01:54.851528+08:00",
  600 + "listIntervalEndTime": "2020-11-16T12:01:54.851528+08:00"
  601 +}
  602 +2020/11/22 19:39:59.000 [D] [server.go:2843] <====Send RequestId:PUT./list-interval/20.1606045198983054000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  603 +2020/11/22 19:39:59.027 [D] [server.go:1925] | 127.0.0.1| 200 | 44.73455ms| match| PUT  /list-interval/20 r:/list-interval/:listId
  604 +2020/11/22 19:40:01.694 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./list-interval/20.1606045201694007000
  605 + Auth=
  606 + BodyData:{
  607 + "listIntervalStartTime": "2020-11-10T12:01:54.851528+08:00",
  608 + "listIntervalEndTime": "2020-11-16T12:01:54.851528+08:00"
  609 +}
  610 +2020/11/22 19:40:01.698 [D] [server.go:2843] <====Send RequestId:PUT./list-interval/20.1606045201694007000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  611 +2020/11/22 19:40:01.698 [D] [server.go:1925] | 127.0.0.1| 200 | 4.185461ms| match| PUT  /list-interval/20 r:/list-interval/:listId
  612 +2020/11/22 19:40:08.567 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./list-interval/20.1606045208567467000
  613 + Auth=
  614 + BodyData:{
  615 + "listIntervalStartTime": "2020-11-10T12:01:54.851528+08:00",
  616 + "listIntervalEndTime": "2020-11-20T12:01:54.851528+08:00"
  617 +}
  618 +2020/11/22 19:40:08.571 [D] [server.go:2843] <====Send RequestId:PUT./list-interval/20.1606045208567467000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  619 +2020/11/22 19:40:08.571 [D] [server.go:1925] | 127.0.0.1| 200 | 4.336836ms| match| PUT  /list-interval/20 r:/list-interval/:listId
  620 +2020/11/22 19:40:13.378 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./list-interval/20.1606045213378658000
  621 + Auth=
  622 + BodyData:{
  623 + "listIntervalStartTime": "2020-11-11T12:01:54.851528+08:00",
  624 + "listIntervalEndTime": "2020-11-20T12:01:54.851528+08:00"
  625 +}
  626 +2020/11/22 19:40:13.415 [D] [server.go:2843] <====Send RequestId:PUT./list-interval/20.1606045213378658000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  627 +2020/11/22 19:40:13.416 [D] [server.go:1925] | 127.0.0.1| 200 | 38.183747ms| match| PUT  /list-interval/20 r:/list-interval/:listId
  628 +2020/11/22 19:40:17.764 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./list-interval/20.1606045217764641000
  629 + Auth=
  630 + BodyData:{
  631 + "listIntervalStartTime": "2020-11-14T12:01:54.851528+08:00",
  632 + "listIntervalEndTime": "2020-11-20T12:01:54.851528+08:00"
  633 +}
  634 +2020/11/22 19:40:17.777 [D] [server.go:2843] <====Send RequestId:PUT./list-interval/20.1606045217764641000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  635 +2020/11/22 19:40:17.801 [D] [server.go:1925] | 127.0.0.1| 200 | 36.762524ms| match| PUT  /list-interval/20 r:/list-interval/:listId
  636 +2020/11/22 19:40:21.083 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./list-interval/20.1606045221083406000
  637 + Auth=
  638 + BodyData:{
  639 + "listIntervalStartTime": "2020-11-15T12:01:54.851528+08:00",
  640 + "listIntervalEndTime": "2020-11-20T12:01:54.851528+08:00"
  641 +}
  642 +2020/11/22 19:40:21.171 [D] [server.go:2843] <====Send RequestId:PUT./list-interval/20.1606045221083406000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  643 +2020/11/22 19:40:21.180 [D] [server.go:1925] | 127.0.0.1| 200 | 97.416213ms| match| PUT  /list-interval/20 r:/list-interval/:listId
  644 +2020/11/22 19:40:24.666 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./list-interval/20.1606045224666853000
  645 + Auth=
  646 + BodyData:{
  647 + "listIntervalStartTime": "2020-11-16T12:01:54.851528+08:00",
  648 + "listIntervalEndTime": "2020-11-20T12:01:54.851528+08:00"
  649 +}
  650 +2020/11/22 19:40:24.693 [D] [server.go:2843] <====Send RequestId:PUT./list-interval/20.1606045224666853000 BodyData:{"code":501,"msg":"内部服务出错:年榜开始时间必须大于上一个年榜结束时间"}
  651 +2020/11/22 19:40:24.693 [D] [server.go:1925] | 127.0.0.1| 200 | 27.14888ms| match| PUT  /list-interval/20 r:/list-interval/:listId
  652 +2020/11/22 19:40:30.295 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./list-interval/20.1606045230295148000
  653 + Auth=
  654 + BodyData:{
  655 + "listIntervalStartTime": "2020-11-17T12:01:54.851528+08:00",
  656 + "listIntervalEndTime": "2020-11-20T12:01:54.851528+08:00"
  657 +}
  658 +2020/11/22 19:40:30.331 [D] [server.go:2843] <====Send RequestId:PUT./list-interval/20.1606045230295148000 BodyData:{"code":0,"data":{"listIntervalId":20,"companyId":381,"intervalStartTime":"2020-11-17T12:01:54.851528+08:00","intervalEndTime":"2020-11-20T12:01:54.851528+08:00"},"msg":"ok"}
  659 +2020/11/22 19:40:30.331 [D] [server.go:1925] | 127.0.0.1| 200 | 36.18399ms| match| PUT  /list-interval/20 r:/list-interval/:listId
  660 +2020/11/22 19:40:35.974 [D] [server.go:2843] ====>Recv User:<nil> RequestId:GET./list-interval/?companyId=381&offset=0&limit=20.1606045235974062000
  661 + Auth=
  662 + BodyData:{}
  663 +2020/11/22 19:40:35.984 [D] [server.go:2843] <====Send RequestId:GET./list-interval/?companyId=381&offset=0&limit=20.1606045235974062000 BodyData:{"code":0,"data":{"count":2,"listIntervals":[{"listIntervalId":20,"companyId":381,"intervalStartTime":"2020-11-17T12:01:54.851528+08:00","intervalEndTime":"2020-11-20T12:01:54.851528+08:00"},{"listIntervalId":7,"companyId":381,"intervalStartTime":"2020-11-10T12:01:54.851528+08:00","intervalEndTime":"2020-11-16T12:01:54.851528+08:00"}]},"msg":"ok"}
  664 +2020/11/22 19:40:35.984 [D] [server.go:1925] | 127.0.0.1| 200 | 10.621505ms| match| GET  /list-interval/ r:/list-interval/
@@ -197,6 +197,7 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt @@ -197,6 +197,7 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt
197 listIntervalRepository = value 197 listIntervalRepository = value
198 } 198 }
199 199
  200 + // 获取当前年榜
200 listIntervalFound, err := listIntervalRepository.FindOne(map[string]interface{}{"listId": updateListIntervalCommand.ListIntervalId}) 201 listIntervalFound, err := listIntervalRepository.FindOne(map[string]interface{}{"listId": updateListIntervalCommand.ListIntervalId})
201 if err != nil { 202 if err != nil {
202 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 203 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -205,19 +206,50 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt @@ -205,19 +206,50 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt
205 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateListIntervalCommand.ListIntervalId))) 206 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateListIntervalCommand.ListIntervalId)))
206 } 207 }
207 208
208 - fmt.Printf("Command: %+v\n", updateListIntervalCommand)  
209 -  
210 - if err := listIntervalFound.Update(tool_funs.SimpleStructToMap(updateListIntervalCommand)); err != nil {  
211 - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 209 + // 获取上一个榜单
  210 + listListIntervalQuery := &query.ListListIntervalQuery {
  211 + CompanyId: listIntervalFound.CompanyId,
  212 + Offset: 1,
  213 + Limit: 1,
212 } 214 }
213 215
214 - if listIntervalUpdated, err := listIntervalRepository.Save(listIntervalFound); err != nil { 216 + //获取上个年榜时间
  217 + _, listIntervals, err := listIntervalRepository.Find(tool_funs.SimpleStructToMap(listListIntervalQuery))
  218 + if err != nil {
215 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 219 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
216 - } else {  
217 - if err := transactionContext.CommitTransaction(); err != nil {  
218 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 220 + }
  221 +
  222 + // 判断年榜时间是否和上个年榜重叠
  223 + if len(listIntervals) > 0 {
  224 + if updateListIntervalCommand.ListIntervalStartTime.Before(listIntervals[0].IntervalEndTime) || updateListIntervalCommand.ListIntervalStartTime.Equal(listIntervals[0].IntervalEndTime){
  225 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "年榜开始时间必须大于上一个年榜结束时间")
  226 + } else { // 正常更新
  227 + if err := listIntervalFound.Update(tool_funs.SimpleStructToMap(updateListIntervalCommand)); err != nil {
  228 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  229 + }
  230 +
  231 + if listIntervalUpdated, err := listIntervalRepository.Save(listIntervalFound); err != nil {
  232 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  233 + } else {
  234 + if err := transactionContext.CommitTransaction(); err != nil {
  235 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  236 + }
  237 + return listIntervalUpdated, nil
  238 + }
  239 + }
  240 + } else { // 正常更新
  241 + if err := listIntervalFound.Update(tool_funs.SimpleStructToMap(updateListIntervalCommand)); err != nil {
  242 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  243 + }
  244 +
  245 + if listIntervalUpdated, err := listIntervalRepository.Save(listIntervalFound); err != nil {
  246 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  247 + } else {
  248 + if err := transactionContext.CommitTransaction(); err != nil {
  249 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  250 + }
  251 + return listIntervalUpdated, nil
219 } 252 }
220 - return listIntervalUpdated, nil  
221 } 253 }
222 } 254 }
223 255
@@ -10,8 +10,9 @@ type ListExchangeCashActivityQuery struct { @@ -10,8 +10,9 @@ type ListExchangeCashActivityQuery struct {
10 CompanyId int64 `json:"companyId"` // 公司id 10 CompanyId int64 `json:"companyId"` // 公司id
11 ActivityNameMatch string `json:"activityNameMatch,omitempty"` // 活动名称匹配 11 ActivityNameMatch string `json:"activityNameMatch,omitempty"` // 活动名称匹配
12 //Deadline time.Time `json:"deadline,omitempty"` // 截止时间筛选 12 //Deadline time.Time `json:"deadline,omitempty"` // 截止时间筛选
13 - Offset int `json:"offset,omitempty"` // 查询偏移量  
14 - Limit int `json:"limit,omitempty"` // 查询限制条目 13 + IsEnd bool `json:"isEnd"` // 已结束活动和未结束活动筛选 true: 已结束活动 false: 未结束活动
  14 + Offset int `json:"offset,omitempty"` // 查询偏移量
  15 + Limit int `json:"limit,omitempty"` // 查询限制条目
15 } 16 }
16 17
17 func (listExchangeCashActivityQuery *ListExchangeCashActivityQuery) ValidateQuery() error { 18 func (listExchangeCashActivityQuery *ListExchangeCashActivityQuery) ValidateQuery() error {
@@ -551,6 +551,7 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas @@ -551,6 +551,7 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas
551 "offset": listExchangeCashActivityQuery.Offset, 551 "offset": listExchangeCashActivityQuery.Offset,
552 "limit": listExchangeCashActivityQuery.Limit, 552 "limit": listExchangeCashActivityQuery.Limit,
553 "countdown": 0, 553 "countdown": 0,
  554 + "isEnd": listExchangeCashActivityQuery.IsEnd,
554 }); err != nil { 555 }); err != nil {
555 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 556 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
556 } else { 557 } else {
@@ -908,7 +909,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang @@ -908,7 +909,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
908 if cashPoolUpdated == nil { 909 if cashPoolUpdated == nil {
909 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 910 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
910 } 911 }
911 - } else { // 未更新兑换活动汇率 912 + } else { // 未更新兑换活动汇率 TODO 更新截止时间
912 updateExchangeCashActivityCommand.ExchangedCash = activityFound.ExchangedCash 913 updateExchangeCashActivityCommand.ExchangedCash = activityFound.ExchangedCash
913 } 914 }
914 915
@@ -89,7 +89,14 @@ func (repository *ExchangeCashActivityRepository) Find(queryOptions map[string]i @@ -89,7 +89,14 @@ func (repository *ExchangeCashActivityRepository) Find(queryOptions map[string]i
89 query = query.Where(`exchange_cash_activity.activity_name LIKE ?`, fmt.Sprintf("%%%s%%", activityNameMatch.(string))) 89 query = query.Where(`exchange_cash_activity.activity_name LIKE ?`, fmt.Sprintf("%%%s%%", activityNameMatch.(string)))
90 } 90 }
91 if countDown, ok := queryOptions["countDown"]; ok { 91 if countDown, ok := queryOptions["countDown"]; ok {
92 - query = query.Where(`exchange_cash_activity.countDown = ?`, countDown) 92 + query = query.Where(`exchange_cash_activity.count_down = ?`, countDown)
  93 + }
  94 + if isEnd, ok := queryOptions["isEnd"]; ok {
  95 + if isEnd.(bool) {
  96 + query = query.Where(`exchange_cash_activity.count_down = ?`, 0)
  97 + } else {
  98 + query = query.Where(`exchange_cash_activity.count_down > ?`, 0)
  99 + }
93 } 100 }
94 if deadline, ok := queryOptions["deadline"]; ok && deadline != "" { 101 if deadline, ok := queryOptions["deadline"]; ok && deadline != "" {
95 t, _ := time.ParseInLocation("2006-01-02", deadline.(string), time.Local) 102 t, _ := time.ParseInLocation("2006-01-02", deadline.(string), time.Local)
@@ -394,32 +394,12 @@ func (controller *SuMoneyController) ExchangeCashListRanking() { @@ -394,32 +394,12 @@ func (controller *SuMoneyController) ExchangeCashListRanking() {
394 // 导入兑换素币清单 394 // 导入兑换素币清单
395 func (controller *SuMoneyController) ImportExchangeList () { 395 func (controller *SuMoneyController) ImportExchangeList () {
396 cashPoolService := service.NewCashPoolService(nil) 396 cashPoolService := service.NewCashPoolService(nil)
397 - //importExchangeCashListCommand := &command.ImportExchangeCashListCommand{}  
398 - //json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), importExchangeCashListCommand)  
399 where := controller.GetString("where") 397 where := controller.GetString("where")
400 - //fmt.Printf("%+v\n", importExchangeCashListCommand)  
401 - //activityId, _ := strconv.ParseInt(interface{}(importExchangeCashListCommand.Where).(map[string]interface{})["activityId"].(string), 10, 64)  
402 - //fmt.Print(activityId, "\n")  
403 - //fmt.Print(int64(interface{}(importExchangeCashListCommand.Where).(map[string]interface{})["uid"].(float64)), "\n")  
404 file, h, _ := controller.GetFile("file") 398 file, h, _ := controller.GetFile("file")
405 399
406 jsonMap := make(map[string]interface{}) 400 jsonMap := make(map[string]interface{})
407 _ = json.Unmarshal([]byte(where), &jsonMap) 401 _ = json.Unmarshal([]byte(where), &jsonMap)
408 402
409 - //if reflect.TypeOf(where).Kind() == reflect.TypeOf(jsonMap).Kind() { // 传入json  
410 - // jsonMap = map[string]interface{}{  
411 - // "activityId": where.(map[string]interface{})["activityId"],  
412 - // "uid": where["uid"],  
413 - // }  
414 - //} else { // 传入json string  
415 - // _ := json.Unmarshal([]byte(where), &jsonMap)  
416 - //}  
417 -  
418 - //fmt.Printf("%+v\n", jsonMap)  
419 -  
420 - //tmp, _ := strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 )  
421 - //fmt.Print(tmp, "\n")  
422 -  
423 // 错误信息返回 403 // 错误信息返回
424 var response utils.JsonResponse 404 var response utils.JsonResponse
425 405