Compare commits
No commits in common. 'test-sian' and 'master' have entirely different histories.
@ -0,0 +1,67 @@
|
|||||||
|
package batchSku
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package batchSku
|
||||||
|
|
||||||
|
type BatchSku struct {
|
||||||
|
Banner banner
|
||||||
|
Type skuType
|
||||||
|
Sale sale
|
||||||
|
Item item
|
||||||
|
HotType skuHotType
|
||||||
|
HotItem hotItem
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
package batchSku
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
)
|
||||||
|
|
||||||
|
type hotItem struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplySkuHotItemHandle struct {
|
||||||
|
SkuId uint `json:"skuId"`
|
||||||
|
Error string `json:"error"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSkuHotItemAdd struct {
|
||||||
|
SkuTypeId uint
|
||||||
|
SkuIds []uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add @Title 添加商品
|
||||||
|
func (i *hotItem) Add(ctx context.Context, args ArgsSkuHotItemAdd) (reply []ReplySkuHotItemHandle, err error) {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Add", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSkuHotItemDel struct {
|
||||||
|
SkuTypeId uint
|
||||||
|
SkuIds []uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// Del @Title 删除商品
|
||||||
|
func (i *hotItem) Del(ctx context.Context, args ArgsSkuHotItemDel) error {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Del", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSkuHotItemLists struct {
|
||||||
|
SkuTypeId uint
|
||||||
|
SkuId uint
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplySkuHotItemLists struct {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
Lists []SkuHotItem `json:"lists"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SkuHotItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
SkuId uint `json:"skuId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 商品列表
|
||||||
|
func (i *hotItem) Lists(ctx context.Context, args ArgsSkuHotItemLists) (reply ReplySkuHotItemLists, err error) {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return ReplySkuHotItemLists{}, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DelAll @Title 删除全部商品
|
||||||
|
func (i *hotItem) DelAll(ctx context.Context, skuTypeId uint) error {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "DelAll", skuTypeId, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsBySkuHotIds struct {
|
||||||
|
SkuIds []uint
|
||||||
|
SkuTypeId uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindBySkuIds @Title 根据SkuId查询数据
|
||||||
|
func (i *hotItem) FindBySkuIds(ctx context.Context, args ArgsBySkuHotIds) (reply []SkuHotItem, err error) {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindBySkuIds", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package batchSku
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type skuHotType struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSkuHotTypeEdit struct {
|
||||||
|
Id uint
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit @Title 编辑分类
|
||||||
|
func (s *skuHotType) Edit(ctx context.Context, args ArgsSkuHotTypeEdit) error {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Edit", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add @Title 添加分类
|
||||||
|
func (s *skuHotType) 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 *skuHotType) 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 HotTypeItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// All @Title 全部分类
|
||||||
|
func (s *skuHotType) All(ctx context.Context) (reply []HotTypeItem, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
args := 0
|
||||||
|
err = xClient.Call(ctx, "All", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
package batchSku
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSkuItemDel struct {
|
||||||
|
SkuTypeId uint
|
||||||
|
SkuIds []uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// Del @Title 删除商品
|
||||||
|
func (i *item) Del(ctx context.Context, args ArgsSkuItemDel) error {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Del", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSkuItemLists struct {
|
||||||
|
SkuTypeId uint
|
||||||
|
SkuId 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
|
||||||
|
}
|
||||||
|
|
||||||
|
// DelAll @Title 删除全部商品
|
||||||
|
func (i *item) DelAll(ctx context.Context, skuTypeId uint) error {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "DelAll", skuTypeId, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsBySkuIds struct {
|
||||||
|
SkuIds []uint
|
||||||
|
SkuTypeId uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindBySkuIds @Title 根据SkuId查询数据
|
||||||
|
func (i *item) FindBySkuIds(ctx context.Context, args ArgsBySkuIds) (reply []SkuItem, err error) {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindBySkuIds", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,102 @@
|
|||||||
|
package batchSku
|
||||||
|
|
||||||
|
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 []SaleHandleItem, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Add", skuIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSaleLists struct {
|
||||||
|
SkuId uint
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 商品列表
|
||||||
|
func (s *sale) Lists(ctx context.Context, args ArgsSaleLists) (reply ReplySaleSkuItemLists, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return ReplySaleSkuItemLists{}, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &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
|
||||||
|
}
|
||||||
|
|
||||||
|
// DelAll @Title 删除全部商品
|
||||||
|
func (s *sale) DelAll(ctx context.Context) error {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
args := 0
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "DelAll", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindBySkuIds @Title 根据SkuId查询数据
|
||||||
|
func (s *sale) FindBySkuIds(ctx context.Context, skuIds []uint) (reply []SaleSkuItem, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindBySkuIds", skuIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package batchSku
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
@ -1,12 +1,18 @@
|
|||||||
package customer
|
package customer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"git.oa00.com/supply-chain/service/customer/batchSku"
|
||||||
|
"git.oa00.com/supply-chain/service/customer/data"
|
||||||
|
"git.oa00.com/supply-chain/service/customer/finance"
|
||||||
"git.oa00.com/supply-chain/service/customer/service"
|
"git.oa00.com/supply-chain/service/customer/service"
|
||||||
"git.oa00.com/supply-chain/service/customer/sku"
|
"git.oa00.com/supply-chain/service/customer/sku"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Customer struct {
|
type Customer struct {
|
||||||
User user
|
User user
|
||||||
Service service.Service
|
Service service.Service
|
||||||
Sku sku.Sku
|
Sku sku.Sku
|
||||||
|
BatchSku batchSku.BatchSku
|
||||||
|
Finance finance.Finance
|
||||||
|
Data data.Data
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
type Data struct {
|
||||||
|
Wallet wallet
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
type wallet struct {
|
||||||
|
}
|
||||||
|
type ArgsWalletMonthCount struct {
|
||||||
|
StartAt string // 年份
|
||||||
|
EndAt string // 月份
|
||||||
|
}
|
||||||
|
type WalletMonthCountItem struct {
|
||||||
|
UserId uint `json:"userId"`
|
||||||
|
UserName string `json:"userName"`
|
||||||
|
BeforePeriod decimal.Decimal `json:"beforePeriod"` // 期初
|
||||||
|
RechargeAmount decimal.Decimal `json:"rechargeAmount"` // 充值
|
||||||
|
PlaceAmount decimal.Decimal `json:"placeAmount"` // 下单
|
||||||
|
RefundAmount decimal.Decimal `json:"refundAmount"` // 退款
|
||||||
|
AfterPeriod decimal.Decimal `json:"afterPeriod"` // 期末
|
||||||
|
}
|
||||||
|
|
||||||
|
// MonthCount @Title 月消费统计
|
||||||
|
func (w *wallet) MonthCount(ctx context.Context, args ArgsWalletMonthCount) (reply []WalletMonthCountItem, err error) {
|
||||||
|
xClient, err := client.GetClient(w)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "MonthCount", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
package finance
|
||||||
|
|
||||||
|
type Finance struct {
|
||||||
|
Wallet wallet
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package finance
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
type wallet struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsWalletDetail struct {
|
||||||
|
Year uint // 年份
|
||||||
|
Month uint // 月份
|
||||||
|
}
|
||||||
|
|
||||||
|
type WalletItem struct {
|
||||||
|
CustomerName string `json:"customerName"` // 客户名称
|
||||||
|
CreatedAt int64 `json:"createdAt"` // 交易时间
|
||||||
|
Type uint `json:"type"` // 交易类型
|
||||||
|
Amount decimal.Decimal `json:"amount"` // 交易金额
|
||||||
|
AfterAmount decimal.Decimal `json:"afterAmount"` // 交易后余额
|
||||||
|
TradeChannel string `json:"tradeChannel"` // 交易渠道
|
||||||
|
TradeSerialSn string `json:"tradeSerialSn"` // 交易流水号
|
||||||
|
Remark string `json:"remark"` // 交易备注
|
||||||
|
}
|
||||||
|
|
||||||
|
// WalletDetail @Title 余额统计
|
||||||
|
func (w *wallet) WalletDetail(ctx context.Context, args ArgsWalletDetail) (reply []WalletItem, err error) {
|
||||||
|
xClient, err := client.GetClient(w)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "WalletDetail", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsUserWallet struct {
|
||||||
|
Year uint // 年份
|
||||||
|
Month uint // 月份
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserWalletItem struct {
|
||||||
|
CustomerName string `json:"customerName"`
|
||||||
|
BeforeAmount decimal.Decimal `json:"beforeAmount"` // 期初余额
|
||||||
|
AfterAmount decimal.Decimal `json:"afterAmount"` // 期末余额
|
||||||
|
ConsumeAmount decimal.Decimal `json:"consumeAmount"` // 消费金额
|
||||||
|
ReturnAmount decimal.Decimal `json:"returnAmount"` // 退款金额
|
||||||
|
RechargeAmount decimal.Decimal `json:"rechargeAmount"` // 充值金额
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserWallet @Title 客户余额
|
||||||
|
func (w *wallet) UserWallet(ctx context.Context, args ArgsWalletDetail) (reply []UserWalletItem, err error) {
|
||||||
|
xClient, err := client.GetClient(w)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "UserWallet", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -1,5 +0,0 @@
|
|||||||
package audit
|
|
||||||
|
|
||||||
type Audit struct {
|
|
||||||
Supply supply
|
|
||||||
}
|
|
@ -1,101 +0,0 @@
|
|||||||
package audit
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"git.oa00.com/supply-chain/service/client"
|
|
||||||
)
|
|
||||||
|
|
||||||
type supply struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
type ArgsSupplyApply struct {
|
|
||||||
ApplyUserId uint // 申请人id
|
|
||||||
CustomerId uint // 客户id
|
|
||||||
RateId uint // 费率id
|
|
||||||
ExpirationAt int64 // 到期时间
|
|
||||||
Enclosure string // 附件
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply @Title 申请
|
|
||||||
func (s *supply) Apply(ctx context.Context, args ArgsSupplyApply) error {
|
|
||||||
reply := 0
|
|
||||||
xClient, err := client.GetClient(s)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return xClient.Call(ctx, "Apply", args, &reply)
|
|
||||||
}
|
|
||||||
|
|
||||||
type ArgsSupplyAdopt struct {
|
|
||||||
AuditUserId uint // 审核人id
|
|
||||||
UserServiceId uint // 客户服务id
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adopt @Title 审核通过
|
|
||||||
func (s *supply) Adopt(ctx context.Context, args ArgsSupplyAdopt) error {
|
|
||||||
reply := 0
|
|
||||||
xClient, err := client.GetClient(s)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return xClient.Call(ctx, "Adopt", args, &reply)
|
|
||||||
}
|
|
||||||
|
|
||||||
type ArgsSupplyReject struct {
|
|
||||||
AuditUserId uint // 审核人id
|
|
||||||
UserServiceId uint // 客户服务id
|
|
||||||
Reason string // 驳回原因
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reject @Title 驳回
|
|
||||||
func (s *supply) Reject(ctx context.Context, args ArgsSupplyReject) error {
|
|
||||||
reply := 0
|
|
||||||
xClient, err := client.GetClient(s)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return xClient.Call(ctx, "Reject", args, &reply)
|
|
||||||
}
|
|
||||||
|
|
||||||
type ReplySupplyInfo struct {
|
|
||||||
Id uint `json:"id"`
|
|
||||||
UserName string `json:"userName"`
|
|
||||||
ApplyUserId uint `json:"applyUserId"`
|
|
||||||
ApplyAt int64 `json:"applyAt"`
|
|
||||||
ServiceId uint `json:"serviceId"`
|
|
||||||
ServiceName string `json:"serviceName"`
|
|
||||||
ExpirationAt int64 `json:"expirationAt"`
|
|
||||||
RateId uint `json:"rateId"`
|
|
||||||
Enclosure string `json:"enclosure"`
|
|
||||||
AuditStatus uint `json:"auditStatus"`
|
|
||||||
AuditAt int64 `json:"auditAt"`
|
|
||||||
Reason string `json:"reason"`
|
|
||||||
AuditUserId uint `json:"auditUserId"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Info @Title 详情
|
|
||||||
func (s *supply) Info(ctx context.Context, userServiceId uint) (reply ReplySupplyInfo, err error) {
|
|
||||||
xClient, err := client.GetClient(s)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = xClient.Call(ctx, "Info", userServiceId, &reply)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
type ReplyProof struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
ChannelId uint `json:"channelId"` // 用户Id
|
|
||||||
AppKey string `json:"appKey"`
|
|
||||||
AppSecret string `json:"appSecret"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetProof @Title 获取凭证
|
|
||||||
func (s *supply) GetProof(ctx context.Context, userServiceId uint) (reply ReplyProof, err error) {
|
|
||||||
xClient, err := client.GetClient(s)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = xClient.Call(ctx, "GetProof", userServiceId, &reply)
|
|
||||||
return
|
|
||||||
}
|
|
@ -0,0 +1,96 @@
|
|||||||
|
package sku
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
)
|
||||||
|
|
||||||
|
type hotItem struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplySkuHotItemHandle struct {
|
||||||
|
SkuId uint `json:"skuId"`
|
||||||
|
Error string `json:"error"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSkuHotItemAdd struct {
|
||||||
|
SkuTypeId uint
|
||||||
|
SkuIds []uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add @Title 添加商品
|
||||||
|
func (i *hotItem) Add(ctx context.Context, args ArgsSkuHotItemAdd) (reply []ReplySkuHotItemHandle, err error) {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Add", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSkuHotItemDel struct {
|
||||||
|
SkuTypeId uint
|
||||||
|
SkuIds []uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// Del @Title 删除商品
|
||||||
|
func (i *hotItem) Del(ctx context.Context, args ArgsSkuHotItemDel) error {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Del", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSkuHotItemLists struct {
|
||||||
|
SkuTypeId uint
|
||||||
|
SkuId uint
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplySkuHotItemLists struct {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
Lists []SkuHotItem `json:"lists"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SkuHotItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
SkuId uint `json:"skuId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 商品列表
|
||||||
|
func (i *hotItem) Lists(ctx context.Context, args ArgsSkuHotItemLists) (reply ReplySkuHotItemLists, err error) {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return ReplySkuHotItemLists{}, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DelAll @Title 删除全部商品
|
||||||
|
func (i *hotItem) DelAll(ctx context.Context, skuTypeId uint) error {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "DelAll", skuTypeId, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsBySkuHotIds struct {
|
||||||
|
SkuIds []uint
|
||||||
|
SkuTypeId uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindBySkuIds @Title 根据SkuId查询数据
|
||||||
|
func (i *hotItem) FindBySkuIds(ctx context.Context, args ArgsBySkuHotIds) (reply []SkuHotItem, err error) {
|
||||||
|
xClient, err := client.GetClient(i)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindBySkuIds", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package sku
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type skuHotType struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSkuHotTypeEdit struct {
|
||||||
|
Id uint
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit @Title 编辑分类
|
||||||
|
func (s *skuHotType) Edit(ctx context.Context, args ArgsSkuHotTypeEdit) error {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Edit", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add @Title 添加分类
|
||||||
|
func (s *skuHotType) 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 *skuHotType) 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 HotTypeItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// All @Title 全部分类
|
||||||
|
func (s *skuHotType) All(ctx context.Context) (reply []HotTypeItem, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
args := 0
|
||||||
|
err = xClient.Call(ctx, "All", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -1,8 +1,10 @@
|
|||||||
package sku
|
package sku
|
||||||
|
|
||||||
type Sku struct {
|
type Sku struct {
|
||||||
Banner banner
|
Banner banner
|
||||||
Type skuType
|
Type skuType
|
||||||
Sale sale
|
Sale sale
|
||||||
Item item
|
Item item
|
||||||
|
HotType skuHotType
|
||||||
|
HotItem hotItem
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,77 @@
|
|||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
)
|
||||||
|
|
||||||
|
type cash struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsCashLists struct {
|
||||||
|
Search CashSearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type CashSearch struct {
|
||||||
|
Status uint // 状态 1=待审核 2=通过 3=驳回
|
||||||
|
UserName string // 客户名称
|
||||||
|
}
|
||||||
|
|
||||||
|
type CashItem struct {
|
||||||
|
Id uint
|
||||||
|
UserId uint // 客户id
|
||||||
|
UserName string // 客户名称
|
||||||
|
BkName string // 银行名称
|
||||||
|
BankCode string // 银行卡号
|
||||||
|
BankName string // 银行账户名
|
||||||
|
AuditUserId uint // 审核人
|
||||||
|
Status uint // 审核状态 1=待审核 2=通过 3=驳回
|
||||||
|
Reason string // 驳回原因
|
||||||
|
CreatedAt int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyCashLists struct {
|
||||||
|
Lists []CashItem
|
||||||
|
Total int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 列表
|
||||||
|
func (cash *cash) Lists(ctx context.Context, args ArgsCashLists) (reply ReplyCashLists, err error) {
|
||||||
|
xClient, err := client.GetClient(cash)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsCashAdopt struct {
|
||||||
|
CashId uint // 提款id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adopt @Title 审核通过
|
||||||
|
func (cash *cash) Adopt(ctx context.Context, args ArgsCashAdopt) error {
|
||||||
|
xClient, err := client.GetClient(cash)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Adopt", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsCashReject struct {
|
||||||
|
CashId uint // 提款id
|
||||||
|
Reason string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reject @Title 审核驳回
|
||||||
|
func (cash *cash) Reject(ctx context.Context, args ArgsCashReject) error {
|
||||||
|
xClient, err := client.GetClient(cash)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Reject", args, &reply)
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type message struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
MessageTypeOrder = messageType{
|
||||||
|
Type: 1,
|
||||||
|
TypeName: "零售订单",
|
||||||
|
}
|
||||||
|
MessageTypeAfterOrder = messageType{
|
||||||
|
Type: 2,
|
||||||
|
TypeName: "售后订单",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
type messageType struct {
|
||||||
|
Type uint
|
||||||
|
TypeName string
|
||||||
|
}
|
||||||
|
type ArgsMessagePublish struct {
|
||||||
|
CustomerId uint // 客户id
|
||||||
|
Message string // 消息内容
|
||||||
|
Type messageType // 消息类型
|
||||||
|
TypeId uint // 消息来源id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Publish @Title 推送消息
|
||||||
|
func (m *message) Publish(ctx context.Context, args ArgsMessagePublish) error {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(m)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Publish", args, &reply)
|
||||||
|
}
|
@ -0,0 +1,102 @@
|
|||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
)
|
||||||
|
|
||||||
|
type real struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsUserRealLists struct {
|
||||||
|
Search UserRealSearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserRealSearch struct {
|
||||||
|
UserName string
|
||||||
|
AuditStatus uint // 状态 1=待审核 2=审核通过 3=审核驳回
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyUserRealLists struct {
|
||||||
|
Lists []UserRealItem
|
||||||
|
Total int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserRealItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
UserName string `json:"userName"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
CardImg string `json:"cardImg"`
|
||||||
|
AuditStatus uint `json:"auditStatus"`
|
||||||
|
AuditUserId uint `json:"auditUserId"`
|
||||||
|
AuditAt int64 `json:"auditAt"`
|
||||||
|
Reason string `json:"reason"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List @Title 实名认证列表
|
||||||
|
func (r *real) List(ctx context.Context, args ArgsUserRealLists) (reply ReplyUserRealLists, err error) {
|
||||||
|
xClient, err := client.GetClient(r)
|
||||||
|
if err != nil {
|
||||||
|
return ReplyUserRealLists{}, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "List", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyUserRealInfo struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
UserName string `json:"userName"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
CardImg string `json:"cardImg"`
|
||||||
|
AuditStatus uint `json:"auditStatus"`
|
||||||
|
AuditUserId uint `json:"auditUserId"`
|
||||||
|
AuditAt int64 `json:"auditAt"`
|
||||||
|
Reason string `json:"reason"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info @Title 审核详情
|
||||||
|
func (r *real) Info(ctx context.Context, RealId uint) (reply ReplyUserRealInfo, err error) {
|
||||||
|
xClient, err := client.GetClient(r)
|
||||||
|
if err != nil {
|
||||||
|
return ReplyUserRealInfo{}, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Info", RealId, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsUserRealAdopt struct {
|
||||||
|
RealId uint
|
||||||
|
AuditUserId uint // 审核人Id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adopt @Title 审核通过
|
||||||
|
func (r *real) Adopt(ctx context.Context, args ArgsUserRealAdopt) error {
|
||||||
|
xClient, err := client.GetClient(r)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Adopt", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsUserRealReject struct {
|
||||||
|
RealId uint
|
||||||
|
AuditUserId uint // 审核人Id
|
||||||
|
Reason string // 驳回原因
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reject @Title 审核驳回
|
||||||
|
func (r *real) Reject(ctx context.Context, args ArgsUserRealReject) error {
|
||||||
|
xClient, err := client.GetClient(r)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Reject", args, &reply)
|
||||||
|
}
|
@ -1,7 +1,11 @@
|
|||||||
package user
|
package user
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
Deposit deposit // 充值
|
Deposit deposit // 充值
|
||||||
DepositAudit depositAudit // 充值审核
|
DepositAudit depositAudit // 充值审核
|
||||||
Wallet wallet // 钱包
|
Wallet wallet // 钱包
|
||||||
|
Cash cash // 余额提现
|
||||||
|
Message message // 消息
|
||||||
|
WalletHistory walletHistory // 消费记录
|
||||||
|
Real real // 实名认证
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
type walletHistory struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
WalletHistoryOrderIdAsc = 1 // 排序 id正序
|
||||||
|
WalletHistoryOrderIdDesc = 2 // 排序 id 倒序
|
||||||
|
)
|
||||||
|
|
||||||
|
type ArgsWalletHistoryLists struct {
|
||||||
|
Search WalletHistorySearch
|
||||||
|
Page bean.Page
|
||||||
|
Orders []uint
|
||||||
|
}
|
||||||
|
|
||||||
|
type WalletHistorySearch struct {
|
||||||
|
StartTime string // 格式 2006-01-02 15:04:05 开始时间
|
||||||
|
EndTime string // 格式 2006-01-02 15:04:05 截止时间
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyWalletHistoryList struct {
|
||||||
|
Lists []WalletHistoryItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
type WalletHistoryItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
UserId uint `json:"userId"`
|
||||||
|
UserName string `json:"userName"`
|
||||||
|
Type uint `json:"type"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
BeforeAmount decimal.Decimal `json:"beforeAmount"`
|
||||||
|
Amount decimal.Decimal `json:"amount"`
|
||||||
|
AfterAmount decimal.Decimal `json:"afterAmount"`
|
||||||
|
TradeChannel string `json:"tradeChannel"`
|
||||||
|
TradeSerialSn string `json:"tradeSerialSn"`
|
||||||
|
Remark string `json:"remark"`
|
||||||
|
ServiceId uint `json:"serviceId"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
ServiceName string `json:"serviceName"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 消费记录
|
||||||
|
func (w *walletHistory) Lists(ctx context.Context, args ArgsWalletHistoryLists) (reply ReplyWalletHistoryList, err error) {
|
||||||
|
xClient, err := client.GetClient(w)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
type Data struct {
|
||||||
|
Order order
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
type order struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsOrderLists struct {
|
||||||
|
StartCreatedAt string
|
||||||
|
EndCreatedAt string
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyOrderLists struct {
|
||||||
|
Lists []OrderItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OrderItem struct {
|
||||||
|
OrderSubSn string `json:"orderSubSn"` // 订单号
|
||||||
|
SourceOrderSn string `json:"sourceOrderSn"` // 供应商订单号(云交易外部订单号)
|
||||||
|
Status uint `json:"status"` // 订单状态
|
||||||
|
CreatedAt int64 `json:"createdAt"` // 创建时间
|
||||||
|
LadingBillAt int64 `json:"ladingBillAt"` // 支付时间
|
||||||
|
StockOutAt int64 `json:"stockOutAt"` // 发货时间
|
||||||
|
FinishAt int64 `json:"finishAt"` // 确认收获时间
|
||||||
|
ProcureTotalPrice decimal.Decimal `json:"procureTotalPrice"` // 采购商品金额
|
||||||
|
ProcureFreightPrice decimal.Decimal `json:"procureFreightPrice"` // 应付运费
|
||||||
|
ProcurePrice decimal.Decimal `json:"procurePrice"` // 采购合计金额
|
||||||
|
ServiceFee decimal.Decimal `json:"serviceFee"` // 技术服务费 采购合金金额*1%
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 订单列表
|
||||||
|
func (o *order) Lists(ctx context.Context, args ArgsOrderLists) (reply ReplyOrderLists, err error) {
|
||||||
|
xClient, err := client.GetClient(o)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "PayOrderList", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -1,8 +1,15 @@
|
|||||||
package jd
|
package jd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.oa00.com/supply-chain/service/jd/data"
|
||||||
|
"git.oa00.com/supply-chain/service/jd/jdsdk"
|
||||||
|
)
|
||||||
|
|
||||||
type Jd struct {
|
type Jd struct {
|
||||||
Task task
|
Task task
|
||||||
Brand brand
|
Brand brand
|
||||||
Category category
|
Category category
|
||||||
Sku sku
|
Sku sku
|
||||||
|
Jdsdk jdsdk.Jdsdk
|
||||||
|
Data data.Data
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package jdsdk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
order2 "git.oa00.com/go/jdsdk/order"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type afterSale struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info @Title 售后详情
|
||||||
|
func (a *afterSale) Info(ctx context.Context, afsServiceId uint64) (reply order2.AfterSaleInfo, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Info", afsServiceId, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package jdsdk
|
||||||
|
|
||||||
|
type Jdsdk struct {
|
||||||
|
Order order
|
||||||
|
Sku sku
|
||||||
|
AfterSale afterSale
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package jdsdk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
order2 "git.oa00.com/go/jdsdk/order"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type order struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cancel @Title 订单取消 京东订单id
|
||||||
|
func (o *order) Cancel(ctx context.Context, orderId string) (reply order2.OrderInfo, err error) {
|
||||||
|
xClient, err := client.GetClient(o)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Cancel", orderId, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package jdsdk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
sku2 "git.oa00.com/go/jdsdk/sku"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type sku struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDetail @Title 获取商品详情 sku最大20
|
||||||
|
func (s *sku) GetDetail(ctx context.Context, jdSkuIds []uint64) (reply []sku2.Detail, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "GetDetail", jdSkuIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPriceList @Title 获取商品价格列表 最大100
|
||||||
|
func (s *sku) GetPriceList(ctx context.Context, jdSkuIds []uint64) (reply []sku2.PriceItem, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "GetPriceList", jdSkuIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,244 @@
|
|||||||
|
package consul
|
||||||
|
|
||||||
|
import (
|
||||||
|
"path"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/rpcxio/libkv"
|
||||||
|
"github.com/rpcxio/libkv/store"
|
||||||
|
"github.com/rpcxio/libkv/store/consul"
|
||||||
|
"github.com/smallnest/rpcx/client"
|
||||||
|
"github.com/smallnest/rpcx/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
consul.Register()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConsulDiscovery is a consul service discovery.
|
||||||
|
// It always returns the registered servers in consul.
|
||||||
|
type ConsulDiscovery struct {
|
||||||
|
basePath string
|
||||||
|
kv store.Store
|
||||||
|
pairsMu sync.RWMutex
|
||||||
|
pairs []*client.KVPair
|
||||||
|
chans []chan []*client.KVPair
|
||||||
|
mu sync.Mutex
|
||||||
|
// -1 means it always retry to watch until zookeeper is ok, 0 means no retry.
|
||||||
|
RetriesAfterWatchFailed int
|
||||||
|
|
||||||
|
filter client.ServiceDiscoveryFilter
|
||||||
|
|
||||||
|
stopCh chan struct{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewConsulDiscovery returns a new ConsulDiscovery.
|
||||||
|
func NewConsulDiscovery(basePath, servicePath string, consulAddr []string, options *store.Config) (*ConsulDiscovery, error) {
|
||||||
|
kv, err := libkv.NewStore(store.CONSUL, consulAddr, options)
|
||||||
|
if err != nil {
|
||||||
|
log.Infof("cannot create store: %v", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewConsulDiscoveryStore(basePath+"/"+servicePath, kv)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewConsulDiscoveryStore returns a new ConsulDiscovery with specified store.
|
||||||
|
func NewConsulDiscoveryStore(basePath string, kv store.Store) (*ConsulDiscovery, error) {
|
||||||
|
if basePath[0] == '/' {
|
||||||
|
basePath = basePath[1:]
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(basePath) > 1 && strings.HasSuffix(basePath, "/") {
|
||||||
|
basePath = basePath[:len(basePath)-1]
|
||||||
|
}
|
||||||
|
|
||||||
|
d := &ConsulDiscovery{basePath: basePath, kv: kv}
|
||||||
|
d.stopCh = make(chan struct{})
|
||||||
|
|
||||||
|
ps, err := kv.List(basePath)
|
||||||
|
if err != nil && err != store.ErrKeyNotFound {
|
||||||
|
log.Infof("cannot get services of from registry: %v, err: %v", basePath, err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
pairs := make([]*client.KVPair, 0, len(ps))
|
||||||
|
prefix := d.basePath + "/"
|
||||||
|
for _, p := range ps {
|
||||||
|
if path.Dir(p.Key) != d.basePath {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
k := strings.TrimPrefix(p.Key, prefix)
|
||||||
|
pair := &client.KVPair{Key: k, Value: string(p.Value)}
|
||||||
|
if d.filter != nil && !d.filter(pair) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
pairs = append(pairs, pair)
|
||||||
|
}
|
||||||
|
d.pairsMu.Lock()
|
||||||
|
d.pairs = pairs
|
||||||
|
d.pairsMu.Unlock()
|
||||||
|
d.RetriesAfterWatchFailed = -1
|
||||||
|
go d.watch()
|
||||||
|
return d, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewConsulDiscoveryTemplate returns a new ConsulDiscovery template.
|
||||||
|
func NewConsulDiscoveryTemplate(basePath string, consulAddr []string, options *store.Config) (*ConsulDiscovery, error) {
|
||||||
|
if basePath[0] == '/' {
|
||||||
|
basePath = basePath[1:]
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(basePath) > 1 && strings.HasSuffix(basePath, "/") {
|
||||||
|
basePath = basePath[:len(basePath)-1]
|
||||||
|
}
|
||||||
|
|
||||||
|
kv, err := libkv.NewStore(store.CONSUL, consulAddr, options)
|
||||||
|
if err != nil {
|
||||||
|
log.Infof("cannot create store: %v", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewConsulDiscoveryStore(basePath, kv)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clone clones this ServiceDiscovery with new servicePath.
|
||||||
|
func (d *ConsulDiscovery) Clone(servicePath string) (client.ServiceDiscovery, error) {
|
||||||
|
return NewConsulDiscoveryStore(d.basePath+"/"+servicePath, d.kv)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetFilter sets the filer.
|
||||||
|
func (d *ConsulDiscovery) SetFilter(filter client.ServiceDiscoveryFilter) {
|
||||||
|
d.filter = filter
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetServices returns the servers
|
||||||
|
func (d *ConsulDiscovery) GetServices() []*client.KVPair {
|
||||||
|
d.pairsMu.RLock()
|
||||||
|
defer d.pairsMu.RUnlock()
|
||||||
|
return d.pairs
|
||||||
|
}
|
||||||
|
|
||||||
|
// WatchService returns a nil chan.
|
||||||
|
func (d *ConsulDiscovery) WatchService() chan []*client.KVPair {
|
||||||
|
d.mu.Lock()
|
||||||
|
defer d.mu.Unlock()
|
||||||
|
|
||||||
|
ch := make(chan []*client.KVPair, 10)
|
||||||
|
d.chans = append(d.chans, ch)
|
||||||
|
return ch
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *ConsulDiscovery) RemoveWatcher(ch chan []*client.KVPair) {
|
||||||
|
d.mu.Lock()
|
||||||
|
defer d.mu.Unlock()
|
||||||
|
|
||||||
|
var chans []chan []*client.KVPair
|
||||||
|
for _, c := range d.chans {
|
||||||
|
if c == ch {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
chans = append(chans, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
d.chans = chans
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *ConsulDiscovery) watch() {
|
||||||
|
defer func() {
|
||||||
|
d.kv.Close()
|
||||||
|
}()
|
||||||
|
for {
|
||||||
|
var err error
|
||||||
|
var c <-chan []*store.KVPair
|
||||||
|
var tempDelay time.Duration
|
||||||
|
|
||||||
|
retry := d.RetriesAfterWatchFailed
|
||||||
|
for d.RetriesAfterWatchFailed < 0 || retry >= 0 {
|
||||||
|
c, err = d.kv.WatchTree(d.basePath, d.stopCh)
|
||||||
|
if err != nil {
|
||||||
|
if d.RetriesAfterWatchFailed > 0 {
|
||||||
|
retry--
|
||||||
|
}
|
||||||
|
if tempDelay == 0 {
|
||||||
|
tempDelay = 1 * time.Second
|
||||||
|
} else {
|
||||||
|
tempDelay *= 2
|
||||||
|
}
|
||||||
|
if max := 30 * time.Second; tempDelay > max {
|
||||||
|
tempDelay = max
|
||||||
|
}
|
||||||
|
log.Warnf("can not watchtree (with retry %d, sleep %v): %s: %v", retry, tempDelay, d.basePath, err)
|
||||||
|
time.Sleep(tempDelay)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("can't watch %s: %v", d.basePath, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
prefix := d.basePath + "/"
|
||||||
|
|
||||||
|
readChanges:
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-d.stopCh:
|
||||||
|
log.Info("discovery has been closed")
|
||||||
|
return
|
||||||
|
case ps, ok := <-c:
|
||||||
|
if !ok {
|
||||||
|
break readChanges
|
||||||
|
}
|
||||||
|
var pairs []*client.KVPair // latest servers
|
||||||
|
if ps == nil {
|
||||||
|
d.pairsMu.Lock()
|
||||||
|
d.pairs = pairs
|
||||||
|
d.pairsMu.Unlock()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, p := range ps {
|
||||||
|
if path.Dir(p.Key) != d.basePath {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
k := strings.TrimPrefix(p.Key, prefix)
|
||||||
|
pair := &client.KVPair{Key: k, Value: string(p.Value)}
|
||||||
|
if d.filter != nil && !d.filter(pair) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
pairs = append(pairs, pair)
|
||||||
|
}
|
||||||
|
d.pairsMu.Lock()
|
||||||
|
d.pairs = pairs
|
||||||
|
d.pairsMu.Unlock()
|
||||||
|
|
||||||
|
d.mu.Lock()
|
||||||
|
for _, ch := range d.chans {
|
||||||
|
ch := ch
|
||||||
|
go func() {
|
||||||
|
defer func() {
|
||||||
|
recover()
|
||||||
|
}()
|
||||||
|
select {
|
||||||
|
case ch <- pairs:
|
||||||
|
case <-time.After(time.Minute):
|
||||||
|
log.Warn("chan is full and new change has been dropped")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
d.mu.Unlock()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Warn("chan is closed and will rewatch")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *ConsulDiscovery) Close() {
|
||||||
|
close(d.stopCh)
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package otosaas
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type callback struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// OtoSaas @Title 海旅回调
|
||||||
|
func (c *callback) OtoSaas(ctx context.Context, args string) (reply string, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "OtoSaas", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kuaidi100 @Title 快递100回调
|
||||||
|
func (c *callback) Kuaidi100(ctx context.Context, args string) (reply string, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Kuaidi100", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package otosaas
|
||||||
|
|
||||||
|
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
|
||||||
|
IsMatch uint // 是否匹配 0=全部 1=匹配 2=没匹配
|
||||||
|
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
|
||||||
|
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
|
||||||
|
}
|
@ -0,0 +1,184 @@
|
|||||||
|
package otosaas
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
CommodityStatusNone = 1 // 待处理
|
||||||
|
CommodityStatusAdopt = 2 // 同步入库
|
||||||
|
CommodityStatusReject = 3 // 废弃商品
|
||||||
|
|
||||||
|
CommodityHandleNone = 1 // 未处理
|
||||||
|
CommodityHandleStart = 2 // 开始处理
|
||||||
|
|
||||||
|
CommoditySaasSkuStatusUp = 1 // 商品上架
|
||||||
|
CommoditySaasSkuStatusDown = 2 // 商品下架
|
||||||
|
)
|
||||||
|
|
||||||
|
type commodity struct {
|
||||||
|
}
|
||||||
|
type CommoditySearch struct {
|
||||||
|
Name string // 商品名称
|
||||||
|
CategoryIds []uint // 类目id
|
||||||
|
SkuCode string // 商品条码
|
||||||
|
Handle uint // 处理状态 1=待处理 2=入库 3=废弃
|
||||||
|
CommodityCode string // 商品编码
|
||||||
|
MinSupplyPrice decimal.Decimal // 最小采购价
|
||||||
|
MaxSupplyPrice decimal.Decimal // 最大采购价
|
||||||
|
}
|
||||||
|
type ArgsCommodityList struct {
|
||||||
|
Search CommoditySearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type CommodityItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
CommodityCode string `json:"commodityCode"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
CategoryId uint `json:"categoryId"`
|
||||||
|
CategoryNames string `json:"categoryNames"`
|
||||||
|
Skus []CommoditySkuItem `json:"skus"`
|
||||||
|
GuidePrices []decimal.Decimal `json:"guidePrices"`
|
||||||
|
SupplyPrices []decimal.Decimal `json:"supplyPrices"`
|
||||||
|
Status uint `json:"status"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CommoditySkuItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
SupplyPrice decimal.Decimal `json:"supplyPrice"`
|
||||||
|
SpecValue string `json:"specValue"`
|
||||||
|
SkuCode string `json:"skuCode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyCommodityLists struct {
|
||||||
|
List []CommodityItem `json:"list"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 获取商品列表
|
||||||
|
func (c *commodity) Lists(ctx context.Context, args ArgsCommodityList) (reply ReplyCommodityLists, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyCommodityInfo struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
CommodityCode string `json:"commodityCode"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
ImgUrl string `json:"imgUrl"`
|
||||||
|
FirstCategoryName string `json:"firstCategoryName"`
|
||||||
|
SecondCategoryName string `json:"secondCategoryName"`
|
||||||
|
ThirdCategoryName string `json:"thirdCategoryName"`
|
||||||
|
SupplyCategoryId uint `json:"supplyCategoryId"`
|
||||||
|
Handle uint `json:"handle"`
|
||||||
|
Status uint `json:"status"`
|
||||||
|
Skus []SkuItem `json:"skus"`
|
||||||
|
Imgs []CommodityImgItem `json:"imgs"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CommodityImgItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
ReplacePath string `json:"replacePath"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SkuItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
SkuCode string `json:"skuCode"`
|
||||||
|
SpecName string `json:"specName"`
|
||||||
|
SpecValue string `json:"specValue"`
|
||||||
|
SupplyPrice decimal.Decimal `json:"supplyPrice"`
|
||||||
|
GuidePrice decimal.Decimal `json:"guidePrice"`
|
||||||
|
ImgUrl string `json:"imgUrl"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info @Title 商品详情
|
||||||
|
func (c *commodity) Info(ctx context.Context, goodsId uint) (reply ReplyCommodityInfo, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Info", goodsId, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyImgs struct {
|
||||||
|
GoodsId uint `json:"goodsId"`
|
||||||
|
Imgs []string `json:"imgs"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetImgs @Title 获取商品主图
|
||||||
|
func (c *commodity) GetImgs(ctx context.Context, goodsIds []uint) (reply []ReplyImgs, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "GetImgs", goodsIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdoptItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Error string `json:"error"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adopt @Title 批量入库
|
||||||
|
func (c *commodity) Adopt(ctx context.Context, goodsIds []uint) (reply []AdoptItem, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Adopt", goodsIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Discard @Title 批量废弃
|
||||||
|
func (c *commodity) Discard(ctx context.Context, goodsIds []uint) (err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Discard", goodsIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsCommodityReplaceImg struct {
|
||||||
|
CommodityId uint // 商品id
|
||||||
|
ImgId uint // 图片id
|
||||||
|
ImgPath string // 图片路径
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplaceImg @Title 替换图片
|
||||||
|
func (c *commodity) ReplaceImg(ctx context.Context, args ArgsCommodityReplaceImg) error {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "ReplaceImg", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//// ReHandle @Title 重新处理商品
|
||||||
|
//func (c *commodity) ReHandle(ctx context.Context, goodsIds []uint) (reply []AdoptItem, err error) {
|
||||||
|
// xClient, err := client.GetClient(c)
|
||||||
|
// if err != nil {
|
||||||
|
// return nil, err
|
||||||
|
// }
|
||||||
|
// err = xClient.Call(ctx, "ReHandle", goodsIds, &reply)
|
||||||
|
// return
|
||||||
|
//}
|
@ -0,0 +1,7 @@
|
|||||||
|
package otosaas
|
||||||
|
|
||||||
|
type OtoSaas struct {
|
||||||
|
Callback callback
|
||||||
|
Category category
|
||||||
|
Commodity commodity
|
||||||
|
}
|
@ -0,0 +1,85 @@
|
|||||||
|
package skycrane
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
)
|
||||||
|
|
||||||
|
type address struct {
|
||||||
|
}
|
||||||
|
type AddressSearch struct {
|
||||||
|
AddressId int64
|
||||||
|
Mate int // 1=已匹配 2=未匹配
|
||||||
|
}
|
||||||
|
type ArgsAddressList struct {
|
||||||
|
Search AddressSearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type AddressItem struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
ProvinceName string `json:"provinceName"`
|
||||||
|
CityName string `json:"cityName"`
|
||||||
|
CountyName string `json:"countyName"`
|
||||||
|
MateAddressId int64 `json:"mateAddressId"`
|
||||||
|
MateProvinceName string `json:"mateProvinceName"`
|
||||||
|
MateCityName string `json:"mateCityName"`
|
||||||
|
MateCountyName string `json:"mateCountyName"`
|
||||||
|
}
|
||||||
|
type ReplyAddressList struct {
|
||||||
|
Lists []AddressItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List @Title 地址列表
|
||||||
|
func (c *address) List(ctx context.Context, args ArgsAddressList) (reply ReplyAddressList, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
xClient.Call(ctx, "List", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAddressMate struct {
|
||||||
|
AddressId int64 // 地址id
|
||||||
|
MateAddressID int64 // 修改匹配地址id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mate @Title 地址匹配
|
||||||
|
func (c *address) Mate(ctx context.Context, args ArgsAddressMate) error {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Mate", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// All @Title 地址
|
||||||
|
func (c *address) All(ctx context.Context, args AddressSearch) (reply []AddressItem, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
xClient.Call(ctx, "All", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type MateAddressItem struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
ProvinceName string `json:"provinceName"`
|
||||||
|
CityName string `json:"cityName"`
|
||||||
|
CountyName string `json:"countyName"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// MateAll @Title 匹配地址
|
||||||
|
func (c *address) MateAll(ctx context.Context) (reply []MateAddressItem, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
xClient.Call(ctx, "MateAll", 0, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package skycrane
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
)
|
||||||
|
|
||||||
|
type brand struct {
|
||||||
|
}
|
||||||
|
type BrandSearch struct {
|
||||||
|
Name string // 商品名称
|
||||||
|
}
|
||||||
|
type ArgsBrandList struct {
|
||||||
|
Search BrandSearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type BrandItem struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
MateBrandID int64 `json:"mateBrandID"`
|
||||||
|
}
|
||||||
|
type ReplyBrandList struct {
|
||||||
|
Lists []BrandItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List @Title 品牌列表
|
||||||
|
func (b *brand) List(ctx context.Context, args ArgsBrandList) (reply ReplyBrandList, err error) {
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
xClient.Call(ctx, "List", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsBrandMate struct {
|
||||||
|
BrandId int64 // 品牌id
|
||||||
|
SupplyBrandId int64 // 修改匹配品牌id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mate @Title 品牌匹配
|
||||||
|
func (b *brand) Mate(ctx context.Context, args ArgsBrandMate) error {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Mate", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// All @Title 品牌
|
||||||
|
func (b *brand) All(ctx context.Context, args BrandSearch) (reply []BrandItem, err error) {
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
xClient.Call(ctx, "All", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package skycrane
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type callback struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cancel @TITLE 取消订单
|
||||||
|
func (c *callback) Cancel(ctx context.Context, sourceOrderSn string) error {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Cancel", sourceOrderSn, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// StockOut @Title 出库
|
||||||
|
func (c *callback) StockOut(ctx context.Context, sourceOrderSn string) error {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "StockOut", sourceOrderSn, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delivered @Title 订单妥投
|
||||||
|
func (c *callback) Delivered(ctx context.Context, sourceOrderSn string) error {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Delivered", sourceOrderSn, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finish @Title 订单完成
|
||||||
|
func (c *callback) Finish(ctx context.Context, sourceOrderSn string) error {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Finish", sourceOrderSn, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logistics @Title 更新包裹信息
|
||||||
|
func (c *callback) Logistics(ctx context.Context, sourceOrderSn string) error {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Logistics", sourceOrderSn, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsCallbackAfsStepResult struct {
|
||||||
|
ReturnOrderCode string
|
||||||
|
ReturnOrderStatus int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// AfsStepResult @Title 售后处理
|
||||||
|
func (c *callback) AfsStepResult(ctx context.Context, args ArgsCallbackAfsStepResult) error {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "AfsStepResult", args, &reply)
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package skycrane
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
)
|
||||||
|
|
||||||
|
type category struct {
|
||||||
|
}
|
||||||
|
type CategorySearch struct {
|
||||||
|
CategoryId int64
|
||||||
|
Mate int // 1=已匹配 2=未匹配
|
||||||
|
}
|
||||||
|
type ArgsCategoryList struct {
|
||||||
|
Search CategorySearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type CategoryItem struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
FirstCategoryName string `json:"firstCategoryName"`
|
||||||
|
SecondCategoryName string `json:"secondCategoryName"`
|
||||||
|
ThirdCategoryName string `json:"thirdCategoryName"`
|
||||||
|
MateCategoryID int64 `json:"mateCategoryID"`
|
||||||
|
}
|
||||||
|
type ReplyCategoryList struct {
|
||||||
|
Lists []CategoryItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List @Title 类目列表
|
||||||
|
func (c *category) List(ctx context.Context, args ArgsCategoryList) (reply ReplyCategoryList, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
xClient.Call(ctx, "List", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsCategoryMate struct {
|
||||||
|
CategoryId int64 // 类目id
|
||||||
|
SupplyCategoryId int64 // 修改匹配类目id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mate @Title 类目匹配
|
||||||
|
func (c *category) Mate(ctx context.Context, args ArgsCategoryMate) error {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Mate", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// All @Title 类目
|
||||||
|
func (c *category) All(ctx context.Context, args CategorySearch) (reply []CategoryItem, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
xClient.Call(ctx, "All", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,191 @@
|
|||||||
|
package skycrane
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
SkuStatusNone = 1 // 待处理
|
||||||
|
SkuStatusAdopt = 2 // 同步入库
|
||||||
|
SkuStatusReject = 3 // 废弃商品
|
||||||
|
)
|
||||||
|
|
||||||
|
type sku struct {
|
||||||
|
}
|
||||||
|
type SkuSearch struct {
|
||||||
|
Status int // 状态
|
||||||
|
Name string // 商品名称
|
||||||
|
Code string // sku编码
|
||||||
|
CategoryId int64 // 类目id
|
||||||
|
BrandName string // 品牌
|
||||||
|
MinSupplyPrice decimal.Decimal // 采购价最小
|
||||||
|
MaxSupplyPrice decimal.Decimal // 采购价最大
|
||||||
|
}
|
||||||
|
type ArgsSkuList struct {
|
||||||
|
Search SkuSearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
type SkuItem struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
MainPhoto string `json:"mainPhoto"`
|
||||||
|
BrandName string `json:"brandName"`
|
||||||
|
FirstCategoryName string `json:"firstCategoryName"`
|
||||||
|
SecondCategoryName string `json:"secondCategoryName"`
|
||||||
|
ThirdCategoryName string `json:"thirdCategoryName"`
|
||||||
|
SupplyPrice decimal.Decimal `json:"supplyPrice"`
|
||||||
|
GuidePrice decimal.Decimal `json:"guidePrice"`
|
||||||
|
ShelvesStatus int64 `json:"shelvesStatus"`
|
||||||
|
Status int64 `json:"status"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
UpdatedAt int64 `json:"updatedAt"`
|
||||||
|
MateBrandId int64 `json:"mateBrandId"`
|
||||||
|
MateCategoryId int64 `json:"mateCategoryId"`
|
||||||
|
}
|
||||||
|
type ReplySkuList struct {
|
||||||
|
Lists []SkuItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List @Title 商品列表
|
||||||
|
func (s *sku) List(ctx context.Context, args ArgsSkuList) (reply ReplySkuList, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
xClient.Call(ctx, "List", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type SkuImg struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
ReplacePath string `json:"replacePath"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Imgs @Title 获取预览图
|
||||||
|
func (s *sku) Imgs(ctx context.Context, skuId int64) (reply []SkuImg, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Imgs", skuId, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplySkuInfo struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
GoodsCode string `json:"goodsCode"`
|
||||||
|
GoodsName string `json:"goodsName"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
SellPrice decimal.Decimal `json:"sellPrice"`
|
||||||
|
MarketPrice decimal.Decimal `json:"marketPrice"`
|
||||||
|
StartQty int64 `json:"startQty"`
|
||||||
|
ShelvesStatus int64 `json:"shelvesStatus"`
|
||||||
|
TaxCode string `json:"taxCode"`
|
||||||
|
TaxRate decimal.Decimal `json:"taxRate"`
|
||||||
|
BarCode string `json:"barCode"`
|
||||||
|
IsDeleted int64 `json:"isDeleted"`
|
||||||
|
BrandId int64 `json:"brandId"`
|
||||||
|
BrandCode string `json:"brandCode"`
|
||||||
|
BrandName string `json:"brandName"`
|
||||||
|
CategoryId int64 `json:"categoryId"`
|
||||||
|
FirstCategoryCode string `json:"firstCategoryCode"`
|
||||||
|
FirstCategoryName string `json:"firstCategoryName"`
|
||||||
|
SecondCategoryCode string `json:"secondCategoryCode"`
|
||||||
|
SecondCategoryName string `json:"secondCategoryName"`
|
||||||
|
ThirdCategoryCode string `json:"thirdCategoryCode"`
|
||||||
|
ThirdCategoryName string `json:"thirdCategoryName"`
|
||||||
|
ReturnGoodsRules int64 `json:"returnGoodsRules"`
|
||||||
|
GoodsCharacteristic string `json:"goodsCharacteristic"`
|
||||||
|
GoodsUnit string `json:"goodsUnit"`
|
||||||
|
ModelNumber string `json:"modelNumber"`
|
||||||
|
ProductPlace string `json:"productPlace"`
|
||||||
|
HaveShelfLife int64 `json:"haveShelfLife"`
|
||||||
|
ShelfLife string `json:"shelfLife"`
|
||||||
|
FragileGoods int64 `json:"fragileGoods"`
|
||||||
|
GrossWeight decimal.Decimal `json:"grossWeight"`
|
||||||
|
GrossWeightUnit string `json:"grossWeightUnit"`
|
||||||
|
Density decimal.Decimal `json:"density"`
|
||||||
|
Extent decimal.Decimal `json:"extent"`
|
||||||
|
Width decimal.Decimal `json:"width"`
|
||||||
|
Height decimal.Decimal `json:"height"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
UpdatedAt int64 `json:"updatedAt"`
|
||||||
|
MateBrandId int64 `json:"mateBrandId"`
|
||||||
|
MateCategoryId int64 `json:"mateCategoryId"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
Imgs []SkuImg `json:"imgs"`
|
||||||
|
Attributes []SkuAttribute `json:"attributes"`
|
||||||
|
Specs []SkuSpec `json:"specs"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SkuAttribute struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
|
type SkuSpec struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info @Title 获取详情
|
||||||
|
func (s *sku) Info(ctx context.Context, skuId int64) (reply ReplySkuInfo, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Info", skuId, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSkuReplaceImg struct {
|
||||||
|
SkuId int64 // 商品id
|
||||||
|
ImgId int64 // 图片id
|
||||||
|
ImgPath string // 图片路径
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReplaceImg @Title 替换图片
|
||||||
|
func (s *sku) ReplaceImg(ctx context.Context, args ArgsSkuReplaceImg) error {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "ReplaceImg", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdoptItem struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Error string `json:"error"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adopt @Title 入库
|
||||||
|
func (s *sku) Adopt(ctx context.Context, skuIds []int64) (reply []AdoptItem, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Adopt", skuIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Discard @Title 废弃
|
||||||
|
func (s *sku) Discard(ctx context.Context, skuIds []int64) error {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Discard", skuIds, &reply)
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package skycrane
|
||||||
|
|
||||||
|
type Skycrane struct {
|
||||||
|
Task task
|
||||||
|
Sku sku
|
||||||
|
Brand brand
|
||||||
|
Category category
|
||||||
|
Address address
|
||||||
|
Callback callback
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package skycrane
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
TaskStatusIng = 1 // 进行中
|
||||||
|
TaskStatusFinish = 2 // 结束
|
||||||
|
)
|
||||||
|
|
||||||
|
type task struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pull @Title 拉取商品
|
||||||
|
func (t *task) Pull(ctx context.Context) error {
|
||||||
|
a := 0
|
||||||
|
xClient, err := client.GetClient(t)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Pull", 0, &a)
|
||||||
|
}
|
||||||
|
|
||||||
|
type TaskStatus struct {
|
||||||
|
ScrollId string `json:"scrollId"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
Count int64 `json:"count"`
|
||||||
|
Status int `json:"status"` // 1=运行中 2=已完成
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
StartTime time.Time `json:"startTime"`
|
||||||
|
LastTime time.Time `json:"lastTime"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPullStatus @Title 获取拉取状态
|
||||||
|
func (t *task) GetPullStatus(ctx context.Context) (reply TaskStatus, err error) {
|
||||||
|
xClient, err := client.GetClient(t)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "GetPullStatus", 0, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prices @Title 商品更新
|
||||||
|
func (t *task) Prices(ctx context.Context) error {
|
||||||
|
a := 0
|
||||||
|
xClient, err := client.GetClient(t)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Prices", 0, &a)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPricesStatus @Title 获取拉取状态
|
||||||
|
func (t *task) GetPricesStatus(ctx context.Context) (reply TaskStatus, err error) {
|
||||||
|
xClient, err := client.GetClient(t)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "GetPricesStatus", 0, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,276 @@
|
|||||||
|
package supplier
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
)
|
||||||
|
|
||||||
|
type afs struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfsLists struct {
|
||||||
|
Search AfsSearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type AfsSearch struct {
|
||||||
|
Status uint
|
||||||
|
AfsSn string
|
||||||
|
OrderSubSn string
|
||||||
|
CreatedStartDate string
|
||||||
|
CreatedEndDate string
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyAfsLists struct {
|
||||||
|
Lists []AfsItem
|
||||||
|
Total int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type AfsItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
AfsSn string `json:"afsSn"`
|
||||||
|
OrderSubSn string `json:"orderSubSn"`
|
||||||
|
SkuName string `json:"skuName"`
|
||||||
|
Quantity uint `json:"quantity"`
|
||||||
|
Status uint `json:"status"`
|
||||||
|
AuditStatus uint `json:"manageStatus"`
|
||||||
|
Result string `json:"result"`
|
||||||
|
OrderFee decimal.Decimal `json:"orderFee"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
UpdatedAt int64 `json:"updatedAt"`
|
||||||
|
ReturnAddress []ReturnAddressItem `json:"returnAddress"`
|
||||||
|
Notes string `json:"notes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 售后列表
|
||||||
|
func (a *afs) Lists(ctx context.Context, args ArgsAfsLists) (reply ReplyAfsLists, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyAfsDetail struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
AuditId uint `json:"auditId"` // 审核Id
|
||||||
|
AfsSn string `json:"afsSn"` // 售后单号
|
||||||
|
Status uint `json:"status"` // 售后状态
|
||||||
|
AuditStatus uint `json:"auditStatus"` // 主管审核状态
|
||||||
|
ApproveNotes string `json:"approveNotes"` // 备注
|
||||||
|
Result string `json:"result"` // 处理结果
|
||||||
|
CreatedAt int64 `json:"createdAt"` // 创建时间
|
||||||
|
UpdatedAt int64 `json:"updatedAt"` // 更新时间
|
||||||
|
SkuName string `json:"skuName"` // 商品名称
|
||||||
|
ImgUrl string `json:"imgUrl"` // 商品图片
|
||||||
|
SkuId uint `json:"skuId"` // 商品Id
|
||||||
|
Price decimal.Decimal `json:"price"` // 商品单价
|
||||||
|
Quantity uint `json:"quantity"` // 数量
|
||||||
|
HopeTypeName string `json:"hopeTypeName"` // 期望售后类型
|
||||||
|
TypeReasonName string `json:"typeReasonName"` // 售后原因
|
||||||
|
Imgs []string `json:"imgs"` // 售后图片
|
||||||
|
RefundFee decimal.Decimal `json:"refundFee"` // 退款金额
|
||||||
|
PackageSend uint `json:"packageSend"` // 发货状态
|
||||||
|
AfsPackageSend AfsPackageSend `json:"afsPackageSend"` // 售后物流信息
|
||||||
|
SourceName string `json:"sourceName"` // 所属供应商
|
||||||
|
OrderSubSn string `json:"orderSubSn"` // 沙马订单号
|
||||||
|
NewOrderSubSn string `json:"newOrderSubSn"` // 新订单号
|
||||||
|
SupplyOrderSubSn string `json:"supplyOrderSubSn"` // 供应链订单号
|
||||||
|
NewSupplyOrderSn string `json:"newSupplyOrderSn"` // 供应链新订单号
|
||||||
|
Address string `json:"address"` // 售后退货地址
|
||||||
|
ReturnAddress []ReturnAddressItem `json:"returnAddress"` // 退货地址列表
|
||||||
|
}
|
||||||
|
|
||||||
|
type AfsPackageSend struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Mobile string `json:"mobile"`
|
||||||
|
LogisticsCompany string `json:"logisticsCompany"`
|
||||||
|
WaybillCode string `json:"waybillCode"`
|
||||||
|
SendGoodsDate int64 `json:"sendGoodsDate"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detail @Title 售后详情
|
||||||
|
func (a *afs) Detail(ctx context.Context, afsSn uint64) (reply ReplyAfsDetail, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Detail", afsSn, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyFindByAfsOrderInfo struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
CreatedAt int64 `json:"createdAt"` // 申请时间
|
||||||
|
UpdatedAt int64 `json:"updatedAt"` // 更新时间
|
||||||
|
AfsSn string `json:"afsSn"` // 售后单号
|
||||||
|
OrderSubSn string `json:"orderSubSn"` // 订单号
|
||||||
|
HandleStatus uint `json:"handleStatus"` // 处理结果
|
||||||
|
Status uint `json:"status"` // 售后状态
|
||||||
|
ApproveNotes string `json:"approveNotes"` // 处理描述
|
||||||
|
Result string `json:"result"` // 处理结果
|
||||||
|
SkuName string `json:"skuName"` // 商品名称
|
||||||
|
SkuId uint `json:"skuId"` // 供应商编码
|
||||||
|
SupplyPrice decimal.Decimal `json:"price"` // 商品单价
|
||||||
|
Quantity uint `json:"quantity"` // 售后数量
|
||||||
|
UpcCode string `json:"upcCode"` // 商品条码
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindByAfsOrderInfos @Title 根据售后单号批量查询信息
|
||||||
|
func (a *afs) FindByAfsOrderInfos(ctx context.Context, afsSns []uint64) (reply []ReplyFindByAfsOrderInfo, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindByAfsOrderInfos", afsSns, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfsReject struct {
|
||||||
|
AfsSn string `json:"afsSn"`
|
||||||
|
Notes string `json:"notes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reject @Title 审核驳回
|
||||||
|
func (a *afs) Reject(ctx context.Context, args ArgsAfsReject) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Reject", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ForcedClose @Title 强制关单
|
||||||
|
func (a *afs) ForcedClose(ctx context.Context, args ArgsAfsReject) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "ForcedClose", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfsDeliver struct {
|
||||||
|
AfsSn string `json:"afsSn"`
|
||||||
|
ReturnAddressId uint `json:"returnAddressId"`
|
||||||
|
Notes string `json:"notes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deliver @Title 待客户发货
|
||||||
|
func (a *afs) Deliver(ctx context.Context, args ArgsAfsDeliver) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Deliver", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfterDeliverRefund struct {
|
||||||
|
AfsSn string
|
||||||
|
Notes string
|
||||||
|
RefundFee decimal.Decimal
|
||||||
|
ApplyUserId uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// AfterDeliverRefund @Title 待客户发货后的赔偿
|
||||||
|
func (a *afs) AfterDeliverRefund(ctx context.Context, args ArgsAfterDeliverRefund) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "AfterDeliverRefund", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfsOriginReturn struct {
|
||||||
|
AfsSn string `json:"afsSn"`
|
||||||
|
Notes string `json:"notes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// OriginReturn @Title 原返
|
||||||
|
func (a *afs) OriginReturn(ctx context.Context, args ArgsAfsOriginReturn) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "OriginReturn", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfsRefund struct {
|
||||||
|
AfsSn string `json:"afsSn"`
|
||||||
|
Notes string `json:"notes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refund @Title 退款
|
||||||
|
func (a *afs) Refund(ctx context.Context, args ArgsAfsRefund) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Refund", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfsCompensate struct {
|
||||||
|
ApplyUserId uint `json:"applyUserId"`
|
||||||
|
AfsSn string `json:"afsSn"`
|
||||||
|
RefundFee decimal.Decimal `json:"refundFee"`
|
||||||
|
Notes string `json:"notes"`
|
||||||
|
RefundId uint `json:"refundId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compensate @Title 订单赔偿
|
||||||
|
func (a *afs) Compensate(ctx context.Context, args ArgsAfsCompensate) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Compensate", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfsCompensateSku struct {
|
||||||
|
AfsSn string `json:"afsSn"`
|
||||||
|
Notes string `json:"notes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CompensateSku @Title 直赔商品
|
||||||
|
func (a *afs) CompensateSku(ctx context.Context, args ArgsAfsCompensateSku) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "CompensateSku", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfsReissue struct {
|
||||||
|
AfsSn string `json:"afsSn"`
|
||||||
|
Notes string `json:"notes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reissue @Title 补发商品
|
||||||
|
func (a *afs) Reissue(ctx context.Context, args ArgsAfsReissue) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Reissue", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
package supplier
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
AfsAuditSwitchOn = 1 // 开
|
||||||
|
AfsAuditSwitchOff = 2 // 关
|
||||||
|
)
|
||||||
|
|
||||||
|
type afsAudit struct {
|
||||||
|
}
|
||||||
|
type ArgsAfsAuditLists struct {
|
||||||
|
Search AfsAuditSearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
type AfsAuditSearch struct {
|
||||||
|
Status uint // 0=全部 1=待审核 2=审核通过 3=审核驳回
|
||||||
|
AfsSn string
|
||||||
|
OrderSubSn string
|
||||||
|
CreatedStartDate string
|
||||||
|
CreatedEndDate string
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyAfsAuditLists struct {
|
||||||
|
Lists []AfsAuditItem
|
||||||
|
Total int64
|
||||||
|
}
|
||||||
|
type AfsAuditItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
AfsSn uint64 `json:"afsSn"`
|
||||||
|
OrderSubSn uint64 `json:"orderSubSn"`
|
||||||
|
SkuName string `json:"skuName"`
|
||||||
|
Status uint `json:"status"`
|
||||||
|
Quantity uint `json:"quantity"`
|
||||||
|
OrderSubAfsId uint `json:"orderSubAfsId"`
|
||||||
|
RefundFee decimal.Decimal `json:"refundFee"`
|
||||||
|
Remark string `json:"remark"`
|
||||||
|
Result string `json:"result"`
|
||||||
|
Notes string `json:"notes"`
|
||||||
|
AuditAt int64 `json:"auditAt"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 售后审核列表
|
||||||
|
func (a *afsAudit) Lists(ctx context.Context, args ArgsAfsAuditLists) (reply ReplyAfsAuditLists, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfsAuditAdopt struct {
|
||||||
|
AuditUserId uint
|
||||||
|
AfsAuditId uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adopt @Title 审核通过
|
||||||
|
func (a *afsAudit) Adopt(ctx context.Context, args ArgsAfsAuditAdopt) error {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Adopt", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfsAuditReject struct {
|
||||||
|
AuditUserId uint
|
||||||
|
Remark string
|
||||||
|
AfsAuditId uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reject @Title 审核驳回
|
||||||
|
func (a *afsAudit) Reject(ctx context.Context, args ArgsAfsAuditReject) error {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Reject", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSetAfsAuditPrice struct {
|
||||||
|
Price decimal.Decimal
|
||||||
|
Switch uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAfsAuditConfig @Title 设置售后审核配置
|
||||||
|
func (a *afsAudit) SetAfsAuditConfig(ctx context.Context, args ArgsSetAfsAuditPrice) error {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "SetAfsAuditConfig", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyAfsAuditConfig struct {
|
||||||
|
Price decimal.Decimal
|
||||||
|
Switch uint
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAfsAuditConfig @Title 获取售后审核配置
|
||||||
|
func (a *afsAudit) GetAfsAuditConfig(ctx context.Context) (reply ReplyAfsAuditConfig, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
args := 0
|
||||||
|
err = xClient.Call(ctx, "GetAfsAuditConfig", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info @Title 审核详情
|
||||||
|
func (a *afsAudit) Info(ctx context.Context, afsAuditId uint) (reply ReplyAfsDetail, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Info", afsAuditId, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,216 @@
|
|||||||
|
package batch
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
"git.oa00.com/supply-chain/service/supplier/batch/order"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Goods struct {
|
||||||
|
goods
|
||||||
|
Order order.Order
|
||||||
|
}
|
||||||
|
|
||||||
|
type goods struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type GoodsSearch struct {
|
||||||
|
Name string // 商品名称
|
||||||
|
CategoryIds []uint // 类目id
|
||||||
|
BrandName string // 品牌名
|
||||||
|
UpcCode string // 商品条码
|
||||||
|
Handle uint // 处理状态 1=待处理 2=入库 3=废弃
|
||||||
|
SkuId uint // 供应商skuId
|
||||||
|
MinSupplyPrice decimal.Decimal // 最小采购价
|
||||||
|
MaxSupplyPrice decimal.Decimal // 最大采购价
|
||||||
|
}
|
||||||
|
type ArgsGoodsList struct {
|
||||||
|
Search GoodsSearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type GoodsItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
GoodsNum string `json:"goodsNum"`
|
||||||
|
CategoryId uint `json:"categoryId"`
|
||||||
|
BrandId uint `json:"brandId"`
|
||||||
|
BrandName string `json:"brandName"`
|
||||||
|
SkuItems []GoodsItemLists `json:"skuItems"`
|
||||||
|
UpcCodes []string `json:"upcCodes"`
|
||||||
|
StockCount uint `json:"stockCount"`
|
||||||
|
GuidePrices []decimal.Decimal `json:"guidePrices"`
|
||||||
|
SupplyPrices []decimal.Decimal `json:"supplyPrices"`
|
||||||
|
Status uint `json:"status"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GoodsItemLists struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Specifications []SkuSpecificationItem `json:"specifications"`
|
||||||
|
Stock uint `json:"stock"`
|
||||||
|
SupplyPrice decimal.Decimal `json:"supplyPrice"`
|
||||||
|
GoodsId uint `json:"goodsId"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
UpcCode string `json:"upcCode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GoodsSpecificationItem struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Values []string `json:"values"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SkuSpecificationItem struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyGoodsLists struct {
|
||||||
|
List []GoodsItem `json:"list"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 获取商品列表
|
||||||
|
func (g *goods) Lists(ctx context.Context, args ArgsGoodsList) (reply ReplyGoodsLists, err error) {
|
||||||
|
xClient, err := client.GetClient(g)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsGoodsInfo struct {
|
||||||
|
SkuId uint
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyGoodsInfo struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
SupplierId uint `json:"supplierId"`
|
||||||
|
SupplierName string `json:"supplierName"`
|
||||||
|
CategoryId uint `json:"categoryId"`
|
||||||
|
BrandId uint `json:"brandId"`
|
||||||
|
Imgs []string `json:"imgs"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
Attributes []GoodsAttributeItem `json:"attributes"`
|
||||||
|
Skus []SkuItem `json:"skus"`
|
||||||
|
Status uint `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GoodsAttributeItem struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
GroupName string `json:"groupName"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SkuSpecItem struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SkuItem struct {
|
||||||
|
SkuId uint `json:"skuId"`
|
||||||
|
Color string `json:"color"`
|
||||||
|
Size string `json:"size"`
|
||||||
|
SupplyPrice decimal.Decimal `json:"supplyPrice"`
|
||||||
|
MarketPrice decimal.Decimal `json:"marketPrice"`
|
||||||
|
UpcCode string `json:"upcCode"`
|
||||||
|
UnitId uint `json:"uintId"`
|
||||||
|
TaxCategoryId uint `json:"taxCategoryId"`
|
||||||
|
TaxName string `json:"taxName"`
|
||||||
|
TaxCode string `json:"taxCode"`
|
||||||
|
Unit string `json:"uint"`
|
||||||
|
Tax decimal.Decimal `json:"tax"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info @Title 商品详情
|
||||||
|
func (g *goods) Info(ctx context.Context, goodsId uint) (reply ReplyGoodsInfo, err error) {
|
||||||
|
xClient, err := client.GetClient(g)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Info", goodsId, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetImgs @Title 获取商品主图
|
||||||
|
func (g *goods) GetImgs(ctx context.Context, goodsId uint) (reply []string, err error) {
|
||||||
|
xClient, err := client.GetClient(g)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "GetImgs", goodsId, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdoptItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Error string `json:"error"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adopt @Title 批量入库
|
||||||
|
func (g *goods) Adopt(ctx context.Context, goodsIds []uint) (reply []AdoptItem, err error) {
|
||||||
|
xClient, err := client.GetClient(g)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Adopt", goodsIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Discard @Title 批量废弃
|
||||||
|
func (g *goods) Discard(ctx context.Context, goodsIds []uint) (err error) {
|
||||||
|
xClient, err := client.GetClient(g)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Discard", goodsIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReHandle @Title 重新处理商品
|
||||||
|
func (g *goods) ReHandle(ctx context.Context, goodsIds []uint) (reply []AdoptItem, err error) {
|
||||||
|
xClient, err := client.GetClient(g)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "ReHandle", goodsIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyByIdItem struct {
|
||||||
|
SkuId uint `json:"skuId"`
|
||||||
|
SupplierId uint `json:"supplierIds"`
|
||||||
|
SupplierName string `json:"supplierName"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindBySkuIds @Title 根据商品Ids获取商品信息
|
||||||
|
func (g *goods) FindBySkuIds(ctx context.Context, skuIds []uint) (reply []ReplyByIdItem, err error) {
|
||||||
|
xClient, err := client.GetClient(g)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindBySkuIds", skuIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsBatchGoodsChange struct {
|
||||||
|
GoodsIds []uint // 商品id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change @Title 商品信息变动
|
||||||
|
func (g *goods) Change(ctx context.Context, args ArgsBatchGoodsChange) (err error) {
|
||||||
|
xClient, err := client.GetClient(g)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Change", args, &reply)
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package order
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Order struct {
|
||||||
|
order
|
||||||
|
}
|
||||||
|
|
||||||
|
type order struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsOrderFreightFee struct {
|
||||||
|
OrderSn string
|
||||||
|
FreightFee decimal.Decimal
|
||||||
|
FreightFile string
|
||||||
|
}
|
||||||
|
|
||||||
|
// FreightFee @Title 运费处理
|
||||||
|
func (o *order) FreightFee(ctx context.Context, args ArgsOrderFreightFee) (err error) {
|
||||||
|
xClient, err := client.GetClient(o)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "FreightFee", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,118 @@
|
|||||||
|
package supplier
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
EnterpriseAuditStatusNone = 1 // 未审核
|
||||||
|
EnterpriseAuditStatusAdopt = 2 // 通过
|
||||||
|
EnterpriseAuditStatusReject = 3 // 驳回
|
||||||
|
)
|
||||||
|
|
||||||
|
type enterprise struct {
|
||||||
|
}
|
||||||
|
type ArgsEnterpriseLists struct {
|
||||||
|
Search EnterpriseSearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
type EnterpriseSearch struct {
|
||||||
|
Name string // 企业名称
|
||||||
|
AuditStatus uint // 审核状态 1=待审核 2=通过 3=驳回
|
||||||
|
}
|
||||||
|
type ReplyEnterpriseLists struct {
|
||||||
|
Lists []EnterpriseItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
type EnterpriseItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
AuditStatus uint `json:"auditStatus"`
|
||||||
|
AuditUserId uint `json:"auditUserId"`
|
||||||
|
AuditAt int64 `json:"auditAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 审核列表
|
||||||
|
func (e *enterprise) Lists(ctx context.Context, args ArgsEnterpriseLists) (reply ReplyEnterpriseLists, err error) {
|
||||||
|
xClient, err := client.GetClient(e)
|
||||||
|
if err != nil {
|
||||||
|
return ReplyEnterpriseLists{}, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyEnterpriseInfo struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
AuditStatus uint `json:"auditStatus"`
|
||||||
|
AuditUserId uint `json:"auditUserId"`
|
||||||
|
AuditAt int64 `json:"auditAt"`
|
||||||
|
Reason string `json:"reason"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
CreditCode string `json:"creditCode"`
|
||||||
|
BusinessAddress string `json:"businessAddress"`
|
||||||
|
LegalPersonName string `json:"legalPersonName"`
|
||||||
|
PayTaxes uint `json:"payTaxes"`
|
||||||
|
TaxNumber string `json:"taxNumber"`
|
||||||
|
BankName string `json:"bankName"`
|
||||||
|
BankCode string `json:"bankCode"`
|
||||||
|
BankAddress string `json:"bankAddress"`
|
||||||
|
Phone string `json:"phone"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
BusinessLicense string `json:"businessLicense"`
|
||||||
|
IdPhotoFront string `json:"idPhotoFront"`
|
||||||
|
IdPhotoBack string `json:"idPhotoBack"`
|
||||||
|
AccountPhoto string `json:"accountPhoto"`
|
||||||
|
ContactName string `json:"contactName"`
|
||||||
|
ContactEmail string `json:"contactEmail"`
|
||||||
|
ContactPhone string `json:"contactPhone"`
|
||||||
|
Position string `json:"position"`
|
||||||
|
PaytaxesPhoto string `json:"paytaxesPhoto"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info @Title 审核详情
|
||||||
|
func (e *enterprise) Info(ctx context.Context, enterpriseId uint) (reply ReplyEnterpriseInfo, err error) {
|
||||||
|
xClient, err := client.GetClient(e)
|
||||||
|
if err != nil {
|
||||||
|
return ReplyEnterpriseInfo{}, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Info", enterpriseId, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsEnterpriseAdopt struct {
|
||||||
|
AuditUserId uint // 审核人id
|
||||||
|
EnterpriseId uint // 企业id
|
||||||
|
Account string // 账号
|
||||||
|
Password string // 密码
|
||||||
|
PayType uint // 结算类型 1=预付款 2=月结
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adopt @Title 审核通过
|
||||||
|
func (e *enterprise) Adopt(ctx context.Context, args ArgsEnterpriseAdopt) error {
|
||||||
|
xClient, err := client.GetClient(e)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Adopt", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsEnterpriseReject struct {
|
||||||
|
AuditUserId uint // 审核人id
|
||||||
|
EnterpriseId uint // 企业id
|
||||||
|
Reason string // 驳回原因
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reject @Title 审核驳回
|
||||||
|
func (e *enterprise) Reject(ctx context.Context, args ArgsEnterpriseReject) error {
|
||||||
|
xClient, err := client.GetClient(e)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Reject", args, &reply)
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package supplier
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
)
|
||||||
|
|
||||||
|
type logisticsCompany struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type CompanyItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select @Title 物流公司筛选
|
||||||
|
func (l *logisticsCompany) Select(ctx context.Context) (reply []CompanyItem, err error) {
|
||||||
|
xClient, err := client.GetClient(l)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
args := 0
|
||||||
|
err = xClient.Call(ctx, "Select", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package supplier
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
)
|
||||||
|
|
||||||
|
type returnAddress struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyReturnAddressAll struct {
|
||||||
|
SupplierId uint `json:"supplierId"`
|
||||||
|
Item []ReturnAddressItem `json:"item"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReturnAddressItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Address string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// All @Title 全部退货地址
|
||||||
|
func (r *returnAddress) All(ctx context.Context) (reply []ReplyReturnAddressAll, err error) {
|
||||||
|
xClient, err := client.GetClient(r)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
args := 0
|
||||||
|
err = xClient.Call(ctx, "All", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,105 @@
|
|||||||
|
package supplier
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
)
|
||||||
|
|
||||||
|
type supplierReal struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSupplierRealLists struct {
|
||||||
|
Search SupplierRealSearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type SupplierRealSearch struct {
|
||||||
|
SupplierName string
|
||||||
|
ApplyUserName string
|
||||||
|
AuditStatus uint // 状态 1=待审核 2=审核通过 3=审核驳回
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplySupplierRealLists struct {
|
||||||
|
Lists []SupplierRealItem
|
||||||
|
Total int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type SupplierRealItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
SupplierName string `json:"supplierName"`
|
||||||
|
ApplyUserName string `json:"applyUserName"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
CardImg string `json:"cardImg"`
|
||||||
|
AuditStatus uint `json:"auditStatus"`
|
||||||
|
AuditUserId uint `json:"auditUserId"`
|
||||||
|
AuditAt int64 `json:"auditAt"`
|
||||||
|
Reason string `json:"reason"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List @Title 实名认证列表
|
||||||
|
func (s *supplierReal) List(ctx context.Context, args ArgsSupplierRealLists) (reply ReplySupplierRealLists, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return ReplySupplierRealLists{}, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "List", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplySupplierRealInfo struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
SupplierName string `json:"supplierName"`
|
||||||
|
ApplyUserName string `json:"applyUserName"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
CardImg string `json:"cardImg"`
|
||||||
|
AuditStatus uint `json:"auditStatus"`
|
||||||
|
AuditUserId uint `json:"auditUserId"`
|
||||||
|
AuditAt int64 `json:"auditAt"`
|
||||||
|
Reason string `json:"reason"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info @Title 审核详情
|
||||||
|
func (s *supplierReal) Info(ctx context.Context, RealId uint) (reply ReplySupplierRealInfo, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return ReplySupplierRealInfo{}, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Info", RealId, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSupplierRealAdopt struct {
|
||||||
|
RealId uint
|
||||||
|
AuditUserId uint // 审核人Id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adopt @Title 审核通过
|
||||||
|
func (s *supplierReal) Adopt(ctx context.Context, args ArgsSupplierRealAdopt) error {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Adopt", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSupplierRealReject struct {
|
||||||
|
RealId uint
|
||||||
|
AuditUserId uint // 审核人Id
|
||||||
|
Reason string // 驳回原因
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reject @Title 审核驳回
|
||||||
|
func (s *supplierReal) Reject(ctx context.Context, args ArgsSupplierRealReject) error {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Reject", args, &reply)
|
||||||
|
}
|
@ -0,0 +1,323 @@
|
|||||||
|
package supply
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
//售后状态 1=售后申请中 2=客户发货 3=收货处理中 4=售后完成 5=售后关闭
|
||||||
|
)
|
||||||
|
|
||||||
|
type afterService struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsRetailHistory struct {
|
||||||
|
Search RetailHistorySearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type RetailHistorySearch struct {
|
||||||
|
AfterServiceSn string `label:"售后单号"`
|
||||||
|
OrderSn string `label:"订单号"`
|
||||||
|
Status uint `label:"售后状态"`
|
||||||
|
SourceId uint `label:"所属供应商"`
|
||||||
|
CustomerId uint `label:"所属客户"`
|
||||||
|
CreateStartDate string `label:"创建开始日期"`
|
||||||
|
CreateEndDate string `label:"创建结束日期"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RetailHistoryItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
AfterServiceSn uint64 `json:"afterServiceSn"`
|
||||||
|
OrderSn uint64 `json:"orderSn"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Quantity uint `json:"quantity"`
|
||||||
|
Status uint `json:"status"`
|
||||||
|
Reason string `json:"reason"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
UpdatedAt int64 `json:"updatedAt"`
|
||||||
|
Source string `json:"source"`
|
||||||
|
CustomerId uint `json:"customerId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyRetailHistory struct {
|
||||||
|
Lists []RetailHistoryItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// RetailAfsHistory @Title 零售订单售后记录
|
||||||
|
func (a *afterService) RetailAfsHistory(ctx context.Context, args ArgsRetailHistory) (reply ReplyRetailHistory, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return ReplyRetailHistory{}, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "RetailAfsHistory", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfsLists struct {
|
||||||
|
Search AfsListSearch `json:"search"`
|
||||||
|
Page bean.Page `json:"page"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AfsListSearch struct {
|
||||||
|
Status uint `json:"status"`
|
||||||
|
AfsSn string `json:"afsSn"`
|
||||||
|
OrderSubSn string `json:"orderSubSn"`
|
||||||
|
CreatedStartDate string `json:"createdStartAt"`
|
||||||
|
CreatedEndDate string `json:"createdEndAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyAfsLists struct {
|
||||||
|
Lists []AfsItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AfsItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
AfsSn string `json:"afsSn"`
|
||||||
|
OrderSubSn string `json:"orderSubSn"`
|
||||||
|
SourceId uint `json:"sourceId"`
|
||||||
|
SourceSkuId string `json:"sourceSkuId"`
|
||||||
|
SkuName string `json:"skuName"`
|
||||||
|
Quantity uint `json:"quantity"`
|
||||||
|
Status uint `json:"status"`
|
||||||
|
Result string `json:"result"`
|
||||||
|
Price decimal.Decimal `json:"price"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
UpdatedAt int64 `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 售后列表
|
||||||
|
func (a *afterService) Lists(ctx context.Context, args ArgsAfsLists) (reply ReplyAfsLists, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return ReplyAfsLists{}, err
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfterServiceDeliver struct {
|
||||||
|
SourceAfsSn string `json:"sourceAfsSn"`
|
||||||
|
SourceSkuId string `json:"sourceSkuId"`
|
||||||
|
SourceOrderSn string `json:"sourceOrderSn"`
|
||||||
|
ApproveNotes string `json:"approveNotes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deliver @Title 需要发货
|
||||||
|
func (a *afterService) Deliver(ctx context.Context, args ArgsAfterServiceDeliver) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Deliver", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfterServiceReceipt struct {
|
||||||
|
SourceAfsSn string `json:"sourceAfsSn"`
|
||||||
|
SourceSkuId string `json:"sourceSkuId"`
|
||||||
|
SourceOrderSN string `json:"sourceOrderSN"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Receipt @Title 收货处理
|
||||||
|
func (a *afterService) Receipt(ctx context.Context, args ArgsAfterServiceReceipt) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Receipt", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfterServiceClose struct {
|
||||||
|
Source source `json:"source"`
|
||||||
|
SourceAfsSn string `json:"sourceAfsSn"`
|
||||||
|
SourceSkuId string `json:"sourceSkuId"`
|
||||||
|
SourceOrderSn string `json:"sourceOrderSn"`
|
||||||
|
Result string `json:"result"`
|
||||||
|
ApproveNotes string `json:"approveNotes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close @Title 关闭售后单
|
||||||
|
func (a *afterService) Close(ctx context.Context, args ArgsAfterServiceClose) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Close", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfterServiceRefund struct {
|
||||||
|
Source source `json:"source"`
|
||||||
|
SourceAfsSn string `json:"sourceAfsSn"`
|
||||||
|
SourceSkuId string `json:"sourceSkuId"`
|
||||||
|
SourceOrderSn string `json:"sourceOrderSn"`
|
||||||
|
Result string `json:"result"`
|
||||||
|
RefundFee decimal.Decimal `json:"refundFee"`
|
||||||
|
RefundOrderFee decimal.Decimal `json:"refundOrderFee"`
|
||||||
|
RefundFreightFee decimal.Decimal `json:"refundFreightFee"`
|
||||||
|
ApproveNotes string `json:"approveNotes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refund @Title 退款
|
||||||
|
func (a *afterService) Refund(ctx context.Context, args ArgsAfterServiceRefund) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "Refund", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfterServiceNewOrder struct {
|
||||||
|
Source source `json:"source"`
|
||||||
|
SourceAfsSn string `json:"sourceAfsSn"`
|
||||||
|
SourceSkuId string `json:"sourceSkuId"`
|
||||||
|
SourceOrderSn string `json:"sourceOrderSn"`
|
||||||
|
Result string `json:"result"`
|
||||||
|
NewSourceOrderSn string `json:"newSourceOrderSn"`
|
||||||
|
ApproveNotes string
|
||||||
|
Skus []NewOrderSku `json:"skus"`
|
||||||
|
}
|
||||||
|
type NewOrderSku struct {
|
||||||
|
SourceSkuId string `json:"sourceSkuId"`
|
||||||
|
Quantity uint `json:"quantity"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOrder @Title 新订单
|
||||||
|
func (a *afterService) NewOrder(ctx context.Context, args ArgsAfterServiceNewOrder) (err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
err = xClient.Call(ctx, "NewOrder", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyAfterServiceDetail struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
AfsSn string `json:"afsSn"` // 售后单号
|
||||||
|
Status uint `json:"status"` // 状态
|
||||||
|
ApproveNotes string `json:"approveNotes"` // 备注
|
||||||
|
Result string `json:"result"` // 处理结果
|
||||||
|
CreatedAt int64 `json:"createdAt"` // 创建时间
|
||||||
|
UpdatedAt int64 `json:"updatedAt"` // 更新时间
|
||||||
|
SkuName string `json:"skuName"` // 商品名称
|
||||||
|
ImgUrl string `json:"imgUrl"` // 商品图片
|
||||||
|
SkuId uint `json:"skuId"` // skuId
|
||||||
|
SupplySkuId uint `json:"supplySkuId"` // 供应商skuId
|
||||||
|
Price decimal.Decimal `json:"price"` // 采购单价
|
||||||
|
SupplyPrice decimal.Decimal `json:"supplyPrice"` // 供货价
|
||||||
|
Quantity uint `json:"quantity"` // 数量
|
||||||
|
HopeTypeName string `json:"hopeTypeName"` // 期望售后类型
|
||||||
|
TypeReasonName string `json:"typeReasonName"` // 售后原因
|
||||||
|
Imgs []string `json:"imgs"` // 售后图片
|
||||||
|
PackageSend uint `json:"packageSend"` // 发货状态
|
||||||
|
AfsPackageSend AfsPackageSend `json:"afsPackageSend"` // 售后信息
|
||||||
|
OrderSubSn uint64 `json:"orderSubSn"` // 订单号
|
||||||
|
SourceOrderSubSn string `json:"sourceOrderSubSn"` // 供应商的订单号
|
||||||
|
SourceId uint `json:"sourceId"` // 供应商id
|
||||||
|
ChannelId uint `json:"channelId"` // 客户id
|
||||||
|
NewOrderSubSn string `json:"newOrderSubSn"` // 新订单信息
|
||||||
|
NewSourceOrderSubSn string `json:"newSourceOrderSubSn"` // 新供应商订单信息
|
||||||
|
ReceiverName string `json:"receiverName"` // 收件人名称
|
||||||
|
ReceiverPhone string `json:"receiverPhone"` // 收件手机号
|
||||||
|
ReceiverAddress string `json:"receiverAddress"` // 收件人地址
|
||||||
|
StockOutAt int64 `json:"stockOutAt"` // 订单发货时间
|
||||||
|
RefundFee decimal.Decimal `json:"refundFee"` // 沙马退款金额
|
||||||
|
SourceRefundFee decimal.Decimal `json:"sourceRefundFee"` // 供应商退款金额
|
||||||
|
}
|
||||||
|
type AfsPackageSend struct {
|
||||||
|
Name string `json:"name"` // 售后收件人
|
||||||
|
Mobile string `json:"mobile"` /// 售后手机号
|
||||||
|
ZipCode string `json:"zipCode"`
|
||||||
|
Address string `json:"address"` // 售后地址
|
||||||
|
LogisticsCompany string `json:"logisticsCompany"` // 快递公司
|
||||||
|
WaybillCode string `json:"waybillCode"` // 运单号
|
||||||
|
SendGoodsDate int64 `json:"sendGoodsDate"` // 发货时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detail @Title 售后详情
|
||||||
|
func (a *afterService) Detail(ctx context.Context, afsSn string) (reply ReplyAfterServiceDetail, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Detail", afsSn, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyAfterServiceLogisticsAddress struct {
|
||||||
|
Name string `json:"name"` // 姓名
|
||||||
|
Mobile string `json:"mobile"` // 手机号
|
||||||
|
ZipCode string `json:"zipCode"` // 邮编
|
||||||
|
Address string `json:"address"` // 地址
|
||||||
|
}
|
||||||
|
|
||||||
|
// LogisticsAddress @Title 寄回地址
|
||||||
|
func (a *afterService) LogisticsAddress(ctx context.Context, afsSn string) (reply ReplyAfterServiceLogisticsAddress, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "LogisticsAddress", afsSn, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyAfsInfoById struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
AfsSn string `json:"afsSn"`
|
||||||
|
SourceAfsSn string `json:"sourceAfsSn"`
|
||||||
|
SkuId uint `json:"skuId"`
|
||||||
|
SourceSkuId string `json:"sourceSkuId"`
|
||||||
|
SourceId uint `json:"sourceId"`
|
||||||
|
OrderSubSn string `json:"orderSn"`
|
||||||
|
SourceOrderSn string `json:"SourceOrderSn"`
|
||||||
|
OrderFee decimal.Decimal `json:"orderFee"`
|
||||||
|
SourceOrderFee decimal.Decimal `json:"sourceOrderFee"`
|
||||||
|
FreightFee decimal.Decimal `json:"freightFee"`
|
||||||
|
ApproveNotes string `json:"approveNotes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindByAfsId @Title 获取售后信息
|
||||||
|
func (a *afterService) FindByAfsId(ctx context.Context, afsId uint) (reply ReplyAfsInfoById, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindByAfsId", afsId, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplySourceSkuIdsAfsInfos struct {
|
||||||
|
SourceId uint // 供应商Id
|
||||||
|
SourceName string // 供应商名称
|
||||||
|
ChannelId uint // 客户Id
|
||||||
|
SkuId uint // 沙马skuId
|
||||||
|
SourceSkuId string // 供应商skuId
|
||||||
|
HopeTypeName string // 期望售后类型
|
||||||
|
TypeReasonName string // 售后原因
|
||||||
|
CustomerPrice decimal.Decimal // 销售价格
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindBySourceSkuIdsAfsInfos @Title 根据sourceSkuId查询售后信息
|
||||||
|
func (a *afterService) FindBySourceSkuIdsAfsInfos(ctx context.Context, sourceSkuIds []uint) (reply []ReplySourceSkuIdsAfsInfos, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindBySourceSkuIdsAfsInfos", sourceSkuIds, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package channel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"github.com/smallnest/rpcx/share"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
MqSubscribeNameSkuPriceChange = "sku_price_change" // sku价格变动
|
||||||
|
MqSubscribeNameSkuChange = "sku_change" // sku信息变动
|
||||||
|
MqSubscribeNameOrderSplit = "order_split" // 订单拆单
|
||||||
|
MqSubscribeNameOrderStockOut = "order_stock_out" // 订单出库
|
||||||
|
MqSubscribeNameOrderDelivered = "order_delivered" // 订单签收
|
||||||
|
MqSubscribeNameOrderFinish = "order_finish" // 订单完成
|
||||||
|
MqSubscribeNameOrderCancel = "order_cancel" // 订单取消
|
||||||
|
MqSubscribeNameAfsDeliver = "afs_deliver" // 需要客户发货
|
||||||
|
MqSubscribeNameAfsWait = "afs_wait" // 等待收货处理
|
||||||
|
MqSubscribeNameAfsClose = "afs_close" // 售后关闭
|
||||||
|
MqSubscribeNameAfsFinish = "afs_finish" // 售后完成
|
||||||
|
)
|
||||||
|
|
||||||
|
type mq struct {
|
||||||
|
}
|
||||||
|
type ArgsMqSubscribe struct {
|
||||||
|
Name string // 队列名称
|
||||||
|
AppKey string // 队列名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subscribe @Title 订阅mq
|
||||||
|
func (m *mq) Subscribe(ctx context.Context, channelId string, args ArgsMqSubscribe) (key string, err error) {
|
||||||
|
xClient, err := client.GetClient(m)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Subscribe", args, &key)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// SubscribeCancel @Title 订阅取消
|
||||||
|
func (m *mq) SubscribeCancel(ctx context.Context, channelId string, args ArgsMqSubscribe) (err error) {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(m)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "SubscribeCancel", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsMqUser struct {
|
||||||
|
AppKey string
|
||||||
|
AppSecret string
|
||||||
|
}
|
||||||
|
|
||||||
|
// User @Title Mq用户
|
||||||
|
func (m *mq) User(ctx context.Context, channelId string, args ArgsMqUser) (err error) {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(m)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "User", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
type afs struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsAfsLists struct {
|
||||||
|
StartFinishAt string
|
||||||
|
EndFinishAt string
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyAfsLists struct {
|
||||||
|
Lists []AfsItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AfsItem struct {
|
||||||
|
SourceName string `json:"sourceName"` // 供应渠道
|
||||||
|
SourceSonName string `json:"sourceSonName"` // 供应商
|
||||||
|
CustomerName string `json:"customerName"` // 客户名
|
||||||
|
AfsSn string `json:"afsSn"` // 售后单号
|
||||||
|
AfsResult string `json:"afsResult"` // 售后处理结果
|
||||||
|
AfsFinishAt int64 `json:"afsFinishAt"` // 售后完成时间
|
||||||
|
OrderSn string `json:"orderSn"` // 原始订单号
|
||||||
|
OrderSunSn string `json:"orderSunSn"` // 订单号
|
||||||
|
LadingBillAt int64 `json:"ladingBillAt"` // 订单支付时间
|
||||||
|
FinishAt int64 `json:"finishAt"` // 确认收货时间
|
||||||
|
SkuName string `json:"skuName"` // 商品名称
|
||||||
|
SkuUpcCode string `json:"skuUpcCode"` // 商品条码
|
||||||
|
Unit string `json:"unit"` // 单位
|
||||||
|
AfsQuality uint `json:"afsQuality"` // 售后数量
|
||||||
|
NewOrderSn string `json:"newOrderSn"` // 新订单号
|
||||||
|
PlatformRefund decimal.Decimal `json:"platformRefund"` // 平台退款金额
|
||||||
|
SupplierRefund decimal.Decimal `json:"supplierRefund"` // 供应商退款金额
|
||||||
|
}
|
||||||
|
|
||||||
|
// AfsLists @Title 售后明细列表
|
||||||
|
func (a *afs) AfsLists(ctx context.Context, args ArgsAfsLists) (reply ReplyAfsLists, err error) {
|
||||||
|
xClient, err := client.GetClient(a)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "AfsLists", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
type count struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsCountSource struct {
|
||||||
|
StartAt string
|
||||||
|
EndAt string
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplySourceItem struct {
|
||||||
|
SourceName string `json:"sourceName"` // 供应渠道
|
||||||
|
ProduceTotalPrice decimal.Decimal `json:"produceTotalPrice"` // 采购总金额
|
||||||
|
ProduceFreightFee decimal.Decimal `json:"produceFreightFee"` // 采购应付运费
|
||||||
|
ProducePrice decimal.Decimal `json:"producePrice"` // 采购合计金额
|
||||||
|
SaleTotalPrice decimal.Decimal `json:"saleTotalPrice"` // 销售总金额
|
||||||
|
SaleFreightFee decimal.Decimal `json:"saleFreightFee"` // 销售应收运费
|
||||||
|
SalePrice decimal.Decimal `json:"salePrice"` // 销售合计金额
|
||||||
|
PlatformRefund decimal.Decimal `json:"platformRefund"` // 平台退款金额
|
||||||
|
SupplierRefund decimal.Decimal `json:"supplierRefund"` // 供应商退款金额
|
||||||
|
}
|
||||||
|
|
||||||
|
// Source @Title 供应商对账表
|
||||||
|
func (c *count) Source(ctx context.Context, args ArgsCountSource) (reply []ReplySourceItem, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Source", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
type Data struct {
|
||||||
|
Order order
|
||||||
|
Afs afs
|
||||||
|
Count count
|
||||||
|
}
|
@ -0,0 +1,201 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
type order struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsPayOrderLists struct {
|
||||||
|
StartLadingBillAt string
|
||||||
|
EndLadingBillAt string
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyPayOrderLists struct {
|
||||||
|
Lists []PayOrderItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PayOrderItem struct {
|
||||||
|
SourceName string `json:"sourceName"` // 供应渠道
|
||||||
|
SourceSonName string `json:"sourceSonName"` // 供应商
|
||||||
|
CustomerName string `json:"customerName"` // 客户名
|
||||||
|
OrderSn string `json:"orderSn"` // 原始订单号
|
||||||
|
OrderSubSn string `json:"orderSubSn"` // 订单号
|
||||||
|
SupplierOrderSn string `json:"supplierOrderSn"` // 供应商订单号
|
||||||
|
OrderStatus uint `json:"orderStatus"` // 订单状态
|
||||||
|
LadingBillAt int64 `json:"ladingBillAt"` // 支付时间
|
||||||
|
StockOutAt int64 `json:"stockOutAt"` // 发货时间
|
||||||
|
FinishAt int64 `json:"finishAt"` // 确认收货时间
|
||||||
|
SkuName string `json:"skuName"` // 商品名称
|
||||||
|
SkuUpcCode string `json:"skuUpcCode"` // 商品条码
|
||||||
|
Specification string `json:"specification"` // 规格
|
||||||
|
Quality uint `json:"quality"` // 数量
|
||||||
|
ProduceSupplyPrice decimal.Decimal `json:"produceSupplyPrice"` // 采购单价
|
||||||
|
ProduceTotalPrice decimal.Decimal `json:"produceTotalPrice"` // 采购总金额
|
||||||
|
ProduceFreightFee decimal.Decimal `json:"ProduceFreightFee"` // 采购应付运费
|
||||||
|
ProducePrice decimal.Decimal `json:"producePrice"` // 采购合计金额
|
||||||
|
SaleSupplyPrice decimal.Decimal `json:"saleSupplyPrice"` // 销售单价
|
||||||
|
SaleTotalPrice decimal.Decimal `json:"saleTotalPrice"` // 销售总金额
|
||||||
|
SaleFreightFee decimal.Decimal `json:"saleFreightFee"` // 销售应收运费
|
||||||
|
SalePrice decimal.Decimal `json:"salePrice"` // 销售合计金额
|
||||||
|
Unit string `json:"unit"` // 单位
|
||||||
|
Tax string `json:"tax"` // 税率
|
||||||
|
ReceiverName string `json:"receiverName"` // 收件人
|
||||||
|
ReceiverPhone string `json:"receiverPhone"` // 收件人手机号
|
||||||
|
ReceiverAddress string `json:"receiverAddress"` // 收件人地址
|
||||||
|
}
|
||||||
|
|
||||||
|
// PayOrderList @Title 支付订单统计
|
||||||
|
func (o *order) PayOrderList(ctx context.Context, args ArgsPayOrderLists) (result ReplyPayOrderLists, err error) {
|
||||||
|
xClient, err := client.GetClient(o)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "PayOrderList", args, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsCancelOrderLists struct {
|
||||||
|
StartCancelAt string
|
||||||
|
EndCancelAt string
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyCancelOrderLists struct {
|
||||||
|
Lists []CancelOrderItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
type CancelOrderItem struct {
|
||||||
|
SourceName string `json:"sourceName"` // 供应渠道
|
||||||
|
SourceSonName string `json:"sourceSonName"` // 供应商
|
||||||
|
CustomerName string `json:"customerName"` // 客户名
|
||||||
|
OrderSn string `json:"orderSn"` // 原始订单号
|
||||||
|
OrderSubSn string `json:"orderSubSn"` // 订单号
|
||||||
|
SupplierOrderSn string `json:"supplierOrderSn"` // 供应商订单号
|
||||||
|
OrderStatus uint `json:"orderStatus"` // 订单状态
|
||||||
|
LadingBillAt int64 `json:"ladingBillAt"` // 支付时间
|
||||||
|
StockOutAt int64 `json:"stockOutAt"` // 发货时间
|
||||||
|
CancelAt int64 `json:"cancelAt"` // 取消时间
|
||||||
|
|
||||||
|
TotalPrice decimal.Decimal `json:"totalPrice"` // 商品金额
|
||||||
|
FreightFee decimal.Decimal `json:"freightFee"` // 运费
|
||||||
|
Price decimal.Decimal `json:"price"` // 销售合计金额
|
||||||
|
RefundPrice decimal.Decimal `json:"refundPrice"` // 退款金额
|
||||||
|
}
|
||||||
|
|
||||||
|
// CancelOrderLists @Title 取消订单统计
|
||||||
|
func (o *order) CancelOrderLists(ctx context.Context, args ArgsCancelOrderLists) (result ReplyCancelOrderLists, err error) {
|
||||||
|
xClient, err := client.GetClient(o)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "CancelOrderLists", args, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsStockOutOrderList struct {
|
||||||
|
StartStockOutAt string
|
||||||
|
EndStockOutAt string
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyStockOutOrderList struct {
|
||||||
|
Lists []StockOutOrderItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type StockOutOrderItem struct {
|
||||||
|
SourceName string `json:"sourceName"` // 供应渠道
|
||||||
|
SourceSonName string `json:"sourceSonName"` // 供应商
|
||||||
|
CustomerName string `json:"customerName"` // 客户名
|
||||||
|
OrderSn string `json:"orderSn"` // 原始订单号
|
||||||
|
OrderSubSn string `json:"orderSubSn"` // 订单号
|
||||||
|
SupplierOrderSn string `json:"supplierOrderSn"` // 供应商订单号
|
||||||
|
OrderStatus uint `json:"orderStatus"` // 订单状态
|
||||||
|
LadingBillAt int64 `json:"ladingBillAt"` // 支付时间
|
||||||
|
StockOutAt int64 `json:"stockOutAt"` // 发货时间
|
||||||
|
FinishAt int64 `json:"finishAt"` // 确认收货时间
|
||||||
|
SkuName string `json:"skuName"` // 商品名称
|
||||||
|
SkuUpcCode string `json:"skuUpcCode"` // 商品条码
|
||||||
|
Specification string `json:"specification"` // 规格
|
||||||
|
Quality uint `json:"quality"` // 数量
|
||||||
|
ProduceSupplyPrice decimal.Decimal `json:"produceSupplyPrice"` // 采购单价
|
||||||
|
ProduceTotalPrice decimal.Decimal `json:"produceTotalPrice"` // 采购总金额
|
||||||
|
ProduceFreightFee decimal.Decimal `json:"ProduceFreightFee"` // 采购应付运费
|
||||||
|
ProducePrice decimal.Decimal `json:"producePrice"` // 采购合计金额
|
||||||
|
SaleSupplyPrice decimal.Decimal `json:"saleSupplyPrice"` // 销售单价
|
||||||
|
SaleTotalPrice decimal.Decimal `json:"saleTotalPrice"` // 销售总金额
|
||||||
|
SaleFreightFee decimal.Decimal `json:"saleFreightFee"` // 销售应收运费
|
||||||
|
SalePrice decimal.Decimal `json:"salePrice"` // 销售合计金额
|
||||||
|
Unit string `json:"unit"` // 单位
|
||||||
|
Tax string `json:"tax"` // 税率
|
||||||
|
ReceiverName string `json:"receiverName"` // 收件人
|
||||||
|
ReceiverPhone string `json:"receiverPhone"` // 收件人手机号
|
||||||
|
ReceiverAddress string `json:"receiverAddress"` // 收件人地址
|
||||||
|
}
|
||||||
|
|
||||||
|
// StockOutOrderList @Title 发货订单统计
|
||||||
|
func (o *order) StockOutOrderList(ctx context.Context, args ArgsStockOutOrderList) (result ReplyStockOutOrderList, err error) {
|
||||||
|
xClient, err := client.GetClient(o)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "StockOutOrderList", args, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type JdOrderItem struct {
|
||||||
|
CustomerName string `json:"customerName"`
|
||||||
|
OrderSn string `json:"orderSn"`
|
||||||
|
OrderSubSn string `json:"orderSubSn"`
|
||||||
|
SupplierOrderSn string `json:"supplierOrderSn"`
|
||||||
|
OrderStatus uint `json:"orderStatus"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
LadingBillAt int64 `json:"ladingBillAt"`
|
||||||
|
StockOutAt int64 `json:"stockOutAt"`
|
||||||
|
FinishAt int64 `json:"finishAt"`
|
||||||
|
SkuName string `json:"skuName"`
|
||||||
|
SkuUpcCode string `json:"skuUpcCode"`
|
||||||
|
Specification string `json:"specification"`
|
||||||
|
Quality uint `json:"quality"`
|
||||||
|
ProduceSupplyPrice decimal.Decimal `json:"produceSupplyPrice"`
|
||||||
|
ProduceTotalPrice decimal.Decimal `json:"produceTotalPrice"`
|
||||||
|
ProduceFreightFee decimal.Decimal `json:"produceFreightFee"`
|
||||||
|
ProducePrice decimal.Decimal `json:"producePrice"`
|
||||||
|
SaleSupplyPrice decimal.Decimal `json:"saleSupplyPrice"`
|
||||||
|
SaleTotalPrice decimal.Decimal `json:"saleTotalPrice"`
|
||||||
|
SaleFreightFee decimal.Decimal `json:"saleFreightFee"`
|
||||||
|
SalePrice decimal.Decimal `json:"salePrice"`
|
||||||
|
Unit string `json:"unit"`
|
||||||
|
Tax string `json:"tax"`
|
||||||
|
ReceiverName string `json:"receiverName"`
|
||||||
|
ReceiverPhone string `json:"receiverPhone"`
|
||||||
|
ReceiverAddress string `json:"receiverAddress"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsJdOrderList struct {
|
||||||
|
StartAt string
|
||||||
|
EndAt string
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyJdOrderList struct {
|
||||||
|
Lists []JdOrderItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// JdList @Title 京东订单
|
||||||
|
func (o *order) JdList(ctx context.Context, args ArgsJdOrderList) (result ReplyJdOrderList, err error) {
|
||||||
|
xClient, err := client.GetClient(o)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "JdList", args, &result)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package setting
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type opensearch struct {
|
||||||
|
}
|
||||||
|
type ArgsOpensearchToken struct {
|
||||||
|
Analyzer string
|
||||||
|
Text string
|
||||||
|
}
|
||||||
|
type TokenOpensearchItem struct {
|
||||||
|
Token string `json:"token"`
|
||||||
|
StartOffset int `json:"startOffset"`
|
||||||
|
EndOffset int `json:"endOffset"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Position int `json:"position"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Analyzer @Title 分词测试
|
||||||
|
func (o *opensearch) Analyzer(ctx context.Context, args ArgsOpensearchToken) (result []TokenOpensearchItem, err error) {
|
||||||
|
xClient, err := client.GetClient(o)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Analyzer", args, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// IndicesRefresh @Title 刷新索引
|
||||||
|
func (o *opensearch) IndicesRefresh(ctx context.Context) error {
|
||||||
|
xClient, err := client.GetClient(o)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "IndicesRefresh", 0, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refresh @Title 刷新
|
||||||
|
func (o *opensearch) Refresh(ctx context.Context) error {
|
||||||
|
xClient, err := client.GetClient(o)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Refresh", 0, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyOpensearchRefreshProgress struct {
|
||||||
|
Completed bool `json:"completed"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
Updated int `json:"updated"`
|
||||||
|
StartTimeInMillis int64 `json:"startTimeInMillis"`
|
||||||
|
RunningTimeInNanos int64 `json:"runningTimeInNanos"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// RefreshProgress @Title 刷新进度
|
||||||
|
func (o *opensearch) RefreshProgress(ctx context.Context) (reply ReplyOpensearchRefreshProgress, err error) {
|
||||||
|
xClient, err := client.GetClient(o)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err = xClient.Call(ctx, "RefreshProgress", 0, &reply); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package setting
|
package setting
|
||||||
|
|
||||||
type Setting struct {
|
type Setting struct {
|
||||||
Rate rate
|
Rate rate
|
||||||
|
Tag tag
|
||||||
|
Opensearch opensearch
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,113 @@
|
|||||||
|
package setting
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
)
|
||||||
|
|
||||||
|
type tag struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsTagList struct {
|
||||||
|
Search TagSearch
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type TagItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
UpdatedAt int64 `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
type ReplyTagList struct {
|
||||||
|
Lists []TagItem `json:"lists"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TagSearch struct {
|
||||||
|
Name string // 标签名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 标签列表
|
||||||
|
func (b *tag) Lists(ctx context.Context, args ArgsTagList) (result ReplyTagList, err error) {
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// All @Title 全部标签
|
||||||
|
func (b *tag) All(ctx context.Context) (result []TagItem, err error) {
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "All", 0, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindByNameAll @Title 标签名称筛选标签
|
||||||
|
func (b *tag) FindByNameAll(ctx context.Context, name string) (result []TagItem, err error) {
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindByNameAll", name, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsTagAdd struct {
|
||||||
|
Name string // 标签名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add @Title 添加标签
|
||||||
|
func (b *tag) Add(ctx context.Context, args ArgsTagAdd) (err error) {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Add", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds @Title 添加标签
|
||||||
|
func (b *tag) Adds(ctx context.Context, tagNames []string) (err error) {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Adds", tagNames, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsTagEdit struct {
|
||||||
|
TagId uint // 标签id
|
||||||
|
Name string // 标签名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit @Title 编辑标签
|
||||||
|
func (b *tag) Edit(ctx context.Context, args ArgsTagEdit) (err error) {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Edit", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsTagFindByIds struct {
|
||||||
|
TagIds []uint // 标签id数组
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindByIds @Title 标签获取
|
||||||
|
func (b *tag) FindByIds(ctx context.Context, args ArgsTagFindByIds) (result []TagItem, err error) {
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindByIds", args, &result)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package supply
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/lib/bean"
|
||||||
|
)
|
||||||
|
|
||||||
|
type skuTag struct {
|
||||||
|
}
|
||||||
|
type ArgsSkuTagAdds struct {
|
||||||
|
SkuIds []uint // skuIds
|
||||||
|
TagId uint // tagId
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds @Title 添加商品
|
||||||
|
func (s *skuTag) Adds(ctx context.Context, args ArgsSkuTagAdds) error {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Adds", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsSkuTagDels struct {
|
||||||
|
SkuIds []uint // skuIds
|
||||||
|
TagId uint // tagId
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dels @Title 删除商品
|
||||||
|
func (s *skuTag) Dels(ctx context.Context, args ArgsSkuTagDels) error {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Dels", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsTagSkuLists struct {
|
||||||
|
TagId uint
|
||||||
|
Page bean.Page
|
||||||
|
}
|
||||||
|
|
||||||
|
type TagSkuItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
SkuId uint `json:"skuId"`
|
||||||
|
Status uint `json:"status"` // 上下架状态 1=上架 2=下架
|
||||||
|
SkuName string `json:"skuName"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyTagSkuLists struct {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
Lists []TagSkuItem `json:"lists"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SkuLists @Title 标签商品列表
|
||||||
|
func (s *skuTag) SkuLists(ctx context.Context, args ArgsTagSkuLists) (reply ReplyTagSkuLists, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "SkuLists", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
@ -1,9 +1,49 @@
|
|||||||
package supply
|
package supply
|
||||||
|
|
||||||
type Source struct {
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
type sourceRpc struct {
|
||||||
Id uint `gorm:"primaryKey"`
|
Id uint `gorm:"primaryKey"`
|
||||||
Name string // 供货商名称
|
Name string // 供货商名称
|
||||||
Base string // rpc服务基础名称
|
Base string // rpc服务基础名称
|
||||||
SkuName string // sku名称
|
SkuName string // sku名称
|
||||||
OrderName string // order名称
|
OrderName string // order名称
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SourceItem struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select @Title 订单列表
|
||||||
|
func (s *sourceRpc) Select(ctx context.Context) (reply []SourceItem, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
args := 0
|
||||||
|
err = xClient.Call(ctx, "Select", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type SourceInfo struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Base string `json:"base"`
|
||||||
|
SkuName string `json:"skuName"`
|
||||||
|
OrderName string `json:"orderName"`
|
||||||
|
AfterService string `json:"afterService"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info @Title 获取供货商
|
||||||
|
func (s *sourceRpc) Info(ctx context.Context, sourceId uint) (reply SourceInfo, err error) {
|
||||||
|
xClient, err := client.GetClient(s)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Info", sourceId, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
package wholesale
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/supply"
|
||||||
|
)
|
||||||
|
|
||||||
|
type brand struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists @Title 品牌列表
|
||||||
|
func (b *brand) Lists(ctx context.Context, args supply.ArgsBrandList) (result supply.ReplyBrandList, err error) {
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Lists", args, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// All @Title 全部品牌
|
||||||
|
func (b *brand) All(ctx context.Context) (result []supply.BrandItem, err error) {
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "All", 0, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindByNameAll @Title 品牌名称筛选品牌
|
||||||
|
func (b *brand) FindByNameAll(ctx context.Context, name string) (result []supply.BrandItem, err error) {
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindByNameAll", name, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add @Title 添加品牌
|
||||||
|
func (b *brand) Add(ctx context.Context, args supply.ArgsBrandAdd) (err error) {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Add", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit @Title 编辑品牌
|
||||||
|
func (b *brand) Edit(ctx context.Context, args supply.ArgsBrandEdit) (err error) {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Edit", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindByIds @Title 品牌获取
|
||||||
|
func (b *brand) FindByIds(ctx context.Context, args supply.ArgsBrandFindByIds) (result []supply.BrandItem, err error) {
|
||||||
|
xClient, err := client.GetClient(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindByIds", args, &result)
|
||||||
|
return
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package wholesale
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"git.oa00.com/supply-chain/service/supply"
|
||||||
|
)
|
||||||
|
|
||||||
|
type category struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// All @Title 获取分类
|
||||||
|
func (c *category) All(ctx context.Context) (result []supply.CategoryItem, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "All", 0, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllNoHidden @Title 获取显示的分类
|
||||||
|
func (c *category) AllNoHidden(ctx context.Context) (result []supply.CategoryItem, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "AllNoHidden", 0, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add @Title 添加分类
|
||||||
|
func (c *category) Add(ctx context.Context, args supply.ArgsCategoryAdd) (err error) {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Add", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit @Title 编辑分类
|
||||||
|
func (c *category) Edit(ctx context.Context, args supply.ArgsCategoryEdit) (err error) {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return xClient.Call(ctx, "Edit", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindByIds @Title 三级分类获取
|
||||||
|
func (c *category) FindByIds(ctx context.Context, args supply.ArgsCategoryFindByIds) (result []supply.ThirdCategoryItem, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "FindByIds", args, &result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ChangeHidden @Title 切换隐藏状态
|
||||||
|
func (c *category) ChangeHidden(ctx context.Context, args supply.ArgsChangeHidden) error {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "ChangeHidden", args, &reply)
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package channel
|
||||||
|
|
||||||
|
type Channel struct {
|
||||||
|
Sku sku
|
||||||
|
Order order
|
||||||
|
Mq mq
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package channel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"git.oa00.com/supply-chain/service/client"
|
||||||
|
"github.com/smallnest/rpcx/share"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
MqSubscribeNameSkuPriceChange = "sku_price_change" // sku价格变动
|
||||||
|
MqSubscribeNameSkuChange = "sku_change" // sku信息变动
|
||||||
|
MqSubscribeNameOrderFreightFee = "order_freight_fee" // 运费处理完成
|
||||||
|
MqSubscribeNameOrderSplit = "order_split" // 拆单
|
||||||
|
MqSubscribeNameOrderStockOut = "order_stock_out" // 订单出库
|
||||||
|
MqSubscribeNameOrderFinish = "order_finish" // 订单完成
|
||||||
|
MqSubscribeNameOrderCancel = "order_cancel" // 订单取消
|
||||||
|
)
|
||||||
|
|
||||||
|
type mq struct {
|
||||||
|
}
|
||||||
|
type ArgsMqSubscribe struct {
|
||||||
|
Name string // 队列名称
|
||||||
|
AppKey string // 队列名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subscribe @Title 订阅mq
|
||||||
|
func (m *mq) Subscribe(ctx context.Context, channelId string, args ArgsMqSubscribe) (key string, err error) {
|
||||||
|
xClient, err := client.GetClient(m)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Subscribe", args, &key)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// SubscribeCancel @Title 订阅取消
|
||||||
|
func (m *mq) SubscribeCancel(ctx context.Context, channelId string, args ArgsMqSubscribe) (err error) {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(m)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "SubscribeCancel", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsMqUser struct {
|
||||||
|
AppKey string
|
||||||
|
AppSecret string
|
||||||
|
}
|
||||||
|
|
||||||
|
// User @Title Mq用户
|
||||||
|
func (m *mq) User(ctx context.Context, channelId string, args ArgsMqUser) (err error) {
|
||||||
|
reply := 0
|
||||||
|
xClient, err := client.GetClient(m)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "User", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue