美团外卖券小程序路径过长导致插入文本消息失败的问题解决办法
美团的推广路径是这个
/index/pages/h5/h5?weburl=https%3A%2F%2Fclick.meituan.com%2Ft%3Ft%3D1%26c%3D1%26p%3DOWMpZ-uzIFOVe6JyOONs3dXuqV0qcAf-r-KCvHdXiNej4xCqMxp88d40kBpNgztIAPe8eitdEs1sN_OL2yM2E_lkwBIdcDGWXOKzXh1Q_Fow-lzpLfJCB_fBrI47Ty-Gq_59tX6tC14cXpD_QOvWw9Wnx5hGN6ZCTydEwEGX-Zg-F2FJRNWq08EBqKSJFn6H1WH5dB1yzHzks_x1BSUNUtHX8uC05Cllbg3ve4nmi0Te58mKiK1Qivn2bjL-yr3HBHXJ0IbslV_J5rh9UwXgC2LESIDlAf_Ys19LcAA_y5svmbp7f4KCCLhcjVdSq_DDJoh0UsDKQZc4wfsYlvrkBepw6kQcbkLY0KbQxP2pxABQ8tEuXwEU7DqTjfUUQR7_Bkj9rq-pKuM33577SwObeTChdEL5K079ZspIbKGdqBVVYyhfiuwmKnpbprd44m_2Bmb5mpXjT7kvE2Eg5I4NG5d-Rg1QBKx91INMu0dfJ7JWudurRRYIHa_Gusx21tdBdjxM3PGEzUdZ-7s0WFj5NY-6hfOZ3Fj36OqIWavtftDLqvGB4AzLPAI-BLfyHTf3BGywMm2aJ5ZQbGZIgJUEanZss09xDlAMbqteSdAc8mFo6Mu3iWgCxORHrnST_LNzX8yPIb3Y6w9rwsGWhsLcjj5w4fnAD2U87Mm5x27Gvsg&lch=cps:waimai:5:669dc60208f861e36c7355a243a7fdf3:qq&f_token=1&f_userId=1
/index/pages/h5/h5?weburl=https%3A%2F%2Fclick.meituan.com%2Ft%3Ft%3D1%26c%3D1%26p%3DOWMpZ-uzIFOVe6JyOONs3dXuqV0qcAf-r-KCvHdXiNej4xCqMxp88d40kBpNgztIAPe8eitdEs1sN_OL2yM2E_lkwBIdcDGWXOKzXh1Q_Fow-lzpLfJCB_fBrI47Ty-Gq_59tX6tC14cXpD_QOvWw9Wnx5hGN6ZCTydEwEGX-Zg-F2FJRNWq08EBqKSJFn6H1WH5dB1yzHzks_x1BSUNUtHX8uC05Cllbg3ve4nmi0Te58mKiK1Qivn2bjL-yr3HBHXJ0IbslV_J5rh9UwXgC2LESIDlAf_Ys19LcAA_y5svmbp7f4KCCLhcjVdSq_DDJoh0UsDKQZc4wfsYlvrkBepw6kQcbkLY0KbQxP2pxABQ8tEuXwEU7DqTjfUUQR7_Bkj9rq-pKuM33577SwObeTChdEL5K079ZspIbKGdqBVVYyhfiuwmKnpbprd44m_2Bmb5mpXjT7kvE2Eg5I4NG5d-Rg1QBKx91INMu0dfJ7JWudurRRYIHa_Gusx21tdBdjxM3PGEzUdZ-7s0WFj5NY-6hfOZ3Fj36OqIWavtftDLqvGB4AzLPAI-BLfyHTf3BGywMm2aJ5ZQbGZIgJUEanZss09xDlAMbqteSdAc8mFo6Mu3iWgCxORHrnST_LNzX8yPIb3Y6w9rwsGWhsLcjj5w4fnAD2U87Mm5x27Gvsg&lch=cps:waimai:5:669dc60208f861e36c7355a243a7fdf3:qq&f_token=1&f_userId=1
插入小程序路径,通过文本消息回复,就会失败,那如何缩短呢?
后面的weburl 是一个完整的路径是通过url encode的,需要通过解码,把完成路径解码出来
http://tool.chinaz.com/tools/urlencode.aspx
解码出来的网址是这样的
/index/pages/h5/h5?weburl=https://click.meituan.com/t?t=1&c=1&p=OWMpZ-uzIFOVe6JyOONs3dXuqV0qcAf-r-KCvHdXiNej4xCqMxp88d40kBpNgztIAPe8eitdEs1sN_OL2yM2E_lkwBIdcDGWXOKzXh1Q_Fow-lzpLfJCB_fBrI47Ty-Gq_59tX6tC14cXpD_QOvWw9Wnx5hGN6ZCTydEwEGX-Zg-F2FJRNWq08EBqKSJFn6H1WH5dB1yzHzks_x1BSUNUtHX8uC05Cllbg3ve4nmi0Te58mKiK1Qivn2bjL-yr3HBHXJ0IbslV_J5rh9UwXgC2LESIDlAf_Ys19LcAA_y5svmbp7f4KCCLhcjVdSq_DDJoh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Mu3iWgCxORHrnST_LNzX8yPIb3Y6w9rwsGWhsLcjj5w4fnAD2U87Mm5x27Gvsg&lch=cps:waimai:5:669dc60208f861e36c7355a243a7fdf3:qq&f_token=1&f_userId=1
通过浏览器打开
https://market.waimai.meituan.com/gd/single.html?utm_term=74060.cps.24412203&el_biz=waimai&gundam_id=2KAWnD&utm_campaign=AffProg&utm_medium=wandie&el_page=gundam.loader&urpid=74060.161941038093.24412203.0&appkey=669dc60208f861e36c7355a243a7fdf3%3Aqq&source=wandie&_rdt=1&utm_source=&utm_content=&noguide=1&utm_term=&utm_campaign=other&utm_medium=MU&channel=union&utm_source=60413&utm_content=1380426742014976088 链接就变成这样了
替换原来路径的weburl参数,就可以了
/index/pages/h5/h5?weburl=https%3A%2F%2Fmarket.waimai.meituan.com%2Fgd%2Fsingle.html%3Futm_term%3D74060.cps.24412203%26el_biz%3Dwaimai%26gundam_id%3D2KAWnD%26utm_campaign%3DAffProg%26utm_medium%3Dwandie%26el_page%3Dgundam.loader%26urpid%3D74060.161941038093.24412203.0%26appkey%3D669dc60208f861e36c7355a243a7fdf3%253Aqq%26source%3Dwandie%26_rdt%3D1%26utm_source%3D%26utm_content%3D%26noguide%3D1%26utm_term%3D%26utm_campaign%3Dother%26utm_medium%3DMU%26channel%3Dunion%26utm_source%3D60413%26utm_content%3D1380426742014976088
将这个路径生成小程序链接
<a href=‘#‘ data-miniprogram-appid=‘wxde8ac0a21135c07d‘ data-miniprogram-path=‘/index/pages/h5/h5?weburl=/index/pages/h5/h5?weburl=https%3A%2F%2Fmarket.waimai.meituan.com%2Fgd%2Fsingle.html%3Futm_term%3D74060.cps.24412203%26el_biz%3Dwaimai%26gundam_id%3D2KAWnD%26utm_campaign%3DAffProg%26utm_medium%3Dwandie%26el_page%3Dgundam.loader%26urpid%3D74060.161941038093.24412203.0%26appkey%3D669dc60208f861e36c7355a243a7fdf3%253Aqq%26source%3Dwandie%26_rdt%3D1%26utm_source%3D%26utm_content%3D%26noguide%3D1%26utm_term%3D%26utm_campaign%3Dother%26utm_medium%3DMU%26channel%3Dunion%26utm_source%3D60413%26utm_content%3D1380426742014976088‘>美团外卖券</a>
这样就可以通过芝麻小客服的,公众号客服消息群发,发给用户了。