mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
初始化项目
This commit is contained in:
64
app/common/ColumnFormat.php
Normal file
64
app/common/ColumnFormat.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
namespace app\common;
|
||||
|
||||
use think\migration\db\Column;
|
||||
|
||||
class ColumnFormat
|
||||
{
|
||||
public static function timestamp($name){
|
||||
return Column::make($name,'integer')
|
||||
->setLimit(10)
|
||||
->setSigned(false)
|
||||
->setDefault(0);
|
||||
}
|
||||
|
||||
public static function stringLong($name)
|
||||
{
|
||||
return Column::make($name,'string')
|
||||
->setLimit(500)
|
||||
->setDefault('');
|
||||
}
|
||||
public static function stringNormal($name)
|
||||
{
|
||||
return Column::make($name,'string')
|
||||
->setLimit(100)
|
||||
->setDefault('');
|
||||
}
|
||||
|
||||
public static function stringUrl($name)
|
||||
{
|
||||
return Column::make($name,'string')
|
||||
->setLimit(300)
|
||||
->setDefault('');
|
||||
}
|
||||
|
||||
public static function stringMd5($name)
|
||||
{
|
||||
return Column::make($name,'string')
|
||||
->setLimit(32)
|
||||
->setDefault('');
|
||||
}
|
||||
|
||||
public static function stringShort($name)
|
||||
{
|
||||
return Column::make($name,'string')
|
||||
->setLimit(30)
|
||||
->setDefault('');
|
||||
}
|
||||
|
||||
public static function integerTypeStatus($name,$default = 0)
|
||||
{
|
||||
return Column::make($name,'integer')
|
||||
->setLimit(10)
|
||||
->setSigned(false)
|
||||
->setDefault($default);
|
||||
}
|
||||
|
||||
public static function integer($name)
|
||||
{
|
||||
return Column::make($name,'integer')
|
||||
->setDefault(0)
|
||||
->setLimit(20)
|
||||
->setSigned(false);
|
||||
}
|
||||
}
|
||||
12
app/common/TextFormat.php
Normal file
12
app/common/TextFormat.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace app\common;
|
||||
|
||||
class TextFormat
|
||||
{
|
||||
public static function br($content){
|
||||
$content = str_replace("\n",'<br/>',$content);
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user