<?php
$rt = \Phpcmf\Service::M('table')->install_schema([
    'tables' => [
        'member_setting' => [
            'comment' => '用户属性参数表',
            'fields' => [
                'name' => 'varchar(50) NOT NULL',
                'value' => 'mediumtext NOT NULL',
            ],
            'indexes' => [
                'PRIMARY KEY (`name`)',
            ],
        ],
        'member_paylog' => [
            'comment' => '用户支付记录表',
            'fields' => [
                'id' => 'bigint(18) unsigned NOT NULL AUTO_INCREMENT',
                'site' => 'int(10) NOT NULL COMMENT \'站点\'',
                'mid' => 'varchar(100) NOT NULL COMMENT \'支付标识\'',
                'uid' => 'int(10) unsigned NOT NULL COMMENT \'付款人\'',
                'touid' => 'int(10) unsigned DEFAULT 0 COMMENT \'收款人\'',
                'title' => 'varchar(255) NOT NULL COMMENT \'支付标题\'',
                'url' => 'varchar(255) NOT NULL COMMENT \'相关链接\'',
                'value' => 'decimal(10,2) NOT NULL COMMENT \'支付金额\'',
                'money' => 'decimal(10,2) NOT NULL COMMENT \'余额\'',
                'type' => 'varchar(20) NOT NULL COMMENT \'支付方式\'',
                'status' => 'tinyint(1) unsigned NOT NULL COMMENT \'支付状态\'',
                'result' => 'text NOT NULL COMMENT \'支付结果\'',
                'paytime' => 'int(10) unsigned NOT NULL COMMENT \'支付时间\'',
                'inputtime' => 'int(10) unsigned NOT NULL COMMENT \'创建时间\'',
            ],
            'indexes' => [
                'PRIMARY KEY (`id`)',
                'KEY `uid` (`uid`)',
                'KEY `touid` (`touid`)',
                'KEY `mid` (`mid`)',
                'KEY `status` (`status`)',
                'KEY `value` (`value`)',
                'KEY `paytime` (`paytime`)',
                'KEY `inputtime` (`inputtime`)',
            ],
        ],
    ],
    'seeds' => [],
]);
if (empty($rt['code'])) {
    log_message('error', 'Pay install_schema: '.($rt['msg'] ?? ''));
    return dr_return_data(0, dr_lang('安装失败').'：'.($rt['msg'] ?? ''));
}
