新增商城配置接口

finance
黄伟 2 years ago
parent c459660cbc
commit 542d319b32

@ -1,8 +1,12 @@
package customer
import "git.oa00.com/supply-chain/service/customer/service"
import (
"git.oa00.com/supply-chain/service/customer/service"
"git.oa00.com/supply-chain/service/customer/sku"
)
type Customer struct {
User user
Service service.Service
Sku sku.Sku
}

@ -0,0 +1,52 @@
package sku
import (
"context"
"git.oa00.com/supply-chain/service/client"
)
type banner struct {
}
type BannerItem struct {
Id uint `json:"id"`
Img string `json:"img"`
SkuId uint `json:"skuId"`
}
// All @Title 全部轮播图
func (b *banner) All(ctx context.Context) (reply []BannerItem, err error) {
xClient, err := client.GetClient(b)
if err != nil {
return
}
args := 0
err = xClient.Call(ctx, "All", args, &reply)
return
}
type ArgsSkuBannerEdit struct {
Id uint
SkuId uint
Img string
}
// Edit @Title 编辑轮播图
func (b *banner) Edit(ctx context.Context, args ArgsSkuBannerEdit) (err error) {
xClient, err := client.GetClient(b)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Del @Title 删除轮播图
func (b *banner) Del(ctx context.Context, id uint) (err error) {
xClient, err := client.GetClient(b)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Del", id, &reply)
}

@ -0,0 +1,65 @@
package sku
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
)
type item struct {
}
type ReplySkuItemHandle struct {
SkuId uint `json:"skuId"`
Error string `json:"error"`
}
type ArgsSkuItemAdd struct {
SkuTypeId uint
SkuIds []uint
}
// Add @Title 添加商品
func (i *item) Add(ctx context.Context, args []ArgsSkuItemAdd) (reply []ReplySkuItemHandle, err error) {
xClient, err := client.GetClient(i)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "Add", args, &reply)
return
}
// Del @Title 删除商品
func (i *item) Del(ctx context.Context, ids []uint) error {
xClient, err := client.GetClient(i)
if err != nil {
return err
}
reply := 0
return xClient.Call(ctx, "Del", ids, &reply)
}
type ArgsSkuItemLists struct {
SkuTypeId uint
Page bean.Page
}
type ReplySkuItemLists struct {
Total int64 `json:"total"`
Lists []SkuItem `json:"lists"`
}
type SkuItem struct {
Id uint `json:"id"`
SkuId uint `json:"skuId"`
}
// Lists @Title 商品列表
func (i *item) Lists(ctx context.Context, args ArgsSkuItemLists) (reply ReplySkuItemLists, err error) {
xClient, err := client.GetClient(i)
if err != nil {
return ReplySkuItemLists{}, err
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}

@ -0,0 +1,19 @@
package sku
type sale struct {
}
type SaleHandleItem struct {
SkuId uint `json:"skuId"`
Error string `json:"error"`
}
type ReplySaleSkuItemLists struct {
Total int64 `json:"total"`
Lists []SaleSkuItem `json:"lists"`
}
type SaleSkuItem struct {
Id uint `json:"id"`
SkuId uint `json:"skuId"`
}

@ -0,0 +1,8 @@
package sku
type Sku struct {
Banner banner
Type skuType
Sale sale
Item item
}

@ -0,0 +1,59 @@
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, "Add", id, &reply)
}
type TypeItem struct {
Id uint `json:"id"`
Name string `json:"name"`
}
// All @Title 全部分类
func (s *skuType) All(ctx context.Context, id uint) (reply []TypeItem, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "All", id, &reply)
return
}
Loading…
Cancel
Save