From 83b335a4f4dc46b1cee9b4325a05a1856aa83088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sat, 14 Sep 2024 11:48:45 +0800 Subject: [PATCH] 1 --- .../partner/purchase/mtwm/order_comment.go | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/business/partner/purchase/mtwm/order_comment.go b/business/partner/purchase/mtwm/order_comment.go index a87404a8d..c69562601 100644 --- a/business/partner/purchase/mtwm/order_comment.go +++ b/business/partner/purchase/mtwm/order_comment.go @@ -213,6 +213,10 @@ func CommentListData(db *dao.DaoDB, skuList []*mtwmapi.CommentsList, startTime, orderCommentList := make([]*model.OrderComment, 0, len(skuList)) for _, mtwmComment := range skuList { + store, err := dao.GetStoreDetailByVendorStoreID(db, utils.Int2Str(mtwmComment.WmPoiId), model.VendorIDMTWM, "") + if err != nil { + continue + } createdTime, _ := utils.TryStr2Time(mtwmComment.CreateTime) orderComment := &model.OrderComment{ VendorOrderID: utils.Int64ToStr(mtwmComment.Id), // 美团评价不能得到订单号,以评价ID代替 @@ -260,26 +264,20 @@ func CommentListData(db *dao.DaoDB, skuList []*mtwmapi.CommentsList, startTime, foodNameList[strings.TrimSuffix(fn.FoodName[0:strings.LastIndex(fn.FoodName, "(")], " ")] = 1 } } - store, err := dao.GetStoreDetailByVendorStoreID(db, orderComment.VendorStoreID, orderComment.VendorID, "") - if err == nil { - orderComment.StoreID = store.ID - if len(foodNameList) > 0 { - foodName := make([]string, 0, len(foodNameList)) - for fnl, _ := range foodNameList { - foodName = append(foodName, fnl) - } - vendorOrderID, _ := dao.GetBadCommentOrderId(store.ID, st.AddDate(0, 0, -7), et.AddDate(0, 0, 7), foodName) - if vendorOrderID != "" { - orderComment.VendorOrderID2 = vendorOrderID - } + + orderComment.StoreID = store.ID + if len(foodNameList) > 0 { + foodName := make([]string, 0, len(foodNameList)) + for fnl, _ := range foodNameList { + foodName = append(foodName, fnl) + } + vendorOrderID, _ := dao.GetBadCommentOrderId(store.ID, st.AddDate(0, 0, -7), et.AddDate(0, 0, 7), foodName) + if vendorOrderID != "" { + orderComment.VendorOrderID2 = vendorOrderID } - orderCommentList = append(orderCommentList, orderComment) - } else { - orderComment.StoreID = 999999 - orderComment.VendorOrderID2 = orderComment.VendorOrderID - orderCommentList = append(orderCommentList, orderComment) - globals.SugarLogger.Debugf("获取美团外卖差评列表,失败:%s,%v", orderComment.VendorStoreID, err) } + orderCommentList = append(orderCommentList, orderComment) + } return orderCommentList