This commit is contained in:
邹宗楠
2024-09-14 11:48:45 +08:00
parent b988c70bf7
commit 83b335a4f4

View File

@@ -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