**字段新增**
**会员表:aijiacms_member**
| 字段名 | 字段类型 | 是否可空 | 默认值 | 字段描述 |
| ---------- | ------------ | -------- | ------ | -------------- |
| parentid | int(11) | yes | | 推荐人 userid |
| houseid | int(11) | yes | | 推荐楼盘itemid |
| people | int(11) | no | 0 | 邀请人数 |
| commission | float(10,2) | no | 0 | 累计获得佣金 |
| roleid | int(10) | no | 0 | 角色ID |
| houseids | varchar(500) | no | | 权限楼盘ID |
```
ALTER TABLE aijiacms_member ADD COLUMN `parentid` int(11);
ALTER TABLE aijiacms_member ADD COLUMN `houseid` int(11);
ALTER TABLE aijiacms_member ADD COLUMN `people` int(11) NOT NULL DEFAULT 0;
ALTER TABLE aijiacms_member ADD COLUMN `commission` float(10,2) NOT NULL DEFAULT 0;
ALTER TABLE aijiacms_member ADD COLUMN `roleid` int(10) NOT NULL DEFAULT 0;
ALTER TABLE aijiacms_member ADD COLUMN `houseids` varchar(500) NOT NULL DEFAULT 0;
ALTER TABLE aijiacms_member ADD COLUMN `nun` varchar(50) NOT NULL DEFAULT '';
```
**分销表:aijiacms_fenxiao**
| 字段名 | 字段类型 | 是否可空 | 默认值 | 字段描述 |
| ---------------- | ----------- | -------- | ------ | ------------------------- |
| shareid | int(11) | yes | | aijiacms_share_log 主键ID |
| tuijian_memberid | int(11) | no | | 推荐人会员ID |
| tuijian_mobile | varchar(50) | no | | 推荐人手机号 |
```
ALTER TABLE aijiacms_fenxiao ADD COLUMN `shareid` int(11) NOT NULL;
ALTER TABLE aijiacms_fenxiao ADD COLUMN `tuijian_memberid` int(11) NOT NULL;
ALTER TABLE aijiacms_fenxiao ADD COLUMN `tuijian_mobile` varchar(50) NOT NULL;
```
**表新增**
**分销记录表:aijiacms_fenxiao_log**
| 字段名 | 字段类型 | 是否可空 | 默认值 | 字段描述 |
| -------- | ------------- | -------- | ------ | ---------------------------------------------- |
| itemid | int(11) | no | | 主键ID |
| parentid | int(11) | no | | aijiacms_fenxiao itemid |
| status | tinyint(1) | no | | 0 待受理 1 已预约 2 已到访 3 已交定金 4 已成交 |
| memberid | int(11) | no | | 操作人会员ID |
| datatime | int(11) | no | | 操作时间 |
| remark | varchar(2000) | yes | | 操作备注 |
| money | float(10,2) | no | 0 | 获取佣金金额 |
```
create table `aijiacms_fenxiao_log` (
`itemid` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`parentid` int(11) UNSIGNED NOT NULL,
`status` tinyint(1) UNSIGNED NOT NULL,
`memberid` int(11) UNSIGNED NOT NULL,
`datatime` int(11) UNSIGNED NOT NULL,
`remark` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL default '',
`money` float(10,2) NOT NULL default 0,
PRIMARY KEY (`itemid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci;
```
会员招募 -> 已交定金
线上选房 -> 已成交
手动推荐 -> 待受理
**分享记录表:aijiacms_share_log**
| 字段名 | 字段类型 | 是否可空 | 默认值 | 字段描述 |
| -------- | ---------- | -------- | ------ | --------------------------------- |
| itemid | int(11) | no | | 主键ID |
| houseid | int(11) | no | | 推荐楼盘itemid |
| memberid | int(11) | no | | 分享人会员ID |
| type | tinyint(1) | no | | 分享类型 1 手动推荐 2 链接 3 海报 |
| amount | int(11) | no | 0 | 推荐成功次数 |
```
create table `aijiacms_share_log` (
`itemid` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`houseid` int(11) UNSIGNED NOT NULL,
`memberid` int(11) UNSIGNED NOT NULL,
`type` tinyint(1) UNSIGNED NOT NULL,
`amount` int(11) UNSIGNED NOT NULL,
PRIMARY KEY (`itemid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci;
```
**权限角色表:aijiacms_role**
| 字段名 | 字段类型 | 是否可空 | 默认值 | 字段描述 |
| --------- | -------------------- | -------- | ------ | -------- |
| id | int(11) | no | | 主键ID |
| name | varchar(500) | no | | 角色名称 |
| parentid | int(11) | No | 0 | 父ID |
| listorder | smallint(4) unsigned | no | 0 | |
| title | varchar(30) | no | | |
| url | varchar(255) | no | | |
| moduleid | smallint(6) | no | 0 | |
| file | varchar(20) | no | | |
| action | varchar(255) | no | | |
| catid | varchar(255) | no | | |
| style | varchar(50) | no | | |
| describe | varchar(500) | yes | | 角色描述 |
| datatime | int(11) | no | | 添加时间 |
```
create table `aijiacms_role` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(500) not null,
`parentid` int(11) UNSIGNED NOT NULL default 0,
`listorder` smallint(4) UNSIGNED NOT NULL default 0,
`title` varchar(30) NOT NULL default '',
`url` varchar(255) NOT NULL default '',
`moduleid` smallint(6) NOT NULL default 0,
`file` varchar(20) NOT NULL default '',
`action` varchar(255) NOT NULL default '',
`catid` varchar(255) NOT NULL default '',
`style` varchar(255) NOT NULL default '',
`describe` varchar(500) NOT NULL default '',
`datatime` int(11) UNSIGNED NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci;
```