


WeChat public platform development (104) Scan the custom menu, send pictures, and send geographical location, 104 scan_PHP tutorial
WeChat public platform development (104) Scan the custom menu, send pictures, send location, 104 scan
Keywords: WeChat public platform custom menu Scan Scan hair pictures and send geographical location
Author: Fangbei Studio
Original text: http://www.cnblogs.com/txw1958/p/weixin-menu-new-type.html
Customized menus can help official accounts enrich their interfaces, allowing users to understand the important functions of official accounts better and faster. WeChat has added the ability to launch a scan (supports QR code/one-dimensional code), send pictures, and send geographical location after clicking on the menu, which needs to be developed and implemented. Official accounts with original custom menu development permissions can obtain the above capabilities.
In this WeChat public platform development tutorial, we will introduce how to develop functions such as scanning, sending pictures, and sending geographical location on the custom menu. For the development of original click and jump events, please refer to WeChat Public Platform Development (58) Custom Menu.
This article is divided into the following two parts:
1. Menu introduction
1. Scan code push event scancode_push
After the user clicks the button, the WeChat client will launch the scan tool. After completing the scan operation, the scan result will be displayed (if it is a URL, the URL will be entered), and the The result of scanning the code is sent to the developer, who can send messages.
2. Scan the code to push the event, and the "Message Receiving" prompt box scancode_waitmsg will pop up
After the user clicks the button, the WeChat client will activate the scan tool. After completing the scan operation, the result of the scan will be Pass it to the developer, put away the scanning tool at the same time, and then the "Message Receiving" prompt box will pop up, and you may receive a message from the developer.
3. Pop up the system to take pictures and send pictures pic_sysphoto
After the user clicks the button, the WeChat client will call up the system camera. After completing the photo operation, the taken photos will be sent to the developer and the event will be pushed to the developer. Put away the system camera and you may receive a message from the developer.
4. Pop up to take a photo or send a picture to an album pic_photo_or_album
After the user clicks the button, the WeChat client will pop up a selector for the user to choose "take a photo" or "select from the mobile phone album". After the user chooses, he will go through the other two processes.
5. Pop up the WeChat photo album sender pic_weixin
After the user clicks the button, the WeChat client will call up the WeChat photo album. After completing the selection operation, the selected photos will be sent to the developer's server and the event will be pushed to the development If you close the photo album at the same time, you may receive a message from the developer later.
6. Pop up the location selector location_select
After the user clicks the button, the WeChat client will call up the location selection tool. After completing the selection operation, the selected location will be sent to the developer's server, and at the same time, it will be closed The location selection tool may then receive a message from the developer.
The above new capabilities only support WeChat iPhone 5.4.1 or above, and Android 5.4 or above WeChat users. WeChat users with older versions will not respond after clicking, and developers will not be able to receive event push normally.
Interface call request description
http request method: POST (please use https protocol)
https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN
An example of a button request is as follows
<span>{ </span><span>"</span><span>button</span><span>"</span><span>: [ { </span><span>"</span><span>name</span><span>"</span>: <span>"</span><span>扫码</span><span>"</span><span>, </span><span>"</span><span>sub_button</span><span>"</span><span>: [ { </span><span>"</span><span>type</span><span>"</span>: <span>"</span><span>scancode_waitmsg</span><span>"</span><span>, </span><span>"</span><span>name</span><span>"</span>: <span>"</span><span>扫码带提示</span><span>"</span><span>, </span><span>"</span><span>key</span><span>"</span>: <span>"</span><span>rselfmenu_0_0</span><span>"</span><span>, </span><span>"</span><span>sub_button</span><span>"</span><span>: [ ] }, { </span><span>"</span><span>type</span><span>"</span>: <span>"</span><span>scancode_push</span><span>"</span><span>, </span><span>"</span><span>name</span><span>"</span>: <span>"</span><span>扫码推事件</span><span>"</span><span>, </span><span>"</span><span>key</span><span>"</span>: <span>"</span><span>rselfmenu_0_1</span><span>"</span><span>, </span><span>"</span><span>sub_button</span><span>"</span><span>: [ ] } ] }, { </span><span>"</span><span>name</span><span>"</span>: <span>"</span><span>发图</span><span>"</span><span>, </span><span>"</span><span>sub_button</span><span>"</span><span>: [ { </span><span>"</span><span>type</span><span>"</span>: <span>"</span><span>pic_sysphoto</span><span>"</span><span>, </span><span>"</span><span>name</span><span>"</span>: <span>"</span><span>系统拍照发图</span><span>"</span><span>, </span><span>"</span><span>key</span><span>"</span>: <span>"</span><span>rselfmenu_1_0</span><span>"</span><span>, </span><span>"</span><span>sub_button</span><span>"</span><span>: [ ] }, { </span><span>"</span><span>type</span><span>"</span>: <span>"</span><span>pic_photo_or_album</span><span>"</span><span>, </span><span>"</span><span>name</span><span>"</span>: <span>"</span><span>拍照或者相册发图</span><span>"</span><span>, </span><span>"</span><span>key</span><span>"</span>: <span>"</span><span>rselfmenu_1_1</span><span>"</span><span>, </span><span>"</span><span>sub_button</span><span>"</span><span>: [ ] }, { </span><span>"</span><span>type</span><span>"</span>: <span>"</span><span>pic_weixin</span><span>"</span><span>, </span><span>"</span><span>name</span><span>"</span>: <span>"</span><span>微信相册发图</span><span>"</span><span>, </span><span>"</span><span>key</span><span>"</span>: <span>"</span><span>rselfmenu_1_2</span><span>"</span><span>, </span><span>"</span><span>sub_button</span><span>"</span><span>: [ ] } ] }, { </span><span>"</span><span>name</span><span>"</span>: <span>"</span><span>发送位置</span><span>"</span><span>, </span><span>"</span><span>type</span><span>"</span>: <span>"</span><span>location_select</span><span>"</span><span>, </span><span>"</span><span>key</span><span>"</span>: <span>"</span><span>rselfmenu_2_0</span><span>"</span><span> } ] }</span>
Parameter Description
Parameter | Is it necessary | Explanation | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
button | Yes | First-level menu array, the number should be 1~3 | |||||||||||||||||||||
sub_button | No | Secondary menu array, the number should be 1~5 | |||||||||||||||||||||
type | Yes | Menu response action type | |||||||||||||||||||||
name | Yes | Menu title, no more than 16 bytes, submenu no more than 40 bytes | |||||||||||||||||||||
key | Click and other click types are required | Menu KEY value, used for message interface push, no more than 128 bytes | |||||||||||||||||||||
url | View type is required | Web page link, the user can click the menu to open the link, no more than 256 bytes
|
二、生成菜单
菜单具体的生成方法,与之前是一样的,先生成access token,再将菜单post内容提交给微信服务器,具体代码及方法可以参考 微信公众平台开发(58)自定义菜单。
生成后的效果如下如示:
三、响应菜单点击
响应菜单点击,则需要在接口文件中添加新的EventKey事件的响应,并回复相应的内容。
相关代码如下
<span> 1</span> <span>//</span><span>接收事件消息</span> <span> 2</span> <span>private</span> <span>function</span> receiveEvent(<span>$object</span><span>) </span><span> 3</span> <span> { </span><span> 4</span> <span>$content</span> = ""<span>; </span><span> 5</span> <span>switch</span> (<span>$object</span>-><span>Event) </span><span> 6</span> <span> { </span><span> 7</span> <span>case</span> "subscribe": <span> 8</span> <span>$content</span> = "欢迎关注方倍工作室 "<span>; </span><span> 9</span> <span>$content</span> .= (!<span>empty</span>(<span>$object</span>->EventKey))?("\n来自二维码场景 ".<span>str_replace</span>("qrscene_","",<span>$object</span>->EventKey)):""<span>; </span><span>10</span> <span>break</span><span>; </span><span>11</span> <span>case</span> "unsubscribe": <span>12</span> <span>$content</span> = "取消关注"<span>; </span><span>13</span> <span>break</span><span>; </span><span>14</span> <span>case</span> "CLICK": <span>15</span> <span>switch</span> (<span>$object</span>-><span>EventKey) </span><span>16</span> <span> { </span><span>17</span> <span>case</span> "COMPANY": <span>18</span> <span>$content</span> = <span>array</span><span>(); </span><span>19</span> <span>$content</span>[] = <span>array</span>("Title"=>"方倍工作室", "Description"=>"", "PicUrl"=>"http://discuz.comli.com/weixin/weather/icon/cartoon.jpg", "Url" =>"http://m.cnblogs.com/?u=txw1958"<span>); </span><span>20</span> <span>break</span><span>; </span><span>21</span> <span>default</span>: <span>22</span> <span>$content</span> = "点击菜单:".<span>$object</span>-><span>EventKey; </span><span>23</span> <span>break</span><span>; </span><span>24</span> <span> } </span><span>25</span> <span>break</span><span>; </span><span>26</span> <span>case</span> "VIEW": <span>27</span> <span>$content</span> = "跳转链接 ".<span>$object</span>-><span>EventKey; </span><span>28</span> <span>break</span><span>; </span><span>29</span> <span>case</span> "SCAN": <span>30</span> <span>$content</span> = "扫描场景 ".<span>$object</span>-><span>EventKey; </span><span>31</span> <span>break</span><span>; </span><span>32</span> <span>case</span> "LOCATION": <span>33</span> <span>$content</span> = "上传位置:纬度 ".<span>$object</span>->Latitude.";经度 ".<span>$object</span>-><span>Longitude; </span><span>34</span> <span>break</span><span>; </span><span>35</span> <span>case</span> "scancode_waitmsg": <span>36</span> <span>$content</span> = "扫码带提示:类型 ".<span>$object</span>->ScanCodeInfo->ScanType." 结果:".<span>$object</span>->ScanCodeInfo-><span>ScanResult; </span><span>37</span> <span>break</span><span>; </span><span>38</span> <span>case</span> "scancode_push": <span>39</span> <span>$content</span> = "扫码推事件"<span>; </span><span>40</span> <span>break</span><span>; </span><span>41</span> <span>case</span> "pic_sysphoto": <span>42</span> <span>$content</span> = "系统拍照"<span>; </span><span>43</span> <span>break</span><span>; </span><span>44</span> <span>case</span> "pic_weixin": <span>45</span> <span>$content</span> = "相册发图:数量 ".<span>$object</span>->SendPicsInfo-><span>Count</span><span>; </span><span>46</span> <span>break</span><span>; </span><span>47</span> <span>case</span> "pic_photo_or_album": <span>48</span> <span>$content</span> = "拍照或者相册:数量 ".<span>$object</span>->SendPicsInfo-><span>Count</span><span>; </span><span>49</span> <span>break</span><span>; </span><span>50</span> <span>case</span> "location_select": <span>51</span> <span>$content</span> = "发送位置:标签 ".<span>$object</span>->SendLocationInfo-><span>Label; </span><span>52</span> <span>break</span><span>; </span><span>53</span> <span>default</span>: <span>54</span> <span>$content</span> = "receive a new event: ".<span>$object</span>->Event." \n技术支持 方倍工作室"<span>; </span><span>55</span> <span>break</span><span>; </span><span>56</span> <span> } </span><span>57</span> <span>58</span> <span>if</span>(<span>is_array</span>(<span>$content</span><span>)){ </span><span>59</span> <span>if</span> (<span>isset</span>(<span>$content</span>[0]['PicUrl'<span>])){ </span><span>60</span> <span>$result</span> = <span>$this</span>->transmitNews(<span>$object</span>, <span>$content</span><span>); </span><span>61</span> }<span>else</span> <span>if</span> (<span>isset</span>(<span>$content</span>['MusicUrl'<span>])){ </span><span>62</span> <span>$result</span> = <span>$this</span>->transmitMusic(<span>$object</span>, <span>$content</span><span>); </span><span>63</span> <span> } </span><span>64</span> }<span>else</span><span>{ </span><span>65</span> <span>$result</span> = <span>$this</span>->transmitText(<span>$object</span>, <span>$content</span><span>); </span><span>66</span> <span> } </span><span>67</span> <span>return</span> <span>$result</span><span>; </span><span>68</span> }
各项类型推送给后台的xml详解如下
scancode_waitmsg,回应该事件给用户,用户可收到消息
<span><</span><span>xml</span><span>></span> <span><</span><span>ToUserName</span><span>></span><span><![CDATA[</span><span>gh_82479813ed64</span><span>]]></span><span></</span><span>ToUserName</span><span>></span> <span><</span><span>FromUserName</span><span>></span><span><![CDATA[</span><span>ojpX_jig-gyi3_Q9fHXQ4rdHniQs</span><span>]]></span><span></</span><span>FromUserName</span><span>></span> <span><</span><span>CreateTime</span><span>></span>1412075435<span></</span><span>CreateTime</span><span>></span> <span><</span><span>MsgType</span><span>></span><span><![CDATA[</span><span>event</span><span>]]></span><span></</span><span>MsgType</span><span>></span> <span><</span><span>Event</span><span>></span><span><![CDATA[</span><span>scancode_waitmsg</span><span>]]></span><span></</span><span>Event</span><span>></span> <span><</span><span>EventKey</span><span>></span><span><![CDATA[</span><span>rselfmenu_0_0</span><span>]]></span><span></</span><span>EventKey</span><span>></span> <span><</span><span>ScanCodeInfo</span><span>></span> <span><</span><span>ScanType</span><span>></span><span><![CDATA[</span><span>qrcode</span><span>]]></span><span></</span><span>ScanType</span><span>></span> <span><</span><span>ScanResult</span><span>></span><span><![CDATA[</span><span>http://weixin.qq.com/r/pUNnf4HEX9wgrcUc9xa3</span><span>]]></span><span></</span><span>ScanResult</span><span>></span> <span><</span><span>EventKey</span><span>></span><span><![CDATA[</span><span>rselfmenu_0_0</span><span>]]></span><span></</span><span>EventKey</span><span>></span> <span></</span><span>ScanCodeInfo</span><span>></span> <span></</span><span>xml</span><span>></span>
scancode_push,回应该事件给用户,用户不能收到消息
<span><</span><span>xml</span><span>></span> <span><</span><span>ToUserName</span><span>></span><span><![CDATA[</span><span>gh_82479813ed64</span><span>]]></span><span></</span><span>ToUserName</span><span>></span> <span><</span><span>FromUserName</span><span>></span><span><![CDATA[</span><span>ojpX_jig-gyi3_Q9fHXQ4rdHniQs</span><span>]]></span><span></</span><span>FromUserName</span><span>></span> <span><</span><span>CreateTime</span><span>></span>1412075451<span></</span><span>CreateTime</span><span>></span> <span><</span><span>MsgType</span><span>></span><span><![CDATA[</span><span>event</span><span>]]></span><span></</span><span>MsgType</span><span>></span> <span><</span><span>Event</span><span>></span><span><![CDATA[</span><span>scancode_push</span><span>]]></span><span></</span><span>Event</span><span>></span> <span><</span><span>EventKey</span><span>></span><span><![CDATA[</span><span>rselfmenu_0_1</span><span>]]></span><span></</span><span>EventKey</span><span>></span> <span><</span><span>ScanCodeInfo</span><span>></span> <span><</span><span>ScanType</span><span>></span><span><![CDATA[</span><span>qrcode</span><span>]]></span><span></</span><span>ScanType</span><span>></span> <span><</span><span>ScanResult</span><span>></span><span><![CDATA[</span><span>http://weixin.qq.com/r/pUNnf4HEX9wgrcUc9xa3</span><span>]]></span><span></</span><span>ScanResult</span><span>></span> <span><</span><span>EventKey</span><span>></span><span><![CDATA[</span><span>rselfmenu_0_1</span><span>]]></span><span></</span><span>EventKey</span><span>></span> <span></</span><span>ScanCodeInfo</span><span>></span> <span></</span><span>xml</span><span>></span>
pic_weixin ,下面是一次推送3张相片时的数据
<span><</span><span>xml</span><span>></span> <span><</span><span>ToUserName</span><span>></span><span><![CDATA[</span><span>gh_82479813ed64</span><span>]]></span><span></</span><span>ToUserName</span><span>></span> <span><</span><span>FromUserName</span><span>></span><span><![CDATA[</span><span>ojpX_jig-gyi3_Q9fHXQ4rdHniQs</span><span>]]></span><span></</span><span>FromUserName</span><span>></span> <span><</span><span>CreateTime</span><span>></span>1412075552<span></</span><span>CreateTime</span><span>></span> <span><</span><span>MsgType</span><span>></span><span><![CDATA[</span><span>event</span><span>]]></span><span></</span><span>MsgType</span><span>></span> <span><</span><span>Event</span><span>></span><span><![CDATA[</span><span>pic_weixin</span><span>]]></span><span></</span><span>Event</span><span>></span> <span><</span><span>EventKey</span><span>></span><span><![CDATA[</span><span>rselfmenu_1_2</span><span>]]></span><span></</span><span>EventKey</span><span>></span> <span><</span><span>SendPicsInfo</span><span>></span> <span><</span><span>Count</span><span>></span>3<span></</span><span>Count</span><span>></span> <span><</span><span>PicList</span><span>></span> <span><</span><span>item</span><span>></span> <span><</span><span>PicMd5Sum</span><span>></span><span><![CDATA[</span><span>a6ab74b73a298f49f6fc66f41f88d3c7</span><span>]]></span><span></</span><span>PicMd5Sum</span><span>></span> <span></</span><span>item</span><span>></span> <span><</span><span>item</span><span>></span> <span><</span><span>PicMd5Sum</span><span>></span><span><![CDATA[</span><span>5b9aea2b3683c5c21aaf3629739cafd9</span><span>]]></span><span></</span><span>PicMd5Sum</span><span>></span> <span></</span><span>item</span><span>></span> <span><</span><span>item</span><span>></span> <span><</span><span>PicMd5Sum</span><span>></span><span><![CDATA[</span><span>2325ff3f39705ac987d3e0660906791d</span><span>]]></span><span></</span><span>PicMd5Sum</span><span>></span> <span></</span><span>item</span><span>></span> <span></</span><span>PicList</span><span>></span> <span><</span><span>EventKey</span><span>></span><span><![CDATA[</span><span>rselfmenu_1_2</span><span>]]></span><span></</span><span>EventKey</span><span>></span> <span></</span><span>SendPicsInfo</span><span>></span> <span></</span><span>xml</span><span>></span>
回应上述消息,用户收不到,但微信会继续推送3个图片消息给接口
<span><</span><span>xml</span><span>></span> <span><</span><span>ToUserName</span><span>></span><span><![CDATA[</span><span>gh_82479813ed64</span><span>]]></span><span></</span><span>ToUserName</span><span>></span> <span><</span><span>FromUserName</span><span>></span><span><![CDATA[</span><span>ojpX_jig-gyi3_Q9fHXQ4rdHniQs</span><span>]]></span><span></</span><span>FromUserName</span><span>></span> <span><</span><span>CreateTime</span><span>></span>1412075562<span></</span><span>CreateTime</span><span>></span> <span><</span><span>MsgType</span><span>></span><span><![CDATA[</span><span>image</span><span>]]></span><span></</span><span>MsgType</span><span>></span> <span><</span><span>PicUrl</span><span>></span><span><![CDATA[</span><span>http://mmbiz.qpic.cn/mmbiz/qOTIrRtMKFxZQo3cQ6vYxmfteo0fw2Y00MuuFS6OjlNvTkx0nBQJibjjafQMf4dCtJwyMeP5e3SQCuJpcoJdb8Q/0</span><span>]]></span><span></</span><span>PicUrl</span><span>></span> <span><</span><span>MsgId</span><span>></span>6064818358471506877<span></</span><span>MsgId</span><span>></span> <span><</span><span>MediaId</span><span>></span><span><![CDATA[</span><span>AM8Gbiu7S2vTIMS2l9zNCWiMCpeM8wccmKdFxmstHiuAybCbB-08dTQJN40cCIBD</span><span>]]></span><span></</span><span>MediaId</span><span>></span> <span></</span><span>xml</span><span>></span>
<span><</span><span>xml</span><span>></span> <span><</span><span>ToUserName</span><span>></span><span><![CDATA[</span><span>gh_82479813ed64</span><span>]]></span><span></</span><span>ToUserName</span><span>></span> <span><</span><span>FromUserName</span><span>></span><span><![CDATA[</span><span>ojpX_jig-gyi3_Q9fHXQ4rdHniQs</span><span>]]></span><span></</span><span>FromUserName</span><span>></span> <span><</span><span>CreateTime</span><span>></span>1412075564<span></</span><span>CreateTime</span><span>></span> <span><</span><span>MsgType</span><span>></span><span><![CDATA[</span><span>image</span><span>]]></span><span></</span><span>MsgType</span><span>></span> <span><</span><span>PicUrl</span><span>></span><span><![CDATA[</span><span>http://mmbiz.qpic.cn/mmbiz/qOTIrRtMKFxZQo3cQ6vYxmfteo0fw2Y0ellMniarWto4zL0pWKhr6a0FSARDeXprSgd0JmgU0YQo2iagGsYc1iaLA/0</span><span>]]></span><span></</span><span>PicUrl</span><span>></span> <span><</span><span>MsgId</span><span>></span>6064818367061441471<span></</span><span>MsgId</span><span>></span> <span><</span><span>MediaId</span><span>></span><span><![CDATA[</span><span>2CJKZ2mft-5hWEkVcVmnKwyvp3y59Uzv7YdpBsnGIyTlkMNb0ytU4oimTgimBGyP</span><span>]]></span><span></</span><span>MediaId</span><span>></span> <span></</span><span>xml</span><span>></span>
<span><</span><span>xml</span><span>></span> <span><</span><span>ToUserName</span><span>></span><span><![CDATA[</span><span>gh_82479813ed64</span><span>]]></span><span></</span><span>ToUserName</span><span>></span> <span><</span><span>FromUserName</span><span>></span><span><![CDATA[</span><span>ojpX_jig-gyi3_Q9fHXQ4rdHniQs</span><span>]]></span><span></</span><span>FromUserName</span><span>></span> <span><</span><span>CreateTime</span><span>></span>1412075567<span></</span><span>CreateTime</span><span>></span> <span><</span><span>MsgType</span><span>></span><span><![CDATA[</span><span>image</span><span>]]></span><span></</span><span>MsgType</span><span>></span> <span><</span><span>PicUrl</span><span>></span><span><![CDATA[</span><span>http://mmbiz.qpic.cn/mmbiz/qOTIrRtMKFxZQo3cQ6vYxmfteo0fw2Y0mwQoENttnmYAz0VTicY3xkO0lhn9mE5r3FB4cF04kia50riajcjY1qvzA/0</span><span>]]></span><span></</span><span>PicUrl</span><span>></span> <span><</span><span>MsgId</span><span>></span>6064818379946343361<span></</span><span>MsgId</span><span>></span> <span><</span><span>MediaId</span><span>></span><span><![CDATA[</span><span>VICm1-y8w_MmdpcLYWP0u12HVXrWdhm3c3tdq1PTsbiFFgH6YOcmmIEbZ27z-Qcl</span><span>]]></span><span></</span><span>MediaId</span><span>></span> <span></</span><span>xml</span><span>></span>
上述多个图片消息,后台收到都能进行单独回应,用户可以收到响应消息。
pic_photo_or_album,方式和pic_weixin 一样,先推送菜单事件,再推送图片消息
<span><</span><span>xml</span><span>></span> <span><</span><span>ToUserName</span><span>></span><span><![CDATA[</span><span>gh_82479813ed64</span><span>]]></span><span></</span><span>ToUserName</span><span>></span> <span><</span><span>FromUserName</span><span>></span><span><![CDATA[</span><span>ojpX_jig-gyi3_Q9fHXQ4rdHniQs</span><span>]]></span><span></</span><span>FromUserName</span><span>></span> <span><</span><span>CreateTime</span><span>></span>1412075614<span></</span><span>CreateTime</span><span>></span> <span><</span><span>MsgType</span><span>></span><span><![CDATA[</span><span>event</span><span>]]></span><span></</span><span>MsgType</span><span>></span> <span><</span><span>Event</span><span>></span><span><![CDATA[</span><span>pic_photo_or_album</span><span>]]></span><span></</span><span>Event</span><span>></span> <span><</span><span>EventKey</span><span>></span><span><![CDATA[</span><span>rselfmenu_1_1</span><span>]]></span><span></</span><span>EventKey</span><span>></span> <span><</span><span>SendPicsInfo</span><span>></span> <span><</span><span>Count</span><span>></span>1<span></</span><span>Count</span><span>></span> <span><</span><span>PicList</span><span>></span> <span><</span><span>item</span><span>></span> <span><</span><span>PicMd5Sum</span><span>></span><span><![CDATA[</span><span>58f4989164b2a432889e64fa81632152</span><span>]]></span><span></</span><span>PicMd5Sum</span><span>></span> <span></</span><span>item</span><span>></span> <span></</span><span>PicList</span><span>></span> <span><</span><span>EventKey</span><span>></span><span><![CDATA[</span><span>rselfmenu_1_1</span><span>]]></span><span></</span><span>EventKey</span><span>></span> <span></</span><span>SendPicsInfo</span><span>></span> <span></</span><span>xml</span><span>></span>
<span><</span><span>xml</span><span>></span> <span><</span><span>ToUserName</span><span>></span><span><![CDATA[</span><span>gh_82479813ed64</span><span>]]></span><span></</span><span>ToUserName</span><span>></span> <span><</span><span>FromUserName</span><span>></span><span><![CDATA[</span><span>ojpX_jig-gyi3_Q9fHXQ4rdHniQs</span><span>]]></span><span></</span><span>FromUserName</span><span>></span> <span><</span><span>CreateTime</span><span>></span>1412075618<span></</span><span>CreateTime</span><span>></span> <span><</span><span>MsgType</span><span>></span><span><![CDATA[</span><span>image</span><span>]]></span><span></</span><span>MsgType</span><span>></span> <span><</span><span>PicUrl</span><span>></span><span><![CDATA[</span><span>http://mmbiz.qpic.cn/mmbiz/qOTIrRtMKFxZQo3cQ6vYxmfteo0fw2Y0fwSdF54rribCj9zqDG0wVDsiasKuUC8gskbuZmX43a1hs9esySIvmrqA/0</span><span>]]></span><span></</span><span>PicUrl</span><span>></span> <span><</span><span>MsgId</span><span>></span>6064818598989675467<span></</span><span>MsgId</span><span>></span> <span><</span><span>MediaId</span><span>></span><span><![CDATA[</span><span>Jh7Bsjaodmz-Dc_Hdz_wRzY3RiFxNvA4JHpUWRNRCIgps19ANsDFIOYOUV1dIVYV</span><span>]]></span><span></</span><span>MediaId</span><span>></span> <span></</span><span>xml</span><span>></span>
pic_sysphoto 这个后台其实收不到该菜单的消息,点击它后,调用的是手机里面的照相机功能,而照相以后再发过来时,就收到的是一个图片消息了
<span><</span><span>xml</span><span>></span> <span><</span><span>ToUserName</span><span>></span><span><![CDATA[</span><span>gh_82479813ed64</span><span>]]></span><span></</span><span>ToUserName</span><span>></span> <span><</span><span>FromUserName</span><span>></span><span><![CDATA[</span><span>ojpX_jig-gyi3_Q9fHXQ4rdHniQs</span><span>]]></span><span></</span><span>FromUserName</span><span>></span> <span><</span><span>CreateTime</span><span>></span>1412135923<span></</span><span>CreateTime</span><span>></span> <span><</span><span>MsgType</span><span>></span><span><![CDATA[</span><span>image</span><span>]]></span><span></</span><span>MsgType</span><span>></span> <span><</span><span>PicUrl</span><span>></span><span><![CDATA[</span><span>http://mmbiz.qpic.cn/mmbiz/qOTIrRtMKFxGzYCchrNiczZ9aCd1fgCEWbicHGvmaz1d7VZOSMqoLB4RL69rK2Fos6fSM4FJRkLtiajpe32ibkicw1A/0</span><span>]]></span><span></</span><span>PicUrl</span><span>></span> <span><</span><span>MsgId</span><span>></span>6065077606992462276<span></</span><span>MsgId</span><span>></span> <span><</span><span>MediaId</span><span>></span><span><![CDATA[</span><span>PqRRUPLhMc27EG5F4cCtTozBsin7SY8kPRRuAF-CwPl5MzR5ewE5oji0FhGTDl6_</span><span>]]></span><span></</span><span>MediaId</span><span>></span> <span></</span><span>xml</span><span>></span>
location_select 将会调起发送位置功能,菜单的响应用户收不到,在用户发送位置之后,会再推送一个地理位置消息功能给用户
<span><</span><span>xml</span><span>></span> <span><</span><span>ToUserName</span><span>></span><span><![CDATA[</span><span>gh_82479813ed64</span><span>]]></span><span></</span><span>ToUserName</span><span>></span> <span><</span><span>FromUserName</span><span>></span><span><![CDATA[</span><span>ojpX_jig-gyi3_Q9fHXQ4rdHniQs</span><span>]]></span><span></</span><span>FromUserName</span><span>></span> <span><</span><span>CreateTime</span><span>></span>1412075681<span></</span><span>CreateTime</span><span>></span> <span><</span><span>MsgType</span><span>></span><span><![CDATA[</span><span>event</span><span>]]></span><span></</span><span>MsgType</span><span>></span> <span><</span><span>Event</span><span>></span><span><![CDATA[</span><span>location_select</span><span>]]></span><span></</span><span>Event</span><span>></span> <span><</span><span>EventKey</span><span>></span><span><![CDATA[</span><span>rselfmenu_2_0</span><span>]]></span><span></</span><span>EventKey</span><span>></span> <span><</span><span>SendLocationInfo</span><span>></span> <span><</span><span>Location_X</span><span>></span><span><![CDATA[</span><span>22.538145</span><span>]]></span><span></</span><span>Location_X</span><span>></span> <span><</span><span>Location_Y</span><span>></span><span><![CDATA[</span><span>113.952298</span><span>]]></span><span></</span><span>Location_Y</span><span>></span> <span><</span><span>Scale</span><span>></span><span><![CDATA[</span><span>13</span><span>]]></span><span></</span><span>Scale</span><span>></span> <span><</span><span>Label</span><span>></span><span><![CDATA[</span><span>深圳市南山区高新南一道9号</span><span>]]></span><span></</span><span>Label</span><span>></span> <span><</span><span>Poiname</span><span>></span><span><![CDATA[]]></span><span></</span><span>Poiname</span><span>></span> <span><</span><span>EventKey</span><span>></span><span><![CDATA[</span><span>rselfmenu_2_0</span><span>]]></span><span></</span><span>EventKey</span><span>></span> <span></</span><span>SendLocationInfo</span><span>></span> <span></</span><span>xml</span><span>></span>
<span><</span><span>xml</span><span>></span> <span><</span><span>ToUserName</span><span>></span><span><![CDATA[</span><span>gh_82479813ed64</span><span>]]></span><span></</span><span>ToUserName</span><span>></span> <span><</span><span>FromUserName</span><span>></span><span><![CDATA[</span><span>ojpX_jig-gyi3_Q9fHXQ4rdHniQs</span><span>]]></span><span></</span><span>FromUserName</span><span>></span> <span><</span><span>CreateTime</span><span>></span>1412075681<span></</span><span>CreateTime</span><span>></span> <span><</span><span>MsgType</span><span>></span><span><![CDATA[</span><span>location</span><span>]]></span><span></</span><span>MsgType</span><span>></span> <span><</span><span>Location_X</span><span>></span>22.538145<span></</span><span>Location_X</span><span>></span> <span><</span><span>Location_Y</span><span>></span>113.952298<span></</span><span>Location_Y</span><span>></span> <span><</span><span>Scale</span><span>></span>13<span></</span><span>Scale</span><span>></span> <span><</span><span>Label</span><span>></span><span><![CDATA[</span><span>深圳市南山区高新南一道9号飞亚达科技大厦方倍工作室</span><span>]]></span><span></</span><span>Label</span><span>></span> <span><</span><span>MsgId</span><span>></span>6064818869572615123<span></</span><span>MsgId</span><span>></span> <span></</span><span>xml</span><span>></span>
四、使用场景
4.1 产品二维码检测真伪
使用scancode_waitmsg事件,可以获得扫描结果,再与现有结果进行比对,从而可以达到检测二维码真实性的功能。
一个检测代码如下所示:
<span>1</span> <span>case</span> "scancode_waitmsg": <span>2</span> <span>if</span> (<span>$object</span>->ScanCodeInfo->ScanResult == "http://mm.wanggou.com/item/jd2.shtml?sku=11447844"<span>){ </span><span>3</span> <span>$content</span> = <span>array</span><span>(); </span><span>4</span> <span>$content</span>[] = <span>array</span>("Title"=>"该产品检测结果为正品", "Description"=>"书名:微信公众平台开发最佳实践\n定价:¥69.00\n作者:方倍工作室\n\n点击“查看全文”,使用微信支付在线购买", "PicUrl"=>"http://images.cnitblog.com/i/340216/201404/301756448922305.jpg", "Url" =>"http://mm.wanggou.com/item/jd2.shtml?sku=11447844"<span>); </span><span>5</span> }<span>else</span><span>{ </span><span>6</span> <span>$content</span> = "扫码带提示:类型 ".<span>$object</span>->ScanCodeInfo->ScanType." 结果:".<span>$object</span>->ScanCodeInfo-><span>ScanResult; </span><span>7</span> <span> } </span><span>8</span> <span>break</span>;
当用户使用scancode_waitmsg菜单扫描以下二维码时,将出现检测结果,结果为真时,还可以再进一步,让用户进入购买
4.2 快递进度查询
基于上面同样的原理,可以实现扫描快递条形码,就查询快递进度的功能。
一个快递的单号如下
扫描以后,返回结果为
扫码带提示:类型 qrcode/CODE_39 结果:762480955342
正确识别了其中的快递单号
4.3 导航/附近/地图
location_select事件比之前的直接发送地理位置消息更少了一步,比如下面的
WeChat has launched a custom menu, which has made many people have high expectations, but I think this is not necessary for public accounts. Nowadays, form is more important than practicality. Most users are actually used to getting content through input. There is really no need to be too obsessed with it. The use of customized menus and good service are fundamental. Recently, WeChat quietly launched a custom menu for internal testing, which once again attracted the attention of countless people. No matter who it was, they were doing a few things on the 19th. One was to fill out the form to apply for internal testing, and the other was to study the custom menu interface. Documents, the third is to write various analysis articles on custom menus, and the fourth is to rely on various connections to get the qualification for internal testing as soon as possible. Ztalk also has to take the company information to apply, but because it is a self-media, it is probably not available, so it will be a bit disappointing, but calm down
...Expand
WeChat launches a custom menu, which makes many people happy I have high expectations, but I think this is not necessary for public accounts. Nowadays, form is more important than practicality. Most users are actually used to getting content through input. There is really no need to be too obsessed with using custom menus. Good service is fundamental. Recently, WeChat quietly launched a custom menu for internal testing, which once again attracted the attention of countless people. No matter who it was, they were doing a few things on the 19th. One was to fill out the form to apply for internal testing, and the other was to study the custom menu interface. Documents, the third is to write various analysis articles on custom menus, and the fourth is to rely on various connections to get the qualification for internal testing as soon as possible. Ztalk also has to take the company information to apply, but because it is a self-media, it is probably not available, so I will be a little disappointed, but I will not be depressed if I calm down and think about it clearly. In fact, so what if you get this interface? Do public accounts really need to customize menus? What exactly is a custom menu? Friends, what is the essence of subscribing to "ZTalk"? What exactly is a custom menu? Most people have great expectations for custom menus, thinking that anything new officially launched must be a powerful marketing tool, but in fact it is just a shortcut key to focus on functions, and not everyone needs it. I remember an article once mentioned that the user service acquisition path for WeChat public accounts is too long. Users must first find the public account to enter, then click on an article or obtain the article through query and click to enter the WeChat article template, and then click to read the original text To finally reach the service, that is, the user may have to go through three to four steps or even more to get what he wants. Of course, having a custom menu can shorten this process. For some companies, the content that needs to be displayed prominently can be placed directly on the menu. For example, an e-commerce seller can set up a menu bar to place new products on the market, and then set up a menu bar to place group purchase discounts. Users can directly enter the purchase page after clicking. You can also set up a menu bar to place product categories to go directly to each product category. For example, a hotel chain can set up a menu to display the latest promotions, another menu to display hotel introductions and room displays, and another menu bar to send geographical locations and query nearby hotels. For example, in a department store, you can set up a menu to display the latest discounts and promotions, another menu to display product introductions at the floor counter, and another menu for information services such as store address, telephone number, and membership services. The main function of the custom menu is to allow users to reduce the learning cost of information acquisition, make the company's public account more intuitive, and make information transmission easier. In fact, with this menu, you can treat the WeChat public account as a website. Users It can be used like browsing the web. Custom menu is not a necessary function for public accounts. First of all, before this custom menu, public accounts could already complete these functions very well. By designing a friendly, clear and interactive welcome word and usage help, and using keyword replies to display the corresponding content to users in the form of text or multiple graphics, now with a custom menu, it is nothing more than paying attention to what is in the welcome word. A bunch of interactive guidance has been replaced. Of course, there will be new interfaces for custom menus in the future, but for now, just link pointing is not very useful. Of course, it will be very useful for H5 pages in games or e-commerce. Secondly, the custom menu will cover the input box of the public account. When the user needs to interact by inputting text or voice, he has to click the button to switch, which will be an extra step. Therefore, for some public accounts that focus on content browsing information query, the custom menu automatically Defining the menu is useful, but it is better not to have a public account that focuses on user interaction and services. Finally, the custom menu currently needs to be developed through the interface before it can be used. Originally, this menu will be made into the backend... The rest of the full text >>
Judging from the current situation, both service accounts and subscription accounts can apply for their own custom menus after certification. However, some advanced development functions can only be reflected on service accounts, and subscription accounts cannot yet be implemented.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Thanks to netizens Qing Qiechensi, HH_KK, Satomi Ishihara and Wu Yanzu of South China for submitting clues! According to news on September 2, there are recent rumors that "iPhone 16 may not support WeChat." In response to this, a reporter from Shell Finance called Apple's official hotline. Apple's technical consultant in China responded that whether iOS systems or Apple devices can continue to use WeChat, and WeChat The issue of whether it can continue to be listed and downloaded on the Apple App Store requires communication and discussion between Apple and Tencent to determine the future situation. Software App Store and WeChat Problem Description Software App Store technical consultant pointed out that developers may need to pay fees to put software on the Apple Store. After reaching a certain number of downloads, Apple will need to pay corresponding fees for subsequent downloads. Apple is actively communicating with Tencent,

DeepSeek: A powerful AI image generation tool! DeepSeek itself is not an image generation tool, but its powerful core technology provides underlying support for many AI painting tools. Want to know how to use DeepSeek to generate images indirectly? Please continue reading! Generate images with DeepSeek-based AI tools: The following steps will guide you to use these tools: Launch the AI Painting Tool: Search and open a DeepSeek-based AI Painting Tool (for example, search "Simple AI"). Select the drawing mode: select "AI Drawing" or similar function, and select the image type according to your needs, such as "Anime Avatar", "Landscape"

Rumors of WeChat supporting iPhone 16 were debunked. Thanks to netizens Xi Chuang Jiu Shi and HH_KK for submitting clues! According to news on September 2, there are rumors today that WeChat may not support iPhone 16. Once the iPhone is upgraded to the iOS 18.2 system, it will not be able to use WeChat. According to "Daily Economic News", it was learned from people familiar with the matter that this rumor is a rumor. Apple's response: According to Shell Finance, Apple's technical consultant in China responded that the issue of whether WeChat can continue to be used on iOS systems or Apple devices, and whether WeChat can continue to be listed and downloaded in the Apple App Store, needs to be resolved between Apple and Tencent. Only through communication and discussion can we determine the future situation. Currently, Apple is actively communicating with Tencent to confirm whether Tencent will continue to

The top ten trading apps in the currency circle are: 1. OKX; 2. Binance; 3. Gate.io; 4. Huobi Global; 5. Kraken; 6. Coinbase; 7. KuCoin; 8. Bitfinex; 9. Crypto.com; 10. Gemini. The ranking is based on the comprehensive consideration of the exchange's technical strength, user experience, security, currency selection, compliance and other factors.

Gate.io, a leading cryptocurrency trading platform founded in 2013, provides Chinese users with a complete official Chinese website. The website provides a wide range of services, including spot trading, futures trading and lending, and provides special features such as Chinese interface, rich resources and community support.

Gateio Exchange app download channels for old versions, covering official, third-party application markets, forum communities and other channels. It also provides download precautions to help you easily obtain old versions and solve the problems of discomfort in using new versions or device compatibility.

Gate.io (Sesame Open Door) is the world's leading cryptocurrency trading platform. This article provides a complete tutorial on spot trading of Gate.io. The tutorial covers steps such as account registration and login, KYC certification, fiat currency and digital currency recharge, trading pair selection, limit/market transaction orders, and orders and transaction records viewing, helping you quickly get started on the Gate.io platform for cryptocurrency trading. Whether a beginner or a veteran, you can benefit from this tutorial and easily master the Gate.io trading skills.

Decentralized physical artificial intelligence (DePAI) is leading a new direction in the development of artificial intelligence and providing innovative solutions for the control of robots and related infrastructure. This article will conduct in-depth discussions on DePAI and its applications in the fields of data acquisition, remote operation and spatial intelligence, and analyze its development prospects. As Nvidia CEO Huang Renxun said, the "ChatGPT moment" in the field of general robots is coming soon. The development process of artificial intelligence, from hardware to software, is now moving towards the physical world. In the era of future robot popularity, DePAI provides important opportunities for building a physical artificial intelligence ecosystem based on Web3, especially when centralized forces have not yet fully dominated the market. The wide application of autonomous physical artificial intelligence agents will bring robots,
