1
This commit is contained in:
@@ -2,6 +2,7 @@ package mtwmapi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -11,31 +12,46 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestCommentQuery(t *testing.T) {
|
func TestCommentQuery(t *testing.T) {
|
||||||
result, err := api.CommentQuery("7756297", "20250415", "20250507", 0, 20, CommentReplyStatusAll)
|
result, err := api.CommentQuery("27674533", "20250420", "20250514", 40, 20, CommentReplyStatusAll)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
for _, mtwmComment := range result {
|
for _, mtwmComment := range result {
|
||||||
foodNameList := make(map[string]int, 0)
|
if mtwmComment.CommentID == 8667486211 {
|
||||||
for _, fn := range mtwmComment.PraiseRetailList {
|
|
||||||
foodNameList[fn.Name] = 1
|
|
||||||
}
|
|
||||||
for _, fn := range mtwmComment.CriticRetailList {
|
|
||||||
foodNameList[fn.Name] = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, fn := range mtwmComment.CommentOrderDetail {
|
foodNameList := make(map[string]int, 0)
|
||||||
if len(fn.FoodName)-strings.LastIndex(fn.FoodName, ")") > 3 {
|
skuIdMap := make(map[string]int, 0)
|
||||||
foodNameList[strings.TrimSpace(fn.FoodName)] = 1
|
for _, fn := range mtwmComment.PraiseRetailList {
|
||||||
} else {
|
skuIdMap[fn.SkuId] = 1
|
||||||
foodNameList[strings.TrimSpace(fn.FoodName[0:strings.LastIndex(fn.FoodName, "(")])] = 1
|
foodNameList[fn.Name] = 1
|
||||||
}
|
}
|
||||||
|
for _, fn := range mtwmComment.CriticRetailList {
|
||||||
|
skuIdMap[fn.SkuId] = 1
|
||||||
|
foodNameList[fn.Name] = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, fn := range mtwmComment.CommentOrderDetail {
|
||||||
|
if len(fn.FoodName)-strings.LastIndex(fn.FoodName, ")") > 3 {
|
||||||
|
foodNameList[strings.TrimSpace(fn.FoodName)] = 1
|
||||||
|
} else {
|
||||||
|
foodNameList[strings.TrimSpace(fn.FoodName[0:strings.LastIndex(fn.FoodName, "(")])] = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nameList := make([]string, 0, 0)
|
||||||
|
skuIdList := make([]int, 0, 0)
|
||||||
|
for k, _ := range foodNameList {
|
||||||
|
nameList = append(nameList, k)
|
||||||
|
}
|
||||||
|
for k, _ := range skuIdMap {
|
||||||
|
skuIdList = append(skuIdList, utils.Str2Int(k))
|
||||||
|
}
|
||||||
|
|
||||||
|
globals.SugarLogger.Debugf("----------nameList:= %s", utils.Format4Output(nameList, false))
|
||||||
|
globals.SugarLogger.Debugf("----------skuIdList:= %s", utils.Format4Output(skuIdList, false))
|
||||||
|
break
|
||||||
}
|
}
|
||||||
fmt.Println(foodNameList)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(result[19])
|
|
||||||
//t.Log(utils.Format4Output(result, false))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCommentAddReply(t *testing.T) {
|
func TestCommentAddReply(t *testing.T) {
|
||||||
|
|||||||
@@ -333,8 +333,6 @@ func (a *API) RetailSkuPrice(trackInfo, poiCode string, foodData []*BareStoreFoo
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
failedFoodList, err = handleRetailBatchResult(result)
|
failedFoodList, err = handleRetailBatchResult(result)
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("--------result err:= %v", err)
|
|
||||||
globals.SugarLogger.Debugf("--------result result:= %v", utils.Format4Output(result, false))
|
|
||||||
return failedFoodList, err
|
return failedFoodList, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user