1. 程式人生 > >微擎應用筆記3--manifest.xml檔案使用說明

微擎應用筆記3--manifest.xml檔案使用說明

微擎在安裝或解除安裝模組時會根據manifest.xml生成(或刪除)資料庫中相應記錄,並執行manifest.xml裡指定的指令碼。

manifest.xml檔案內容詳細介紹如下:

manifest - xmlns (新增)

manifest - versionCode

用來說明當前模組適用於哪個版本的微擎, 用來保證模組的相容性. 多個支援的版本請使用逗號隔開.

<manifest xmlns="http://www.zhiyuanweixin.com" versionCode="1.0">

manifest - application

用來定義模組的基本設定屬性

manifest - application - setting

用來說明此模組是否有針對模組的設定項, 設定項可以儲存此模組需要的配置引數(此引數針對不同的公眾號分別儲存)

manifest - application - name

模組的名稱

manifest - application - identifie

模組識別符號, 應對應模組資料夾的名稱, 微擎系統按照此識別符號查詢模組定義

manifest - application - version

模組當前版本, 此版本用於模組的版本更新

manifest - application - type (新增)

模組的型別,方便在左側選單中歸類與顯示, 目前分為 business(主要業務),customer(客戶關係),activity(營銷及活動),services(常用服務及工具),other(其他)

manifest - application - ability

模組功能描述, 使用簡單的語言描述模組的作用, 來吸引使用者

manifest - application - description

模組詳細描述, 詳細介紹模組的功能和使用方法

模組的作者, 留下你的大名吧

manifest - application - url

模組的釋出頁, 可以通過這個url來訪問你的模組最新情況

<application setting="false">
    <name><![CDATA[人人商城V2]]></name>
    <identifie><![CDATA[ewei_shopv2]]></identifie>
    <version><![CDATA[3.0.7]]></version>
    <type><![CDATA[business]]></type>
    <ability><![CDATA[人人商城(分銷),多使用者分權,淘寶商品一鍵轉換,多種外掛支援。]]></ability>
    <description><![CDATA[人人商城(分銷),多項資訊模板,強大的自定義規格設定]]></description>
    <author><![CDATA[xxx社群]]></author>
    <url><![CDATA[https://www.xxxxx.com]]></url>
</application>

manifest - platform

用來定義模組用以處理公眾平臺訊息的設定項

manifest - platform - subscribes

訊息訂閱器定義(訊息訂閱器提供了一種處理公眾平臺訊息的方式, 可以接受到指定型別的訊息, 來進行分析和統計, 不能用以處理訊息返回結果. 這種處理是並行的, 同一個訊息會被每一個訂閱它的模組接收到)

manifest - platform - subscribes - message

定義需要被訂閱器訂閱的訊息型別, 這裡的訊息被 WeModuleReceiver 處理

manifest - platform - handles

訊息處理器定義(訊息處理器用於接收公眾平臺的訊息, 並返回相應的處理結果. 這種處理是互斥的, 同一個訊息只能從一個模組返回處理結果)

manifest - platform - handles - message

定義需要被處理器處理的訊息型別, 這裡的訊息被 WeModuleProcessor 處理

manifest - platform - rule (變更)

定義此模組是否需要規則觸發

manifest - platform - rule - embed

當前模組進行訊息處理時需要定義規則, 是否使用規則路由. (使用規則路由必須要能處理text型別訊息, handles節點中必須包含 )

<platform>
        <subscribes>
            <message type="text" />
            <message type="image" />
            <message type="voice" />
            <message type="video" />
            <message type="shortvideo" />
            <message type="location" />
            <message type="link" />
            <message type="subscribe" />
            <message type="unsubscribe" />
            <message type="qr" />
            <message type="trace" />
            <message type="click" />
            <message type="view" />
            <message type="merchant_order" />
        </subscribes>
        <handles>
            <message type="text" />
            <message type="image" />
            <message type="voice" />
            <message type="video" />
            <message type="shortvideo" />
            <message type="location" />
            <message type="link" />
            <message type="subscribe" />
            <message type="qr" />
            <message type="trace" />
            <message type="click" />
            <message type="merchant_order" />
        </handles>
        <rule embed="false" />
        <card embed="false" />
    </platform>

manifest - bindings (新增)

定義此模組的封面,管理選單,微站選單及規則擴充套件選單

manifest - bindings - cover

定義模組的封面入口,封面入口為單條圖文資訊即是模組需要對使用者開放的入口地址.

manifest - bindings - cover - call

定義模組動態擴充套件選單項, 此值對應 WeModuleSite 類中的方法, 返回的值結構與entry相同, 將成為此節點的選單項.

manifest - bindings - cover - entry

模組繫結選單的定義結構. 需要定義 title - 操作的名稱, do - 模組操作入口, state - 附加的使用者引數(定義於WeModuleSite)

manifest - bindings - rule

定義規則的附加操作, 每個entry代表一個附加操作.

manifest - bindings - menu

定義模組在左側本模組選單下拉列表中的附加選單操作, 每一個entry代表一個選單操作.

manifest - bindings - home

定義模組在微站首頁的擴充套件選單項, 每一個entry代表一個微站首頁選單項.

manifest - bindings - profile

定義模組在微站個人中心的擴充套件選單項, 每一個entry代表一個微站個人中心選單項.

manifest - bindings - shortcut

定義模組在微站快捷選單的擴充套件選單項, 每一個entry代表一個微站快捷選單項.

<bindings>
        <cover>
            <entry title="商城入口" do="mobile" state="" direct="false" />
        </cover>
        <menu call="getMenus">
        </menu>
</bindings>

<bindings>
        <cover>
            <entry title="註冊" do="register" />
            <entry title="會員中心" do="center" />
            <entry title="應聘" do="job" />
        </cover>
        <menu>
            <entry title="公司" do="company" />
            <entry title="員工" do="staff" />
            <entry title="招聘" do="post" />
            <entry title="工資" do="wages" />
            <entry title="崗位" do="job" />
        </menu>
        <home>
        </home>
    </bindings>

manifest - install

安裝執行指令碼, 這裡支援兩種形式: php指令碼和sql語句. 如果安裝時只需要寫入資料庫相關內容, 可以在此直接定義sql語句. 也可以使用php檔案, 例如: install.php 代表執行模組定義目錄下的 install.php

manifest - uninstall

解除安裝執行指令碼, 參上

manifest - upgrade

升級執行指令碼, 參上

<permissions>
</permissions>
<install><![CDATA[install.php]]></install>
<uninstall><![CDATA[]]></uninstall>
<upgrade><![CDATA[upgrade.php]]></upgrade>