<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                [TOC=1,4] ||***processor.php**應用于當此模塊設置過“[[dev:v0.6:module:module|回復規則列表]]”,用戶發送關鍵字后,觸發到模塊中向用戶回復信息的功能。 ||**processor.php** 具體定義如下: * we7_demo為模塊標識,類名的定義遵循“模塊標識ModuleProcessor”規則 * 此類必須繼承 WeModuleProcessor 類 ``` <?php /** * 官方示例模塊處理程序 * * @author 微擎團隊 * @url http://bbs.we7.cc/ */ defined('IN_IA') or exit('Access Denied'); class We7_demoModuleProcessor extends WeModuleProcessor { public function respond() { //$this->message變量包含了用戶信息和關鍵字信息 $content = $this->message['content']; //這里定義此模塊進行消息處理時的具體過程, 請查看微擎文檔來編寫你的代碼 //回復用戶一句話 return $this->respText('您觸發了we7_demo模塊'); } } ``` ####一些類屬性的介紹#### **1、$this->message** 粉絲發送的消息結構 ``` $this->message = array( 'from' => 'fromUser', //來源openid 'to' => 'toUser', //公眾號標識 'time' => '1448694116', 'type' => 'text', //消息類型 'event' => '', 'tousername' => 'toUser', //同from 'fromusername' => 'fromUser', //同to 'createtime' => '1448694116', 'msgtype' => 'text', 'content' => '官方示例', //關鍵字 'msgid' => '1234567890123456', 'redirection' => '', //是否有消息重定向,例如掃描二維碼后觸發某一個關鍵字,這樣的消息就屬于重定向消息 'source' => '', //重定向消息原消息類型 ); ``` **2、$this->module['config']** 設計模塊時勾選“模塊全局配置項”后,用戶配置的選項通過此變量獲取。 ####生成訪問site.php方法的鏈接 processor.php文件中,回復用戶圖文信息時,可以設置跳轉鏈接到site.php文件中的doMobileIndex()函數,可以使用$this->createMobileUrl('index');生成訪問URL 訪問doWebIndex()函數時,可以使用 $this->createWebUrl('index');來生成 ####構造回復消息的相關函數 * $this->respText(); 回復一段文本文字 ``` <?php defined('IN_IA') or exit('Access Denied'); class We7_demoModuleProcessor extends WeModuleProcessor { public function respond() { //回復用戶一句話 return $this->respText('您觸發了we7_demo模塊'); } } ``` * $this->respNews(array $news); 回復一個圖文消息 ``` <?php defined('IN_IA') or exit('Access Denied'); class We7_demoModuleProcessor extends WeModuleProcessor { public function respond() { //多圖文即傳入一個二維的下面的數組即可 return $this->respNews(array( 'Title' => '單圖文的標題', 'Description' => '單圖文的描述', 'PicUrl' => tomedia('封面圖片地址'), 'Url' => $this->createMobileUrl('introduce', array('id' => $rid)), //創建一個帶openid信息的訪問模塊introduce方法的地址,這里也可以直接寫http://we7.cc )); } } ``` * $this->respMusic(array $music); 回復一個音樂消息 ``` <?php defined('IN_IA') or exit('Access Denied'); class We7_demoModuleProcessor extends WeModuleProcessor { public function respond() { return $this->respMusic(array( 'Title' => '音樂回復標題', 'Description' => '音樂回復描述', 'MusicUrl' => tomedia('音樂鏈接'), 'HQMusicUrl' => '高清音樂鏈接,可不填', )); } } ``` * $this->respVideo(array $video); 回復一個視頻消息,視頻需要上傳到微信的素材中。見:[上傳素材](http://www.hmoore.net/donknap/we7/245194) ``` <?php defined('IN_IA') or exit('Access Denied'); class We7_demoModuleProcessor extends WeModuleProcessor { public function respond() { return $this->respVideo(array( 'MediaId' => '素材的Id', 'Title' => '視頻標題', 'Description' => '視頻的描述' )); } } ``` * $this->respVoice($mid); 回復一個語音消息,語音需要上傳到微信的素材中。見:[上傳素材](http://www.hmoore.net/donknap/we7/245194) ``` <?php defined('IN_IA') or exit('Access Denied'); class We7_demoModuleProcessor extends WeModuleProcessor { public function respond() { return $this->respVoice('素材id'); } } ``` * $this->respImage($mid) 回復一個圖片消息,圖片需要上傳到微信的素材中。見:[上傳素材](http://www.hmoore.net/donknap/we7/245194) ``` <?php defined('IN_IA') or exit('Access Denied'); class We7_demoModuleProcessor extends WeModuleProcessor { public function respond() { return $this->respImage('素材id'); } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看