|
|
@ -15,13 +15,17 @@ type CategoryItem struct {
|
|
|
|
Children []CategoryItem `json:"children"`
|
|
|
|
Children []CategoryItem `json:"children"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type ArgsCategoryAll struct {
|
|
|
|
|
|
|
|
Hidden uint // 隐藏状态 1=隐藏 2=显示
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// All @Title 获取分类
|
|
|
|
// All @Title 获取分类
|
|
|
|
func (c *category) All(ctx context.Context) (result []CategoryItem, err error) {
|
|
|
|
func (c *category) All(ctx context.Context, args ArgsCategoryAll) (result []CategoryItem, err error) {
|
|
|
|
xClient, err := client.GetClient(c)
|
|
|
|
xClient, err := client.GetClient(c)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
err = xClient.Call(ctx, "All", 0, &result)
|
|
|
|
err = xClient.Call(ctx, "All", args, &result)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -90,3 +94,18 @@ func (c *category) FindByIds(ctx context.Context, args ArgsCategoryFindByIds) (r
|
|
|
|
err = xClient.Call(ctx, "FindByIds", args, &result)
|
|
|
|
err = xClient.Call(ctx, "FindByIds", args, &result)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type ArgsChangeHidden struct {
|
|
|
|
|
|
|
|
CategoryId uint
|
|
|
|
|
|
|
|
Hidden uint // 1=隐藏 2=显示
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ChangeHidden @Title 切换隐藏状态
|
|
|
|
|
|
|
|
func (c *category) ChangeHidden(ctx context.Context, args ArgsChangeHidden) error {
|
|
|
|
|
|
|
|
xClient, err := client.GetClient(c)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
reply := 0
|
|
|
|
|
|
|
|
return xClient.Call(ctx, "ChangeHidden", args, &reply)
|
|
|
|
|
|
|
|
}
|
|
|
|