Merge branch 'master' of e.coding.net:rosydev/baseapi
This commit is contained in:
@@ -78,41 +78,291 @@ type DeliveryType struct {
|
||||
}
|
||||
|
||||
type GoodsInfo struct {
|
||||
AvaliableStockNum int `json:"avaliableStockNum"`
|
||||
DefaultImageURL string `json:"defaultImageUrl"`
|
||||
ExistEmptyStock bool `json:"existEmptyStock"`
|
||||
GoodsID int64 `json:"goodsId"`
|
||||
IsAllStockEmpty bool `json:"isAllStockEmpty"`
|
||||
IsCanSell bool `json:"isCanSell"`
|
||||
IsExistEmptyStock bool `json:"isExistEmptyStock"`
|
||||
IsMultiSku int `json:"isMultiSku"`
|
||||
IsPutAway int `json:"isPutAway"`
|
||||
MaxPrice float64 `json:"maxPrice"`
|
||||
MinPrice float64 `json:"minPrice"`
|
||||
PutAwayDate int64 `json:"putAwayDate"`
|
||||
PutAwayForBackend int `json:"putAwayForBackend"`
|
||||
SalesNum int `json:"salesNum"`
|
||||
SortNum int `json:"sortNum"`
|
||||
Title string `json:"title"`
|
||||
AvaliableStockNum int `json:"avaliableStockNum"`
|
||||
DefaultImageURL string `json:"defaultImageUrl"`
|
||||
ExistEmptyStock bool `json:"existEmptyStock"`
|
||||
GoodsID int64 `json:"goodsId"`
|
||||
IsAllStockEmpty bool `json:"isAllStockEmpty"`
|
||||
IsCanSell bool `json:"isCanSell"`
|
||||
IsExistEmptyStock bool `json:"isExistEmptyStock"`
|
||||
IsMultiSku int `json:"isMultiSku"`
|
||||
IsPutAway int `json:"isPutAway"`
|
||||
MaxPrice float64 `json:"maxPrice"`
|
||||
MinPrice float64 `json:"minPrice"`
|
||||
PutAwayDate int64 `json:"putAwayDate"`
|
||||
PutAwayForBackend int `json:"putAwayForBackend"`
|
||||
SalesNum int `json:"salesNum"`
|
||||
SortNum int `json:"sortNum"`
|
||||
Title string `json:"title"`
|
||||
GoodsDetailInfo *GoodsDetailInfo `json:"goodsDetailInfo"`
|
||||
}
|
||||
|
||||
type QueryGoodsListParam struct {
|
||||
PageNum int `json:"pageNum"`
|
||||
PageSize int `json:"pageSize"`
|
||||
OrderBy
|
||||
GoodsParameter
|
||||
PageNum int `json:"pageNum"`
|
||||
PageSize int `json:"pageSize"`
|
||||
OrderBy *OrderByInfo `json:"orderBy,omitempty"`
|
||||
QueryGoodsListRequest *QueryGoodsListRequestVo `json:"queryGoodsListRequestVo,omitempty"`
|
||||
}
|
||||
|
||||
type OrderBy struct {
|
||||
type OrderByInfo struct {
|
||||
Field string `json:"field"` //排序字段名: sortNum:按照sort字段排序 putAwayDate:按照上下架时间排序 salesNum:按照销量排序 availableStockNum:按照库存排序 price:按照价格排序
|
||||
Sort string `json:"sort"` //升降/降序 DESC/ASC,只能是这两个值,不区分大小写
|
||||
}
|
||||
|
||||
type GoodsParameter struct {
|
||||
GoodsStatus int `json:"goodsStatus"` //商品状态:0-上架中 1-下架中 2-已售罄
|
||||
GoodsClassifyID int `json:"goodsClassifyId"` //分组id
|
||||
Search string `json:"search"` //搜索框输入内容商品名称
|
||||
GoodsPrice float32 `json:"goodsPrice"`
|
||||
type QueryGoodsListRequestVo struct {
|
||||
GoodsStatus int `json:"goodsStatus"` //商品状态:0-上架中 1-下架中 2-已售罄
|
||||
GoodsClassifyID int `json:"goodsClassifyId"` //分组id
|
||||
Search string `json:"search"` //搜索框输入内容商品名称
|
||||
}
|
||||
|
||||
type GoodsDetailInfo struct {
|
||||
ArchivesTemplate interface{} `json:"archivesTemplate"`
|
||||
B2CGoods *B2CGoods `json:"b2cGoods"`
|
||||
CategoryList []*CategoryList `json:"categoryList"`
|
||||
DeductStockType int `json:"deductStockType"`
|
||||
DefaultImageURL interface{} `json:"defaultImageUrl"`
|
||||
GoodsDesc string `json:"goodsDesc"`
|
||||
GoodsID int64 `json:"goodsId"`
|
||||
GoodsImageURL []string `json:"goodsImageUrl"`
|
||||
GoodsSlogan interface{} `json:"goodsSlogan"`
|
||||
GoodsVideoImageURL interface{} `json:"goodsVideoImageUrl"`
|
||||
GoodsVideoURL interface{} `json:"goodsVideoUrl"`
|
||||
InitialSales int `json:"initialSales"`
|
||||
IsAllowOversold interface{} `json:"isAllowOversold"`
|
||||
IsAssignStore interface{} `json:"isAssignStore"`
|
||||
IsAutoCanSell interface{} `json:"isAutoCanSell"`
|
||||
IsAutoForbidSell interface{} `json:"isAutoForbidSell"`
|
||||
IsCanSell interface{} `json:"isCanSell"`
|
||||
IsDeleted bool `json:"isDeleted"`
|
||||
IsMemberShipDiscount int `json:"isMemberShipDiscount"`
|
||||
IsMultiSku int `json:"isMultiSku"`
|
||||
IsPreSell interface{} `json:"isPreSell"`
|
||||
IsPutAway int `json:"isPutAway"`
|
||||
IsStorePreSell int `json:"isStorePreSell"`
|
||||
LimitBuyNum int `json:"limitBuyNum"`
|
||||
MaxSalePrice interface{} `json:"maxSalePrice"`
|
||||
MinSalePrice interface{} `json:"minSalePrice"`
|
||||
OuterGoodsCode string `json:"outerGoodsCode"`
|
||||
PointDeductRatio int `json:"pointDeductRatio"`
|
||||
PresellGoods interface{} `json:"presellGoods"`
|
||||
SaleChannelType interface{} `json:"saleChannelType"`
|
||||
SelectedClassifyList []SelectedClassifyList `json:"selectedClassifyList"`
|
||||
SelectedGoodsAttrInfoList interface{} `json:"selectedGoodsAttrInfoList"`
|
||||
SelectedGoodsAttrList SelectedGoodsAttrList `json:"selectedGoodsAttrList"`
|
||||
SelectedGoodsPropInfoList interface{} `json:"selectedGoodsPropInfoList"`
|
||||
SelectedGoodsRightsInfoList interface{} `json:"selectedGoodsRightsInfoList"`
|
||||
SelectedInnerGoodsPropInfoList interface{} `json:"selectedInnerGoodsPropInfoList"`
|
||||
SelectedSaleAttrIDList interface{} `json:"selectedSaleAttrIdList"`
|
||||
SelectedSaleAttrInfoList interface{} `json:"selectedSaleAttrInfoList"`
|
||||
SelectedSaleAttrList SelectedSaleAttrList `json:"selectedSaleAttrList"`
|
||||
SelectedTag interface{} `json:"selectedTag"`
|
||||
SellModelType int `json:"sellModelType"`
|
||||
SkuList []SkuList `json:"skuList"`
|
||||
SkuMap SkuMap `json:"skuMap"`
|
||||
Sort int `json:"sort"`
|
||||
Source int `json:"source"`
|
||||
StartForbidTime interface{} `json:"startForbidTime"`
|
||||
StartPutAwayTime interface{} `json:"startPutAwayTime"`
|
||||
StartSellTime interface{} `json:"startSellTime"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
type B2CGoods struct {
|
||||
B2CGoodsType int `json:"b2cGoodsType"`
|
||||
DeliveryTypeIDList interface{} `json:"deliveryTypeIdList"`
|
||||
FreightTemplateID interface{} `json:"freightTemplateId"`
|
||||
SelectedFreightTemplate interface{} `json:"selectedFreightTemplate"`
|
||||
}
|
||||
type CategoryList struct {
|
||||
CategoryID int `json:"categoryId"`
|
||||
ChildrenCategoryList interface{} `json:"childrenCategoryList"`
|
||||
EnableCustom interface{} `json:"enableCustom"`
|
||||
IsLeaf interface{} `json:"isLeaf"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
type ChildrenClassify struct {
|
||||
ChildrenClassify interface{} `json:"childrenClassify"`
|
||||
ClassifyID int `json:"classifyId"`
|
||||
GoodsNum interface{} `json:"goodsNum"`
|
||||
ImageURL interface{} `json:"imageUrl"`
|
||||
IsHot interface{} `json:"isHot"`
|
||||
Level interface{} `json:"level"`
|
||||
ParentID interface{} `json:"parentId"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
type SelectedClassifyList struct {
|
||||
ChildrenClassify []ChildrenClassify `json:"childrenClassify"`
|
||||
ClassifyID int `json:"classifyId"`
|
||||
GoodsNum interface{} `json:"goodsNum"`
|
||||
ImageURL interface{} `json:"imageUrl"`
|
||||
IsHot int `json:"isHot"`
|
||||
Level interface{} `json:"level"`
|
||||
ParentID interface{} `json:"parentId"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
type SelectedGoodsAttrList struct {
|
||||
}
|
||||
type SelectedSaleAttrList struct {
|
||||
}
|
||||
type B2CSku struct {
|
||||
Volume float64 `json:"volume"`
|
||||
Weight float64 `json:"weight"`
|
||||
}
|
||||
type SkuList struct {
|
||||
AdviseSalePriceMax interface{} `json:"adviseSalePriceMax"`
|
||||
AdviseSalePriceMin interface{} `json:"adviseSalePriceMin"`
|
||||
AvailableStockNum int `json:"availableStockNum"`
|
||||
B2CSku *B2CSku `json:"b2cSku"`
|
||||
ChangeGoodsLimitNum int `json:"changeGoodsLimitNum"`
|
||||
ChangeStockNum int `json:"changeStockNum"`
|
||||
CombineProduct interface{} `json:"combineProduct"`
|
||||
CombineProductID interface{} `json:"combineProductId"`
|
||||
CostPrice float64 `json:"costPrice"`
|
||||
DistributorLimitStock interface{} `json:"distributorLimitStock"`
|
||||
GoodsID int64 `json:"goodsId"`
|
||||
GoodsLimitNum int `json:"goodsLimitNum"`
|
||||
ImageURL interface{} `json:"imageUrl"`
|
||||
InStock bool `json:"inStock"`
|
||||
IsDeleted bool `json:"isDeleted"`
|
||||
IsDisabled bool `json:"isDisabled"`
|
||||
LockPriceStatus int `json:"lockPriceStatus"`
|
||||
MerchantSalePrice interface{} `json:"merchantSalePrice"`
|
||||
OriginalPrice float64 `json:"originalPrice"`
|
||||
OuterSkuCode string `json:"outerSkuCode"`
|
||||
ProductCode string `json:"productCode"`
|
||||
ProductTitle string `json:"productTitle"`
|
||||
ProductType int `json:"productType"`
|
||||
SalePrice float64 `json:"salePrice"`
|
||||
SingleProduct interface{} `json:"singleProduct"`
|
||||
SingleProductID interface{} `json:"singleProductId"`
|
||||
SingleProductTitle interface{} `json:"singleProductTitle"`
|
||||
SkuAttrKey interface{} `json:"skuAttrKey"`
|
||||
SkuAttrMap interface{} `json:"skuAttrMap"`
|
||||
SkuAttrValueNameList interface{} `json:"skuAttrValueNameList"`
|
||||
SkuID int64 `json:"skuId"`
|
||||
SkuInfoMap interface{} `json:"skuInfoMap"`
|
||||
SupplierStockMax interface{} `json:"supplierStockMax"`
|
||||
EditStockNum int `json:"editStockNum"`
|
||||
}
|
||||
type SingleSku struct {
|
||||
AdviseSalePriceMax interface{} `json:"adviseSalePriceMax"`
|
||||
AdviseSalePriceMin interface{} `json:"adviseSalePriceMin"`
|
||||
AvailableStockNum int `json:"availableStockNum"`
|
||||
B2CSku B2CSku `json:"b2cSku"`
|
||||
ChangeGoodsLimitNum int `json:"changeGoodsLimitNum"`
|
||||
ChangeStockNum int `json:"changeStockNum"`
|
||||
CombineProduct interface{} `json:"combineProduct"`
|
||||
CombineProductID interface{} `json:"combineProductId"`
|
||||
CostPrice float64 `json:"costPrice"`
|
||||
DistributorLimitStock interface{} `json:"distributorLimitStock"`
|
||||
GoodsID int64 `json:"goodsId"`
|
||||
GoodsLimitNum int `json:"goodsLimitNum"`
|
||||
ImageURL interface{} `json:"imageUrl"`
|
||||
InStock bool `json:"inStock"`
|
||||
IsDeleted bool `json:"isDeleted"`
|
||||
IsDisabled bool `json:"isDisabled"`
|
||||
LockPriceStatus int `json:"lockPriceStatus"`
|
||||
MerchantSalePrice interface{} `json:"merchantSalePrice"`
|
||||
OriginalPrice float64 `json:"originalPrice"`
|
||||
OuterSkuCode string `json:"outerSkuCode"`
|
||||
ProductCode string `json:"productCode"`
|
||||
ProductTitle string `json:"productTitle"`
|
||||
ProductType int `json:"productType"`
|
||||
SalePrice float64 `json:"salePrice"`
|
||||
SingleProduct interface{} `json:"singleProduct"`
|
||||
SingleProductID interface{} `json:"singleProductId"`
|
||||
SingleProductTitle interface{} `json:"singleProductTitle"`
|
||||
SkuAttrKey interface{} `json:"skuAttrKey"`
|
||||
SkuAttrMap interface{} `json:"skuAttrMap"`
|
||||
SkuAttrValueNameList interface{} `json:"skuAttrValueNameList"`
|
||||
SkuID int64 `json:"skuId"`
|
||||
SkuInfoMap interface{} `json:"skuInfoMap"`
|
||||
SupplierStockMax interface{} `json:"supplierStockMax"`
|
||||
}
|
||||
type SkuMap struct {
|
||||
SingleSku SingleSku `json:"singleSku"`
|
||||
}
|
||||
|
||||
type UpdateGoodsParam struct {
|
||||
Goods *Goods `json:"goods"`
|
||||
}
|
||||
type Num1 struct {
|
||||
Key int `json:"key"`
|
||||
}
|
||||
type Num3000 struct {
|
||||
Key int `json:"key"`
|
||||
}
|
||||
type SkuAttrMap struct {
|
||||
Num1 Num1 `json:"1"`
|
||||
Num3000 Num3000 `json:"3000"`
|
||||
}
|
||||
|
||||
type AttrValueList struct {
|
||||
Key int `json:"key"`
|
||||
}
|
||||
|
||||
type Goods struct {
|
||||
B2CGoods *B2CGoods `json:"b2cGoods"`
|
||||
CategoryID int `json:"categoryId"`
|
||||
Title string `json:"title"`
|
||||
IsMultiSku int `json:"isMultiSku"`
|
||||
GoodsTagID int `json:"goodsTagId,omitempty"`
|
||||
GoodsDesc string `json:"goodsDesc"`
|
||||
InitialSales int `json:"initialSales,omitempty"`
|
||||
DeductStockType int `json:"deductStockType,omitempty"`
|
||||
IsPutAway int `json:"isPutAway"`
|
||||
IsMemberShipDiscount int `json:"isMemberShipDiscount"`
|
||||
SkuList []*SkuList `json:"skuList"`
|
||||
SelectedGoodsAttrList []SelectedGoodsAttrList `json:"selectedGoodsAttrList,omitempty"`
|
||||
SelectedSaleAttrList []SelectedSaleAttrList `json:"selectedSaleAttrList,omitempty"`
|
||||
GoodsImageURL []string `json:"goodsImageUrl"`
|
||||
SelectedClassifyIDList []int `json:"selectedClassifyIdList,omitempty"`
|
||||
GoodsID int64 `json:"goodsId"`
|
||||
OuterGoodsCode string `json:"outerGoodsCode"`
|
||||
PointDeductRatio int `json:"pointDeductRatio"`
|
||||
}
|
||||
type FindFreightTemplateListInfo struct {
|
||||
DefaultFreightTemplate DefaultFreightTemplate `json:"defaultFreightTemplate"`
|
||||
FreightTemplateList []FreightTemplateList `json:"freightTemplateList"`
|
||||
SelectedFreightTemplate SelectedFreightTemplate `json:"selectedFreightTemplate"`
|
||||
}
|
||||
type TemplateRuleItemList struct {
|
||||
BaseAmount float64 `json:"baseAmount"`
|
||||
ExtendAmount float64 `json:"extendAmount"`
|
||||
ExtendNumUnit int `json:"extendNumUnit"`
|
||||
ExtendVolumeUnit interface{} `json:"extendVolumeUnit"`
|
||||
ExtendWeightUnit interface{} `json:"extendWeightUnit"`
|
||||
IsDefault int `json:"isDefault"`
|
||||
SupportAreaName string `json:"supportAreaName"`
|
||||
TemplateRuleItemID int `json:"templateRuleItemId"`
|
||||
UpperNum int `json:"upperNum"`
|
||||
UpperVolume interface{} `json:"upperVolume"`
|
||||
UpperWeight interface{} `json:"upperWeight"`
|
||||
}
|
||||
type TemplateRuleList struct {
|
||||
DeliveryMethodName string `json:"deliveryMethodName"`
|
||||
TemplateRuleID int `json:"templateRuleId"`
|
||||
TemplateRuleItemList []TemplateRuleItemList `json:"templateRuleItemList"`
|
||||
}
|
||||
type DefaultFreightTemplate struct {
|
||||
CalculateType int `json:"calculateType"`
|
||||
IsFree int `json:"isFree"`
|
||||
TemplateID int `json:"templateId"`
|
||||
TemplateName string `json:"templateName"`
|
||||
TemplateRuleList []TemplateRuleList `json:"templateRuleList"`
|
||||
}
|
||||
type FreightTemplateList struct {
|
||||
CalculateType int `json:"calculateType"`
|
||||
IsFree int `json:"isFree"`
|
||||
TemplateID int `json:"templateId"`
|
||||
TemplateName string `json:"templateName"`
|
||||
TemplateRuleList interface{} `json:"templateRuleList"`
|
||||
}
|
||||
type SelectedFreightTemplate struct {
|
||||
CalculateType int `json:"calculateType"`
|
||||
IsFree int `json:"isFree"`
|
||||
TemplateID int `json:"templateId"`
|
||||
TemplateName string `json:"templateName"`
|
||||
TemplateRuleList []TemplateRuleList `json:"templateRuleList"`
|
||||
}
|
||||
|
||||
func (a *API) QueryGoodsList(queryParam *QueryGoodsListParam) (goodsList []*GoodsInfo, totalCount int, err error) {
|
||||
@@ -129,13 +379,16 @@ func (a *API) QueryGoodsList(queryParam *QueryGoodsListParam) (goodsList []*Good
|
||||
return goodsList, totalCount, err
|
||||
}
|
||||
|
||||
func (a *API) QueryGoodsDetail(goodsId int64) (retVal map[string]interface{}, err error) {
|
||||
func (a *API) QueryGoodsDetail(goodsId int64) (goodsDetailInfo *GoodsDetailInfo, err error) {
|
||||
apiParams := map[string]interface{}{
|
||||
"goodsId": goodsId,
|
||||
}
|
||||
result, err := a.AccessAPI("goods/queryGoodsDetail", apiParams)
|
||||
if err == nil {
|
||||
return result.(map[string]interface{})["goods"].(map[string]interface{}), nil
|
||||
data := result.(map[string]interface{})
|
||||
err = utils.Map2StructByJson(data["goods"], &goodsDetailInfo, false)
|
||||
return goodsDetailInfo, nil
|
||||
// return result.(map[string]interface{})["goods"].(map[string]interface{}), nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
@@ -294,6 +547,19 @@ func (a *API) AddGoods2(goodsInfo *PendingSaveGoodsVo) (goodsId int64, skuMap ma
|
||||
return 0, nil, err
|
||||
}
|
||||
|
||||
func (a *API) UpdateGoods3(updateGoodsParam *UpdateGoodsParam) (goodsId int64, skuMap map[string]int64, err error) {
|
||||
if updateGoodsParam.Goods.DeductStockType == 0 {
|
||||
updateGoodsParam.Goods.DeductStockType = DeductStockTypePay
|
||||
}
|
||||
result, err := a.AccessAPI("goods/updateGoods", map[string]interface{}{
|
||||
"goods": updateGoodsParam.Goods,
|
||||
})
|
||||
if err == nil {
|
||||
return getDataFromCUGoodsResult(result)
|
||||
}
|
||||
return 0, nil, err
|
||||
}
|
||||
|
||||
func (a *API) UpdateGoods(goodsID int64, title string, isMultiSku bool, goodsImageUrl []string, goodsDesc string, isPutAway bool, sort int, categoryId int64, classifyIdList []int64, b2cGoods *PendingSaveB2CGoodsVo, skuList []map[string]interface{}, addParams map[string]interface{}) (goodsId int64, skuMap map[string]int64, err error) {
|
||||
goodsInfo := map[string]interface{}{
|
||||
"goodsId": goodsID,
|
||||
@@ -413,14 +679,16 @@ func (a *API) UploadImgByURL(uploadImgURL string, name string) (imgURL string, e
|
||||
return "", err
|
||||
}
|
||||
|
||||
func (a *API) FindFreightTemplateList(goodsID int64) (retVal map[string]interface{}, err error) {
|
||||
func (a *API) FindFreightTemplateList(goodsID int64) (freightTemplateListInfo *FindFreightTemplateListInfo, err error) {
|
||||
apiParams := map[string]interface{}{}
|
||||
if goodsID > 0 {
|
||||
apiParams["goodsId"] = goodsID
|
||||
}
|
||||
result, err := a.AccessAPI("goods/findFreightTemplateList", apiParams)
|
||||
if err == nil {
|
||||
return result.(map[string]interface{}), nil
|
||||
data := result.(map[string]interface{})
|
||||
err = utils.Map2StructByJson(data, &freightTemplateListInfo, false)
|
||||
return freightTemplateListInfo, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user