37 lines
994 B
Go
37 lines
994 B
Go
package mtwmapi
|
||
|
||
import (
|
||
"fmt"
|
||
"strings"
|
||
"testing"
|
||
"time"
|
||
)
|
||
|
||
func TestCommentQuery(t *testing.T) {
|
||
result, err := api.CommentQuery("8694203", "20240711", "20240716", 0, 0, CommentReplyStatusAll)
|
||
if err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
for _, mtwmComment := range result {
|
||
foodNameList := make([]string, len(mtwmComment.CommentOrderDetail))
|
||
for _, fn := range mtwmComment.CommentOrderDetail {
|
||
if len(fn.FoodName)-strings.LastIndex(fn.FoodName, ")") > 3 {
|
||
foodNameList = append(foodNameList, fn.FoodName)
|
||
} else {
|
||
foodNameList = append(foodNameList, fn.FoodName[0:strings.LastIndex(fn.FoodName, "(")])
|
||
}
|
||
}
|
||
fmt.Println(foodNameList)
|
||
time.Sleep(5 * time.Second)
|
||
}
|
||
|
||
//t.Log(utils.Format4Output(result, false))
|
||
}
|
||
|
||
func TestCommentAddReply(t *testing.T) {
|
||
err := api.CommentAddReply("24617232", 2947288966, "非常抱歉让您没有得到十分满意的购物体验,我们会及时与您联系进行确认并解决问题!")
|
||
if err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
}
|