/*
Navicat MySQL Data Transfer

Source Server         : 本地开发
Source Server Version : 50731
Source Host           : localhost:3306
Source Database       : wechat

Target Server Type    : MYSQL
Target Server Version : 50731
File Encoding         : 65001

Date: 2020-12-18 10:30:14
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for ai_smartbc_adwords
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_adwords`;
CREATE TABLE `ai_smartbc_adwords` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `member_miniapp_id` int(11) DEFAULT '0',
  `open_type` varchar(50) DEFAULT NULL,
  `group` varchar(100) DEFAULT NULL,
  `title` varchar(50) DEFAULT NULL,
  `link` varchar(200) DEFAULT NULL,
  `picture` varchar(255) DEFAULT NULL,
  `sort` int(11) DEFAULT '0',
  `update_time` int(11) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for ai_smartbc_bill
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_bill`;
CREATE TABLE `ai_smartbc_bill` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `member_miniapp_id` int(11) DEFAULT NULL,
  `store_id` int(11) DEFAULT '0',
  `uid` bigint(20) DEFAULT '0',
  `money` decimal(10,2) DEFAULT '0.00',
  `message` tinytext,
  `update_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `id` (`id`) USING BTREE,
  KEY `id_2` (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='个人财务记录';

-- ----------------------------
-- Table structure for ai_smartbc_config
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_config`;
CREATE TABLE `ai_smartbc_config` (
  `member_miniapp_id` int(11) NOT NULL,
  `service_telephone` varchar(100) DEFAULT NULL,
  `end_time` tinyint(4) DEFAULT '0',
  `is_pay_open_coupon` tinyint(2) DEFAULT NULL,
  `group_join` int(11) DEFAULT NULL,
  `group_member` int(11) DEFAULT NULL,
  `profit` decimal(10,0) DEFAULT NULL,
  `tplmsg_order` varchar(100) DEFAULT NULL COMMENT '支付成功通知',
  `tplmsg_point` varchar(100) DEFAULT NULL COMMENT '积分兑换通知',
  `sla` text,
  `article` text,
  PRIMARY KEY (`member_miniapp_id`),
  UNIQUE KEY `APPID` (`member_miniapp_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for ai_smartbc_coupon
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_coupon`;
CREATE TABLE `ai_smartbc_coupon` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `member_miniapp_id` int(11) DEFAULT NULL,
  `store_id` int(11) DEFAULT NULL,
  `is_top` tinyint(1) DEFAULT NULL,
  `is_lock` tinyint(1) DEFAULT '0',
  `is_super` tinyint(1) DEFAULT '0',
  `is_end` tinyint(1) DEFAULT '0' COMMENT '是否过期失效或删除',
  `types` tinyint(1) DEFAULT '0' COMMENT '0满减/抵扣1满折/折扣/2储值券',
  `price` int(11) DEFAULT '0' COMMENT '满减代金券',
  `discount` float(2,1) DEFAULT '0.0' COMMENT '折扣力度',
  `amount` decimal(10,2) DEFAULT NULL,
  `howmuch` int(10) DEFAULT '0' COMMENT '满多少用',
  `name` varchar(255) DEFAULT NULL,
  `tips` varchar(255) DEFAULT NULL,
  `sort` int(11) DEFAULT '0',
  `update_time` int(11) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL COMMENT '0',
  PRIMARY KEY (`id`),
  KEY `APPID` (`member_miniapp_id`) USING BTREE,
  KEY `STOREID` (`store_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for ai_smartbc_coupon_user
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_coupon_user`;
CREATE TABLE `ai_smartbc_coupon_user` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `member_miniapp_id` int(11) DEFAULT NULL,
  `store_id` int(11) DEFAULT NULL,
  `coupon_id` int(11) DEFAULT NULL,
  `parent_store_id` int(11) DEFAULT '0',
  `uid` bigint(20) DEFAULT NULL,
  `is_end` tinyint(1) DEFAULT '0',
  `types` tinyint(4) DEFAULT '0' COMMENT '0满减1打折卷',
  `name` varchar(255) DEFAULT NULL,
  `price` int(11) DEFAULT NULL COMMENT '分',
  `amount` decimal(10,2) DEFAULT NULL,
  `discount` float(2,1) DEFAULT NULL,
  `howmuch` int(10) DEFAULT NULL COMMENT '元',
  `tips` varchar(255) DEFAULT NULL,
  `money` decimal(10,2) DEFAULT '0.00',
  `group_ids` varchar(11) DEFAULT '0',
  `update_time` int(11) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `APPID` (`member_miniapp_id`) USING BTREE,
  KEY `STOREID` (`store_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户的赠品';

-- ----------------------------
-- Table structure for ai_smartbc_order
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_order`;
CREATE TABLE `ai_smartbc_order` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `member_miniapp_id` int(11) DEFAULT NULL,
  `store_id` int(11) DEFAULT '0' COMMENT '总店',
  `store_chain_id` int(11) DEFAULT '0' COMMENT '分店',
  `uid` bigint(20) DEFAULT NULL,
  `coupon_user_id` int(11) DEFAULT NULL,
  `parent_store_id` int(11) DEFAULT '0',
  `parent_store_price` decimal(10,2) DEFAULT '0.00',
  `amount` decimal(10,2) DEFAULT NULL COMMENT '应付金额',
  `price` decimal(10,2) DEFAULT NULL COMMENT '实付金额',
  `state` tinyint(2) DEFAULT '0',
  `order_no` varchar(255) DEFAULT NULL,
  `paid_time` int(11) DEFAULT NULL,
  `paid_no` varchar(255) DEFAULT NULL,
  `coupon_cache` text,
  `update_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for ai_smartbc_queen
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_queen`;
CREATE TABLE `ai_smartbc_queen` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `member_miniapp_id` int(11) DEFAULT NULL,
  `types` tinyint(1) DEFAULT '0' COMMENT '0:open|1:mchid',
  `store_id` bigint(20) DEFAULT NULL,
  `uid` bigint(20) DEFAULT NULL,
  `mch_id` bigint(20) DEFAULT NULL,
  `amount` int(11) DEFAULT NULL,
  `transaction_id` varchar(64) DEFAULT NULL,
  `out_order_no` varchar(64) DEFAULT NULL,
  `order_id` varchar(64) DEFAULT NULL,
  `is_finish` tinyint(1) DEFAULT NULL COMMENT '0排队1失败2成',
  `msg` varchar(255) DEFAULT NULL,
  `sms` varchar(255) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='任务队列';

-- ----------------------------
-- Table structure for ai_smartbc_store
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_store`;
CREATE TABLE `ai_smartbc_store` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `member_miniapp_id` int(11) DEFAULT NULL,
  `manage_uid` int(11) DEFAULT '0',
  `mch_id` int(11) DEFAULT NULL,
  `cate_id` int(11) DEFAULT NULL,
  `cate_sid` int(11) DEFAULT NULL,
  `cate_name` varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `img` varchar(255) DEFAULT NULL,
  `imgs` text,
  `address` varchar(255) DEFAULT NULL,
  `telphone` varchar(255) DEFAULT NULL,
  `longitude` decimal(10,7) DEFAULT NULL COMMENT '地图坐标',
  `latitude` decimal(10,7) DEFAULT NULL,
  `sort` int(11) DEFAULT '0',
  `is_top` tinyint(1) DEFAULT '0',
  `is_lock` tinyint(1) DEFAULT '0',
  `is_pass` tinyint(1) DEFAULT '0',
  `create_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `APPID` (`member_miniapp_id`) USING BTREE,
  KEY `CID` (`cate_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for ai_smartbc_store_bill
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_store_bill`;
CREATE TABLE `ai_smartbc_store_bill` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `member_miniapp_id` int(11) DEFAULT NULL,
  `store_id` int(11) DEFAULT '0',
  `store_chain_id` int(11) DEFAULT '0',
  `pay_uid` bigint(20) DEFAULT '0',
  `money` decimal(10,2) DEFAULT '0.00',
  `message` tinytext,
  `update_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ID` (`id`) USING BTREE,
  KEY `STORE_ID` (`store_id`) USING BTREE,
  KEY `UID` (`pay_uid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='好店账单';

-- ----------------------------
-- Table structure for ai_smartbc_store_cate
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_store_cate`;
CREATE TABLE `ai_smartbc_store_cate` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `member_miniapp_id` int(11) DEFAULT NULL,
  `parent_id` int(11) DEFAULT '0',
  `root_id` int(11) DEFAULT NULL,
  `title` varchar(50) DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL,
  `picture` varchar(100) DEFAULT NULL,
  `sort` int(11) DEFAULT '0',
  `update_time` int(11) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ID` (`id`) USING BTREE,
  KEY `PARENT_ID` (`parent_id`,`root_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分类信息栏目';

-- ----------------------------
-- Table structure for ai_smartbc_store_chain
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_store_chain`;
CREATE TABLE `ai_smartbc_store_chain` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `member_miniapp_id` int(11) DEFAULT NULL,
  `store_id` int(11) DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `telphone` varchar(50) DEFAULT NULL,
  `longitude` varchar(20) DEFAULT NULL,
  `latitude` varchar(20) DEFAULT NULL,
  `sort` int(11) DEFAULT '0',
  `update_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='连锁门店';

-- ----------------------------
-- Table structure for ai_smartbc_store_group
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_store_group`;
CREATE TABLE `ai_smartbc_store_group` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `member_miniapp_id` int(11) DEFAULT NULL,
  `title` varchar(50) DEFAULT NULL,
  `content` varchar(255) DEFAULT NULL,
  `face` varchar(255) DEFAULT NULL,
  `uid` int(11) DEFAULT NULL,
  `create_time` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ID` (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商圈';

-- ----------------------------
-- Table structure for ai_smartbc_store_union
-- ----------------------------
DROP TABLE IF EXISTS `ai_smartbc_store_union`;
CREATE TABLE `ai_smartbc_store_union` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `member_miniapp_id` int(11) DEFAULT NULL,
  `store_id` int(11) DEFAULT NULL,
  `group_id` int(11) DEFAULT NULL,
  `type` tinyint(2) DEFAULT NULL COMMENT '0正常 1待审核 2拒绝 3退出 4 踢出',
  `create_time` int(11) DEFAULT NULL,
  `update_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商家和圈关联';
SET FOREIGN_KEY_CHECKS=1;
