作者 唐旭辉

清理代码

1 package command 1 package command
2 2
3 -type UpdateBusinessBonusCommand struct {  
4 - Id int64 `json:"id"`  
5 - Bonus float64 `json:"bonus"`  
6 - BonusStatus int8 `json:"bonusStatus"`  
7 - CompanyId int64 `json:"companyId"`  
8 -} 3 +// type UpdateBusinessBonusCommand struct {
  4 +// Id int64 `json:"id"`
  5 +// Bonus float64 `json:"bonus"`
  6 +// BonusStatus int8 `json:"bonusStatus"`
  7 +// CompanyId int64 `json:"companyId"`
  8 +// }
9 9
10 -func (cmd UpdateBusinessBonusCommand) ValidateCommand() error {  
11 - return nil  
12 -} 10 +// func (cmd UpdateBusinessBonusCommand) ValidateCommand() error {
  11 +// return nil
  12 +// }
1 package query 1 package query
2 2
3 -type GetBusinessBonusQuery struct {  
4 - Id int64 `json:"id"`  
5 - CompanyId int64 `json:"companyId"`  
6 -} 3 +// type GetBusinessBonusQuery struct {
  4 +// Id int64 `json:"id"`
  5 +// CompanyId int64 `json:"companyId"`
  6 +// }
1 package query 1 package query
2 2
3 -type ListBusinessBonusQuery struct { 3 +// type ListBusinessBonusQuery struct {
4 4
5 - //用户名称匹配  
6 - PartnerNameMatch string `json:"userNameMatch" `  
7 - // 查询偏离量  
8 - Offset int `json:"offset" `  
9 - // 查询限制  
10 - Limit int `json:"limit"`  
11 - PartnerId int64 `json:"partnerId"`  
12 - CompanyId int64 `json:"companyId"`  
13 -} 5 +// //用户名称匹配
  6 +// PartnerNameMatch string `json:"userNameMatch" `
  7 +// // 查询偏离量
  8 +// Offset int `json:"offset" `
  9 +// // 查询限制
  10 +// Limit int `json:"limit"`
  11 +// PartnerId int64 `json:"partnerId"`
  12 +// CompanyId int64 `json:"companyId"`
  13 +// }
@@ -120,34 +120,6 @@ func (subscriber *OrderLogSubscriber) HandleEvent(domainEvent coreDomain.DomainE @@ -120,34 +120,6 @@ func (subscriber *OrderLogSubscriber) HandleEvent(domainEvent coreDomain.DomainE
120 } 120 }
121 err = orderLogRepository.Add(&orderLog) 121 err = orderLogRepository.Add(&orderLog)
122 break 122 break
123 - // 支付订单中货品的分红  
124 - // case event.PAY_ORDER_GOOD_BONUS_EVENT:  
125 - // currentEvent := domainEvent.(event.PayOrderGoodBonus)  
126 - // adminUser, err = userRepository.FindOne(domain.UsersFindOneQuery{Id: currentEvent.AdminId})  
127 - // if err != nil {  
128 - // return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())  
129 - // }  
130 - // orderLog := domain.OrderLog{  
131 - // OperatorType: domain.ORDER_LOG_OPERATOR_ADMIN,  
132 - // OperatorId: currentEvent.AdminId,  
133 - // Operator: adminUser.Name,  
134 - // AlterTime: time.Now(),  
135 - // DataFrom: domain.ORDER_LOG_FROM,  
136 - // LogAction: "支付",  
137 - // OrderId: currentEvent.OrderId,  
138 - // GoodId: currentEvent.GoodId,  
139 - // Descript: []domain.OrderLogDescript{  
140 - // domain.OrderLogDescript{  
141 - // Title: "支付分红",  
142 - // Item: currentEvent.GoodName,  
143 - // Action: []string{  
144 - // fmt.Sprintf(`支付分红"¥%.2f"`, currentEvent.PartnerBonus),  
145 - // },  
146 - // },  
147 - // },  
148 - // }  
149 - // err = orderLogRepository.Add(&orderLog)  
150 - // break  
151 case event.BATCH_PAY_ORDER_GOOD_BONUS_EVENT: 123 case event.BATCH_PAY_ORDER_GOOD_BONUS_EVENT:
152 currentEvent := domainEvent.(event.BatchPayOrderGoodBonus) 124 currentEvent := domainEvent.(event.BatchPayOrderGoodBonus)
153 orderLog := domain.OrderLog{ 125 orderLog := domain.OrderLog{
@@ -6,20 +6,6 @@ import ( @@ -6,20 +6,6 @@ import (
6 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction" 6 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction"
7 ) 7 )
8 8
9 -// func CreateBusinessBonusService(options map[string]interface{}) (service.BusinessBonusService, error) {  
10 -// var transactionContext *transaction.TransactionContext  
11 -// if value, ok := options["transactionContext"]; ok {  
12 -// transactionContext = value.(*transaction.TransactionContext)  
13 -// }  
14 -// return domainService.NewBusinessBonusService(transactionContext), nil  
15 -// }  
16 -// var transactionContext *transaction.TransactionContext  
17 -// if value, ok := options["transactionContext"]; ok {  
18 -// transactionContext = value.(*transaction.TransactionContext)  
19 -// }  
20 -// return domainService.NewBusinessBonusService(transactionContext), nil  
21 -// }  
22 -  
23 func CreateOrderBonusService(options map[string]interface{}) (service.OrderBonusService, error) { 9 func CreateOrderBonusService(options map[string]interface{}) (service.OrderBonusService, error) {
24 var transactionContext *transaction.TransactionContext 10 var transactionContext *transaction.TransactionContext
25 if value, ok := options["transactionContext"]; ok { 11 if value, ok := options["transactionContext"]; ok {