|
1234567891011121314151617181920212223242526272829303132333435363738 |
- package zhimeng
-
- 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"
- "encoding/json"
- )
-
- func PddGoods(param map[string]interface{}) []map[string]string {
- var goods = make([]map[string]string, 0)
- resp, err := Send("pdd", "getgoods", param)
- if err != nil {
- return goods
- }
- var tmp struct {
- Data []md.PDDZhimengItem `json:"data"`
- }
- if err = json.Unmarshal(resp, &tmp); err != nil {
- return goods
- }
- for _, v := range tmp.Data {
- var tmp = map[string]string{
- "gid": v.Gid,
- "title": v.GoodsTitle,
- "img": v.GoodsImg,
- "sales": zhios_third_party_utils.AnyToString(v.GoodsSales),
- "price": zhios_third_party_utils.Float64ToStr(v.MinGroupPrice - float64(v.CouponPrice)),
- "cost_price": zhios_third_party_utils.Float64ToStr(v.MinNormalPrice),
- "coupon": zhios_third_party_utils.IntToStr(v.CouponPrice),
- "commission_rate": zhios_third_party_utils.AnyToString(v.Commission),
- "commission": zhios_third_party_utils.Float64ToStr((v.MinGroupPrice - float64(v.CouponPrice)) * (zhios_third_party_utils.AnyToFloat64(v.Commission) / 100)),
- "pvd": md.PVD_PDD,
- "share_content": "",
- }
- goods = append(goods, tmp)
- }
- return goods
- }
|