提交 829bd33b authored 作者: 屈传平's avatar 屈传平

ikucun

上级 f21630ce
package main
import (
"context"
"gitlab.jxhh.com/stbz/library.git/upstream/ikucun"
)
func main() {
config := ikucun.Config{}
config.AppSecret = "d6bfa503b81641c88a8ec22ff1728e44"
config.AppId = "7dca552382b0407f8b7ebc965d53e72e"
config.AccessToken = "efa79a299fec4ef58a606486544fe30d"
config.ApiUrl = "https://openapi-stable.akucun.com/route/rest"
ikucun.New(&config)
activityList := ikucun.ActivityListReq{}
activityList.PageIndex = "1"
activityList.PageSize = "10"
ikucun.Activity.List(context.Background(), activityList)
}
......@@ -32,7 +32,7 @@ type ActivityListRes struct {
}
//List 列表
func (*activityIkc) List(ctx context.Context, req ActivityListReq) (res *ActivityListRes, err error) {
func (*activityIkc) List(ctx context.Context, req *ActivityListReq) (res *ActivityListRes, err error) {
method := "mengxiang.supply.consignment.activity.search"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
......
package ikucun
import (
"context"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
)
type address struct {
}
var Address = address{}
type AddressProvinceRes struct {
Code int `json:"code"`
Message string `json:"message"`
Success bool `json:"success"`
Data []struct {
Id string `json:"id"`
Name string `json:"name"`
LevelType int `json:"levelType"`
ParentId interface{} `json:"parentId"`
MergerName string `json:"mergerName"`
} `json:"data"`
}
func (s *msg) Province(ctx context.Context) (res *AddressProvinceRes, err error) {
method := "aikucun.base.address.province.list"
result, err := post(ctx, method, g.Map{})
_ = gjson.New(result).Scan(&res)
return
}
type AddressCityReq struct {
ProvinceId string `json:"provinceId"`
}
type AddressCityRes struct {
Code int `json:"code"`
Message string `json:"message"`
Success bool `json:"success"`
Data []struct {
Id string `json:"id"`
Name string `json:"name"`
LevelType int `json:"levelType"`
ParentId string `json:"parentId"`
MergerName string `json:"mergerName"`
} `json:"data"`
}
func (s *msg) City(ctx context.Context, req *AddressCityReq) (res *AddressCityRes, err error) {
method := "aikucun.base.address.city.list"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type AddressAreaReq struct {
CityId string `json:"cityId"`
}
type AddressAreaRes struct {
Code int `json:"code"`
Message string `json:"message"`
Success bool `json:"success"`
Data []struct {
Id string `json:"id"`
Name string `json:"name"`
LevelType int `json:"levelType"`
ParentId string `json:"parentId"`
MergerName string `json:"mergerName"`
} `json:"data"`
}
func (s *msg) Area(ctx context.Context, req *AddressAreaReq) (res *AddressAreaRes, err error) {
method := "aikucun.base.address.district.list"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type AddressStreetReq struct {
DistrictId string `json:"districtId"`
}
type AddressStreetRes struct {
Code int `json:"code"`
Message string `json:"message"`
Success bool `json:"success"`
Data []struct {
Id string `json:"id"`
Name string `json:"name"`
LevelType int `json:"levelType"`
ParentId string `json:"parentId"`
MergerName string `json:"mergerName"`
CityCode string `json:"cityCode"`
ZipCode string `json:"zipCode"`
Lng interface{} `json:"lng"`
Lat interface{} `json:"lat"`
Pinyin string `json:"pinyin"`
ShortName string `json:"shortName"`
DeleteFlag int `json:"deleteFlag"`
AreaId interface{} `json:"areaId"`
AreaName interface{} `json:"areaName"`
} `json:"data"`
}
func (s *msg) Street(ctx context.Context, req *AddressStreetReq) (res *AddressStreetRes, err error) {
method := "aikucun.base.address.villages.list"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
package ikucun
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
type goods struct {
}
var Goods = goods{}
type GoodsListReq struct {
PageIndex string `json:"pageIndex"`
PageSize string `json:"pageSize"`
}
type GoodsListRes struct {
Code string `json:"code"`
Success bool `json:"success"`
Message string `json:"message"`
Data struct {
GoodsList []struct {
ActivityId string `json:"activityId"`
ActivitySpuId string `json:"activitySpuId"`
ProductNum string `json:"productNum"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
SpuId string `json:"spuId"`
SpuType string `json:"spuType"`
SpuName string `json:"spuName"`
SpuImage []string `json:"spuImage"`
Status int `json:"status"`
SoldOut bool `json:"soldOut"`
CategoryCode string `json:"categoryCode"`
CategoryName string `json:"categoryName"`
SecondCategoryCode string `json:"secondCategoryCode"`
SecondCategoryName string `json:"secondCategoryName"`
FirstCategoryCode string `json:"firstCategoryCode"`
FirstCategoryName string `json:"firstCategoryName"`
BrandId string `json:"brandId"`
BrandName string `json:"brandName"`
BrandLogo string `json:"brandLogo"`
SpuDetailImage []string `json:"spuDetailImage"`
SizeImage string `json:"sizeImage,omitempty"`
SalesAttributeInfoList []struct {
AttributeCode string `json:"attributeCode"`
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
Priority int `json:"priority"`
AttributeImage []string `json:"attributeImage"`
} `json:"salesAttributeInfoList"`
BaseAttributeInfoList []struct {
AttributeCode string `json:"attributeCode"`
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
} `json:"baseAttributeInfoList"`
SkuList []struct {
SkuId string `json:"skuId"`
SoldOut bool `json:"soldOut"`
SalesAttributeInfoList []struct {
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
Priority int `json:"priority"`
} `json:"salesAttributeInfoList"`
BaseAttributeInfoList []struct {
AttributeCode string `json:"attributeCode"`
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
} `json:"baseAttributeInfoList"`
CurrentPriceInfo struct {
ActivitySpuId string `json:"activitySpuId"`
MarketingPrice int `json:"marketingPrice"`
Commission float64 `json:"commission"`
CommissionAddition int `json:"commissionAddition"`
SupplyPrice float64 `json:"supplyPrice"`
TagPrice int `json:"tagPrice"`
SowingPrice int `json:"sowingPrice"`
PromotionDetailInfoList []struct {
PromotionId string `json:"promotionId"`
PromotionType string `json:"promotionType"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
PromoPrice int `json:"promoPrice"`
SupplyPrice float64 `json:"supplyPrice"`
} `json:"promotionDetailInfoList,omitempty"`
} `json:"currentPriceInfo"`
AdvancePriceInfo struct {
} `json:"advancePriceInfo"`
} `json:"skuList"`
} `json:"goodsList"`
} `json:"data"`
}
//List 列表
func (s *goods) List(ctx context.Context, req *GoodsListReq) (res *GoodsListRes, err error) {
method := "mengxiang.supply.consignment.goods.search"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type GoodsDetailReq struct {
ThirdUserId string `json:"thirdUserId"`
SpuId string `json:"spuId"`
}
type GoodsDetailRes struct {
Code string `json:"code"`
Success bool `json:"success"`
Message string `json:"message"`
Data struct {
ActivityId string `json:"activityId"`
ActivitySpuId string `json:"activitySpuId"`
ProductNum string `json:"productNum"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
SpuId string `json:"spuId"`
SpuType string `json:"spuType"`
SpuName string `json:"spuName"`
SpuImage []string `json:"spuImage"`
Status int `json:"status"`
SoldOut bool `json:"soldOut"`
CategoryCode string `json:"categoryCode"`
CategoryName string `json:"categoryName"`
SecondCategoryCode string `json:"secondCategoryCode"`
SecondCategoryName string `json:"secondCategoryName"`
FirstCategoryCode string `json:"firstCategoryCode"`
FirstCategoryName string `json:"firstCategoryName"`
BrandId string `json:"brandId"`
BrandName string `json:"brandName"`
BrandLogo string `json:"brandLogo"`
SpuDetailImage []string `json:"spuDetailImage"`
SizeImage string `json:"sizeImage"`
SalesAttributeInfoList []struct {
AttributeCode string `json:"attributeCode"`
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
Priority int `json:"priority"`
AttributeImage []string `json:"attributeImage"`
} `json:"salesAttributeInfoList"`
BaseAttributeInfoList []struct {
AttributeCode string `json:"attributeCode"`
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
} `json:"baseAttributeInfoList"`
SkuList []struct {
SkuId string `json:"skuId"`
SoldOut bool `json:"soldOut"`
SalesAttributeInfoList []struct {
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
Priority int `json:"priority"`
} `json:"salesAttributeInfoList"`
BaseAttributeInfoList []struct {
AttributeCode string `json:"attributeCode"`
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
} `json:"baseAttributeInfoList"`
CurrentPriceInfo struct {
ActivitySpuId string `json:"activitySpuId"`
MarketingPrice int `json:"marketingPrice"`
Commission int `json:"commission"`
CommissionAddition int `json:"commissionAddition"`
SupplyPrice int `json:"supplyPrice"`
TagPrice int `json:"tagPrice"`
SowingPrice int `json:"sowingPrice"`
} `json:"currentPriceInfo"`
AdvancePriceInfo struct {
} `json:"advancePriceInfo"`
} `json:"skuList"`
} `json:"data"`
}
//List 商品列表
func (s *goods) Detail(ctx context.Context, req *GoodsDetailReq) (res *GoodsDetailRes, err error) {
method := "mengxiang.supply.consignment.goods.detail"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
package ikucun
import (
"context"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
)
type msg struct {
}
var Msg = msg{}
type MsgRes struct {
}
/**
商品变更消息通知
*/
func (s *msg) GoodsChange(ctx context.Context) (res *MsgRes, err error) {
method := "mengxiang.supply.goods.change.notify"
result, err := post(ctx, method, g.Map{})
_ = gjson.New(result).Scan(&res)
return
}
/**
规则内商品增量通知
*/
func (s *msg) RuleGoodsChange(ctx context.Context) (res *MsgRes, err error) {
method := "mengxiang.supply.rule.goods.change"
result, err := post(ctx, method, g.Map{})
_ = gjson.New(result).Scan(&res)
return
}
/**
自助选品推送通知
*/
func (s *msg) GoodsPush(ctx context.Context) (res *MsgRes, err error) {
method := "mengxiang.supply.self.goods.push"
result, err := post(ctx, method, g.Map{})
_ = gjson.New(result).Scan(&res)
return
}
/**
发货通知、修改通知
*/
func (s *msg) OrderDelivery(ctx context.Context) (res *MsgRes, err error) {
method := "mengxiang.supply.order.delivery.notify"
result, err := post(ctx, method, g.Map{})
_ = gjson.New(result).Scan(&res)
return
}
type MsgPickUpReq struct {
PickUpNo string `json:"pickUpNo"`
ThirdUserId string `json:"thirdUserId"`
PickUpStatus int `json:"pickUpStatus"`
MsgStatus int `json:"msgStatus"`
}
type MsgPickUpRes struct {
}
/**
上门取件消息通知
*/
func (s *msg) PickUp(ctx context.Context, req *MsgPickUpReq) (res *MsgPickUpRes, err error) {
method := "mengxiang.aftersale.notfiy.pick.up.changes"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type MsgAfterChangeReq struct {
GenerationTime string `json:"generationTime"`
AfterSalesNo string `json:"afterSalesNo"`
NotificationType int `json:"notificationType"`
OrderStatus int `json:"orderStatus"`
}
type MsgAfterChangeRes struct {
}
/**
售后状态变更推送
*/
func (s *msg) AftersaleChange(ctx context.Context, req *MsgAfterChangeReq) (res *MsgAfterChangeRes, err error) {
method := "mengxiang.aftersale.notify.order.changes"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
/**
订单状态通知
*/
func (s *msg) OrderNotify(ctx context.Context) (res *MsgAfterChangeRes, err error) {
method := "mengxiang.supply.order.event.notify"
result, err := post(ctx, method, g.Map{})
_ = gjson.New(result).Scan(&res)
return
}
package ikucun
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
type order struct {
}
var Order = order{}
type OrderCreateReq struct {
ThirdUserId string `json:"thirdUserId"`
ThirdOrderNo string `json:"thirdOrderNo"`
Receiver struct {
TownName string `json:"townName"`
DistrictCode string `json:"districtCode"`
CityName string `json:"cityName"`
DistrictName string `json:"districtName"`
TownCode string `json:"townCode"`
ProvinceCode string `json:"provinceCode"`
CityCode string `json:"cityCode"`
IdCardNo string `json:"idCardNo"`
Mobile string `json:"mobile"`
RecipientName string `json:"recipientName"`
ProvinceName string `json:"provinceName"`
Address string `json:"address"`
} `json:"receiver"`
SpuList []*OrderSpuList `json:"spuList"`
}
type OrderSpuList struct {
Quantity string `json:"quantity"`
MarketingSalePrice string `json:"marketingSalePrice"`
ExtSubOrderNo string `json:"extSubOrderNo"`
SpuId string `json:"spuId"`
SkuId string `json:"skuId"`
}
type OrderCreateRes struct {
Code string `json:"code"`
Success bool `json:"success"`
Message string `json:"message"`
Data struct {
OrderGroupNo string `json:"orderGroupNo"`
OrderList []struct {
OrderNo string `json:"orderNo"`
PayOverTime string `json:"payOverTime"`
Quantity int `json:"quantity"`
TotalProductAmount int `json:"totalProductAmount"`
TotalDiscountAmount int `json:"totalDiscountAmount"`
TotalCommission int `json:"totalCommission"`
TotalCommissionAddition int `json:"totalCommissionAddition"`
Freight int `json:"freight"`
TotalTax int `json:"totalTax"`
PaymentAmount int `json:"paymentAmount"`
TotalProduct2CAmount int `json:"totalProduct2CAmount"`
TotalDiscount2CAmount int `json:"totalDiscount2CAmount"`
Payment2CAmount int `json:"payment2CAmount"`
OrderSkuList []struct {
OrderSkuNo string `json:"orderSkuNo"`
SpuId string `json:"spuId"`
SkuId string `json:"skuId"`
Quantity int `json:"quantity"`
UnitPrice int `json:"unitPrice"`
SpuAmount int `json:"spuAmount"`
DiscountAmount int `json:"discountAmount"`
SkuTax int `json:"skuTax"`
SettlementAmount int `json:"settlementAmount"`
Commission int `json:"commission"`
CommissionAddition int `json:"commissionAddition"`
Spu2CAmount int `json:"spu2CAmount"`
Discount2CAmount int `json:"discount2CAmount"`
Settlement2CAmount int `json:"settlement2CAmount"`
OrderPromotionList []interface{} `json:"orderPromotionList"`
} `json:"orderSkuList"`
} `json:"orderList"`
} `json:"data"`
}
func (s *order) Create(ctx context.Context, req *OrderCreateReq) (res *OrderCreateRes, err error) {
method := "mengxiang.supply.order.create"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type OrderDetailReq struct {
OrderNo string `json:"orderNo"`
}
type OrderDetailRes struct {
Code string `json:"code"`
Success bool `json:"success"`
Message string `json:"message"`
Data struct {
OrderNo string `json:"orderNo"`
OrderType int `json:"orderType"`
OrderStatus int `json:"orderStatus"`
OrderTime string `json:"orderTime"`
TotalProductAmount int `json:"totalProductAmount"`
TotalDiscountAmount int `json:"totalDiscountAmount"`
TotalCommission int `json:"totalCommission"`
TotalIntegratedTax int `json:"totalIntegratedTax"`
Freight int `json:"freight"`
OrderGroupNo string `json:"orderGroupNo"`
PaymentAmount int `json:"paymentAmount"`
TotalProduct2CAmount int `json:"totalProduct2CAmount"`
TotalDiscount2CAmount int `json:"totalDiscount2CAmount"`
Payment2CAmount int `json:"payment2CAmount"`
PayOverTime string `json:"payOverTime"`
BrandId string `json:"brandId"`
BrandName string `json:"brandName"`
BrandLogo string `json:"brandLogo"`
ThirdUserId string `json:"thirdUserId"`
SignType int `json:"signType"`
ThirdOrderNo string `json:"thirdOrderNo"`
OrderSkuList []struct {
OrderSkuNo string `json:"orderSkuNo"`
OrderSkuStatus int `json:"orderSkuStatus"`
SpuId string `json:"spuId"`
SkuId string `json:"skuId"`
UnitPrice int `json:"unitPrice"`
ProductAmount int `json:"productAmount"`
Product2CAmount int `json:"product2CAmount"`
Discount2CAmount int `json:"discount2CAmount"`
Settlement2CAmount int `json:"settlement2CAmount"`
Commission int `json:"commission"`
DiscountAmount int `json:"discountAmount"`
SkuTax int `json:"skuTax"`
SettlementAmount int `json:"settlementAmount"`
Quantity int `json:"quantity"`
CancelQuantity int `json:"cancelQuantity"`
DeliveryQuantity int `json:"deliveryQuantity"`
UnDeliveryQuantity int `json:"unDeliveryQuantity"`
SpuName string `json:"spuName"`
SpuImage string `json:"spuImage"`
BrandName string `json:"brandName"`
BrandLogo string `json:"brandLogo"`
} `json:"orderSkuList"`
Recipient struct {
RecipientName string `json:"recipientName"`
Mobile string `json:"mobile"`
Address string `json:"address"`
ProvinceCode string `json:"provinceCode"`
CityCode string `json:"cityCode"`
DistrictCode string `json:"districtCode"`
TownCode string `json:"townCode"`
} `json:"recipient"`
} `json:"data"`
}
/*
*获取订单详情
*/
func (s *order) Detail(ctx context.Context, req *OrderDetailReq) (res *OrderDetailRes, err error) {
method := "mengxiang.supply.order.detail"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type OderLogisticsReq struct {
LogisticsNo string `json:"logisticsNo"`
LogisticsCode string `json:"logisticsCode"`
}
type OderLogisticsRes struct {
}
/*
*物流轨迹查询
*/
func (s *order) Logistics(ctx context.Context, req *OderLogisticsReq) (res *OderLogisticsRes, err error) {
method := "mengxiang.supply.logistics.trace.get"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
package ikucun
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
type orderRefund struct {
}
var OrderRefund = orderRefund{}
type OrderRefundReq struct {
ThirdUserId string `json:"thirdUserId"`
OrderNo string `json:"orderNo"`
AfterSaleApplyAmount string `json:"afterSaleApplyAmount"`
IsReceived string `json:"isReceived"`
ReturnName string `json:"returnName"`
CityId string `json:"cityId"`
AfterSaleReason string `json:"afterSaleReason"`
ProvinceId string `json:"provinceId"`
AsType string `json:"asType"`
ReturnPhone string `json:"returnPhone"`
Spec string `json:"spec"`
ReturnAddress string `json:"returnAddress"`
DistrictId string `json:"districtId"`
ProofImageUrls []string `json:"proofImageUrls"`
ApplyRemark string `json:"applyRemark"`
SkuOrderNo string `json:"skuOrderNo"`
AfterSaleApplyCount string `json:"afterSaleApplyCount"`
ExSkuId string `json:"exSkuId"`
AsReason string `json:"asReason"`
}
type OrderRefundRes struct {
}
func (s *orderRefund) Apply(ctx context.Context, req *OrderRefundReq) (res *OrderRefundRes, err error) {
method := "mengxiang.aftersale.apply.order"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type OrefundRefundCancelReq struct {
ThirdUserId string `json:"thirdUserId"`
AfterSalesNo string `json:"afterSalesNo"`
}
type OrefundRefundCancelRes struct {
}
func (s *orderRefund) Cancel(ctx context.Context, req *OrefundRefundCancelReq) (res *OrefundRefundCancelRes, err error) {
method := "mengxiang.aftersale.cancel.order"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type OrefundRefundDetailReq struct {
ThirdUserId string `json:"thirdUserId"`
AfterSalesNo string `json:"afterSalesNo"`
}
type OrefundRefundDetailRes struct {
}
func (s *orderRefund) Detail(ctx context.Context, req *OrefundRefundDetailReq) (res *OrefundRefundDetailRes, err error) {
method := "mengxiang.aftersale.order.detail"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type OrderfundRefundDetailReq struct {
OrderNo string `json:"orderNo"`
SkuOrderNo string `json:"skuOrderNo"`
ThirdUserId string `json:"thirdUserId"`
}
type OrderfundRefundDetailRes struct {
}
func (s *orderRefund) Check(ctx context.Context, req *OrderfundRefundDetailReq) (res *OrderfundRefundDetailRes, err error) {
method := "mengxiang.aftersale.order.support.exchange"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
package ikucun
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
type user struct {
}
var User = user{}
type UserInfoReq struct {
ThirdUserId string `json:"thirdUserId"`
Mobile string `json:"mobile"`
Name string `json:"name"`
}
type UserAddRes struct {
Code string `json:"code"`
Success bool `json:"success"`
Message string `json:"message"`
Data bool `json:"data"`
}
func (s *user) Add(ctx context.Context, req *UserInfoReq) (res *UserAddRes, err error) {
method := "mengxiang.supply.user.create"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type UserDetailReq struct {
ThirdUserId string `json:"thirdUserId"`
}
type UserInfoRes struct {
Code string `json:"code"`
Success bool `json:"success"`
Message string `json:"message"`
Data struct {
ThirdUserId string `json:"thirdUserId"`
Name string `json:"name"`
} `json:"data"`
}
func (s *user) Detail(ctx context.Context, req *UserDetailReq) (res *UserInfoRes, err error) {
method := "mengxiang.supply.user.detail"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论