第二阶段完善代理商激活码
This commit is contained in:
31
database/migrations/20240212001_agents.php
Normal file
31
database/migrations/20240212001_agents.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class Agents extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('cursor_agents', ['engine' => 'InnoDB']);
|
||||
$table->addColumn('username', 'string', ['limit' => 50, 'null' => false, 'comment' => '代理商用户名'])
|
||||
->addColumn('password', 'string', ['limit' => 255, 'null' => false, 'comment' => '密码'])
|
||||
->addColumn('nickname', 'string', ['limit' => 50, 'null' => true, 'comment' => '昵称'])
|
||||
->addColumn('parent_id', 'integer', ['null' => true, 'default' => 0, 'comment' => '上级代理ID,0表示一级代理'])
|
||||
->addColumn('level', 'integer', ['limit' => 1, 'null' => false, 'default' => 1, 'comment' => '代理级别:1=一级代理,2=二级代理'])
|
||||
->addColumn('balance', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'comment' => '余额'])
|
||||
->addColumn('total_income', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'comment' => '总收入'])
|
||||
->addColumn('commission_rate', 'decimal', ['precision' => 5, 'scale' => 2, 'default' => '0.00', 'comment' => '佣金比例'])
|
||||
->addColumn('status', 'integer', ['limit' => 1, 'null' => false, 'default' => 1, 'comment' => '状态:0=禁用,1=启用'])
|
||||
->addColumn('remark', 'string', ['limit' => 255, 'null' => true, 'comment' => '备注'])
|
||||
->addColumn('last_login_time', 'datetime', ['null' => true, 'comment' => '最后登录时间'])
|
||||
->addColumn('last_login_ip', 'string', ['limit' => 50, 'null' => true, 'comment' => '最后登录IP'])
|
||||
->addColumn('created_at', 'datetime', ['null' => false, 'comment' => '创建时间'])
|
||||
->addColumn('updated_at', 'datetime', ['null' => false, 'comment' => '更新时间'])
|
||||
->addIndex(['username'], ['unique' => true])
|
||||
->addIndex(['parent_id'])
|
||||
->addIndex(['level'])
|
||||
->addIndex(['status'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
25
database/migrations/20240212002_agent_codes.php
Normal file
25
database/migrations/20240212002_agent_codes.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class AgentCodes extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('cursor_agent_codes', ['engine' => 'InnoDB']);
|
||||
$table->addColumn('agent_id', 'integer', ['null' => false, 'comment' => '代理商ID'])
|
||||
->addColumn('code_id', 'integer', ['null' => false, 'comment' => '激活码ID'])
|
||||
->addColumn('price', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'comment' => '销售价格'])
|
||||
->addColumn('commission', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'comment' => '佣金'])
|
||||
->addColumn('parent_commission', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'comment' => '上级佣金'])
|
||||
->addColumn('status', 'integer', ['limit' => 1, 'null' => false, 'default' => 0, 'comment' => '状态:0=未结算,1=已结算'])
|
||||
->addColumn('settle_time', 'datetime', ['null' => true, 'comment' => '结算时间'])
|
||||
->addColumn('created_at', 'datetime', ['null' => false, 'comment' => '创建时间'])
|
||||
->addColumn('updated_at', 'datetime', ['null' => false, 'comment' => '更新时间'])
|
||||
->addIndex(['agent_id'])
|
||||
->addIndex(['code_id'])
|
||||
->addIndex(['status'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user