返佣商品

导入商品

  1. products := &request.RequestProduct{
  2. Product: []*request.Product{
  3. {
  4. PID: "pid001",
  5. ImageInfo: &request.ImageInfo{
  6. MainImageList: []*request.MainImage{
  7. {URL: "http://www.google.com/a.jpg"},
  8. },
  9. },
  10. CategoryInfo: &request.CategoryInfo{
  11. CategoryItem: []*request.CategoryItem{
  12. {CategoryName: "图书"},
  13. {CategoryName: "少儿图书"},
  14. },
  15. },
  16. OfficialCategoryInfo: &request.OfficialCategoryInfo{
  17. CategoryItem: []*request.CategoryItem{
  18. {CategoryName: "图书"},
  19. },
  20. },
  21. LinkInfo: &request.LinkInfo{
  22. URL: "pages/index/index",
  23. WxaAppID: "wxa0x01adx3423566",
  24. LinkType: "wxa",
  25. },
  26. Title: "test title",
  27. SubTitle: "test sub_title",
  28. Brand: "test brand",
  29. ShopInfo: &request.ShopInfo{
  30. Source: 2,
  31. },
  32. Desc: "test desc",
  33. PriceInfo: &request.PriceInfo{
  34. MinPrice: 250,
  35. MaxPrice: 250.22,
  36. MinOriPrice: 300.1,
  37. MaxOriPrice: 320.15,
  38. },
  39. SaleInfo: &request.SaleInfo{
  40. SaleStatus: "on",
  41. Stock: 1000,
  42. },
  43. CustomInfo: &request.CustomInfo{CustomList: []*request.Custom{
  44. {
  45. Key: "book_desc",
  46. Value: "“熊猫先生”通过4个富有节律性、带有因果关系、幽默风趣,又有正反对比的故事,让小朋友明白礼仪的重要性。",
  47. },
  48. {
  49. Key: "author",
  50. Value: "史蒂夫•安东尼",
  51. },
  52. {
  53. Key: "publisher",
  54. Value: "中信出版社",
  55. },
  56. }},
  57. SKUInfo: &request.SKUInfo{
  58. SKUItem: []*request.SKUItem{
  59. {
  60. SKUID: "sku001",
  61. BarcodeType: "ean13",
  62. Barcode: 2018032105140,
  63. ImageInfo: &request.ImageInfo{
  64. MainImageList: []*request.MainImage{
  65. {URL: "http://www.baidu.com/c.jpg"},
  66. {URL: "http://www.baidu.com/d.jpg"},
  67. },
  68. },
  69. LinkUrl: "pages/index/index?a=b",
  70. PriceInfo: &request.PriceInfo{
  71. MinPrice: 250,
  72. MaxPrice: 250.22,
  73. MinOriPrice: 300.1,
  74. MaxOriPrice: 320.15,
  75. },
  76. SaleInfo: &request.SaleInfo{
  77. SaleStatus: "on",
  78. Stock: 500,
  79. },
  80. ShopInfo: &request.ShopInfo{
  81. Source: 2,
  82. },
  83. AttributeInfo: &request.AttributeInfo{
  84. AttributeItem: []*request.AttributeItem{
  85. {
  86. AttributeKey: "酒店房型",
  87. AttributeValue: "海景大床房",
  88. },
  89. },
  90. },
  91. },
  92. },
  93. },
  94. PartialUpdate: 0,
  95. TagInfo: nil,
  96. },
  97. },
  98. }
  99. OfficialAccountApp.Goods.Add(products)

微信官方文档

更新商品

  1. // 整个products参考上面导入商品
  2. products := &request.RequestProduct{
  3. Product: []*request.Product{
  4. {
  5. PID: "pid001",
  6. }
  7. }
  8. }
  9. OfficialAccountApp.Goods.Update(products)

微信官方文档

查询导入/更新商品状态

  1. OfficialAccountApp.Goods.Status("[statusTicket]")

微信官方文档

获取单个商品信息

  1. OfficialAccountApp.Goods.Get(ctx, &request.RequestProductGet{
  2. Product: &request.ProductID{
  3. PID: "[pid]",
  4. },
  5. })

微信官方文档

分页获取商品信息

  1. page := 1
  2. size := 10
  3. res, err := services.OfficialAccountApp.Goods.List("[page_context]", page, size)

微信官方文档

使用示例

参考: PowerWechatTutorial