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.
 
 
 

133 lines
4.2 KiB

<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_goods".
*
* @property int $id
* @property int $pid 父级id
* @property int $cat_id 后台商品类别id
* @property int $brand_id 品牌id
* @property int $shop_cat_id 前端商品类别id
* @property string $name 商品名称
* @property string $sn 商品唯一货号
* @property string $code 商品货码
* @property int $supplier_id 供应商id
* @property int $weight 重量
* @property int $length 长度
* @property int $width 宽度
* @property int $height 高度
* @property int $diameter 直径
* @property string $unit 单位
* @property int $sold_count 已售数量
* @property int $limit_count 限购数量
* @property int $stock 库存
* @property int $stock_warn 库存警告
* @property int $market_price 市场价
* @property int $price 销售价
* @property string $brief 简介
* @property string $description 详细介绍
* @property int $image 图片id
* @property int $model_id 模型id
* @property int $is_sale 该商品是否开放销售,1为是,0为否
* @property int $sort_order 排序
* @property int $bouns_points 奖励积分
* @property int $experience_points 经验值
* @property int $is_delete 是否删除,1为已删除
* @property int $express_template 配送详情id
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class Goods extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_goods';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['pid', 'cat_id', 'brand_id', 'shop_cat_id', 'supplier_id', 'weight', 'length', 'width', 'height', 'diameter', 'sold_count', 'limit_count', 'stock', 'stock_warn', 'market_price', 'price', 'image', 'model_id', 'is_sale', 'sort_order', 'bouns_points', 'experience_points', 'is_delete', 'express_template'], 'integer'],
[['description'], 'string'],
[['name'], 'string', 'max' => 120],
[['sn'], 'string', 'max' => 60],
[['code'], 'string', 'max' => 50],
[['unit'], 'string', 'max' => 16],
[['brief'], 'string', 'max' => 255],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'pid' => '父级id',
'cat_id' => '后台商品类别id',
'brand_id' => '品牌id',
'shop_cat_id' => '前端商品类别id',
'name' => '商品名称',
'sn' => '商品唯一货号',
'code' => '商品货码',
'supplier_id' => '供应商id',
'weight' => '重量',
'length' => '长度',
'width' => '宽度',
'height' => '高度',
'diameter' => '直径',
'unit' => '单位',
'sold_count' => '已售数量',
'limit_count' => '限购数量',
'stock' => '库存',
'stock_warn' => '库存警告',
'market_price' => '市场价',
'price' => '销售价',
'brief' => '简介',
'description' => '详细介绍',
'image' => '图片id',
'model_id' => '模型id',
'is_sale' => '该商品是否开放销售,1为是,0为否',
'sort_order' => '排序',
'bouns_points' => '奖励积分',
'experience_points' => '经验值',
'is_delete' => '是否删除,1为已删除',
'express_template' => '配送详情id',
'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();
},
],
];
}
}