<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns="http://www.we7.cc" versionCode="0.51,0.52">
	<application setting="false">
		<name><![CDATA[优惠券]]></name>
		<identifie><![CDATA[izc_strcoupon]]></identifie>
		<version><![CDATA[1.3]]></version>
		<type><![CDATA[customer]]></type>
		<ability><![CDATA[各种券]]></ability>
		<description><![CDATA[各种券]]></description>
		<author><![CDATA[智策&strai]]></author>
		<url><![CDATA[]]></url>
	</application>
	<platform>
		<subscribes>
		</subscribes>
		<handles>
			<message type="text" />
		</handles>
	</platform>
	<bindings>
		<cover>
			<entry title="入口设置" do="index" state="" direct="false" />
		</cover>
		<menu>
			<entry title="优惠券管理" do="manage" state="" direct="false" />
			<entry title="领取记录" do="receive" state="" direct="false" />
			<entry title="使用记录" do="record" state="" direct="false" />
		</menu>
		<profile>
			<entry title="我的优惠券" do="myCoupon" state="" direct="false" />
		</profile>
	</bindings>
	<install><![CDATA[
	CREATE TABLE IF NOT EXISTS `ims_strcoupon`(
		`id` int(10) unsigned AUTO_INCREMENT,
		`weid` int(10) unsigned NOT NULL DEFAULT 0,
		`title` varchar(256) NOT NULL DEFAULT '' COMMENT '图文标题',
		`displayorder` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '排序',
		`module_name` varchar(50) NOT NULL DEFAULT '' COMMENT '模块标识',
		`logo` varchar(200) NOT NULL DEFAULT '' COMMENT '图文封面',
		`name` varchar(100) NOT NULL DEFAULT '' COMMENT '优惠券名',
		`type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '优惠券类型',
		`description` varchar(2000) NOT NULL DEFAULT '' COMMENT '图文描述',
		`cp_dst` varchar(2000) NOT NULL DEFAULT ''  COMMENT '优惠券说明',
		`start_time` int(10) unsigned NOT NULL DEFAULT 0  COMMENT '有效期',
		`end_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '有效期',
		`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '创建时间',
		`status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '状态',
		`total_num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '总数',
		`day_sum` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '每天发送数',
		`surplus_num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '剩余数',
		`day_surplus_num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '每天剩余数',
		`user_sum` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '每人领取总数',
		`user_day_sum` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '每人每天领取数',
		`money` decimal(10,2) NOT NULL DEFAULT 0 COMMENT '面额',
		`discount_money` decimal(10,2) NOT NULL DEFAULT 0 COMMENT '抵用金额',
		`total_money` decimal(10,2) NOT NULL DEFAULT 0 COMMENT '满金额',
		PRIMARY KEY (`id`)
	)ENGINE=MyISAM  DEFAULT CHARSET=utf8;
	CREATE TABLE IF NOT EXISTS `ims_strcoupon_fans`(
		`id` int(10) unsigned AUTO_INCREMENT,
		`weid` int(10) unsigned NOT NULL DEFAULT 0,
		`day_sum` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '每天领取数',
		`user_day_sum` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '每人每天领取数',
		`surplus_num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '剩余领取数',
		`day_surplus_num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '当天剩余领取数',
		`total_sum` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '每人总数',
		`coupon_name` varchar(100) NOT NULL DEFAULT '' COMMENT '优惠券名',
		`coupon_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '优惠券id',
		`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '创建时间',
		`last_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '最后领取时间',
		`use_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '使用时间',
		`status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '状态,0,失效,1,可使用,2,使用中',
		`start_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '有效期',
		`end_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '有效期',
		`from_user` varchar(50) NOT NULL DEFAULT '' COMMENT 'openid',
		`cp_dst` varchar(2000) NOT NULL DEFAULT '' COMMENT '优惠券说明',
		`money` decimal(10,2) NOT NULL DEFAULT 0 COMMENT '面额',
		`num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '已有数量',
		`used_num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '已使用数量',
		`inuse_num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '在使用数量',
		`fansid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '粉丝id',
		`title` varchar(100) NOT NULL DEFAULT '' COMMENT '图文标题',
		`content` varchar(1024) NOT NULL DEFAULT '' COMMENT '图文内容',
		`discount_money` decimal(10,2) NOT NULL DEFAULT 0 COMMENT '抵用金额',
		`total_money` decimal(10,2) NOT NULL DEFAULT 0 COMMENT '满金额',
		`credit1` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '积分',
		`credit2` decimal(10,2) NOT NULL DEFAULT 0 COMMENT '现金',
		`isused` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否使用',
		`coupon_module` varchar(100) NOT NULL DEFAULT '' COMMENT '模块标识',
		`coupon_type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '优惠券类型',
		PRIMARY KEY (`id`)
 	)ENGINE=MyISAM DEFAULT CHARSET=utf8;
	CREATE TABLE IF NOT EXISTS `ims_strcoupon_fans_log`(
		`id` int(10) AUTO_INCREMENT,
		`weid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '公众号id',
		`from_user` varchar(50) NOT NULL DEFAULT '' COMMENT 'openid',
		`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '创建时间',
		`use_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '使用时间',
		`SN` varchar(100) NOT NULL DEFAULT '' COMMENT 'SN码',
		`discount_money` decimal(10,2) COMMENT '抵用金额',
		`coupon_fans_id` int(10) unsigned  NOT NULL DEFAULT 0 COMMENT 'fans优惠券id',
		`order_id` int(10) unsigned NOT NULL DEFAULT 0  COMMENT '订单id',
		`order_sn` varchar(30) NOT NULL DEFAULT '' COMMENT '订单号',
		`module_name` varchar(100) NOT NULL DEFAULT '' COMMENT '模块名称',
		`coupon_name` varchar(100) NOT NULL DEFAULT '' COMMENT '优惠券名称',
		`isused` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0使用中1使用成功2使用失败',
 		PRIMARY KEY (`id`)
	)ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- `ims_coupon_shop`店铺表
--
	CREATE TABLE IF NOT EXISTS `ims_strcoupon_shop`(
		`id` int(10) AUTO_INCREMENT,
		`weid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '公众号id',
		`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '创建时间',
		`displayorder` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '排序',
		`shop_name` varchar(100) NOT NULL DEFAULT '' COMMENT '店铺名称',
		`address` varchar(200) NOT NULL DEFAULT '' COMMENT '地址',
		`tel` varchar(20) NOT NULL DEFAULT '' COMMENT '电话',
		`mobile` varchar(20) NOT NULL DEFAULT '' COMMENT '手机',
		`shop_imgs` varchar(2048) NOT NULL DEFAULT '' COMMENT '店铺实景',
		`description` text NOT NULL DEFAULT '' COMMENT '介绍',
		`module_name` varchar(100) NOT NULL DEFAULT '' COMMENT '模块标识',
		`order_id` int(10) NOT NULL DEFAULT 0 COMMENT '订单id',
		PRIMARY KEY (`id`)
 	)ENGINE=MyISAM DEFAULT CHARSET=utf8;
	]]></install>
	<uninstall><![CDATA[
	DROP TABLE IF EXISTS `ims_strcoupon_fans`;
	DROP TABLE IF EXISTS `ims_strcoupon`;
	DROP TABLE IF EXISTS `ims_strcoupon_fans_log`;
	DROP TABLE IF EXISTS `ims_strcoupon_shop`;
	]]></uninstall>
	<upgrade><![CDATA[]]></upgrade>
</manifest>