云中鹤接口

master
杨赟 7 months ago
parent e27dfb1b3f
commit 8fd1ecd4e8

@ -4,6 +4,7 @@ import (
"git.oa00.com/supply-chain/service/customer"
"git.oa00.com/supply-chain/service/jd"
"git.oa00.com/supply-chain/service/otosaas"
"git.oa00.com/supply-chain/service/skycrane"
"git.oa00.com/supply-chain/service/supplier"
"git.oa00.com/supply-chain/service/supply"
"git.oa00.com/supply-chain/service/wholesale"
@ -18,4 +19,5 @@ type rpc struct {
Supplier supplier.Supplier
Wholesale wholesale.Wholesale
OtoSaas otosaas.OtoSaas
Skycrane skycrane.Skycrane
}

@ -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,193 @@
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"`
MateSkuId int64 `json:"mateSkuId"`
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"`
MateSkuId int64 `json:"mateSkuId"`
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,45 @@
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
}

@ -47,6 +47,7 @@ type ArgsOrderSubmit struct {
FreightFee decimal.Decimal // 运费
Receiver OrderReceiver // 收件信息
UserIp string // 用户ip
BuyerMsg string // 用户备注
}
type OrderReceiver struct {

@ -16,6 +16,7 @@ const (
SkuSourceJd source = 1 // 京东开普勒渠道
SkuSourceSupplier source = 2 // 供应链供应商渠道
SkuSourceOtoSaas source = 3 // 海旅供应商渠道
SkuSourceSkycrane source = 4 // 云中鹤渠道
)
const (

Loading…
Cancel
Save