Files
baseapi/platformapi/mtwmapi/comment_test.go
邹宗楠 3d5ac6505c 1
2024-08-01 15:21:32 +08:00

42 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package mtwmapi
import (
"fmt"
"strings"
"testing"
)
func TestCommentQuery(t *testing.T) {
result, err := api.CommentQuery("7821254", "20240730", "20240731", 0, 0, CommentReplyStatusAll)
if err != nil {
t.Fatal(err)
}
for _, mtwmComment := range result {
foodNameList := make(map[string]int, 0)
for _, fn := range mtwmComment.PraiseRetailList {
foodNameList[fn.Name] = 1
}
for _, fn := range mtwmComment.CriticRetailList {
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
}
}
fmt.Println(foodNameList)
}
//t.Log(utils.Format4Output(result, false))
}
func TestCommentAddReply(t *testing.T) {
err := api.CommentAddReply("24617232", 2947288966, "非常抱歉让您没有得到十分满意的购物体验,我们会及时与您联系进行确认并解决问题!")
if err != nil {
t.Fatal(err)
}
}