This commit is contained in:
@ -49,6 +49,7 @@ var platiCommand = &cli.Command{
|
|||||||
log.Printf("fetching goods [%d/%d] for %s\n", l, len(categories), c.FlatName)
|
log.Printf("fetching goods [%d/%d] for %s\n", l, len(categories), c.FlatName)
|
||||||
goods, err := platiCli.GetBlockGoodsCategory(ctx, cat.ID, cat.ParentID, "cntSellDESC", 1, 100, "RUR", "ru-RU")
|
goods, err := platiCli.GetBlockGoodsCategory(ctx, cat.ID, cat.ParentID, "cntSellDESC", 1, 100, "RUR", "ru-RU")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Printf("error: %v", err)
|
||||||
return fmt.Errorf("getblockgoodscategory: %w", err)
|
return fmt.Errorf("getblockgoodscategory: %w", err)
|
||||||
}
|
}
|
||||||
if len(goods) == 0 {
|
if len(goods) == 0 {
|
||||||
@ -58,6 +59,7 @@ var platiCommand = &cli.Command{
|
|||||||
|
|
||||||
gormGoods := convertGoodsToGorm(cat, goods)
|
gormGoods := convertGoodsToGorm(cat, goods)
|
||||||
if err := db.Create(gormGoods).Error; err != nil {
|
if err := db.Create(gormGoods).Error; err != nil {
|
||||||
|
log.Printf("error: %v", err)
|
||||||
return fmt.Errorf("db Create: %w", err)
|
return fmt.Errorf("db Create: %w", err)
|
||||||
}
|
}
|
||||||
json.NewEncoder(os.Stdout).Encode(goods)
|
json.NewEncoder(os.Stdout).Encode(goods)
|
||||||
|
@ -126,8 +126,8 @@ func (c *Client) GetBlockGoodsCategory(ctx context.Context, idC int, idR int, so
|
|||||||
return nil, fmt.Errorf("http do: %w", err)
|
return nil, fmt.Errorf("http do: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
dump, err = httputil.DumpResponse(resp, true)
|
// dump, err = httputil.DumpResponse(resp, true)
|
||||||
log.Printf("%d %s", resp.StatusCode, string(dump))
|
// log.Printf("%d %s", resp.StatusCode, string(dump))
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user