[转]微擎应用笔记3--manifest.xml文件使用说明

本文转自:https://blog.csdn.net/seven_north/article/details/79508121

微擎在安装或卸载模块时会根据manifest.xml生成(或删除)数据库中相应记录,并执行manifest.xml里指定的脚本。

manifest.xml文件内容详细介绍如下:

manifest - xmlns (新增)

用来为此模块XML的命令空间,此处必须填写”http://www.we7.cc“.

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 - author

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

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>
版权声明:转载请注明出处~ https://blog.csdn.net/seven_north/article/details/79508121
原文地址:https://www.cnblogs.com/freeliver54/p/9406818.html