From fb09eec25ef8677d6ca9902604b7d0e1d850dab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 26 Nov 2019 09:41:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E7=9B=9F=E6=9F=A5=E8=AF=A2=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=92=8C=E8=AE=A2=E5=8D=95=E6=8E=A5=E5=8F=A3Struts?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/weimobapi/goods.go | 8 +- platformapi/weimobapi/order.go | 182 +++++++++++++++++++++++++++++++++ 2 files changed, 186 insertions(+), 4 deletions(-) diff --git a/platformapi/weimobapi/goods.go b/platformapi/weimobapi/goods.go index c2608d40..608d661e 100644 --- a/platformapi/weimobapi/goods.go +++ b/platformapi/weimobapi/goods.go @@ -98,10 +98,10 @@ type GoodsInfo struct { } type QueryGoodsListParam struct { - PageNum int `json:"pageNum"` - PageSize int `json:"pageSize"` - OrderBy *OrderByInfo `json:"orderBy,omitempty"` - QueryGoodsListRequest *QueryGoodsListRequestVo `json:"queryGoodsListRequestVo,omitempty"` + PageNum int `json:"pageNum"` + PageSize int `json:"pageSize"` + OrderBy *OrderByInfo `json:"orderBy,omitempty"` + QueryParameter *QueryGoodsListRequestVo `json:"queryParameter,omitempty"` } type OrderByInfo struct { diff --git a/platformapi/weimobapi/order.go b/platformapi/weimobapi/order.go index a5dc532f..1d048a07 100644 --- a/platformapi/weimobapi/order.go +++ b/platformapi/weimobapi/order.go @@ -10,6 +10,10 @@ const ( OrderStatusCanceled = 4 // 已取消 ) +const ( + QueryOrdersListPageSize = 10 +) + type DeliveryOrderItem struct { ItemID int64 `json:"itemId"` SkuID int64 `json:"skuId"` @@ -156,6 +160,184 @@ type OrderDetail struct { UpdateTime int64 `json:"updateTime"` } +type QueryOrdersListParam struct { + PageNum int `json:"pageNum"` + PageSize int `json:"pageSize"` + EcBizStoreId int64 `json:"ecBizStoreId,omitempty"` + QueryParameter *MerchantOrderListQueryParameter `json:"queryParameter,omitempty"` +} + +type MerchantOrderListQueryParameter struct { + CreateStartTime int64 `json:"createStartTime,omitempty"` //下单起始时间 + CreateEndTime int64 `json:"createEndTime,omitempty"` //下单结束时间 + UpdateStartTime int64 `json:"updateStartTime,omitempty"` //更新开始时间 + UpdateEndTime int64 `json:"updateEndTime,omitempty"` //更新结束时间 + OrderTypes []int `json:"orderTypes,omitempty"` //订单类型: 1、B2C订单 99、充值订单 97、直接消费订单 不传默认为 1 (建议只传一种类型) + OrderStatuses []int `json:"orderStatuses"` //订单状态 (空为不限,0-待支付,1-待发货,2-已发货,3-已完成,4-已取消) + ChannelTypes []int `json:"channelTypes"` //渠道类型 (空为不限,0-公众号,1-小程序,2-H5,3-QQ,4-微博,5-头条,6-支付宝,7-线下) + DeliveryStatuses []int `json:"deliveryStatuses"` //发货状态 (空为不限,0未发货,1为部分发货,2为已发货) + PaymentTypes []int `json:"paymentTypes"` //支付类型(空为不限,1-线上支付(包括微信、支付宝、银行卡、购物卡等),2-线下支付(包括现金、欠条等,默认是现金),3-混合支付(网上支付和线下支付混合)) + PaymentMethods []int `json:"paymentMethods"` //支付方式 (空为不限,1-支付宝,2-微信,3-银行卡,4-现金,5-货到付款,6-无需支付) + DeliveryTypes []int `json:"deliveryTypes"` //配送类型 (空为不限,1-物流配送(走快递发货流程),2-同城限时达(走即时物流流程),3-到店自提(走自提流程)) + FlagRanks []int `json:"flagRanks"` //订单标记 (空为不限,等级1到5) + BizTypes []int `json:"bizTypes"` //业务类型 (空为不限,0-普通,3-限时折扣,4-砍价, 5-拼团) + GoodsDistributionTypes []int `json:"goodsDistributionTypes,omitempty"` //分销类型:1、普通商品,2、分销商品 + TransferStatus int `json:"transferStatus,omitempty"` //转单状态 : 0未转单,1已转单,2转单失败 不传代表全部 + GoodsPromotionTypes []int `json:"goodsPromotionTypes ,omitempty"` //商品销售类型,1为普通,2为周期购,3、积分订单 +} + +type OrderInfo struct { + BizOrderID string `json:"bizOrderId"` + BizType int `json:"bizType"` + BuyerRemark string `json:"buyerRemark"` + ChannelType int `json:"channelType"` + ChannelTypeName string `json:"channelTypeName"` + ConfirmReceivedTime interface{} `json:"confirmReceivedTime"` + CreateTime int64 `json:"createTime"` + DeliveryAmount float64 `json:"deliveryAmount"` + DeliveryOrderID interface{} `json:"deliveryOrderId"` + DeliveryTime interface{} `json:"deliveryTime"` + DeliveryType int `json:"deliveryType"` + DeliveryTypeName string `json:"deliveryTypeName"` + EnableDelivery int `json:"enableDelivery"` + ExpectDeliveryTime string `json:"expectDeliveryTime"` + FlagContent interface{} `json:"flagContent"` + FlagRank interface{} `json:"flagRank"` + GoodsAmount float64 `json:"goodsAmount"` + GoodsPromotionInfo GoodsPromotionInfo `json:"goodsPromotionInfo"` + ItemList []ItemList `json:"itemList"` + OrderNo int64 `json:"orderNo"` + OrderStatus int `json:"orderStatus"` + OrderStatusName string `json:"orderStatusName"` + PaymentAmount float64 `json:"paymentAmount"` + PaymentMethodName string `json:"paymentMethodName"` + PaymentStatus int `json:"paymentStatus"` + PaymentTime interface{} `json:"paymentTime"` + PaymentType int `json:"paymentType"` + PaymentTypeName string `json:"paymentTypeName"` + Pid int64 `json:"pid"` + ProcessStoreID int `json:"processStoreId"` + ProcessStoreTitle string `json:"processStoreTitle"` + ReceiverAddress string `json:"receiverAddress"` + ReceiverArea string `json:"receiverArea"` + ReceiverCity string `json:"receiverCity"` + ReceiverCounty string `json:"receiverCounty"` + ReceiverMobile string `json:"receiverMobile"` + ReceiverName string `json:"receiverName"` + ReceiverProvince string `json:"receiverProvince"` + SelfPickupSiteName interface{} `json:"selfPickupSiteName"` + SelfPickupStatus interface{} `json:"selfPickupStatus"` + StoreID int `json:"storeId"` + StoreTitle string `json:"storeTitle"` + SubBizType interface{} `json:"subBizType"` + TotalPoint interface{} `json:"totalPoint"` + TransferFailReason interface{} `json:"transferFailReason"` + TransferStatus int `json:"transferStatus"` + TransferType int `json:"transferType"` + UpdateTime int64 `json:"updateTime"` + UserNickname string `json:"userNickname"` + Wid int `json:"wid"` +} +type CycleOrderInfo struct { + CurrentCycleNum interface{} `json:"currentCycleNum"` + CycleDeliveryTime interface{} `json:"cycleDeliveryTime"` + CycleItemList interface{} `json:"cycleItemList"` + CyclePackageList interface{} `json:"cyclePackageList"` + CycleSize interface{} `json:"cycleSize"` + CycleType interface{} `json:"cycleType"` + CycleTypeName interface{} `json:"cycleTypeName"` + FirstTime interface{} `json:"firstTime"` +} +type GoodsPromotionInfo struct { + CycleOrderInfo CycleOrderInfo `json:"cycleOrderInfo"` + GoodsDistributionType interface{} `json:"goodsDistributionType"` + PromotionID interface{} `json:"promotionId"` + PromotionOrderID interface{} `json:"promotionOrderId"` + PromotionType int `json:"promotionType"` +} +type BaseDiscountInfo struct { + BalanceDiscountAmount interface{} `json:"balanceDiscountAmount"` + BalanceDiscountDeliveryAmount interface{} `json:"balanceDiscountDeliveryAmount"` + CouponCodeDiscountAmount interface{} `json:"couponCodeDiscountAmount"` + CouponCodeDiscountInfo interface{} `json:"couponCodeDiscountInfo"` + CouponDiscountAmount interface{} `json:"couponDiscountAmount"` + CouponDiscountInfo interface{} `json:"couponDiscountInfo"` + DeliveryUsedPoints interface{} `json:"deliveryUsedPoints"` + MemberPointsDiscountAmount interface{} `json:"memberPointsDiscountAmount"` + MembershipDiscountAmount interface{} `json:"membershipDiscountAmount"` + MembershipDiscountInfo interface{} `json:"membershipDiscountInfo"` + MerchantDiscountAmount interface{} `json:"merchantDiscountAmount"` + NynjDiscountAmount interface{} `json:"nynjDiscountAmount"` + PointsDiscountDeliveryAmount interface{} `json:"pointsDiscountDeliveryAmount"` + PromotionDiscountAmount int `json:"promotionDiscountAmount"` + UsedMemberPoints interface{} `json:"usedMemberPoints"` +} +type BizInfo struct { + BizID interface{} `json:"bizId"` + BizOrderID interface{} `json:"bizOrderId"` + BizType interface{} `json:"bizType"` + SubBizType interface{} `json:"subBizType"` +} +type TagInfo struct { + ActivityTag interface{} `json:"activityTag"` + AdvancedActivityTagList interface{} `json:"advancedActivityTagList"` + AllActivityTagList interface{} `json:"allActivityTagList"` + AllTagList interface{} `json:"allTagList"` + BizTagList interface{} `json:"bizTagList"` + CouponTag interface{} `json:"couponTag"` + CustomizedTag interface{} `json:"customizedTag"` + GeneralActivityTagList interface{} `json:"generalActivityTagList"` + GoodsBizTag []interface{} `json:"goodsBizTag"` + GoodsUserTag interface{} `json:"goodsUserTag"` + IndustryTagList interface{} `json:"industryTagList"` + MerchantTag interface{} `json:"merchantTag"` + UserTag interface{} `json:"userTag"` +} +type ItemList struct { + BaseDiscountInfo BaseDiscountInfo `json:"baseDiscountInfo"` + BizInfo BizInfo `json:"bizInfo"` + CommentStatus interface{} `json:"commentStatus"` + GoodsCategoryID interface{} `json:"goodsCategoryId"` + GoodsCode interface{} `json:"goodsCode"` + GoodsID int64 `json:"goodsId"` + GoodsTitle string `json:"goodsTitle"` + GoodsType int `json:"goodsType"` + HadDeliveryItemNum int `json:"hadDeliveryItemNum"` + ID int `json:"id"` + ImageURL string `json:"imageUrl"` + OriginalPrice float64 `json:"originalPrice"` + PaymentAmount float64 `json:"paymentAmount"` + Point interface{} `json:"point"` + Price float64 `json:"price"` + RightsOrderID interface{} `json:"rightsOrderId"` + RightsStatus interface{} `json:"rightsStatus"` + RightsStatusName interface{} `json:"rightsStatusName"` + ShouldPaymentAmount interface{} `json:"shouldPaymentAmount"` + SkuAmount float64 `json:"skuAmount"` + SkuCode interface{} `json:"skuCode"` + SkuID int64 `json:"skuId"` + SkuName interface{} `json:"skuName"` + SkuNum int `json:"skuNum"` + TagInfo TagInfo `json:"tagInfo"` + TotalAmount float64 `json:"totalAmount"` + TotalPoint interface{} `json:"totalPoint"` +} + +//查询微盟订单 +func (a *API) QueryOrdersList(queryParam *QueryOrdersListParam) (orderList []*OrderInfo, totalCount int, err error) { + param := make(map[string]interface{}) + if queryParam != nil { + param = utils.Struct2FlatMap(queryParam) + } + result, err := a.AccessAPI("order/queryOrderList", param) + if err == nil { + data := result.(map[string]interface{}) + totalCount = int(utils.MustInterface2Int64(data["totalCount"])) + err = utils.Map2StructByJson(data["pageList"], &orderList, false) + } + return orderList, totalCount, err +} + func (a *API) QueryOrderDetail(orderNo int64, needInvoiceInfo bool) (retVal map[string]interface{}, err error) { result, err := a.AccessAPI("order/queryOrderDetail", map[string]interface{}{ "orderNo": orderNo,