diff --git a/business/partner/purchase/mtwm/order_comment.go b/business/partner/purchase/mtwm/order_comment.go index b15fd920a..31180546c 100644 --- a/business/partner/purchase/mtwm/order_comment.go +++ b/business/partner/purchase/mtwm/order_comment.go @@ -92,16 +92,28 @@ func (c *PurchaseHandler) RefreshComment(fromTime, toTime time.Time) (err error) } } - foodNameList := make([]string, 0, 0) + foodNameList := make(map[string]int, 0) for _, fn := range mtwmComment.PraiseRetailList { - foodNameList = append(foodNameList, fn.Name) + foodNameList[fn.Name] = 1 } for _, fn := range mtwmComment.CriticRetailList { - foodNameList = append(foodNameList, fn.Name) + foodNameList[fn.Name] = 1 + } + + for _, fn := range mtwmComment.CommentOrderDetail { + if len(fn.FoodName)-strings.LastIndex(fn.FoodName, ")") > 3 { + foodNameList[fn.FoodName] = 1 + } else { + foodNameList[fn.FoodName[0:strings.LastIndex(fn.FoodName, "(")]] = 1 + } + } + nameList := make([]string, 0, 0) + for k, _ := range foodNameList { + nameList = append(nameList, k) } if len(foodNameList) > 0 { - vendorOrderID, _ := dao.GetBadCommentOrderId(storeDetail.ID, startTime, endTime, foodNameList) + vendorOrderID, _ := dao.GetBadCommentOrderId(storeDetail.ID, utils.Str2Time(startDateStr), utils.Str2Time(endDateStr), nameList) if vendorOrderID != "" { orderComment.VendorOrderID2 = vendorOrderID }