This commit is contained in:
邹宗楠
2024-09-14 11:22:44 +08:00
parent d1cd153f4c
commit b988c70bf7

View File

@@ -155,6 +155,8 @@ func GetMtwmCommentList4ShanGou(key string, appOrgCode string, startTime, endTim
var ( var (
db = dao.GetDB() db = dao.GetDB()
now = time.Now() now = time.Now()
errs = make([]string, 0, 0)
pageNum = 1
) )
end, _ := utils.TryStr2Time(endTime) end, _ := utils.TryStr2Time(endTime)
if end.Year() == now.Year() && end.Month() == now.Month() && end.Day() == now.Day() { if end.Year() == now.Year() && end.Month() == now.Month() && end.Day() == now.Day() {
@@ -171,7 +173,7 @@ func GetMtwmCommentList4ShanGou(key string, appOrgCode string, startTime, endTim
param := map[string]interface{}{ param := map[string]interface{}{
"wmPoiId": -1, "wmPoiId": -1,
"appType": 3, "appType": 3,
"pageNum": 1, "pageNum": pageNum,
"rate": 0, "rate": 0,
"reply": -1, "reply": -1,
"context": -1, "context": -1,
@@ -179,7 +181,7 @@ func GetMtwmCommentList4ShanGou(key string, appOrgCode string, startTime, endTim
"endDate": endTime, "endDate": endTime,
"timeType": 4, "timeType": 4,
} }
for {
commentList, err := getAPI(appOrgCode, 0, "").GetComment4ShanGou(param, true, configList[0].Value) commentList, err := getAPI(appOrgCode, 0, "").GetComment4ShanGou(param, true, configList[0].Value)
if err != nil { if err != nil {
return err return err
@@ -190,9 +192,19 @@ func GetMtwmCommentList4ShanGou(key string, appOrgCode string, startTime, endTim
// 差评订单数据 // 差评订单数据
orderCommentList := CommentListData(db, commentList, startTime, endTime) orderCommentList := CommentListData(db, commentList, startTime, endTime)
if len(orderCommentList) > 0 { if len(orderCommentList) > 0 {
return partner.CurOrderManager.OnOrderComments(orderCommentList) err2 := partner.CurOrderManager.OnOrderComments(orderCommentList)
if err2 != nil {
errs = append(errs, err2.Error())
} }
return nil }
if len(commentList) >= 10 {
pageNum += 1
} else {
break
}
}
return fmt.Errorf("%s", strings.Join(errs, ","))
} }
func CommentListData(db *dao.DaoDB, skuList []*mtwmapi.CommentsList, startTime, endTime string) []*model.OrderComment { func CommentListData(db *dao.DaoDB, skuList []*mtwmapi.CommentsList, startTime, endTime string) []*model.OrderComment {