diff --git a/customer/service/service.go b/customer/service/service.go index 6a8ec8c..3eaf512 100644 --- a/customer/service/service.go +++ b/customer/service/service.go @@ -1,5 +1,36 @@ package service +import ( + "context" + "git.oa00.com/supply-chain/service/client" +) + type Service struct { - Audit audit + Audit audit + Service service +} + +type ArgsServiceLists struct { + CustomerId uint + Status uint +} + +type ReplyServiceLists struct { + ServiceId uint `json:"serviceId"` + ServiceName string `json:"serviceName"` + EndTime int64 `json:"endTime"` + AuditStatus uint `json:"auditStatus"` +} + +type service struct { +} + +// All @Title 全部服务 +func (s *service) All(ctx context.Context, customerId uint) (reply []ReplyServiceLists, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "All", customerId, &reply) + return } diff --git a/customer/user/user.go b/customer/user/user.go index 0c35d60..d77dbca 100644 --- a/customer/user/user.go +++ b/customer/user/user.go @@ -3,4 +3,5 @@ package user type User struct { Deposit deposit // 充值 DepositAudit depositAudit // 充值审核 + Wallet wallet // 钱包 } diff --git a/jd/sku.go b/jd/sku.go index a802798..79574e2 100644 --- a/jd/sku.go +++ b/jd/sku.go @@ -236,5 +236,5 @@ func (s *sku) ReplaceImgJdSku(ctx context.Context, args ArgsSkuReplaceImgJdSku) if err != nil { return err } - return xClient.Call(ctx, "ReplaceImg", args, &reply) + return xClient.Call(ctx, "ReplaceImgJdSku", args, &reply) } diff --git a/jd/task.go b/jd/task.go index 5a3b0a6..9017f45 100644 --- a/jd/task.go +++ b/jd/task.go @@ -27,3 +27,13 @@ func (t *task) SkuAdd(ctx context.Context) error { } return xClient.Call(ctx, "SkuAdd", 0, &a) } + +// RefreshToken @Title 更新token +func (t *task) RefreshToken(ctx context.Context) error { + a := 0 + xClient, err := client.GetClient(t) + if err != nil { + return err + } + return xClient.Call(ctx, "RefreshToken", 0, &a) +} diff --git a/rpc/error.go b/rpc/error.go new file mode 100644 index 0000000..80f924b --- /dev/null +++ b/rpc/error.go @@ -0,0 +1,28 @@ +package rpc + +type Error uint + +const ( + ErrorSystem Error = 11001 // 系统错误 + + ErrorOrderRepeat Error = 11002 // 重复下单 + ErrorOrderFreightFee Error = 11003 // 运费错误 + ErrorOrderSubmit Error = 11004 // 下单失败 + ErrorOrderShipment Error = 11005 // 无法配送 + ErrorOrderSkuPrice Error = 11006 // 商品价格错误 + ErrorOrderAmount Error = 11007 // 订单金额错误 +) + +var ErrorCodes = map[Error]string{ + ErrorSystem: "系统错误", + ErrorOrderRepeat: "重复下单", + ErrorOrderFreightFee: "运费错误", + ErrorOrderSubmit: "下单失败", + ErrorOrderShipment: "无法配送", + ErrorOrderSkuPrice: "商品价格错误", + ErrorOrderAmount: "订单金额错误", +} + +func (e Error) Error() string { + return ErrorCodes[e] +} diff --git a/supply/brand.go b/supply/brand.go index d4516ff..8ac4215 100644 --- a/supply/brand.go +++ b/supply/brand.go @@ -49,6 +49,16 @@ func (b *brand) All(ctx context.Context) (result []BrandItem, err error) { return } +// FindByNameAll @Title 品牌名称筛选品牌 +func (b *brand) FindByNameAll(ctx context.Context, name string) (result []BrandItem, err error) { + xClient, err := client.GetClient(b) + if err != nil { + return + } + err = xClient.Call(ctx, "FindByNameAll", name, &result) + return +} + type ArgsBrandAdd struct { Name string // 品牌名称 } diff --git a/supply/channel/order.go b/supply/channel/order.go index e5eab07..6e3a5aa 100644 --- a/supply/channel/order.go +++ b/supply/channel/order.go @@ -41,13 +41,24 @@ func (o *order) FreightFee(ctx context.Context, channelId string, args ArgsOrder return } +type SkuOrderItem struct { + SkuId uint // skuId + Price decimal.Decimal // 单价 + Quantity uint // 数量 +} type ArgsOrderSubmit struct { - Address string // 地址 - Skus []SkuFreightFeeItem // sku信息 - Receiver Receiver // 收件信息 - OrderFee decimal.Decimal // 订单金额-不含运费 - FreightFee decimal.Decimal // 运费 - UserIp string // 下单用户ip + ChannelOrderSn string // 渠道订单编号 + Address string // 地址 + Skus []SkuOrderItem // sku信息 + Receiver Receiver // 收件信息 + OrderFee decimal.Decimal // 订单金额-不含运费 + FreightFees []OrderFreightFee // 运费 + UserIp string // 下单用户ip +} + +type OrderFreightFee struct { + SkuIds []uint `json:"skuIds"` + FreightFee decimal.Decimal `json:"freightFee"` } type Receiver struct { @@ -58,10 +69,12 @@ type Receiver struct { } type ReplyOrderSubmit struct { + OrderSn string + ChannelOrderSn string } // Submit @Title 下单 -func (o *order) Submit(ctx context.Context, channelId string, args ArgsOrderSubmit) (reply []ReplyOrderSubmit, err error) { +func (o *order) Submit(ctx context.Context, channelId string, args ArgsOrderSubmit) (reply ReplyOrderSubmit, err error) { xClient, err := client.GetClient(o) if err != nil { return diff --git a/supply/channel/sku.go b/supply/channel/sku.go index ee277f6..55ce82c 100644 --- a/supply/channel/sku.go +++ b/supply/channel/sku.go @@ -40,6 +40,8 @@ type SkuItem struct { Tax string `json:"tax"` Unit string `json:"unit"` UpcCode string `json:"upcCode"` + TaxName string `json:"taxName"` + TaxCode string `json:"taxCode"` Status uint `json:"status"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` @@ -83,6 +85,8 @@ type SkuDetailItem struct { Tax string `json:"tax"` Unit string `json:"unit"` UpcCode string `json:"upcCode"` + TaxName string `json:"taxName"` + TaxCode string `json:"taxCode"` Status uint `json:"status"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` diff --git a/supply/interface/order.go b/supply/interface/order.go index bd97851..c8c5d4a 100644 --- a/supply/interface/order.go +++ b/supply/interface/order.go @@ -23,10 +23,12 @@ type OrderFreightFeeSkuItem struct { } type ArgsOrderSubmit struct { - OrderSn string // 订单号 + OrderSn uint64 // 订单号 Skus []OrderFreightFeeSkuItem // 商品信息 Address string // 地址 FreightFee decimal.Decimal // 运费 + Receiver OrderReceiver // 收件信息 + UserIp string // 用户ip } type OrderReceiver struct { diff --git a/supply/sku.go b/supply/sku.go index ccd360e..4a7beb5 100644 --- a/supply/sku.go +++ b/supply/sku.go @@ -60,6 +60,7 @@ type ArgsSkuAdd struct { } type SkuImg struct { + Id uint `json:"id"` Path string `json:"path"` } @@ -145,6 +146,8 @@ type SkuItem struct { CustomerProfitRate decimal.Decimal `json:"customerProfitRate"` // 供货利润率 供货利润/供货最高价% AdjustType uint `json:"adjustType"` // 加价类型 AdjustPrice decimal.Decimal `json:"adjustPrice"` // 加价金额 + AfterAdjustType uint `json:"afterAdjustType"` // 改价后加价类型 + AfterAdjustPrice decimal.Decimal `json:"afterAdjustPrice"` // 改价后加价金额 Handle uint `json:"handle"` // 1=未处理 2=已处理 Reason string `json:"reason"` // 驳回原因 } @@ -224,3 +227,30 @@ func (s *sku) DownShelves(ctx context.Context, args ArgsSkuDownShelves) error { } return xClient.Call(ctx, "DownShelves", args, &reply) } + +// GetImgs @Title 获取预览图 +func (s *sku) GetImgs(ctx context.Context, skuId uint) (reply []SkuImg, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "GetImgs", skuId, &reply) + return +} + +type ArgsReplaceImg struct { + SkuId uint + Id uint + Path string +} + +// ReplaceImg @Title 替换图片 +func (s *sku) ReplaceImg(ctx context.Context, args ArgsReplaceImg) (err error) { + reply := 0 + xClient, err := client.GetClient(s) + if err != nil { + return err + } + err = xClient.Call(ctx, "ReplaceImg", args, &reply) + return +}