|
@ -4,6 +4,9 @@ namespace antgoods\goods\models\ars; |
|
|
|
|
|
|
|
|
use Yii; |
|
|
use Yii; |
|
|
use yii\behaviors\TimestampBehavior; |
|
|
use yii\behaviors\TimestampBehavior; |
|
|
|
|
|
use antgoods\goods\models\ars\Category; |
|
|
|
|
|
use antgoods\goods\models\ars\ShopCategory; |
|
|
|
|
|
use common\models\ars\File; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* This is the model class for table "antgoods_goods". |
|
|
* This is the model class for table "antgoods_goods". |
|
@ -61,8 +64,8 @@ class Goods extends \yii\db\ActiveRecord |
|
|
const SKU_MODE_ATTR = 1;//SKU类型属性
|
|
|
const SKU_MODE_ATTR = 1;//SKU类型属性
|
|
|
const SKU_MODE_MANUAL = 2;//SKU类型手写
|
|
|
const SKU_MODE_MANUAL = 2;//SKU类型手写
|
|
|
public static $isSale = [ |
|
|
public static $isSale = [ |
|
|
self::IS_SALE_NO => '否', |
|
|
|
|
|
self::IS_SALE_YES => '是' |
|
|
|
|
|
|
|
|
self::IS_SALE_NO => '不在售', |
|
|
|
|
|
self::IS_SALE_YES => '在售' |
|
|
]; |
|
|
]; |
|
|
public $ruleVerify = 0;//规则验证是否通过
|
|
|
public $ruleVerify = 0;//规则验证是否通过
|
|
|
/** |
|
|
/** |
|
@ -118,9 +121,9 @@ class Goods extends \yii\db\ActiveRecord |
|
|
return [ |
|
|
return [ |
|
|
'id' => 'id', |
|
|
'id' => 'id', |
|
|
'pid' => '父级id', |
|
|
'pid' => '父级id', |
|
|
'cat_id' => '后台商品类别id', |
|
|
|
|
|
|
|
|
'cat_id' => '后台商品类别', |
|
|
'brand_id' => '品牌id', |
|
|
'brand_id' => '品牌id', |
|
|
'shop_cat_id' => '前端商品类别id', |
|
|
|
|
|
|
|
|
'shop_cat_id' => '前端商品类别', |
|
|
'name' => '商品名称', |
|
|
'name' => '商品名称', |
|
|
'sn' => '商品唯一货号', |
|
|
'sn' => '商品唯一货号', |
|
|
'code' => '商品货码', |
|
|
'code' => '商品货码', |
|
@ -139,9 +142,9 @@ class Goods extends \yii\db\ActiveRecord |
|
|
'price' => '销售价', |
|
|
'price' => '销售价', |
|
|
'brief' => '简介', |
|
|
'brief' => '简介', |
|
|
'description' => '详细介绍', |
|
|
'description' => '详细介绍', |
|
|
'image' => '图片id', |
|
|
|
|
|
|
|
|
'image' => '首页图片', |
|
|
'model_id' => '模型id', |
|
|
'model_id' => '模型id', |
|
|
'is_sale' => '该商品是否开放销售', |
|
|
|
|
|
|
|
|
'is_sale' => '销售状态', |
|
|
'sort_order' => '排序', |
|
|
'sort_order' => '排序', |
|
|
'bouns_points' => '奖励积分', |
|
|
'bouns_points' => '奖励积分', |
|
|
'experience_points' => '经验值', |
|
|
'experience_points' => '经验值', |
|
@ -186,4 +189,19 @@ class Goods extends \yii\db\ActiveRecord |
|
|
} |
|
|
} |
|
|
return parent::beforeSave($insert); // TODO: Change the autogenerated stub
|
|
|
return parent::beforeSave($insert); // TODO: Change the autogenerated stub
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getCategory() |
|
|
|
|
|
{ |
|
|
|
|
|
return $this->hasOne(Category::className(), ['id' => 'cat_id']); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getShopCategory() |
|
|
|
|
|
{ |
|
|
|
|
|
return $this->hasOne(ShopCategory::className(), ['id' => 'shop_cat_id']); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getImageFile() |
|
|
|
|
|
{ |
|
|
|
|
|
return $this->hasOne(File::className(), ['id' => 'image']); |
|
|
|
|
|
} |
|
|
} |
|
|
} |