51 lines
1.9 KiB
PHP
51 lines
1.9 KiB
PHP
![]() |
<?php
|
||
|
|
||
|
use think\admin\extend\PhinxExtend;
|
||
|
use think\migration\Migrator;
|
||
|
|
||
|
@set_time_limit(0);
|
||
|
@ini_set('memory_limit', -1);
|
||
|
|
||
|
class InstallKamiTable extends Migrator
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
* 创建数据库
|
||
|
*/
|
||
|
public function change()
|
||
|
{
|
||
|
$this->_create_kami_lockcard();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 创建数据对象
|
||
|
* @class KamiLockcard
|
||
|
* @table kami_lockcard
|
||
|
* @return void
|
||
|
*/
|
||
|
private function _create_kami_lockcard()
|
||
|
{
|
||
|
// 创建数据表对象
|
||
|
$table = $this->table('kami_lockcard', [
|
||
|
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '卡密表',
|
||
|
]);
|
||
|
// 创建或更新数据表
|
||
|
PhinxExtend::upgrade($table, [
|
||
|
['order_id', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '映射订单id']],
|
||
|
['cardno', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '卡号']],
|
||
|
['cardpwd', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '密码']],
|
||
|
['value', 'integer', ['default' => '0', 'null' => false, 'comment' => '面值']],
|
||
|
['lock_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '锁卡状态,0已解锁,1已锁定,2已使用无法解锁或者锁定']],
|
||
|
['cid', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '渠道id']],
|
||
|
['pid', 'integer', ['default' => NULL, 'null' => true, 'comment' => '产品id']],
|
||
|
['mid', 'integer', ['default' => '-1', 'null' => false, 'comment' => '分配的商户']],
|
||
|
['info', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '锁卡说明']],
|
||
|
['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '状态1可用0禁用']],
|
||
|
['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']],
|
||
|
], [
|
||
|
'cardno', 'cardpwd',
|
||
|
], false);
|
||
|
}
|
||
|
|
||
|
}
|