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.
85 lines
2.1 KiB
85 lines
2.1 KiB
<?php
|
|
|
|
namespace common\models\ars;
|
|
|
|
use Yii;
|
|
use yii\behaviors\TimestampBehavior;
|
|
|
|
/**
|
|
* This is the model class for table "ats_category".
|
|
*
|
|
* @property int $id
|
|
* @property string $name 类别名称
|
|
* @property int $pid 父级id
|
|
* @property int $goods_count 商品数量
|
|
* @property int $sort_order 排序
|
|
* @property int $icon_type 图标类型
|
|
* @property string $icon 图标
|
|
* @property int $is_show 是否显示,1为不显示
|
|
* @property int $is_delete 是否删除,1为已删除
|
|
* @property int $created_at 创建时间
|
|
* @property int $updated_at 更新时间
|
|
*/
|
|
class Category extends \yii\db\ActiveRecord
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'ats_category';
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete'], 'integer'],
|
|
[['name'], 'string', 'max' => 60],
|
|
[['icon'], 'string', 'max' => 64],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id' => 'id',
|
|
'name' => '类别名称',
|
|
'pid' => '父级id',
|
|
'goods_count' => '商品数量',
|
|
'sort_order' => '排序',
|
|
'icon_type' => '图标类型',
|
|
'icon' => '图标',
|
|
'is_show' => '是否显示,1为不显示',
|
|
'is_delete' => '是否删除,1为已删除',
|
|
'created_at' => '创建时间',
|
|
'updated_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();
|
|
},
|
|
],
|
|
];
|
|
}
|
|
}
|