You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.4 KiB
63 lines
1.4 KiB
package recook
|
|
|
|
import (
|
|
"live/app/lib"
|
|
"net/url"
|
|
"strconv"
|
|
)
|
|
|
|
const (
|
|
actionHistory = "/lives/order/history"
|
|
actionLiveOrderData = "/lives/order/liveorderdata"
|
|
)
|
|
|
|
type order struct {
|
|
}
|
|
|
|
var Order *order
|
|
|
|
func init() {
|
|
Order = &order{}
|
|
}
|
|
|
|
type ArgsHistoryList struct {
|
|
List []GoodsInfo `json:"list"`
|
|
Total uint `json:"total"`
|
|
}
|
|
|
|
// @Title 获取会员购买历史商品
|
|
func (o *order) GetHistoryGoods(id string, token, deviceType string, page lib.Page) (result *ArgsHistoryList, err error) {
|
|
result = &ArgsHistoryList{}
|
|
err = RecookClient.Exec(actionHistory, url.Values{
|
|
"page": []string{strconv.Itoa(page.GetPage())},
|
|
"limit": []string{strconv.Itoa(page.GetLimit())},
|
|
}, result, map[string]string{
|
|
"X-Recook-ID": id,
|
|
"X-Recook-Token": token,
|
|
"Device-Type": deviceType,
|
|
})
|
|
if err != nil {
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
type ArgsLiveOrderData struct {
|
|
UserCount uint `json:"userCount"`
|
|
CommissionSum string `json:"commissionSum"`
|
|
AmountSum string `json:"amountSum"`
|
|
}
|
|
|
|
// @Title 获取直播数据统计
|
|
func (o *order) LiveOrderData(userId, liveId uint) (result *ArgsLiveOrderData, err error) {
|
|
result = &ArgsLiveOrderData{}
|
|
err = RecookClient.Exec(actionLiveOrderData, url.Values{
|
|
"liveId": []string{strconv.FormatUint(uint64(liveId), 10)},
|
|
"liveUserId": []string{strconv.FormatUint(uint64(userId), 10)},
|
|
}, result)
|
|
if err != nil {
|
|
return
|
|
}
|
|
return
|
|
}
|