From 21aa8db6372da37bec5d0220368831ac489051ec Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 19 Jun 2023 13:46:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- taobao/taobao.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/taobao/taobao.go b/taobao/taobao.go index c2da7f8..74ce7b6 100644 --- a/taobao/taobao.go +++ b/taobao/taobao.go @@ -47,6 +47,34 @@ func TaoBaoFeaturedList(eg *xorm.Engine, dbName, Platform string, AccTaobaoShare } return goods +} +func TaoBaoSearchList(eg *xorm.Engine, dbName, Platform string, AccTaobaoShareId int, postData map[string]string) []map[string]string { + var goods = make([]map[string]string, 0) + sdk, err := NewTaobaoSDK(eg, dbName, Platform, AccTaobaoShareId) + if err != nil { + return goods + } + list, err := sdk.TaoBaoSearchList(postData) + if list != nil { + for _, v := range *list { + var tmp = map[string]string{ + "gid": zhios_third_party_utils.AnyToString(v.ItemID), + "title": v.Title, + "img": v.PictURL, + "sales": zhios_third_party_utils.IntToStr(v.Volume), + "price": zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.StrToFloat64(v.ZkFinalPrice) - zhios_third_party_utils.StrToFloat64(v.CouponAmount)), + "cost_price": v.ZkFinalPrice, + "coupon": v.CouponAmount, + "commission_rate": zhios_third_party_utils.AnyToString(zhios_third_party_utils.StrToFloat64(v.CommissionRate) / 100), + "commission": zhios_third_party_utils.Float64ToStr((zhios_third_party_utils.StrToFloat64(v.ZkFinalPrice) - zhios_third_party_utils.StrToFloat64(v.CouponAmount)) * (zhios_third_party_utils.StrToFloat64(v.CommissionRate) / 100 / 100)), + "pvd": md.PVD_TB, + "share_content": "", + } + goods = append(goods, tmp) + } + } + return goods + } // TaoBaoSearchList is return taobao search list @@ -59,3 +87,12 @@ func (t *TB) TaoBaoFeaturedList(args map[string]string) (*[]md.TBFeatureStruct, } return list, nil } +func (t *TB) TaoBaoSearchList(args map[string]string) (*[]Material, error) { + list, err := t.SearchList( + args, + ) + if err != nil { + return nil, err + } + return list, nil +}