package tiktok_api

import (
	"fmt"
	order_getSettleBillDetailV3_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_getSettleBillDetailV3/request"
	"io/ioutil"
	"net/http"
	"strings"
	"testing"
)

func TestBillDetail(t *testing.T) {
	orderDetail, err := a.GetTiktokOrderDetail("6924471291044304141")
	if err != nil {
		fmt.Println(err)
	}

	childrenOrderList := make([]string, 0, 0)
	for _, v := range orderDetail.SkuOrderList {
		childrenOrderList = append(childrenOrderList, v.OrderId)
	}
	childrenOrderList = append(childrenOrderList, "6924471291044304141")

	date, datae, err := a.GetSettleBillDetailV3(&order_getSettleBillDetailV3_request.OrderGetSettleBillDetailV3Param{
		Size:    20,
		OrderId: strings.Join(childrenOrderList, ","),
	})
	fmt.Println(date)
	fmt.Println(datae)
	fmt.Println(err)

}

func TestLen(t *testing.T) {
	url := "https://www.jxc4.com/v2/store/sku/UpdateStoresSkus"

	param := ``
	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeIDs\"\r\n\r\n[" + param + "]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n[{\"nameID\":8461,\"unitPrice\":2600},{\"nameID\":9325,\"unitPrice\":1800},{\"nameID\":15045,\"unitPrice\":500},{\"nameID\":15026,\"unitPrice\":450},{\"nameID\":15007,\"unitPrice\":220},{\"nameID\":15019,\"unitPrice\":700},{\"nameID\":8075561,\"unitPrice\":350},{\"nameID\":10247,\"unitPrice\":600},{\"nameID\":15055,\"unitPrice\":900},{\"nameID\":11044,\"unitPrice\":580},{\"nameID\":15021,\"unitPrice\":300},{\"nameID\":15042,\"unitPrice\":650},{\"nameID\":11479,\"unitPrice\":2600},{\"nameID\":8779,\"unitPrice\":1200},{\"nameID\":15066,\"unitPrice\":700},{\"nameID\":8077377,\"unitPrice\":2200},{\"nameID\":14984,\"unitPrice\":800},{\"nameID\":14993,\"unitPrice\":500},{\"nameID\":15095,\"unitPrice\":750},{\"nameID\":9105,\"unitPrice\":1100},{\"nameID\":15005,\"unitPrice\":300},{\"nameID\":15107,\"unitPrice\":500},{\"nameID\":15029,\"unitPrice\":520},{\"nameID\":15027,\"unitPrice\":1100}]\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"causeFlag\"\r\n\r\n16\r\n-----011000010111000001101001--\r\n\r\n")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("token", "TOKEN.V2.2452A93EEB9111EC9B06525400E86DC0.20231208-110713.localpass.E252DAB0957611EE96A5525400E86DC0.[18981810340]")
	req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
}

func TestName(t *testing.T) {
	a := 1
	a = a | 1
	fmt.Println(a)
}
