增加访问记录功能

This commit is contained in:
2023-06-28 11:12:30 +08:00
parent a12cca37e4
commit 65e1800c6f
18 changed files with 447 additions and 98 deletions

View File

@@ -0,0 +1,42 @@
<?php
use app\common\ColumnFormat;
use think\migration\Migrator;
class CreateTablePostVisit extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('post_visit');
$table->addColumn(ColumnFormat::timestamp('create_time'));
$table->addColumn(ColumnFormat::timestamp('update_time'));
$table->addColumn(ColumnFormat::timestamp('delete_time'));
$table->addColumn(ColumnFormat::integer('post_id'));
$table->addColumn(ColumnFormat::stringUrl('ip'));
$table->addColumn(ColumnFormat::stringNormal('nickname'));
$table->addColumn(ColumnFormat::stringNormal('uid'));
$table->addColumn(ColumnFormat::stringUrl('avatar'));
$table->create();
}
}

View File

@@ -19,7 +19,7 @@ class InitAdmin extends Seeder
$account['account'] = 'admin';
$account['salt'] = Str::random(6);
$account['password'] = md5('123456'.$account['salt']);
$account['avatar'] = '/static/images/avatar.jpeg';
$account['avatar'] = '/static/images/avatar.png';
$model_admin = Admin::where('account',$account['account'])->find();