package cms

import (
	"fmt"
	"testing"

	"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
	"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
	"git.rosy.net.cn/jx-callback/business/model"
	"git.rosy.net.cn/jx-callback/business/partner"
	"git.rosy.net.cn/jx-callback/business/partner/putils"
)

func TestFreeBatchStoreSkuInfo(t *testing.T) {
	var sku2Delete []*partner.StoreSkuInfo
	for i := 0; i < 123; i++ {
		sku2Delete = append(sku2Delete, &partner.StoreSkuInfo{
			SkuID: i + 1,
		})
	}

	ctx := jxcontext.AdminCtx
	var parentTask tasksch.ITask
	isContinueWhenError := true
	handler, _ := partner.GetPurchasePlatformFromVendorID(model.VendorIDEBAI).(partner.ISingleStoreStoreSkuHandler)
	_, err := putils.FreeBatchStoreSkuInfo("删除门店商品", func(task tasksch.ITask, batchedStoreSkuList []*partner.StoreSkuInfo) (result interface{}, successCount int, err error) {
		t.Log(len(batchedStoreSkuList))
		return nil, 0, err
	}, ctx, parentTask, sku2Delete, handler.GetStoreSkusBatchSize(partner.FuncDeleteStoreSkus), isContinueWhenError)
	if err != nil {
		t.Fatal(err)
	}
}

func TestGetTimeMixByInt(t *testing.T) {
	const (
		time1 = 1100
		time2 = 2300
		time3 = 1200
		time4 = 2400
	)
	a, b := GetTimeMixByInt(time1, time2, time3, time4)
	fmt.Println(a, b)
}
