You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

93 lines
2.3 KiB

<?php
namespace backend\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_file".
*
* @property int $id
* @property int $pid 父级id
* @property string $name 名称
* @property int $type 类型
* @property int $own_type 拥有者类型
* @property int $own_id 拥有者id
* @property string $alias 别名
* @property string $path 地址
* @property int $is_delete 是否删除,1为已删除
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class File extends \yii\db\ActiveRecord
{
//own_type
const OWN_TYPE_GOODS_INDEX = 1;//商品首页
const OWN_TYPE_GOODS_DETAILS = 2;//商品详情
const OWN_TYPE_CATEGORY_ICON = 3;//类目图标
//is_delete
const IS_DELETE_YES = 1;//已删除
const IS_DELETE_NO = 0;//未删除
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_file';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['pid', 'type', 'own_type', 'own_id', 'is_delete'], 'integer'],
[['name', 'path'], 'string', 'max' => 255],
[['alias'], 'string', 'max' => 50],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'pid' => '父级id',
'name' => '名称',
'type' => '类型',
'own_type' => '拥有者类型',
'own_id' => '拥有者id',
'alias' => '别名',
'path' => '地址',
'is_delete' => '是否删除,1为已删除',
'updated_at' => '更新时间',
'created_at' => '创建时间',
];
}
/**
* @author linyao
* @email 602604991@qq.com
* @created Nov 8, 2019
*
* 行为存储创建时间和更新时间
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {
return time();
},
],
];
}
}