You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
service/supply/channel/order.go

72 lines
1.9 KiB

package channel
import (
"context"
"git.oa00.com/supply-chain/service/client"
"github.com/shopspring/decimal"
"github.com/smallnest/rpcx/share"
)
const (
ReplyOrderFreightFeeErrCodeNone = 0 // 无错误
ReplyOrderFreightFeeErrCodeErr = 1 // 有错误
)
type order struct {
}
type ArgsOrderFreightFee struct {
Address string // 地址
Skus []SkuFreightFeeItem // sku信息
}
type SkuFreightFeeItem struct {
SkuId uint // skuId
Quantity uint // 数量
}
type ReplyOrderFreightFee struct {
SkuIds []uint `json:"skuIds"`
FreightFee decimal.Decimal `json:"freightFee"`
ErrCode uint `json:"errCode"`
ErrMsg string `json:"errMsg"`
}
// FreightFee @Title 获取运费
func (o *order) FreightFee(ctx context.Context, channelId string, args ArgsOrderFreightFee) (reply []ReplyOrderFreightFee, err error) {
xClient, err := client.GetClient(o)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "FreightFee", args, &reply)
return
}
type ArgsOrderSubmit struct {
Address string // 地址
Skus []SkuFreightFeeItem // sku信息
Receiver Receiver // 收件信息
OrderFee decimal.Decimal // 订单金额-不含运费
FreightFee decimal.Decimal // 运费
UserIp string // 下单用户ip
}
type Receiver struct {
Name string // 姓名
Mobile string // 手机号
Email string // 邮箱
ZipCode string // 邮编
}
type ReplyOrderSubmit struct {
}
// Submit @Title 下单
func (o *order) Submit(ctx context.Context, channelId string, args ArgsOrderSubmit) (reply []ReplyOrderSubmit, err error) {
xClient, err := client.GetClient(o)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Submit", args, &reply)
return
}