package tiktok_store

import (
	"git.rosy.net.cn/baseapi/utils"
	"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
	"git.rosy.net.cn/jx-callback/business/model"
	"git.rosy.net.cn/jx-callback/business/model/dao"
	"testing"
	"time"
)

import (
	_ "git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
	"git.rosy.net.cn/jx-callback/globals/testinit"
)

const (
	testShopVendorID = "2523687"
	testShopID       = 2
)

func init() {
	testinit.Init()
}

// 获取平台分类属性(三级分类标签)
func TestGetVendorCategories(t *testing.T) {
	result, err := new(PurchaseHandler).GetVendorCategories(jxcontext.AdminCtx)
	if err != nil {
		t.Fatal(err)
	}
	for _, v := range result {
		data := model.SkuVendorCategory{
			ModelIDCUL: model.ModelIDCUL{
				CreatedAt:    time.Now(),
				UpdatedAt:    time.Now(),
				LastOperator: "刘磊",
			},
			VendorCategoryID: v.VendorCategoryID,
			VendorID:         v.VendorID,
			Name:             v.Name,
			IsLeaf:           v.IsLeaf,
			Level:            v.Level,
			ParentID:         v.ParentID,
		}
		if err := dao.CreateEntity(dao.GetDB(), &data); err != nil {
			t.Log(utils.Format4Output(err, false))
		}
	}

	t.Log(utils.Format4Output(result, false))
}
