收藏
回答

获取素材列表接口素材重复

https://api.weixin.qq.com/cgi-bin/material/batchget_material?

{
   "total_count": TOTAL_COUNT,
   "item_count": ITEM_COUNT,
   "item": [{
       "media_id": MEDIA_ID,
       "name": NAME,
       "update_time": UPDATE_TIME,
       "url":URL
   },
   //可能会有多个素材
   ]
}
返回的素材media_id重复,导致插入主键重复,重复media_id=c0m6r7YdKnhlt_By-AqKit-SmpH1Bb_cb_nu8M8yyUOVEUiTtu-3Av12msnKlVeK,什么情况下会有这种情况?
回答关注问题邀请回答
收藏

1 个回答

  • 社区技术运营专员--许涛
    社区技术运营专员--许涛
    1天前
    你好,media_id不可能重复,提供下这个接口的请求包,时间点和回包
    
    1天前
    有用
    回复 3
    • 路飞
      路飞
      1天前
      请求:
      curl --location 'https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token=85_M3L-IqVhwPl3WREIhSWTwyw8Tw3jMB3mL71Lkq_e21vCsCf5hioCzZJI1ndhaTdfY0lU2e9YtIT5xuQW5IZbP-dB_6ByFzUUvdNkdICcIsOoHVHP8OIjzBTtNRoxKtmHTCcs7C1MUEhUE3cxLDZdAGDOGC' \
      --header 'Content-Type: application/json' \
      --data '{
          "type":"image",
          "offset":7500,
          "count":20
      }'
      时间点:2024-10-30 14:05-14:06左右
      回包:
      {
       "item": [{
        "media_id": "c0m6r7YdKnhlt_By-AqKiuNxbUbcaP9l9zDJ8JbZv5aRoI6onoavETIrecqdFcGp",
        "name": "58d32dc4N45566363.jpg",
        "update_time": 1517394386,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_jpg\/BjPBXic11H7AycAp2Lhb82EGsk6mMGibkL59JLoOn2bVgrs8mbticcKU95Aa8jUZYU58V4QeB2ic6WZOsTeLRPE1ag\/0?wx_fmt=jpeg",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKipwpq5oEVh-J-uUfQev0jApaUmvU5C--9nA5nevQ2oMc",
        "name": "反光.png",
        "update_time": 1517394106,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_png\/BjPBXic11H7AycAp2Lhb82EGsk6mMGibkL3Y8VvY2kbjdBVqvoeePvTTFbpaNvggYoCvyUCYqzkACLzFw2VPia1UQ\/0?wx_fmt=png",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKiilc6kIvIViavwLZJmjB9UchtPT_bCl4e9edAGHWy7Wr",
        "name": "500521830.jpg",
        "update_time": 1517394065,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_jpg\/BjPBXic11H7AycAp2Lhb82EGsk6mMGibkLgdzgwOMAYwbjdE4eC8ayPcGdnrWHOjPQkLzqaYKAYbvfl8RtvR1rnw\/0?wx_fmt=jpeg",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKih1jIVydMgOTU_lVWw3h1y8NTKXJNng5KVvonW5U4IRt",
        "name": "口罩.png",
        "update_time": 1517394003,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_png\/BjPBXic11H7AycAp2Lhb82EGsk6mMGibkLFxB3MC2QICuTcrALKqY50enbhFmibuDjhFnMKZEzYgzSVLVOLt07mYQ\/0?wx_fmt=png",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKiq247m0HiO4DC7APkt5GmFrfNPSmtKRdkRy_f3kO51X8",
        "name": "洗手.png",
        "update_time": 1517391909,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_png\/BjPBXic11H7AycAp2Lhb82EGsk6mMGibkL7SUfCVIrhWtUl0hek5LqOkc4g5XggT5BCbgotpMiaMZbtC6AjuFlibzA\/0?wx_fmt=png",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKilCDRHdXXJlQjtP7gc5pB8vCcJqKpwthOBvJkVOCz7j0",
        "name": "LAVA-海报微信长图0130_04(7).gif",
        "update_time": 1517391077,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_gif\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXUv0m4qETaIHaE94frTDicoicqjH9mWAl2bJe6KK9MHt5vDcJGjfGPGfaQ\/0?wx_fmt=gif",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKit5BtXlGqvX9NukRv1qVm_N2bbCE_AfkuxQWYVqBiqdz",
        "name": "LAVA-海报微信长图0130_04(5).gif",
        "update_time": 1517389276,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_gif\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXUIHicucuQSlKY2K6vy5nhXHcjyiaJk4nbJVkCOHkibteqXMswnrCicqJTiaA\/0?wx_fmt=gif",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKit-SmpH1Bb_cb_nu8M8yyUOVEUiTtu-3Av12msnKlVeK",
        "name": "LAVA-海报微信长图0130_04(2).gif",
        "update_time": 1517386322,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_gif\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXUP6tq1ZzHz15R0pcg9iaIKRKxfWkxYT0KA256dGRlwhtNqIG9Biaj2XBQ\/0?wx_fmt=gif",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKit-SmpH1Bb_cb_nu8M8yyUOVEUiTtu-3Av12msnKlVeK",
        "name": "LAVA-海报微信长图0130_04(2).gif",
        "update_time": 1517386322,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_gif\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXUP6tq1ZzHz15R0pcg9iaIKRKxfWkxYT0KA256dGRlwhtNqIG9Biaj2XBQ\/0?wx_fmt=gif",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKilJiYJKPGW4IOPTZSjpRv2rgXusS5aYf8qyBUpuUfoBA",
        "name": "LAVA-海报微信长图0130_04(1).gif",
        "update_time": 1517381357,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_gif\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXUkm3dqnI707TVNMj2hJ7dUIRZOrRv30FhHkC7iajTWPDwC2723dUibKpg\/0?wx_fmt=gif",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKivmSNa_qix_Ud9kQFzUfHy6eE0T0J_GiPdF7BJKzAZmy",
        "name": "LAVA-海报微信长图0130_04.gif",
        "update_time": 1517380845,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_gif\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXUvVRG29MtL7lUtsu17bGm5yENM75M3qTXeehPXMtWJ3ljs1dHnT8z3A\/0?wx_fmt=gif",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKive4J1mXoj6i8bMM_YSJh3WPXrajCJD-UhKth_hpjuSY",
        "name": "LAVA绿LOGO.jpg",
        "update_time": 1517371262,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_jpg\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXU1libZ8wt6icBHajBiaNOobwc6rrBHCKrwETicxKB1oDlFAPS3u0ibrO7vyA\/0?wx_fmt=jpeg",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKipm4jqm9vrCr4362lD9YfYB77hKvInyWQh0HwQ6jKuj9",
        "name": "LAVA白LOGO.jpg",
        "update_time": 1517371250,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_jpg\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXUG42Zwre8Cf9qDGu35Um3aPiaF0AiaIBkZKCqM4ibLLnGLbuibGNPFT9sGg\/0?wx_fmt=jpeg",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKiuCpIy1aaHsXVIj23wWJdxWxTNFwTpVV_yz_S8kq_h70",
        "name": "LAVA2333-3.jpg",
        "update_time": 1517371236,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_jpg\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXU4Iuuu42icXicOmctDYLYaMMd6v2ySlOQBgVTYAwrVOyHm8LqGPmgm7MA\/0?wx_fmt=jpeg",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKigQ3xovusTve6D7aGqgTW5DnDNW4COubjAKFPWk5CFOk",
        "name": "LAVA2333-2.jpg",
        "update_time": 1517371200,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_jpg\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXUcgopKiaPqygRKicuqI9icDg1PouDDz0c9z5o61I8gKBUemYk33qbc6XqQ\/0?wx_fmt=jpeg",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKip7p5MRqzEVrrJBYebzispoHvpHEEkQZvo-3pNWouuh4",
        "name": "LAVA头图5.jpg",
        "update_time": 1517368286,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_jpg\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXUFM5E5Eh4cJMF6eCmiaezd3zUgdmCycUbLaWYAX9IMqic9ichhtIfq52BQ\/0?wx_fmt=jpeg",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKiq1Stl7Tzcn00Ei7UlAEuda3z2C38vd4hgejfXq_yo5U",
        "name": "802217267069892372.png",
        "update_time": 1517367723,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_png\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXUZ3XyVJ7XaeBL36djwhjDiaYSUWdcBdSAHDiaZ61GbFbvSCmQhIPwv0Ig\/0?wx_fmt=png",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKio5Fo9nEMCuQXy-Bfxuu5f0LKpiVFgckTFo4WBheYrqi",
        "name": "58675464387049564.jpg",
        "update_time": 1517367647,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_jpg\/bA2cZRVMVYcDhDe5gxxBPLqrsYyFrQXUEJT28ztvO1cbCdh34Alxab0JPv9IEeyD9wJpicZyqjSj0hZ6VpLiaEsw\/0?wx_fmt=jpeg",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKirm7lyzV9vawbgF3cuggYTCdgDywvnKej3SHiaKMIN3L",
        "name": "LAVA头图3.jpg",
        "update_time": 1517323309,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_jpg\/bA2cZRVMVYeUrAxfC1cm4GFGBtX9aFU3ZoguFhp2Gdw9uxJlJX8LKiayUPmupy0dKXTOLrzTRAQNlupHovxnDcw\/0?wx_fmt=jpeg",
        "tags": []
       }, {
        "media_id": "c0m6r7YdKnhlt_By-AqKirzyn6tNkumQxbg2F1WoENTNiIlB1jY0U0Tai684M4wS",
        "name": "LAVA-海报微信长图0130_07.gif",
        "update_time": 1517319506,
        "url": "https:\/\/mmbiz.qpic.cn\/mmbiz_gif\/bA2cZRVMVYeUrAxfC1cm4GFGBtX9aFU3yDricPpuJsCRCvaOlK1hPQrjoA3lH6icu5XtXCfolLC61y3ks0Dpiciazw\/0?wx_fmt=gif",
        "tags": []
       }],
       "total_count": 10496,
       "item_count": 20
      }
      其中c0m6r7YdKnhlt_By-AqKit-SmpH1Bb_cb_nu8M8yyUOVEUiTtu-3Av12msnKlVeK是重复的
      1天前
      回复
    • 路飞
      路飞
      1天前
      麻烦帮忙看下,谢谢
      1天前
      回复
    • 社区技术运营专员--许涛
      社区技术运营专员--许涛
      17小时前回复路飞
      2018年的图片,插入mmbizimggroup有重复操作,导致插入了两次。可以先自己删除重复的,代码要再检查下是否有uniqkey做去重 。


      现在同一张图片上传两次是两个media
      17小时前
      回复
登录 后发表内容