<?php

$setupsql = "";

if (!pdo_tableexists('sms_code')){
    $setupsql = <<<EOF
CREATE TABLE `ims_sms_code` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `uniacid` int(10) unsigned NOT NULL,
  `mobile` varchar(50) DEFAULT NULL COMMENT '手机号',
  `verify_code` varchar(50) DEFAULT NULL COMMENT '验证码',
  `createtime` int(11) DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COMMENT='短信验证码表';
CREATE TABLE `ims_sms_template` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `uniacid` int(10) unsigned NOT NULL,
  `name` varchar(100) NOT NULL COMMENT '模板名称',
  `provider` tinyint(1) NOT NULL DEFAULT '0' COMMENT '服务商  0=阿里云(国内) 1=腾讯云 ',
  `template_id` varchar(255) NOT NULL DEFAULT '' COMMENT '模板ID/CODE',
  `content` varchar(1000) NOT NULL DEFAULT '' COMMENT '模板内容',
  `sign` varchar(50) NOT NULL COMMENT '短信签名',
  `createtime` int(10) unsigned NOT NULL COMMENT '添加时间',
  `updatetime` int(10) unsigned NOT NULL COMMENT '修改时间',
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已删除 0=否 1=是',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='短信模板表';
CREATE TABLE `ims_sms_setting` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `uniacid` int(10) unsigned NOT NULL,
  `sms` text COMMENT '短信配置',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='短信配置表';
EOF;

}

if (!empty($setupsql)){
    pdo_query($setupsql);
}

$finish = true;
