<?php /** * 应用的数据表结构文件 * structure.php * $Author$ */ return " CREATE TABLE IF NOT EXISTS `oa_sale_activity` ( `ac_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `subject` varchar(120) NOT NULL DEFAULT '' COMMENT '活动主题', `source` varchar(100) NOT NULL DEFAULT '' COMMENT '作者', `cover_id` char(32) NOT NULL DEFAULT '' COMMENT '封面图片 ID', `begin_time` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '活动开始时间', `end_time` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '活动结束时间', `content` text NOT NULL COMMENT '活动描述', `is_all` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '参与帖子分享范围是否全公司:0(默认)=否;1=是', `is_all_look` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否可围观:0(默认)=否;1=是', `is_notice` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否发送消息通知:0(默认)=否;1=是', `is_recommend` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否推荐到首页:0(默认)=否;1=是', `is_post_remind` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否开启发帖推送消息提醒(0:否, 1:是)', `is_red_open` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否开启红包:0(默认)=否;1=是', `is_show_red` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否显示抢红包:0(默认)=否;1=是', `is_check_open` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否开启审核:0(默认)=否;1=是', `activity_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '活动状态,0(默认)=草稿,1=发布,2=已终止', `is_hide` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '活动是否隐藏,0(默认)=否,1=是', `packet_bless` varchar(255) NOT NULL DEFAULT '' COMMENT '红包祝福语', `check_user_list` text NOT NULL COMMENT '有权限的审核人员UID集合序列化存储', `ext_fields` text NOT NULL COMMENT '自定义扩展字段,格式(a:2:{i:0;a:7:{s:4:\"name\";s:2:\"11\";s:8:\"reminder\";s:0:\"\";s:4:\"type\";s:1:\"1\";s:4:\"unit\";s:0:\"\";s:11:\"is_required\";s:1:\"1\";s:4:\"text\";s:0:\"\";s:4:\"sort\";s:1:\"0\";}i:1;a:7:{s:4:\"name\";s:2:\"22\";s:8:\"reminder\";s:0:\"\";s:4:\"type\";s:1:\"2\";s:4:\"unit\";s:1:\"2\";s:11:\"is_required\";s:1:\"1\";s:4:\"text\";s:0:\"\";s:4:\"sort\";s:1:\"1\";}})', `likes` int(11) NOT NULL DEFAULT '0' COMMENT '点赞总数量', `comments` int(11) NOT NULL DEFAULT '0' COMMENT '评论总数量(分享总数量)', `join_total` int(11) NOT NULL DEFAULT '0' COMMENT '应参与总人数', `join_num` int(11) NOT NULL DEFAULT '0' COMMENT '已参与人数', `publish_time` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '发布时间', `last_time` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '最后更新活动时间', `stop_pay_time` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '终止支付时间', `domain` varchar(32) NOT NULL DEFAULT '' COMMENT '企业域名', `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态, 1=初始化,2=已更新,3=已删除', `created` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `updated` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `deleted` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间', PRIMARY KEY (`ac_id`), KEY `domain_status` (`domain`,`status`), KEY `activity_status` (`activity_status`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='活动-主表'; CREATE TABLE IF NOT EXISTS `oa_sale_notice` ( `n_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `ac_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '活动ID', `title` varchar(120) NOT NULL DEFAULT '' COMMENT '公告标题', `content` text NOT NULL COMMENT '公告内容', `notice_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '公告状态,0(默认)=草稿,1=发布', `publish_time` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '公告发布时间', `publish_user` varchar(100) NOT NULL DEFAULT '' COMMENT '发布人姓名', `publish_phone` varchar(100) NOT NULL DEFAULT '' COMMENT '发布人电话', `last_time` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '最后更新公告时间', `domain` varchar(32) NOT NULL DEFAULT '' COMMENT '企业域名', `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态, 1=初始化,2=已更新,3=已删除', `created` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `updated` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `deleted` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间', PRIMARY KEY (`n_id`), KEY `domain_status` (`domain`,`status`), KEY `notice_status` (`notice_status`), KEY `ac_id` (`ac_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公告-主表'; CREATE TABLE IF NOT EXISTS `oa_sale_right` ( `right_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', `r_type` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '权限类型(0=参与权限,1=审核权限)', `ac_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '活动ID', `uid` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '人员 ID', `dp_id` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '部门 ID', `job_id` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '岗位 ID', `role_id` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '角色 ID', `tag_id` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '标签 ID', `domain` VARCHAR(32) NOT NULL DEFAULT '' COMMENT '企业域名', `status` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1' COMMENT '状态, 1=初始化,2=已更新,3=已删除', `created` BIGINT(13) UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间', `updated` BIGINT(13) UNSIGNED NOT NULL DEFAULT '0' COMMENT '更新时间', `deleted` BIGINT(13) UNSIGNED NOT NULL DEFAULT '0' COMMENT '删除时间', PRIMARY KEY (`right_id`), KEY `domain_status` (`domain`,`status`), KEY `ac_id` (`ac_id`), KEY `r_type` (`r_type`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='活动-权限表'; CREATE TABLE IF NOT EXISTS `oa_sale_comment` ( `comment_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `ac_id` int(10) NOT NULL DEFAULT '0' COMMENT '活动ID', `uid` char(32) NOT NULL DEFAULT '' COMMENT '用户ID', `content` text NOT NULL COMMENT '评论内容', `pic_ids` text NOT NULL COMMENT '图片ID集合(英文逗号分隔)', `check_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '审核状态(0:待审核,1:已审核,2:已驳回)', `check_uid` varchar(50) NOT NULL DEFAULT '' COMMENT '审核人uid(管理员审核此值为空)', `check_uname` varchar(100) NOT NULL DEFAULT '' COMMENT '审核人姓名(手机端审核此值为空)', `check_phone` varchar(50) NOT NULL DEFAULT '' COMMENT '审核人电话(手机端审核此值为空)', `reason` varchar(200) NOT NULL DEFAULT '' COMMENT '驳回原因', `ext_fields` text NOT NULL COMMENT '自定义扩展字段', `likes` int(11) NOT NULL DEFAULT '0' COMMENT '点赞总数量', `replys` int(11) NOT NULL DEFAULT '0' COMMENT '回复总数量', `top_num` bigint(13) NOT NULL DEFAULT '0' COMMENT '置顶时间(0为不置顶,如果置顶,存入当前时间戳)', `check_time` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '审核时间(也就是发布时间)', `is_autochecked` tinyint(1) NOT NULL DEFAULT '0' COMMENT '系统审核状态(0:系统尚未审核,1:系统已审核)', `autocheck_message` varchar(200) NOT NULL DEFAULT '' COMMENT '自动审核返回的信息', `domain` varchar(32) NOT NULL DEFAULT '' COMMENT '企业域名', `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态, 1=初始化,2=已更新,3=已删除', `created` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `updated` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `deleted` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间', PRIMARY KEY (`comment_id`), KEY `check_status` (`check_status`), KEY `ac_id` (`ac_id`), KEY `domain_status` (`domain`,`status`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='活动-评论(帖子)表'; CREATE TABLE IF NOT EXISTS `oa_sale_reply` ( `reply_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `ac_id` int(10) NOT NULL DEFAULT '0' COMMENT '活动ID', `comment_id` int(10) NOT NULL DEFAULT '0' COMMENT '评论id', `uid` char(32) NOT NULL DEFAULT '' COMMENT '用户ID', `content` text NOT NULL COMMENT '回复内容', `pic_ids` text NOT NULL COMMENT '图片ID集合(英文逗号分隔)', `likes` int(11) NOT NULL DEFAULT '0' COMMENT '点赞总数量', `domain` varchar(32) NOT NULL DEFAULT '' COMMENT '企业域名', `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态, 1=初始化,2=已更新,3=已删除', `created` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `updated` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `deleted` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间', PRIMARY KEY (`reply_id`), KEY `comment_id` (`comment_id`), KEY `domain_status` (`domain`,`status`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='活动-评论回复表'; CREATE TABLE IF NOT EXISTS `oa_sale_like` ( `like_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键', `uid` char(32) NOT NULL DEFAULT '' COMMENT '点赞人ID', `obj_id` int(10) NOT NULL DEFAULT '0' COMMENT '活动、评论、回复ID', `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '点赞类型(1:活动、2:评论,3:回复)', `domain` varchar(32) NOT NULL DEFAULT '' COMMENT '企业域名', `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态, 1=初始化,2=已更新,3=已删除', `created` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `updated` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `deleted` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间', PRIMARY KEY (`like_id`), KEY `obj_id` (`obj_id`), KEY `domain_status` (`domain`,`status`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='活动-点赞表'; CREATE TABLE IF NOT EXISTS `oa_sale_packet` ( `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增ID', `ac_id` int(10) NOT NULL DEFAULT '0' COMMENT '活动ID', `type` tinyint(2) NOT NULL DEFAULT '1' COMMENT '红包类型(1.随机比例红包,2.拼手气红包,3:普通红包)', `red_base_num` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '红包基数(单位:个)', `max_total` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '每人最多领取次数(0为不限制)', `red_content` text NOT NULL COMMENT '红包规则(序列化存储)', `warn_mobile` varchar(50) NOT NULL DEFAULT '' COMMENT '欠费提醒手机号', `domain` varchar(32) NOT NULL DEFAULT '' COMMENT '企业域名', `status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '状态=1.初始化,2.更新,3删除', `created` bigint(13) NOT NULL DEFAULT '0' COMMENT '创建时间', `updated` bigint(13) NOT NULL DEFAULT '0' COMMENT '更新时间', `deleted` bigint(13) NOT NULL DEFAULT '0' COMMENT '删除时间', PRIMARY KEY (`id`), KEY `domain_status` (`domain`,`status`), KEY `ac_id` (`ac_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='红包配置表'; CREATE TABLE IF NOT EXISTS `oa_sale_packetrecord` ( `rid` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增ID', `pid` int(10) NOT NULL DEFAULT '0' COMMENT '红包ID', `p_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '红包类型(1.随机比例红包,2.拼手气红包,3:普通红包,4:定向红包)', `ac_id` int(10) NOT NULL DEFAULT '0' COMMENT '活动ID', `cid` int(10) NOT NULL DEFAULT '0' COMMENT '评论ID', `rand_money` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '红包金额(单位:分)', `packet_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '红包状态(0.未领取,1.已领取,2.领取失败,3.已补发)', `order_sn` varchar(32) NOT NULL DEFAULT '' COMMENT '商户订单号(同wtlPlatformOrderNo)', `send_uname` varchar(100) NOT NULL DEFAULT '' COMMENT '发放人姓名(仅定向红包有此值)', `send_phone` varchar(32) NOT NULL DEFAULT '' COMMENT '发放人电话(仅定向红包有此值)', `uid` varchar(32) NOT NULL DEFAULT '' COMMENT '领取人UID', `username` varchar(100) NOT NULL DEFAULT '' COMMENT '领取人姓名', `give_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '发放时间', `receive_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '领取成功时间', `parent_rid` bigint(13) NOT NULL DEFAULT '0' COMMENT '补发的红包id(为0代表不是补发)', `regive_status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '补发领取状态(1:未成功,2:成功)', `wtlDetailId` varchar(50) NOT NULL DEFAULT '' COMMENT '微信转账订单号(用于对账)', `wtlPaymentNo` varchar(50) NOT NULL DEFAULT '' COMMENT '微信支付系统订单号', `wtlPlatformOrderNo` varchar(50) NOT NULL DEFAULT '' COMMENT '业务平台订单号', `wtlPartnerTradeNo` varchar(50) NOT NULL DEFAULT '' COMMENT '支付平台内部订单号', `domain` varchar(32) NOT NULL DEFAULT '' COMMENT '企业域名', `status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '状态=1.初始化,2.更新,3删除', `created` bigint(13) NOT NULL DEFAULT '0' COMMENT '创建时间', `updated` bigint(13) NOT NULL DEFAULT '0' COMMENT '更新时间', `deleted` bigint(13) NOT NULL DEFAULT '0' COMMENT '删除时间', PRIMARY KEY (`rid`), KEY `pid` (`pid`), KEY `cid` (`cid`), KEY `ac_id` (`ac_id`), KEY `packet_status` (`packet_status`), KEY `domain_status` (`domain`,`status`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='红包记录表'; CREATE TABLE IF NOT EXISTS `oa_sale_syscache` ( `name` varchar(32) NOT NULL DEFAULT '' COMMENT '缓存文件名', `domain` varchar(120) NOT NULL DEFAULT '' COMMENT '企业域名', `type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '缓存类型, 0:非数组, 1:数组', `data` mediumblob NOT NULL COMMENT '数据', `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '记录状态, 1初始化,2=已更新, 3=已删除', `created` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `updated` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `deleted` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='活动-缓存表'; CREATE TABLE IF NOT EXISTS `oa_sale_setting` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 ID', `key` varchar(255) NOT NULL DEFAULT '' COMMENT '变量名', `value` text NOT NULL COMMENT '值', `type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '缓存类型, 0:非数组, 1:数组', `comment` text NOT NULL COMMENT '说明', `domain` varchar(32) NOT NULL DEFAULT '' COMMENT '企业域名', `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态, 1=初始化,2=已更新,3=已删除', `created` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `updated` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `deleted` bigint(13) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间', PRIMARY KEY (`id`), KEY `domain_status` (`domain`,`status`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='活动-设置表'; ";