## 數據字典
>[danger] 包含數據表設計,數據結構的一切,它是軟件程序的命脈。
### 筆記
```html
管理員 表 admin
商家 表 business
用戶 表 user
活動 表 activity
活動掃描記錄 表 active_scanning_record
二維碼生成批次 表 qrcode_generate
二維碼批次 表 qrcode
二維碼 表 qrcode_item
二維碼掃描記錄 表 qrcode_scanning_record
系統設置 表 (系統設置) system_settings
系統數據 表 (存放系統數據) system_data
充值記錄(訂單) 表 recharge_order
資金變動記錄(明細) 表 fund_change_record
紅包 表 money_in_red_envelop
提現 表 withdrawals
二維碼購買記錄(訂單) 表 qrcode_order
用戶分享記錄(點進來就記錄,增加一字段以表示是否轉發了) user_share_record
(用戶)掃描商家記錄 表 user_business_scanning_record (用戶掃描過的商家記錄)
微信支付的商戶訂單表(暫不確定)
```
* * * * *
### 表清單
| 序號 | 表名 | 表名稱 | 備注 |
| --- | --- | --- | --- | ---|
| 1 | admin | 管理員 表 | |
| 2 | business | 商家 表 | |
| 3 | user | 用戶 表 | |
| 4 | activity | 活動 表 | |
| 5 | active_scanning_record | 活動掃描記錄 表| |
| 6 | qrcode_generate |二維碼生成批次 表 | 主要是為了方便打印,打印一次兩萬張起,但是商家可能買幾百張 |
| 7 | qrcode |二維碼批次 表 | 這個不同于二維碼的生成批次,這個是分配給商家的批次,和二維碼訂單有關系 |
| 8 | qrcode_item | 二維碼 表 | |
| 9 | qrcode_scanning_record | 二維碼掃描記錄 表 | 點進來就記錄,增加一字段以表示是否轉發了 |
| 10 | system_settings | 系統設置 表 | 系統設置 |
| 11 | system_data | 系統數據 表 | 存放系統數據 |
| 12 | recharge_order | 充值記錄(訂單) 表 | |
| 13 | fund_change_record | 資金變動記錄(明細) 表 | |
| 14 | money_in_red_envelop | 紅包 表 | |
| 15 | withdrawals | 提現 表 | |
| 16 | qrcode_goods | 二維碼商品 表 | |
| 17 | qrcode_order | 二維碼購買記錄(訂單) 表 | |
| 18 |user_business_scanning_record |(用戶)掃描商家記錄 表 | 用戶掃描過的商家記錄|
**<span style="color:red;font-size:22px;">筆記和表清單未更新,不是最新的,請以數據字典為準!</span>**
**<span style="color:red;font-size:18px;">筆記和表清單未更新,不是最新的,請以數據字典為準!</span>**
**<span style="color:red;font-size:16px;">筆記和表清單未更新,不是最新的,請以數據字典為準!</span>**
* * * * *
### 數據字典
```sql
/*
Navicat MySQL Data Transfer
Source Server : 127.0.0.1_3306
Source Server Version : 50714
Source Host : 127.0.0.1:3306
Source Database : code
Target Server Type : MYSQL
Target Server Version : 50714
File Encoding : 65001
Date: 2017-7-14 13:09:41
*/
SET FOREIGN_KEY_CHECKS=0;
-- 系統設置 表 系統設置
-- system_data 系統數據 表 存放系統數據
-- ----------------------------
-- Table structure for `c_admin`
-- ----------------------------
DROP TABLE IF EXISTS `c_admin`;
CREATE TABLE `c_admin` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '管理員用戶ID',
`nickname` char(16) NOT NULL DEFAULT '' COMMENT '昵稱',
`avatar` varchar(500) NOT NULL DEFAULT '' COMMENT '頭像',
`password` char(40) NOT NULL DEFAULT '' COMMENT '用戶密碼',
`salt` char(32) NOT NULL DEFAULT '' COMMENT '用于保護用戶密碼安全的鹽值',
-- 這個用戶郵箱和手機是唯一的,但是有的人開始并沒有綁定郵箱或手機,所以也不能為空串,不然唯一沖突,所以只能允許為空null了,并且默認為null
`email` char(32) NULL DEFAULT NULL COMMENT '用戶郵箱(可用作登錄名)',
`mobile` char(15) NULL DEFAULT NULL COMMENT '用戶手機(可用作登錄名)',
`login` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '登錄次數',
`create_ip` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '注冊IP',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '注冊時間',
`last_login_ip` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '最后登錄IP',
`last_login_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '最后登錄時間',
`update_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '更新時間',
`status` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '狀態',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`) USING BTREE,
UNIQUE KEY `mobile` (`mobile`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='管理員 表';
-- ----------------------------
-- Records of c_admin
-- ----------------------------
-- ----------------------------
-- Table structure for `c_business`
-- ----------------------------
DROP TABLE IF EXISTS `c_business`;
CREATE TABLE `c_business` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '商家ID',
`name` char(16) NOT NULL DEFAULT '' COMMENT '商家名稱',
`logo` varchar(500) NOT NULL DEFAULT '' COMMENT '商家logo',
`contact_name` char(16) NOT NULL DEFAULT '' COMMENT '聯系人姓名',
`contact_mobile` char(16) NOT NULL DEFAULT '' COMMENT '聯系人手機',
`password` char(40) NOT NULL DEFAULT '' COMMENT '用戶密碼',
`salt` char(32) NOT NULL DEFAULT '' COMMENT '用于保護用戶密碼安全的鹽值',
-- 這個用戶郵箱和手機是唯一的,但是有的人開始并沒有綁定郵箱或手機,所以也不能為空串,不然唯一沖突,所以只能允許為空null了,并且默認為null
`email` char(32) NULL DEFAULT NULL COMMENT '用戶郵箱(可用作登錄名)',
`mobile` char(15) NULL DEFAULT NULL COMMENT '用戶手機(可用作登錄名)',
`balance` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '賬戶余額',
`consumption_amount` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '已消耗金額',
`login` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '登錄次數',
`create_ip` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '注冊IP',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '注冊時間',
`last_login_ip` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '最后登錄IP',
`last_login_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '最后登錄時間',
`update_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '更新時間',
`bind_se_user` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '商家可以綁定一個安全賬戶,用于活動獎勵發放,活動金額報警,密碼找回等通知和聯系方式(其實就是user用戶表的user_id)',
`status` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '狀態',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`) USING BTREE,
UNIQUE KEY `mobile` (`mobile`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='商家 表';
-- ----------------------------
-- Records of c_business
-- ----------------------------
-- ----------------------------
-- Table structure for `c_user`
-- ----------------------------
DROP TABLE IF EXISTS `c_user`;
CREATE TABLE `c_user` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '用戶ID',
`nickname` char(16) NOT NULL DEFAULT '' COMMENT '昵稱',
`avatar` varchar(500) NOT NULL DEFAULT '' COMMENT '頭像',
`openid` varchar(250) NULL DEFAULT NULL COMMENT 'openid',
`password` char(40) NOT NULL DEFAULT '' COMMENT '用戶密碼',
`salt` char(32) NOT NULL DEFAULT '' COMMENT '用于保護用戶密碼安全的鹽值',
-- 這個用戶郵箱和手機是唯一的,但是有的人開始并沒有綁定郵箱或手機,所以也不能為空串,不然唯一沖突,所以只能允許為空null了,并且默認為null
`email` char(32) NULL DEFAULT NULL COMMENT '用戶郵箱(可用作登錄名)',
`mobile` char(15) NULL DEFAULT NULL COMMENT '用戶手機(可用作登錄名)',
`receive_amount` decimal(10,2) DEFAULT 0.00 COMMENT '已領取金額',
`login` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '登錄次數',
`create_ip` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '注冊IP',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '注冊時間',
`last_login_ip` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '最后登錄IP',
`last_login_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '最后登錄時間',
`update_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '更新時間',
`subscribe` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '是否關注了',
`recently_qrcode_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '最近掃描的二維碼,用于模擬代替“場景二維碼”的',
`status` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '狀態',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`) USING BTREE,
UNIQUE KEY `mobile` (`mobile`) USING BTREE,
UNIQUE KEY `openid` (`openid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='用戶 表';
-- ----------------------------
-- Records of c_user
-- ----------------------------
-- ----------------------------
-- Table structure for `c_activity`
-- ----------------------------
DROP TABLE IF EXISTS `c_activity`;
CREATE TABLE `c_activity` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`business_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬商家ID',
`name` varchar(250) NOT NULL DEFAULT '' COMMENT '活動名稱',
`img` varchar(250) NOT NULL DEFAULT '' COMMENT '活動圖片',
`share_data` longtext NULL COMMENT '活動分享數據,json(標題,微縮圖,url)',
`activity_data` longtext NULL COMMENT '活動詳情數據,json',
`is_restrict` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '是否 限制活動,0-不限制,1-限制,不限制時那么其他限制的條件設置全部不起作用了',
`is_restrict_day_amount` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '是否 限制活動每天最多發放紅包金額多少元',
`is_restrict_day_num` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '是否 限制活動每天最多發放紅包總數多少個',
`is_restrict_day_user_to_num` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '是否 限制每個用戶每天最多可以參與該活動多少次',
`is_restrict_user_to_num` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '是否 限制每個用戶總共最多可以參與該活動多少次',
`restrict_day_amount` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '限制活動每天最多發放紅包金額多少元',
`restrict_day_num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '限制活動每天最多發放紅包總數多少個',
`restrict_day_user_to_num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '限制每個用戶每天最多可以參與該活動多少次',
`restrict_user_to_num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '限制每個用戶總共最多可以參與該活動多少次',
`amount_invested` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '活動的投放金額',
`amount_consume` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '活動的消耗金額',
`bonus_a` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '紅包獎勵邊界',
`bonus_b` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '紅包獎勵邊界',
`click_num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '點擊次數',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '創建時間',
`update_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '更新時間',
`status` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '狀態,0-暫停,1-正常(上線)',
PRIMARY KEY (`id`),
KEY `business_id` (`business_id`) USING BTREE,
KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='活動 表';
-- ----------------------------
-- Records of c_activity
-- ----------------------------
-- ----------------------------
-- Table structure for `c_activity_day_state`
-- ----------------------------
DROP TABLE IF EXISTS `c_activity_day_state`;
CREATE TABLE `c_activity_day_state` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`business_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '商家ID(加這個字段為了做數據報表時好做統計)',
`activity_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬活動ID',
`click_num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '點擊次數,這樣可以統計點擊次數',
`day` varchar(10) NOT NULL DEFAULT '' COMMENT 'day',
`num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '當日當前的參與次數',
`total` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '當日當前的紅包金額累計',
PRIMARY KEY (`id`),
KEY `business_id` (`business_id`) USING BTREE,
UNIQUE KEY `activity_id_day` (`activity_id`,`day`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='活動每天的參與狀況 表(可用于活動每天的限制條件)';
-- ----------------------------
-- Records of c_activity_day_state
-- ----------------------------
-- 還需要一個 用戶參與 活動快照表
-- ----------------------------
-- Table structure for `c_activity_participate_record`
-- ----------------------------
DROP TABLE IF EXISTS `c_activity_participate_record`;
CREATE TABLE `c_activity_participate_record` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`business_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬商家ID',
`activity_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬活動ID',
`user_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '掃描用戶ID',
`amount` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '獎勵金額',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '參與時間',
PRIMARY KEY (`id`),
KEY `business_id` (`business_id`) USING BTREE,
KEY `activity_id` (`activity_id`) USING BTREE,
KEY `user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='活動參與記錄 表(參與成功才會記錄,對商戶來說參與成功了就扣除獎勵了)';
-- ----------------------------
-- Records of c_activity_participate_record
-- ----------------------------
-- ----------------------------
-- Table structure for `c_qrcode`
-- ----------------------------
DROP TABLE IF EXISTS `c_qrcode`;
CREATE TABLE `c_qrcode` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL DEFAULT '' COMMENT '批次名稱',
`note` varchar(250) NOT NULL DEFAULT '' COMMENT '備注',
`qrcode_order_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '對應的二維碼訂單ID',
`activity_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '綁定的活動ID',
`num` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '數量',
`start_id` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '開始ID',
`end_id` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '結束ID',
`original_num` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '數量(原始,僅第一次分配給商家時寫入)',
`original_start_id` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '開始ID(原始,僅第一次分配給商家時寫入)',
`original_end_id` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '結束ID(原始,僅第一次分配給商家時寫入)',
`business_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬商家ID,0表示未分配',
`pid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '上級批次,拆分批次才有',
`is_break` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '是否為拆分,0-不是拆分的批次,1-為拆分',
`is_be_break` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '是否被拆分,0-沒有被拆分,1-被拆分',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '創建時間',
PRIMARY KEY (`id`),
KEY `business_id` (`business_id`) USING BTREE,
KEY `activity_id` (`activity_id`) USING BTREE,
KEY `pid` (`pid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='二維碼批次(其實就是商家的碼段表) 表 (這個不同于二維碼的生成批次,這個是分配給商家的批次,和二維碼訂單有關系)';
-- ----------------------------
-- Records of c_qrcode
-- ----------------------------
-- ----------------------------
-- Table structure for `c_qrcode_generate`
-- ----------------------------
DROP TABLE IF EXISTS `c_qrcode_generate`;
CREATE TABLE `c_qrcode_generate` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL DEFAULT '' COMMENT '生成批次名稱',
`num` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '數量',
`start_id` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '開始ID',
`end_id` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '結束ID',
`is_print` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '是否打印了,0-未打印,1-已打印',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '創建時間',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='二維碼生成批次 表 (主要是為了方便打印,打印一次兩萬張起,但是商家可能買幾百張)';
-- ----------------------------
-- Records of c_qrcode_generate
-- ----------------------------
-- ----------------------------
-- Table structure for `c_qrcode_item`
-- ----------------------------
DROP TABLE IF EXISTS `c_qrcode_item`;
CREATE TABLE `c_qrcode_item` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '二維碼ID',
`business_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬商家ID',
`qrcode_generate_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬二維碼生成批次ID',
`qrcode_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬的二維碼批次ID(這個“批次”是分配給商家的,和二維碼訂單有關)',
`activity_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '綁定的活動ID(使用后就不能再更改)',
`user_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '用戶ID',
`use_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '使用時間',
PRIMARY KEY (`id`),
KEY `business_id` (`business_id`) USING BTREE,
KEY `qrcode_generate_id` (`qrcode_generate_id`) USING BTREE,
KEY `qrcode_id` (`qrcode_id`) USING BTREE,
KEY `activity_id` (`activity_id`) USING BTREE,
KEY `user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='二維碼條目 表';
-- ----------------------------
-- Records of c_qrcode_item
-- ----------------------------
-- ----------------------------
-- Table structure for `c_qrcode_scanning_record`
-- ----------------------------
DROP TABLE IF EXISTS `c_qrcode_scanning_record`;
CREATE TABLE `c_qrcode_scanning_record` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`qrcode_item_id` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '二維碼ID',
`qrcode_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬批次ID',
`business_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬商家ID',
`user_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '用戶ID',
`status` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '狀態:0-未成功參與活動,1-已成功參與活動(未成功參與活動的情況有很多,比如活動狀態,二維碼狀態不通過等)',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '掃描時間',
PRIMARY KEY (`id`),
KEY `qrcode_item_id` (`qrcode_item_id`) USING BTREE,
KEY `qrcode_id` (`qrcode_id`) USING BTREE,
KEY `business_id` (`business_id`) USING BTREE,
KEY `user_id` (`user_id`) USING BTREE,
KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='二維碼掃描記錄 表';
-- ----------------------------
-- Records of c_qrcode_scanning_record
-- ----------------------------
-- ----------------------------
-- Table structure for `c_recharge_order`
-- ----------------------------
DROP TABLE IF EXISTS `c_recharge_order`;
CREATE TABLE `c_recharge_order` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`order_no` char(32) NOT NULL DEFAULT '' COMMENT '訂單號',
`business_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬商家ID',
`name` varchar(250) NOT NULL DEFAULT '' COMMENT '訂單名稱',
`amount` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '充值金額',
`poundage_rate` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '手續費費率',
`poundage` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '手續費',
`actual_amount` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '實際充值金額/實際到賬',
`notice_results` text NULL COMMENT '微信支付通知結果',
`status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '狀態:0-待支付,1-已支付(已完成)',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '創建時間',
`arrive_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '到賬時間',
PRIMARY KEY (`id`),
KEY `business_id` (`business_id`) USING BTREE,
KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='充值訂單 表';
-- ----------------------------
-- Records of c_recharge_order
-- ----------------------------
-- ----------------------------
-- Table structure for `c_fund_change_record`
-- ----------------------------
DROP TABLE IF EXISTS `c_fund_change_record`;
CREATE TABLE `c_fund_change_record` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`business_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬商家ID',
`amount` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '金額',
`balance` tinyint(2) unsigned NOT NULL DEFAULT 0 COMMENT '收支,0-平衡(只記錄,無變化),1-收入,2-支出',
`title` varchar(250) NOT NULL DEFAULT '' COMMENT '標題',
`content` text NULL COMMENT '內容(描述)',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '創建時間',
PRIMARY KEY (`id`),
KEY `business_id` (`business_id`) USING BTREE,
KEY `balance` (`balance`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='【商家】資金變動記錄(明細) 表 (注意:這種表沒有狀態字段的,只會記錄成功發生了的,比如支付成功的)';
-- ----------------------------
-- Records of c_fund_change_record
-- ----------------------------
-- ----------------------------
-- Table structure for `c_amount_record`
-- ----------------------------
DROP TABLE IF EXISTS `c_amount_record`;
CREATE TABLE `c_amount_record` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`amount` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '金額',
`balance` tinyint(2) unsigned NOT NULL DEFAULT 0 COMMENT '收支,0-平衡(只記錄,無變化),1-收入,2-支出',
`title` varchar(250) NOT NULL DEFAULT '' COMMENT '標題',
`content` text NULL COMMENT '內容(描述)',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '創建時間',
PRIMARY KEY (`id`),
KEY `balance` (`balance`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='【系統】資金變動記錄(明細) 表(商家充值,購買二維碼等支付成功的,發送紅包成功的,待增商家提現處理成功的) (注意:這種表沒有狀態字段的,只會記錄成功發生了的,比如支付成功的)';
-- ----------------------------
-- Records of c_amount_record
-- ----------------------------
-- ----------------------------
-- Table structure for `c_money_in_red_envelop`
-- ----------------------------
DROP TABLE IF EXISTS `c_money_in_red_envelop`;
CREATE TABLE `c_money_in_red_envelop` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`business_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '發送方:商家ID',
`user_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '接收方:用戶ID',
`qrcode_item_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '二維碼ID',
`activity_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '活動ID',
`amount` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '金額',
`title` varchar(250) NOT NULL DEFAULT '' COMMENT '紅包標題',
`status` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '狀態:0-待發放(原因為未關注公眾號),1-發放中,2-已到賬,3-發放失敗',
`notice_results` text NULL COMMENT '微信支付通知結果',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '創建時間',
`arrive_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '到賬時間',
PRIMARY KEY (`id`),
KEY `business_id` (`business_id`) USING BTREE,
KEY `user_id` (`user_id`) USING BTREE,
KEY `activity_id` (`activity_id`) USING BTREE,
KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='紅包表 表(對于商戶來說活動參與成功就扣除獎勵金額,但是對于用戶來說不一定參與成功就發放紅包到微信余額,而是用戶必須先關注平臺才發放,所以這里會記錄) 這個應該是獎勵表,發放表是另外一張表,有可能是紅包有可能是企業打款';
-- ----------------------------
-- Records of c_money_in_red_envelop
-- ----------------------------
-- ----------------------------
-- Table structure for `c_qrcode_goods`
-- ----------------------------
DROP TABLE IF EXISTS `c_qrcode_goods`;
CREATE TABLE `c_qrcode_goods` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(250) NOT NULL DEFAULT '' COMMENT '名稱',
`minimum` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '最低購買數量',
`price` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '單價',
`describe` text NULL COMMENT '描述',
`status` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '狀態:0-下架,1-上架',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '創建時間',
PRIMARY KEY (`id`),
KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='二維碼商品 表';
-- ----------------------------
-- Records of c_qrcode_goods
-- ----------------------------
-- ----------------------------
-- Table structure for `c_qrcode_order`
-- ----------------------------
DROP TABLE IF EXISTS `c_qrcode_order`;
CREATE TABLE `c_qrcode_order` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`order_no` char(32) NOT NULL DEFAULT '' COMMENT '訂單號',
`title` varchar(250) NOT NULL DEFAULT '' COMMENT '訂單標題(自主購買、系統贈送)',
`business_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬商家ID',
`qrcode_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '分配的二維碼批次ID(這個“批次”是分配給商家的,和二維碼訂單有關)',
`num` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '購買數量',
`amount` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '金額',
`price` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '單價',
`pay_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '狀態:0-待支付,1-已支付(已完成)',
`status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '狀態:0-待客服處理,1-已發貨',
`note` text NULL COMMENT '備注',
`notice_results` text NULL COMMENT '微信支付通知結果',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '創建時間',
`pay_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '支付完成時間',
`complete_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '完成時間',
PRIMARY KEY (`id`),
KEY `business_id` (`business_id`) USING BTREE,
KEY `pay_status` (`pay_status`) USING BTREE,
KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='二維碼購買訂單 表';
-- ----------------------------
-- Records of c_qrcode_order
-- ----------------------------
-- ----------------------------
-- Table structure for `c_user_business_scanning_record`
-- ----------------------------
DROP TABLE IF EXISTS `c_user_business_scanning_record`;
CREATE TABLE `c_user_business_scanning_record` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '用戶ID',
`business_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '商家ID',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '創建時間',
`active_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '活躍時間',
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`) USING BTREE,
KEY `business_id` (`business_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='(用戶)掃描商家記錄 表 (用戶掃描過的商家記錄)';
-- ----------------------------
-- Records of c_user_business_scanning_record
-- ----------------------------
-- ----------------------------
-- Table structure for `c_system_settings`
-- ----------------------------
DROP TABLE IF EXISTS `c_system_settings`;
CREATE TABLE `c_system_settings` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`inc_type` varchar(64) NOT NULL DEFAULT '' COMMENT '設置分組',
`name` varchar(64) NOT NULL DEFAULT '' COMMENT '設置的key鍵名',
`value` varchar(520) NOT NULL DEFAULT '' COMMENT '設置的val值',
`desc` varchar(500) NOT NULL DEFAULT '' COMMENT '描述',
PRIMARY KEY (`id`),
KEY `inc_type` (`inc_type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='系統設置 表';
INSERT INTO `c_system_settings`
(`inc_type`, `name`, `value`, `desc`)
VALUES
('wechat', 'name', '十力網絡服務號', ''),
('wechat', 'appId', 'wxe1408f347667dbb2', ''),
('wechat', 'appSecret', 'c75478471d241cc09c011ab8cd4d5291', ''),
('wechat', 'avatar', '20170624/ed3cdb691b8625a1676886850576a076.png', ''),
('wechatPay', 'name', '微信支付商戶名稱', ''),
('wechatPay', 'appId', '222', ''),
('wechatPay', 'appSecret', '444', ''),
('wechat', 'token', 'l0X8tHj0qH3n0jXRO1tg3388o3Xtbn0h', ''),
('wechat', 'aes_key', 'RfhXGG9KX9h9FiOXGK9ImxGig9QKu9gM9fKzHXM9GMv', ''),
('wechatPay', 'merchant_id', '1483405782', ''),
('wechatPay', 'key', '736b04a7d60b95b9df03bc67acc6cd82', ''),
('wechatPay', 'apiclient_cert', 'e7/3507cba4a2fb6f9196f5fbee070240.pem', ''),
('wechatPay', 'apiclient_key', 'fb/c52092c7cf7ff8ecc89be577823abe.pem', ''),
('system', 'poundage_rate', '1', ''),
('wechat', 'qrcode', '20170710/bab1cd5126e65b6e31b32d530d4b5619.jpg', ''),
('system', 'qq', '811800545', ''),
('system', 'name', '網站名稱', ''),
('system', 'describe', '網站描述', ''),
('system', 'pay_dev', 0, ''),
('system', 'logo', '20170710/2bd5de93459bc46ac86c607ea7898004.jpg', '');
-- ----------------------------
-- Records of c_system_settings
-- ----------------------------
-- ----------------------------
-- Table structure for `c_business_withdrawals`
-- ----------------------------
DROP TABLE IF EXISTS `c_business_withdrawals`;
CREATE TABLE `c_business_withdrawals` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`advertisers_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '廣告商id',
`title` varchar(250) NOT NULL DEFAULT '' COMMENT '標題',
`content` text NULL COMMENT '申請說明',
`amount` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '提現金額',
`status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '狀態:0-申請(待處理),1-已完成(同意),2-駁回',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '創建時間',
`update_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '更新時間',
PRIMARY KEY (`id`),
KEY `advertisers_id` (`advertisers_id`) USING BTREE,
KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='商家提現 表';
-- ----------------------------
-- Records of c_business_withdrawals
-- ----------------------------
-- ----------------------------
-- Table structure for `c_pay_money_order`
-- ----------------------------
DROP TABLE IF EXISTS `c_pay_money_order`;
CREATE TABLE `c_pay_money_order` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`title` varchar(250) NOT NULL DEFAULT '' COMMENT '標題(XXX充值)',
`amount` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '金額',
`status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '狀態:0-發起,1-已 打款(已完成)',
`notice_results` text NULL COMMENT '微信支付服務器返回的支付通知結果',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '創建時間',
`update_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '更新時間',
PRIMARY KEY (`id`),
KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='【系統】打款 訂單表(同意用戶提現時由管理員用戶發起的,檢測到重復支付退款時由系統發起的)';
-- ----------------------------
-- Records of c_pay_money_order
-- ----------------------------
```
last update:2017-7-14 13:10:51