This commit is contained in:
邹宗楠
2024-08-05 14:40:26 +08:00
parent 6390826aaf
commit 9e2462da8f

View File

@@ -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 { for _, fn := range mtwmComment.PraiseRetailList {
foodNameList = append(foodNameList, fn.Name) foodNameList[fn.Name] = 1
} }
for _, fn := range mtwmComment.CriticRetailList { 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 { 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 != "" { if vendorOrderID != "" {
orderComment.VendorOrderID2 = vendorOrderID orderComment.VendorOrderID2 = vendorOrderID
} }