diff --git a/customer/customer.go b/customer/customer.go index aef31de..5b89f2a 100644 --- a/customer/customer.go +++ b/customer/customer.go @@ -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 } diff --git a/customer/sku/banner.go b/customer/sku/banner.go new file mode 100644 index 0000000..4dfa398 --- /dev/null +++ b/customer/sku/banner.go @@ -0,0 +1,67 @@ +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) +} + +type ArgsSkuBannerAdd struct { + SkuId uint + Img string +} + +// Add @Title 添加轮播图 +func (b *banner) Add(ctx context.Context, args ArgsSkuBannerAdd) error { + xClient, err := client.GetClient(b) + if err != nil { + return err + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} diff --git a/customer/sku/item.go b/customer/sku/item.go new file mode 100644 index 0000000..8171e24 --- /dev/null +++ b/customer/sku/item.go @@ -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 +} diff --git a/customer/sku/sale.go b/customer/sku/sale.go new file mode 100644 index 0000000..61b16a8 --- /dev/null +++ b/customer/sku/sale.go @@ -0,0 +1,76 @@ +package sku + +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "git.oa00.com/supply-chain/service/lib/bean" +) + +type sale struct { +} + +type SaleHandleItem struct { + SkuId uint `json:"skuId"` + Error string `json:"error"` +} + +// Add @Title 添加 +func (s *sale) Add(ctx context.Context, skuIds []uint) (reply []SaleSkuItem, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "Add", skuIds, &reply) + return +} + +// Lists @Title 商品列表 +func (s *sale) Lists(ctx context.Context, page bean.Page) (reply ReplySaleSkuItemLists, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return ReplySaleSkuItemLists{}, err + } + err = xClient.Call(ctx, "Lists", page, &reply) + return +} + +type ReplySaleSkuItemLists struct { + Total int64 `json:"total"` + Lists []SaleSkuItem `json:"lists"` +} + +type SaleSkuItem struct { + Id uint `json:"id"` + SkuId uint `json:"skuId"` +} + +// Del @Title 删除商品 +func (s *sale) Del(ctx context.Context, ids []uint) error { + xClient, err := client.GetClient(s) + if err != nil { + return err + } + reply := 0 + return xClient.Call(ctx, "Del", ids, &reply) +} + +// SetImg @Title 设置区域导图 +func (s *sale) SetImg(ctx context.Context, path string) error { + xClient, err := client.GetClient(s) + if err != nil { + return err + } + reply := 0 + return xClient.Call(ctx, "SetImg", path, &reply) +} + +// GetImg @Title 获取区域导图 +func (s *sale) GetImg(ctx context.Context) (reply string, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return "", err + } + args := 0 + err = xClient.Call(ctx, "GetImg", args, &reply) + return +} diff --git a/customer/sku/sku.go b/customer/sku/sku.go new file mode 100644 index 0000000..a2ffb5e --- /dev/null +++ b/customer/sku/sku.go @@ -0,0 +1,8 @@ +package sku + +type Sku struct { + Banner banner + Type skuType + Sale sale + Item item +} diff --git a/customer/sku/type.go b/customer/sku/type.go new file mode 100644 index 0000000..9ad61ed --- /dev/null +++ b/customer/sku/type.go @@ -0,0 +1,60 @@ +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 +} diff --git a/customer/user.go b/customer/user.go index 92fd31e..c319df4 100644 --- a/customer/user.go +++ b/customer/user.go @@ -136,6 +136,7 @@ type ArgsUserServiceInfo struct { } type ReplyUserServiceInfo struct { CustomerId uint `json:"customerId"` + AppKey string `json:"appKey"` AppSecret string `json:"appSecret"` ExpirationAt int64 `json:"expirationAt"` } diff --git a/supply/sku.go b/supply/sku.go index 3869e0b..0f63d78 100644 --- a/supply/sku.go +++ b/supply/sku.go @@ -308,3 +308,37 @@ func (s *sku) ChangeData(ctx context.Context, args ArgsSkuChangeData) (err error err = xClient.Call(ctx, "ChangeData", args, &reply) return } + +type ByIdsSkuItem struct { + Id uint `json:"id"` + Name string `json:"name"` // 名称 + BrandName string `json:"brandName"` // 品牌名称 + FirstCategoryId uint `json:"firstCategoryId"` // 一级分类id + SecondCategoryId uint `json:"secondCategoryId"` // 二级分类id + ThirdCategoryId uint `json:"thirdCategoryId"` // 三级分类id + SupplyPrice decimal.Decimal `json:"supplyPrice"` // 采购价 + GuidePrice decimal.Decimal `json:"guidePrice"` // 指导价 + ImgUrl string `json:"imgUrl"` // 商品主图 + PlatformStatus uint `json:"platformStatus"` // 平台状态 1=上架 2=下架 + SourceName string `json:"sourceName"` // 供应商名称 + SourceSkuId string `json:"sourceSkuId"` // 源skuId + SourceStatus uint `json:"sourceStatus"` // 供应商状态 1=上架 2=下架 + CustomerPrice decimal.Decimal `json:"customerPrice"` // 供货最高价 + CustomerProfitRate decimal.Decimal `json:"customerProfitRate"` // 供货利润率 供货利润/供货最高价% + AdjustType uint `json:"adjustType"` // 加价类型 + AdjustPrice decimal.Decimal `json:"adjustPrice"` // 加价金额 + AfterAdjustType uint `json:"afterAdjustType"` // 改价后加价类型 + AfterAdjustPrice decimal.Decimal `json:"afterAdjustPrice"` // 改价后加价金额 + Handle uint `json:"handle"` // 1=未处理 2=已处理 + Reason string `json:"reason"` // 驳回原因 +} + +// FindByIds @Title 根据Ids查询sku信息 +func (s *sku) FindByIds(ctx context.Context, ids []uint) (reply []ByIdsSkuItem, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "FindByIds", ids, &reply) + return +}