作者 陈志颖

test:分红 预算

@@ -901,6 +901,11 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -901,6 +901,11 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
901 if dividendsEstimatesSaved, err := dividendsEstimateRepository.SaveMany(dividendsEstimates); err != nil { 901 if dividendsEstimatesSaved, err := dividendsEstimateRepository.SaveMany(dividendsEstimates); err != nil {
902 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 902 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
903 } else { 903 } else {
  904 + endSave := time.Since(startSave)
  905 + log.Logger.Info("保存预算单耗时", map[string]interface{}{
  906 + "保存预算单耗时": endSave.Seconds(),
  907 + })
  908 +
904 // 获取产品ID 909 // 获取产品ID
905 orderGoodSavedIds := make([]int64, 0) 910 orderGoodSavedIds := make([]int64, 0)
906 for _, dividendsEstimate := range dividendsEstimates { 911 for _, dividendsEstimate := range dividendsEstimates {
@@ -1059,14 +1064,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -1059,14 +1064,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
1059 failedReasonStr = "无" 1064 failedReasonStr = "无"
1060 } 1065 }
1061 1066
1062 - elapsed := time.Since(start)  
1063 - fmt.Println("该函数执行完成耗时:", elapsed)  
1064 -  
1065 - endSave := time.Since(startSave)  
1066 - log.Logger.Info("保存预算单耗时", map[string]interface{}{  
1067 - "保存预算单耗时": endSave.Seconds(),  
1068 - })  
1069 -  
1070 return map[string]interface{}{ 1067 return map[string]interface{}{
1071 "report": fmt.Sprintf("已完成%d单订单分红预算,生成%d单分红预算,%d笔订单分红预算失败,失败原因:%s", len(estimateSuccessfullyDividendsOrders), successfullyCount, len(estimateFailedDividendsOrders), failedReasonStr), 1068 "report": fmt.Sprintf("已完成%d单订单分红预算,生成%d单分红预算,%d笔订单分红预算失败,失败原因:%s", len(estimateSuccessfullyDividendsOrders), successfullyCount, len(estimateFailedDividendsOrders), failedReasonStr),
1072 }, nil 1069 }, nil
@@ -15,6 +15,7 @@ type LoggerConfig struct { @@ -15,6 +15,7 @@ type LoggerConfig struct {
15 Level int `json:"level,omitempty"` 15 Level int `json:"level,omitempty"`
16 Filename string `json:"filename,omitempty"` 16 Filename string `json:"filename,omitempty"`
17 MaxSize int `json:"maxsize,omitempty"` 17 MaxSize int `json:"maxsize,omitempty"`
  18 + Maxlines int `json:"maxlines,omitempty"`
18 MaxBackups int `json:"max_backups,omitempty"` 19 MaxBackups int `json:"max_backups,omitempty"`
19 MaxAge int `json:"max_age,omitempty"` 20 MaxAge int `json:"max_age,omitempty"`
20 Compress bool `json:"compress,omitempty"` 21 Compress bool `json:"compress,omitempty"`
@@ -117,6 +118,7 @@ func NewBeegoLog(conf LoggerConfig) *BeegoLog { @@ -117,6 +118,7 @@ func NewBeegoLog(conf LoggerConfig) *BeegoLog {
117 logger.EnableFuncCallDepth(true) 118 logger.EnableFuncCallDepth(true)
118 logger.SetLogFuncCallDepth(5) 119 logger.SetLogFuncCallDepth(5)
119 logger.SetPrefix(constant.LOG_PREFIX) 120 logger.SetPrefix(constant.LOG_PREFIX)
  121 + logger.Async()
120 return &BeegoLog{ 122 return &BeegoLog{
121 beeLogger: logger, 123 beeLogger: logger,
122 } 124 }
@@ -13,7 +13,8 @@ func init() { @@ -13,7 +13,8 @@ func init() {
13 Logger = NewBeegoLog(LoggerConfig{ 13 Logger = NewBeegoLog(LoggerConfig{
14 Filename: constant.LOG_FILE, 14 Filename: constant.LOG_FILE,
15 Level: 7, 15 Level: 7,
16 - MaxSize: 1024 * 1024 * 6, 16 + MaxSize: 1024 * 1024 * 2,
  17 + Maxlines: 10000000,
17 }) 18 })
18 } else if constant.LOG_FRAMEWORK == "logrus" { 19 } else if constant.LOG_FRAMEWORK == "logrus" {
19 Logger = logrus.NewLogrusLogger() 20 Logger = logrus.NewLogrusLogger()