|
|
|
package jd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"git.oa00.com/supply-chain/service/client"
|
|
|
|
"git.oa00.com/supply-chain/service/lib/bean"
|
|
|
|
)
|
|
|
|
|
|
|
|
type category struct {
|
|
|
|
}
|
|
|
|
type ArgsCategoryList struct {
|
|
|
|
ThirdCategoryId uint
|
|
|
|
Page bean.Page
|
|
|
|
}
|
|
|
|
|
|
|
|
type CategoryItem struct {
|
|
|
|
Id uint `json:"id"`
|
|
|
|
FirstCategoryName string `json:"firstCategoryName"`
|
|
|
|
SecondCategoryName string `json:"secondCategoryName"`
|
|
|
|
ThirdCategoryName string `json:"thirdCategoryName"`
|
|
|
|
SupplyCategoryId uint `json:"supplyCategoryId"`
|
|
|
|
}
|
|
|
|
type ReplyCategoryList struct {
|
|
|
|
Lists []CategoryItem `json:"lists"`
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Lists @Title 获取品牌匹配列表
|
|
|
|
func (c *category) Lists(ctx context.Context, args ArgsCategoryList) (reply ReplyCategoryList, err error) {
|
|
|
|
xClient, err := client.GetClient(c)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
type ArgsCategoryEdit struct {
|
|
|
|
CategoryId uint // 分类id
|
|
|
|
FirstCategoryName string // 一级分类名称
|
|
|
|
SecondCategoryName string // 二级分类名称
|
|
|
|
ThirdCategoryName string // 三级分类名称
|
|
|
|
SupplyCategoryId uint // 匹配分类id
|
|
|
|
}
|
|
|
|
|
|
|
|
// Edit @Title 编辑品牌匹配
|
|
|
|
func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) error {
|
|
|
|
reply := 0
|
|
|
|
xClient, err := client.GetClient(c)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return xClient.Call(ctx, "Edit", args, &reply)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Select @Title 类目筛选
|
|
|
|
func (c *category) Select(ctx context.Context) (reply []CategoryItem, err error) {
|
|
|
|
args := 0
|
|
|
|
xClient, err := client.GetClient(c)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
err = xClient.Call(ctx, "Select", args, &reply)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
type ArgsCategoryImport struct {
|
|
|
|
First string
|
|
|
|
Second string
|
|
|
|
Third string
|
|
|
|
SupplyCategoryId uint
|
|
|
|
}
|
|
|
|
|
|
|
|
// Import @Title 导入
|
|
|
|
func (*category) Import(ctx context.Context, args ArgsCategoryImport) (err error) {
|
|
|
|
reply := 0
|
|
|
|
xClient, err := client.GetClient(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
err = xClient.Call(ctx, "Import", args, &reply)
|
|
|
|
return
|
|
|
|
}
|