作者 tangxvhui

Merge branch 'dev' into test

1 -# Config file for [Air](https://github.com/cosmtrek/air) in TOML format  
2 -  
3 -# Working directory  
4 -# . or absolute path, please note that the directories following must be under root.  
5 -root = "."  
6 -tmp_dir = "tmp"  
7 -  
8 -[build]  
9 -# Just plain old shell command. You could use `make` as well.  
10 -cmd = "go build -o ./tmp/main ."  
11 -# Binary file yields from `cmd`.  
12 -bin = "tmp/main"  
13 -# Customize binary.  
14 -full_bin = "APP_ENV=dev APP_USER=air ./tmp/main"  
15 -# Watch these filename extensions.  
16 -include_ext = ["go", "tpl", "tmpl", "html"]  
17 -# Ignore these filename extensions or directories.  
18 -exclude_dir = ["assets", "tmp", "vendor", "frontend/node_modules"]  
19 -# Watch these directories if you specified.  
20 -include_dir = []  
21 -# Exclude files.  
22 -exclude_file = []  
23 -# Exclude unchanged files.  
24 -exclude_unchanged = true  
25 -# This log file places in your tmp_dir.  
26 -log = "air.log"  
27 -# It's not necessary to trigger build each time file changes if it's too frequent.  
28 -delay = 1000 # ms  
29 -# Stop running old binary when build errors occur.  
30 -stop_on_error = true  
31 -# Send Interrupt signal before killing process (windows does not support this feature)  
32 -send_interrupt = false  
33 -# Delay after sending Interrupt signal  
34 -kill_delay = 500 # ms  
35 -  
36 -[log]  
37 -# Show log time  
38 -time = false  
39 -  
40 -[color]  
41 -# Customize each part's color. If no color found, use the raw app log.  
42 -main = "magenta"  
43 -watcher = "cyan"  
44 -build = "yellow"  
45 -runner = "green"  
46 -  
47 -[misc]  
48 -# Delete tmp directory on exit  
49 -clean_on_exit = true  
@@ -26,3 +26,4 @@ @@ -26,3 +26,4 @@
26 /*.exe~ 26 /*.exe~
27 /logs 27 /logs
28 download 28 download
  29 +partnermg
@@ -2,10 +2,11 @@ package service @@ -2,10 +2,11 @@ package service
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 - "github.com/linmadan/egglib-go/core/application"  
6 "strconv" 5 "strconv"
7 "time" 6 "time"
8 7
  8 + "github.com/linmadan/egglib-go/core/application"
  9 +
9 "github.com/astaxie/beego/logs" 10 "github.com/astaxie/beego/logs"
10 11
11 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/event/subscriber" 12 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/event/subscriber"
@@ -20,7 +21,7 @@ import ( @@ -20,7 +21,7 @@ import (
20 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib" 21 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib"
21 ) 22 )
22 23
23 -//OrderService 自建订单,意向单,实发订单 24 +// OrderService 自建订单,意向单,实发订单
24 type OrderInfoService struct { 25 type OrderInfoService struct {
25 } 26 }
26 27
@@ -125,7 +126,7 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder @@ -125,7 +126,7 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder
125 return orderDataReturn, cnt, nil 126 return orderDataReturn, cnt, nil
126 } 127 }
127 128
128 -//GetOrderDetail 获取订单详情 129 +// GetOrderDetail 获取订单详情
129 func (service OrderInfoService) GetOrderDetail(getOrderQuery query.GetOrderQuery) (*domain.OrderBase, error) { 130 func (service OrderInfoService) GetOrderDetail(getOrderQuery query.GetOrderQuery) (*domain.OrderBase, error) {
130 //实际业务 131 //实际业务
131 transactionContext, err := factory.CreateTransactionContext(nil) 132 transactionContext, err := factory.CreateTransactionContext(nil)
@@ -352,7 +353,7 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( @@ -352,7 +353,7 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) (
352 return newOrder, nil 353 return newOrder, nil
353 } 354 }
354 355
355 -//DeleteOrder 删除订单 356 +// DeleteOrder 删除订单
356 func (service OrderInfoService) DeleteOrder(orderId int64, companyId int64) error { 357 func (service OrderInfoService) DeleteOrder(orderId int64, companyId int64) error {
357 var ( 358 var (
358 transactionContext, _ = factory.CreateTransactionContext(nil) 359 transactionContext, _ = factory.CreateTransactionContext(nil)
@@ -393,7 +394,7 @@ func (service OrderInfoService) DeleteOrder(orderId int64, companyId int64) erro @@ -393,7 +394,7 @@ func (service OrderInfoService) DeleteOrder(orderId int64, companyId int64) erro
393 return nil 394 return nil
394 } 395 }
395 396
396 -//UpdateOrderData 编辑订单 397 +// UpdateOrderData 编辑订单
397 func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) (*domain.OrderBase, error) { 398 func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) (*domain.OrderBase, error) {
398 var ( 399 var (
399 transactionContext, _ = factory.CreateTransactionContext(nil) 400 transactionContext, _ = factory.CreateTransactionContext(nil)
@@ -581,7 +582,7 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) @@ -581,7 +582,7 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand)
581 return oldOrderData, nil 582 return oldOrderData, nil
582 } 583 }
583 584
584 -//deleteOldOrderGoods 新旧商品列表对比 585 +// deleteOldOrderGoods 新旧商品列表对比
585 func (service OrderInfoService) deleteOldOrderGoods(newGoods []domain.OrderGood, oldGoods []domain.OrderGood) (goodIds []int64) { 586 func (service OrderInfoService) deleteOldOrderGoods(newGoods []domain.OrderGood, oldGoods []domain.OrderGood) (goodIds []int64) {
586 for _, old := range oldGoods { 587 for _, old := range oldGoods {
587 var hasIn bool 588 var hasIn bool
@@ -598,7 +599,7 @@ func (service OrderInfoService) deleteOldOrderGoods(newGoods []domain.OrderGood, @@ -598,7 +599,7 @@ func (service OrderInfoService) deleteOldOrderGoods(newGoods []domain.OrderGood,
598 return 599 return
599 } 600 }
600 601
601 -//DisableOrEnable 开启关闭订单 602 +// DisableOrEnable 开启关闭订单
602 func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand) error { 603 func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand) error {
603 var ( 604 var (
604 transactionContext, _ = factory.CreateTransactionContext(nil) 605 transactionContext, _ = factory.CreateTransactionContext(nil)
@@ -642,7 +643,7 @@ func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand) @@ -642,7 +643,7 @@ func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand)
642 return nil 643 return nil
643 } 644 }
644 645
645 -//PageListOrderBouns 获取订单的分红列表 646 +// PageListOrderBouns 获取订单的分红列表
646 func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrderBonusQuery) ([]map[string]interface{}, int, error) { 647 func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrderBonusQuery) ([]map[string]interface{}, int, error) {
647 transactionContext, err := factory.CreateTransactionContext(nil) 648 transactionContext, err := factory.CreateTransactionContext(nil)
648 if err != nil { 649 if err != nil {
@@ -726,10 +727,11 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde @@ -726,10 +727,11 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde
726 goods []domain.OrderGood 727 goods []domain.OrderGood
727 hasBonusPercent bool 728 hasBonusPercent bool
728 ) 729 )
729 - goods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{OrderId: orders[i].Id}) 730 + goods, _, _ = orderGoodRepository.Find(domain.OrderGoodFindQuery{OrderId: orders[i].Id})
730 for ii := range goods { 731 for ii := range goods {
731 if goods[ii].PartnerBonusPercent >= 0 { 732 if goods[ii].PartnerBonusPercent >= 0 {
732 hasBonusPercent = true 733 hasBonusPercent = true
  734 + break
733 } 735 }
734 } 736 }
735 listIndex := listOrderQuery.Offset + (1 + i) 737 listIndex := listOrderQuery.Offset + (1 + i)
@@ -738,6 +740,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde @@ -738,6 +740,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde
738 "createTime": orders[i].CreateTime.Local().Format("2006-01-02 15:04:05"), 740 "createTime": orders[i].CreateTime.Local().Format("2006-01-02 15:04:05"),
739 "updateTime": orders[i].UpdateTime.Local().Format("2006-01-02 15:04:05"), 741 "updateTime": orders[i].UpdateTime.Local().Format("2006-01-02 15:04:05"),
740 "id": fmt.Sprint(orders[i].Id), 742 "id": fmt.Sprint(orders[i].Id),
  743 + "saleDate": orders[i].SaleDate.Local().Format("2006-01-02"),
741 "shipmentsId": orders[i].DeliveryCode, 744 "shipmentsId": orders[i].DeliveryCode,
742 "partner": orders[i].PartnerInfo.PartnerName, 745 "partner": orders[i].PartnerInfo.PartnerName,
743 "dividendsReceivable": fmt.Sprint(orders[i].GetCurrentPartnerBonus()), 746 "dividendsReceivable": fmt.Sprint(orders[i].GetCurrentPartnerBonus()),
@@ -764,7 +767,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde @@ -764,7 +767,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde
764 return resp, cnt, nil 767 return resp, cnt, nil
765 } 768 }
766 769
767 -//PayPartnerBonusWithOrderBestshop 支付分红 770 +// PayPartnerBonusWithOrderBestshop 支付分红
768 func (service OrderInfoService) PayPartnerBonus(orderId int64, goodId int64, adminId int64) error { 771 func (service OrderInfoService) PayPartnerBonus(orderId int64, goodId int64, adminId int64) error {
769 var ( 772 var (
770 transactionContext, _ = factory.CreateTransactionContext(nil) 773 transactionContext, _ = factory.CreateTransactionContext(nil)
@@ -799,7 +802,7 @@ func (service OrderInfoService) PayPartnerBonus(orderId int64, goodId int64, adm @@ -799,7 +802,7 @@ func (service OrderInfoService) PayPartnerBonus(orderId int64, goodId int64, adm
799 return nil 802 return nil
800 } 803 }
801 804
802 -//UpdateOrderRemarkBonus 订单分红详情,更新备注 805 +// UpdateOrderRemarkBonus 订单分红详情,更新备注
803 func (service OrderInfoService) UpdateOrderRemarkBonus(orderId int64, adminId int64, remark string) error { 806 func (service OrderInfoService) UpdateOrderRemarkBonus(orderId int64, adminId int64, remark string) error {
804 var ( 807 var (
805 transactionContext, _ = factory.CreateTransactionContext(nil) 808 transactionContext, _ = factory.CreateTransactionContext(nil)