Files
baseapi/platformapi/ebaiapi/ugc.go
2019-02-18 16:39:03 +08:00

44 lines
1.2 KiB
Go

package ebaiapi
import (
"time"
"git.rosy.net.cn/baseapi/utils"
)
func (a *API) OrderRatesGet(shopID string, baiduShopID int64, startTime, endTime time.Time, replyStatus int) (commentList []map[string]interface{}, err error) {
params := a.genShopIDParams(shopID, baiduShopID)
if !utils.IsTimeZero(startTime) {
params["startTime"] = startTime
}
if !utils.IsTimeZero(endTime) {
params["endTime"] = endTime
}
if replyStatus >= 0 {
params["replyStatus"] = replyStatus
}
pageNo := 1
for {
params["page"] = pageNo
result, err := a.AccessAPI("ugc.orderrates.get", params)
if err != nil {
return nil, err
}
data := result.Data.(map[string]interface{})
commentList = append(commentList, utils.Slice2MapSlice(data["comment_list"].([]interface{}))...)
total := int(utils.MustInterface2Int64(data["total"]))
if len(commentList) >= total {
break
}
}
return commentList, err
}
func (a *API) OrderRatesReply(shopID string, baiduShopID int64, commentID, content string) (err error) {
params := a.genShopIDParams(shopID, baiduShopID)
params["comment_id"] = commentID
params["content"] = content
_, err = a.AccessAPI("ugc.reply", params)
return err
}