Browse Source

更新

master
huangjiajun 9 months ago
parent
commit
6096d9c554
3 changed files with 149 additions and 2 deletions
  1. +99
    -1
      tik_tok/md_tik_tok_goods.go
  2. +47
    -1
      tik_tok/svc_tik_tok_goods.go
  3. +3
    -0
      tik_tok/svc_tik_tok_order.go

+ 99
- 1
tik_tok/md_tik_tok_goods.go View File

@@ -25,7 +25,105 @@ type TikTokGoods struct {
ApplyId string `json:"apply_id"`
ActivityId string `json:"activity_id"`
}

type TikTokGoodsLmNew struct {
ActivityInfo struct {
ActivityType interface{} `json:"activity_type"`
} `json:"activity_info"`
BaseInfo struct {
CategoryId int `json:"category_id"`
CategoryName string `json:"category_name"`
Cover string `json:"cover"`
DetailUrl string `json:"detail_url"`
FirstCid int `json:"first_cid"`
Imgs []string `json:"imgs"`
InStock bool `json:"in_stock"`
Price int `json:"price"`
ProductId int64 `json:"product_id"`
Sales int `json:"sales"`
SecondCid int `json:"second_cid"`
Success bool `json:"success"`
ThirdCid int `json:"third_cid"`
Title string `json:"title"`
} `json:"base_info"`
BrandInfo struct {
BrandId interface{} `json:"brand_id"`
BrandNameCn interface{} `json:"brand_name_cn"`
BrandNameEn interface{} `json:"brand_name_en"`
} `json:"brand_info"`
CommentInfo struct {
CommentNum interface{} `json:"comment_num"`
CommentScore interface{} `json:"comment_score"`
} `json:"comment_info"`
CouponInfo struct {
AvailableCoupons []interface{} `json:"available_coupons"`
CouponPrice int `json:"coupon_price"`
Success bool `json:"success"`
} `json:"coupon_info"`
LogisticsInfo struct {
Text interface{} `json:"text"`
} `json:"logistics_info"`
MonthSaleData struct {
DailyStatistics []struct {
Date string `json:"date"`
KolNum int `json:"kol_num"`
OrderNum int `json:"order_num"`
ViewNum int `json:"view_num"`
} `json:"daily_statistics"`
KolNum int `json:"kol_num"`
OrderNum int `json:"order_num"`
Success bool `json:"success"`
ViewNum int `json:"view_num"`
} `json:"month_sale_data"`
PresellInfo struct {
PresellType interface{} `json:"presell_type"`
} `json:"presell_info"`
PromotionInfo struct {
CommissionType int `json:"commission_type"`
CosFee int `json:"cos_fee"`
CosRatio int `json:"cos_ratio"`
KolCosFee int `json:"kol_cos_fee"`
KolCosRatio int `json:"kol_cos_ratio"`
Success bool `json:"success"`
} `json:"promotion_info"`
QualificationInfo struct {
} `json:"qualification_info"`
RightsInfo struct {
} `json:"rights_info"`
ShareInfo struct {
Sharable bool `json:"sharable"`
Success bool `json:"success"`
} `json:"share_info"`
ShopInfo struct {
ShopId int `json:"shop_id"`
ShopName string `json:"shop_name"`
ShopTotalScore struct {
LogisticsScore struct {
Level int `json:"level"`
Score string `json:"score"`
Text string `json:"text"`
} `json:"logistics_score"`
ProductScore struct {
Level int `json:"level"`
Score string `json:"score"`
Text string `json:"text"`
} `json:"product_score"`
ServiceScore struct {
Level int `json:"level"`
Score string `json:"score"`
Text string `json:"text"`
} `json:"service_score"`
ShopScore struct {
Level int `json:"level"`
Score string `json:"score"`
Text string `json:"text"`
} `json:"shop_score"`
} `json:"shop_total_score"`
Success bool `json:"success"`
} `json:"shop_info"`
Tags struct {
HasDouinGoodsTag interface{} `json:"has_douin_goods_tag"`
} `json:"tags"`
}
type TikTokGoodsLm struct {
CosFee int64 `json:"cos_fee"`
CosRatio float64 `json:"cos_ratio"`


+ 47
- 1
tik_tok/svc_tik_tok_goods.go View File

@@ -86,7 +86,7 @@ func GoodsList(args map[string]string) []TikTokGoods {
}

//详情
func GetDetail(args map[string]string) TikTokGoods {
func GetDetailOld(args map[string]string) TikTokGoods {
params := map[string]interface{}{"product_ids": []string{args["id"]}, "with_share_status": true}
send, err := Send(args["appkey"], args["appSecret"], "alliance.materialsProductsDetails", params, args["acctoken"])
var goodsList = TikTokGoods{}
@@ -112,6 +112,52 @@ func GetDetail(args map[string]string) TikTokGoods {
//
return goodsList
}
func GetDetail(args map[string]string) TikTokGoods {
params := map[string]interface{}{"product_ids": []string{args["id"]}, "fields": "base_info,promotion_info,month_sale_data,share_info,coupon_info,shop_info"}
send, err := Send(args["appkey"], args["appSecret"], "buyin.kolProductsDetail", params, args["acctoken"])
var goodsList = TikTokGoods{}
product := gjson.Get(send, "data.products").String()
if err != nil || product == "" {
return goodsList
}
var lmData struct {
Data struct {
Products []TikTokGoodsLmNew `json:"products"`
} `json:"data"`
}
err = json.Unmarshal([]byte(send), &lmData)
if err != nil {
return goodsList
}
for _, v := range lmData.Data.Products {
tmp1 := TikTokGoodsLm{
CosFee: int64(v.PromotionInfo.CosFee),
CosRatio: float64(v.PromotionInfo.CosRatio),
CouponPrice: int64(v.CouponInfo.CouponPrice),
Cover: v.BaseInfo.Cover,
DetailURL: v.BaseInfo.DetailUrl,
FirstCid: int64(v.BaseInfo.FirstCid),
InStock: v.BaseInfo.InStock,
Price: int64(v.BaseInfo.Price),
ProductID: v.BaseInfo.ProductId,
Sales: int64(v.BaseInfo.Sales),
SecondCid: int64(v.BaseInfo.SecondCid),
Sharable: v.ShareInfo.Sharable,
ShopID: int64(v.ShopInfo.ShopId),
ShopName: v.ShopInfo.ShopName,
ThirdCid: int64(v.BaseInfo.ThirdCid),
Title: v.BaseInfo.Title,
Imgs: v.BaseInfo.Imgs,
ShopTotalScore: v.ShopInfo.ShopTotalScore,
}
tmp := CommGoodsDetail(tmp1)
if tmp.GoodsID == args["id"] {
return tmp
}
}
//
return goodsList
}
func GetDetailSku(args map[string]string, id int64) md.SkuData {
params := map[string]interface{}{"product_id": id}
send, err := Send(args["appkey"], args["appSecret"], "buyin.productSkus", params, args["acctoken"])


+ 3
- 0
tik_tok/svc_tik_tok_order.go View File

@@ -163,6 +163,9 @@ func CommOrder(v interface{}, statusArr map[string]string, types string) map[str
if split[0] == "sharesef" {
tmp["is_share"] = "5"
}
if split[0] == "moref" {
tmp["is_share"] = "6"
}
tmp["uid"] = split[1]
if len(split) == 3 {
tmp["mid"] = split[2]


Loading…
Cancel
Save