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.
|
|
|
package sku
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"git.oa00.com/supply-chain/service/client"
|
|
|
|
)
|
|
|
|
|
|
|
|
type skuType struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
type ArgsSkuTypeEdit struct {
|
|
|
|
Id uint
|
|
|
|
Name string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Edit @Title 编辑分类
|
|
|
|
func (s *skuType) Edit(ctx context.Context, args ArgsSkuTypeEdit) error {
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
reply := 0
|
|
|
|
return xClient.Call(ctx, "Edit", args, &reply)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add @Title 添加分类
|
|
|
|
func (s *skuType) Add(ctx context.Context, name string) error {
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
reply := 0
|
|
|
|
return xClient.Call(ctx, "Add", name, &reply)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Del @Title 删除分类
|
|
|
|
func (s *skuType) Del(ctx context.Context, id uint) error {
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
reply := 0
|
|
|
|
return xClient.Call(ctx, "Del", id, &reply)
|
|
|
|
}
|
|
|
|
|
|
|
|
type TypeItem struct {
|
|
|
|
Id uint `json:"id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// All @Title 全部分类
|
|
|
|
func (s *skuType) All(ctx context.Context) (reply []TypeItem, err error) {
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
args := 0
|
|
|
|
err = xClient.Call(ctx, "All", args, &reply)
|
|
|
|
return
|
|
|
|
}
|