|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package taobao
-
- import (
- "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md"
- zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
- "xorm.io/xorm"
- )
-
- //TaoBaoArgs is args
- type TaoBaoArgs struct {
- Keyword string
- PageIndex string
- PageSize string
- Sort string
- StartPrice string
- EndPrice string
- IsTmall string
- IsCoupon string
- StartCommissionRate string
- EndCommissionRate string
- }
-
- func TaoBaoFeaturedList(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.TaoBaoFeaturedList(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) - float64(v.CouponAmount)),
- "cost_price": v.ZkFinalPrice,
- "coupon": zhios_third_party_utils.IntToStr(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) - float64(v.CouponAmount)) * (zhios_third_party_utils.StrToFloat64(v.CommissionRate) / 100 / 100)),
- "pvd": md.PVD_TB,
- "share_content": "",
- }
- goods = append(goods, tmp)
- }
- }
- 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
- func (t *TB) TaoBaoFeaturedList(args map[string]string) (*[]md.TBFeatureStruct, error) {
- list, err := t.FeaturedList(
- args,
- )
- if err != nil {
- return nil, err
- }
- 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
- }
|