Browse Source

更新

master
huangjiajun 1 year ago
parent
commit
21aa8db637
1 changed files with 37 additions and 0 deletions
  1. +37
    -0
      taobao/taobao.go

+ 37
- 0
taobao/taobao.go View File

@@ -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
}

Loading…
Cancel
Save