企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 第五课微信端回复 processor.php文件内 ``` <pre class="calibre14">``` $account_api <span class="token">=</span> WeAccount<span class="token2">:</span><span class="token2">:</span><span class="token1">create</span><span class="token2">(</span><span class="token2">)</span><span class="token2">;</span> $info <span class="token">=</span> $account_api<span class="token">-</span><span class="token">></span><span class="token1">fansQueryInfo</span><span class="token2">(</span>$this<span class="token">-</span><span class="token">></span>message<span class="token2">[</span><span class="token4">'from'</span><span class="token2">]</span><span class="token2">)</span><span class="token2">;</span> $userinfo<span class="token">=</span><span class="token1">mc_fansinfo</span><span class="token2">(</span>$openid<span class="token2">)</span><span class="token2">;</span> 文本 $this<span class="token">-</span><span class="token">></span>message <span class="token">=</span> <span class="token1">array</span><span class="token2">(</span> <span class="token4">'tousername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'toUser'</span> <span class="token4">'fromusername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'fromUser'</span> <span class="token4">'createtime'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'123456789'</span> <span class="token4">'msgtype'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'text'</span> <span class="token6">// string: 消息类型</span> <span class="token4">'content'</span> <span class="token">=</span><span class="token">></span> <span class="token6">// string: 文本消息内容</span> <span class="token4">'redirection'</span> <span class="token">=</span><span class="token">></span> <span class="token3">false</span><span class="token2">,</span> <span class="token6">// bool: 是否是重定向</span> <span class="token4">'source'</span> <span class="token">=</span><span class="token">></span> <span class="token5">null</span> <span class="token6">// string: 消息来源, 消息二次分析(目前来源:qr,click, 将扫码等事件转换为 text 事件.)</span> <span class="token2">)</span> 图片 $this<span class="token">-</span><span class="token">></span>message <span class="token">=</span> <span class="token1">array</span><span class="token2">(</span> <span class="token4">'tousername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'toUser'</span> <span class="token4">'fromusername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'fromUser'</span> <span class="token4">'createtime'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'123456789'</span> <span class="token4">'msgtype'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'image'</span> <span class="token6">// string: 消息类型</span> <span class="token4">'picurl'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token6">// string: 图片链接</span> <span class="token4">'mediaid'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token6">// long: 图片消息媒体id</span> <span class="token4">'url'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token2">)</span><span class="token2">;</span> 位置 $this<span class="token">-</span><span class="token">></span>message <span class="token">=</span> <span class="token1">array</span><span class="token2">(</span> <span class="token4">'tousername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'toUser'</span> <span class="token4">'fromusername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'fromUser'</span> <span class="token4">'createtime'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'123456789'</span> <span class="token4">'msgtype'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'location'</span> <span class="token6">// string: 消息类型</span> <span class="token4">'location_x'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token6">// float: 地理位置纬度</span> <span class="token4">'location_y'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token6">// float: 地理位置经度</span> <span class="token4">'scale'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token6">// float: 地图缩放大小</span> <span class="token4">'label'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token6">// string: 地理位置信息</span> <span class="token2">)</span> 菜单单机 $this<span class="token">-</span><span class="token">></span>message <span class="token">=</span> <span class="token1">array</span><span class="token2">(</span> <span class="token4">'tousername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'toUser'</span> <span class="token4">'fromusername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'fromUser'</span> <span class="token4">'createtime'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'123456789'</span> <span class="token4">'msgtype'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'event'</span> <span class="token4">'eventkey'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'EVENTKEY'</span> <span class="token6">// string: 模拟的关键字</span> <span class="token2">)</span> 上报位置 $this<span class="token">-</span><span class="token">></span>message <span class="token">=</span> <span class="token1">array</span><span class="token2">(</span> <span class="token4">'tousername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'toUser'</span> <span class="token4">'fromusername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'fromUser'</span> <span class="token4">'createtime'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'123456789'</span> <span class="token4">'msgtype'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'event'</span> <span class="token4">'latitude'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token6">// string: 地理位置纬度</span> <span class="token4">'longitude'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token6">// string: 地理位置经度</span> <span class="token4">'precision'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token6">// string: 地理位置精度 </span> <span class="token4">'location_x'</span> <span class="token">=</span><span class="token">></span> <span class="token">?</span> ⇔ location_x <span class="token6">// 原始值</span> <span class="token4">'location_y'</span> <span class="token">=</span><span class="token">></span> <span class="token">?</span> ⇔ location_y <span class="token6">// 原始值</span> <span class="token2">)</span> 扫码 $this<span class="token">-</span><span class="token">></span>message <span class="token">=</span> <span class="token1">array</span><span class="token2">(</span> <span class="token4">'tousername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'toUser'</span> <span class="token4">'fromusername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'fromUser'</span> <span class="token4">'createtime'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'123456789'</span> <span class="token4">'msgtype'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'event'</span> <span class="token4">'eventkey'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token6">// 事件KEY值,由开发者在创建菜单时设定</span> <span class="token4">'scancodeinfo'</span> <span class="token">=</span><span class="token">></span> <span class="token1">array</span><span class="token2">(</span> <span class="token6">// 扫描信息</span> <span class="token4">'scanresult'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'1'</span> <span class="token6">// 扫描结果,即二维码对应的字符串信息</span> <span class="token4">'scantype'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'qrcode'</span> <span class="token6">// 扫描类型,一般是qrcode</span> <span class="token4">'eventkey'</span> <span class="token">=</span><span class="token">></span> <span class="token2">)</span> <span class="token2">)</span> 发图像相册拍照 $view_message <span class="token">=</span> <span class="token1">array</span><span class="token2">(</span> <span class="token4">'tousername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'toUser'</span> <span class="token4">'fromusername'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'fromUser'</span> <span class="token4">'createtime'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'123456789'</span> <span class="token4">'msgtype'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'event'</span> <span class="token4">'eventkey'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token6">// 事件KEY值,由开发者在创建菜单时设定</span> <span class="token4">'sendpicsinfo'</span> <span class="token">=</span><span class="token">></span> <span class="token1">array</span><span class="token2">(</span> <span class="token6">// 发送的图片信息</span> <span class="token4">'count'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'1'</span> <span class="token6">// 发送的图片数量</span> <span class="token4">'piclist'</span> <span class="token">=</span><span class="token">></span> <span class="token1">array</span><span class="token2">(</span> <span class="token6">// 图片列表</span> <span class="token4">'0'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token6">// 图片的MD5值,开发者若需要,可用于验证接收到图片</span> <span class="token2">)</span> <span class="token2">)</span> <span class="token2">)</span> 配置获取 $this<span class="token">-</span><span class="token">></span>module<span class="token2">[</span><span class="token4">'config'</span><span class="token2">]</span> $this<span class="token">-</span><span class="token">></span><span class="token1">respText</span><span class="token2">(</span>$text<span class="token2">)</span><span class="token2">;</span> $news<span class="token2">[</span><span class="token2">]</span> <span class="token">=</span> <span class="token2">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token2">,</span> <span class="token4">'description'</span> <span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token2">,</span> <span class="token4">'picurl'</span> <span class="token">=</span><span class="token">></span><span class="token1">tomedia</span><span class="token2">(</span><span class="token2">)</span><span class="token2">,</span> <span class="token4">'url'</span> <span class="token">=</span><span class="token">></span>$this<span class="token">-</span><span class="token">></span><span class="token1">createMobileUrl</span><span class="token2">(</span><span class="token4">'introduce'</span><span class="token2">,</span> <span class="token1">array</span><span class="token2">(</span><span class="token4">'id'</span> <span class="token">=</span><span class="token">></span> $rid<span class="token2">)</span><span class="token2">)</span> <span class="token2">]</span> <span class="token2">}</span> $this<span class="token">-</span><span class="token">></span><span class="token1">respNews</span><span class="token2">(</span>$news<span class="token2">)</span><span class="token2">;</span> $arr <span class="token">=</span><span class="token2">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> $title<span class="token2">,</span> <span class="token4">'description'</span> <span class="token">=</span><span class="token">></span> $desc<span class="token2">,</span> <span class="token4">'musicurl'</span> <span class="token">=</span><span class="token">></span> $url1<span class="token2">,</span> <span class="token4">'hqmusicurl'</span> <span class="token">=</span><span class="token">></span> $url1<span class="token2">,</span> <span class="token4">'thumb'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token2">,</span> <span class="token2">]</span><span class="token2">;</span> $this<span class="token">-</span><span class="token">></span><span class="token1">respMusic</span><span class="token2">(</span>$arr<span class="token2">)</span><span class="token2">;</span> $this<span class="token">-</span><span class="token">></span><span class="token1">respImage</span><span class="token2">(</span>$mid<span class="token2">)</span> ``` ``` 信息 ``` <pre class="calibre16">``` <span class="token2">[</span>message<span class="token2">]</span> <span class="token">=</span><span class="token">></span> stdClass Object <span class="token2">(</span> <span class="token2">[</span>tousername<span class="token2">]</span> <span class="token">=</span><span class="token">></span> gh_0c65a0b2e150 <span class="token2">[</span>fromusername<span class="token2">]</span> <span class="token">=</span><span class="token">></span> oY8ebt8ALfZ9Rk_yGXgyOA0KzWW8 <span class="token2">[</span>createtime<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">1463687403</span> <span class="token2">[</span>msgtype<span class="token2">]</span> <span class="token">=</span><span class="token">></span> location <span class="token2">[</span>location_x<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">33.143911</span> <span class="token2">[</span>location_y<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">106.704777</span> <span class="token2">[</span>scale<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">15</span> <span class="token2">[</span>label<span class="token2">]</span> <span class="token">=</span><span class="token">></span> 汉中市勉县勉阳镇九龙新城南<span class="token3">200</span>米<span class="token2">(</span>旧仓路东<span class="token2">)</span> <span class="token2">[</span>msgid<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">6286489527858875403</span> <span class="token2">[</span>from<span class="token2">]</span> <span class="token">=</span><span class="token">></span> oY8ebt8ALfZ9Rk_yGXgyOA0KzWW8 <span class="token2">[</span>to<span class="token2">]</span> <span class="token">=</span><span class="token">></span> gh_0c65a0b2e150 <span class="token2">[</span>time<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">1463687403</span> <span class="token2">[</span>type<span class="token2">]</span> <span class="token">=</span><span class="token">></span> location <span class="token2">[</span>event<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token2">)</span> <span class="token2">[</span>message<span class="token2">]</span> <span class="token">=</span><span class="token">></span> Array <span class="token2">(</span> <span class="token2">[</span>tousername<span class="token2">]</span> <span class="token">=</span><span class="token">></span> gh_0c65a0b2e150 <span class="token2">[</span>fromusername<span class="token2">]</span> <span class="token">=</span><span class="token">></span> oY8ebt8ALfZ9Rk_yGXgyOA0KzWW8 <span class="token2">[</span>createtime<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">1479141525</span> <span class="token2">[</span>msgtype<span class="token2">]</span> <span class="token">=</span><span class="token">></span> image <span class="token2">[</span>picurl<span class="token2">]</span> <span class="token">=</span><span class="token">></span> http<span class="token2">:</span><span class="token">/</span><span class="token">/</span>mmbiz<span class="token2">.</span>qpic<span class="token2">.</span>cn<span class="token">/</span>mmbiz_jpg<span class="token">/</span>WAibKjHvK5nGI3Uibv58s94j6xsDpVMDcUNmGuN6TSpoGmRtzm7jEaVk262Lebw3mhTyEibjQrPibEHhDiakpRrb9bQ<span class="token">/</span><span class="token3">0</span> <span class="token2">[</span>msgid<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">6352864476440140193</span> <span class="token2">[</span>mediaid<span class="token2">]</span> <span class="token">=</span><span class="token">></span> LHBxI5GA10TnUqueuBpfc8Df4fsOboSZshdDQj9FNAfdD4mif<span class="token">-</span>vtHYVPLGfjqWTh <span class="token2">[</span>from<span class="token2">]</span> <span class="token">=</span><span class="token">></span> oY8ebt8ALfZ9Rk_yGXgyOA0KzWW8 <span class="token2">[</span>to<span class="token2">]</span> <span class="token">=</span><span class="token">></span> gh_0c65a0b2e150 <span class="token2">[</span>time<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">1479141525</span> <span class="token2">[</span>type<span class="token2">]</span> <span class="token">=</span><span class="token">></span> text <span class="token2">[</span>event<span class="token2">]</span> <span class="token">=</span><span class="token">></span> pic_weixin <span class="token2">[</span>url<span class="token2">]</span> <span class="token">=</span><span class="token">></span> http<span class="token2">:</span><span class="token">/</span><span class="token">/</span>mmbiz<span class="token2">.</span>qpic<span class="token2">.</span>cn<span class="token">/</span>mmbiz_jpg<span class="token">/</span>WAibKjHvK5nGI3Uibv58s94j6xsDpVMDcUNmGuN6TSpoGmRtzm7jEaVk262Lebw3mhTyEibjQrPibEHhDiakpRrb9bQ<span class="token">/</span><span class="token3">0</span> <span class="token2">[</span>content<span class="token2">]</span> <span class="token">=</span><span class="token">></span> 创建新相册 <span class="token2">[</span>eventkey<span class="token2">]</span> <span class="token">=</span><span class="token">></span> 创建新相册 <span class="token2">[</span>redirection<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">1</span> <span class="token2">[</span>source<span class="token2">]</span> <span class="token">=</span><span class="token">></span> pic_weixin <span class="token2">)</span> <span class="token2">[</span>message<span class="token2">]</span> <span class="token">=</span><span class="token">></span> Array <span class="token2">(</span> <span class="token2">[</span>tousername<span class="token2">]</span> <span class="token">=</span><span class="token">></span> gh_0c65a0b2e150 <span class="token2">[</span>fromusername<span class="token2">]</span> <span class="token">=</span><span class="token">></span> oY8ebt8ALfZ9Rk_yGXgyOA0KzWW8 <span class="token2">[</span>createtime<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">1479141764</span> <span class="token2">[</span>msgtype<span class="token2">]</span> <span class="token">=</span><span class="token">></span> image <span class="token2">[</span>picurl<span class="token2">]</span> <span class="token">=</span><span class="token">></span> http<span class="token2">:</span><span class="token">/</span><span class="token">/</span>mmbiz<span class="token2">.</span>qpic<span class="token2">.</span>cn<span class="token">/</span>mmbiz_jpg<span class="token">/</span>WAibKjHvK5nGI3Uibv58s94j6xsDpVMDcUNmGuN6TSpoGmRtzm7jEaVk262Lebw3mhTyEibjQrPibEHhDiakpRrb9bQ<span class="token">/</span><span class="token3">0</span> <span class="token2">[</span>msgid<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">6352865502937323979</span> <span class="token2">[</span>mediaid<span class="token2">]</span> <span class="token">=</span><span class="token">></span> hsvoscAavkRQ3OM_fUHZt3<span class="token">-</span><span class="token3">37</span>vCjekY1BKr_MP7yB3Z9DO4fyfp65Z8TREgOPMOe <span class="token2">[</span>from<span class="token2">]</span> <span class="token">=</span><span class="token">></span> oY8ebt8ALfZ9Rk_yGXgyOA0KzWW8 <span class="token2">[</span>to<span class="token2">]</span> <span class="token">=</span><span class="token">></span> gh_0c65a0b2e150 <span class="token2">[</span>time<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">1479141764</span> <span class="token2">[</span>type<span class="token2">]</span> <span class="token">=</span><span class="token">></span> text <span class="token2">[</span>event<span class="token2">]</span> <span class="token">=</span><span class="token">></span> pic_photo_or_album <span class="token2">[</span>url<span class="token2">]</span> <span class="token">=</span><span class="token">></span> http<span class="token2">:</span><span class="token">/</span><span class="token">/</span>mmbiz<span class="token2">.</span>qpic<span class="token2">.</span>cn<span class="token">/</span>mmbiz_jpg<span class="token">/</span>WAibKjHvK5nGI3Uibv58s94j6xsDpVMDcUNmGuN6TSpoGmRtzm7jEaVk262Lebw3mhTyEibjQrPibEHhDiakpRrb9bQ<span class="token">/</span><span class="token3">0</span> <span class="token2">[</span>content<span class="token2">]</span> <span class="token">=</span><span class="token">></span> 添加照片 <span class="token2">[</span>eventkey<span class="token2">]</span> <span class="token">=</span><span class="token">></span> 添加照片 <span class="token2">[</span>redirection<span class="token2">]</span> <span class="token">=</span><span class="token">></span> <span class="token3">1</span> <span class="token2">[</span>source<span class="token2">]</span> <span class="token">=</span><span class="token">></span> pic_photo_or_album <span class="token2">)</span> ``` ```