|
|
@ -47,6 +47,10 @@ use backend\modules\goods\models\ars\Supplier; |
|
|
|
* @property int $created_at 创建时间 |
|
|
|
* @property int $updated_at 更新时间 |
|
|
|
* @property int $sku_mode sku类型 |
|
|
|
* @property int $is_taking 是否自提 |
|
|
|
* @property int $is_express 是否快递发货 |
|
|
|
* @property int $express_type 快递运费方式 |
|
|
|
* @property int $uniform_postage 统一邮费 |
|
|
|
*/ |
|
|
|
class Goods extends \yii\db\ActiveRecord |
|
|
|
{ |
|
|
@ -62,9 +66,31 @@ class Goods extends \yii\db\ActiveRecord |
|
|
|
//该商品是否开放销售is_sale
|
|
|
|
const IS_SALE_NO = 0;//否
|
|
|
|
const IS_SALE_YES = 1;//是
|
|
|
|
//sku类型
|
|
|
|
//类型sku
|
|
|
|
const SKU_MODE_ATTR = 1;//SKU类型属性
|
|
|
|
const SKU_MODE_MANUAL = 2;//SKU类型手写
|
|
|
|
//是否自提is_taking
|
|
|
|
const IS_TAKING_NO = 0; //否
|
|
|
|
const IS_TAKING_YES = 1; //是
|
|
|
|
//是否快递发货is_express
|
|
|
|
const IS_EXPRESS_NO = 0; //否
|
|
|
|
const IS_EXPRESS_YES = 1; //是
|
|
|
|
//快递运费计算方式express_type
|
|
|
|
const EXPRESS_TYPE_UNIFORM_POSTAGE = 1; //统一邮费
|
|
|
|
const EXPRESS_TYPE_EXPRESS_TEMPLAGE = 2; //运费模板
|
|
|
|
|
|
|
|
public static $isTaking = [ |
|
|
|
self::IS_TAKING_NO => '否', |
|
|
|
self::IS_TAKING_YES => '是' |
|
|
|
]; |
|
|
|
public static $isExpress = [ |
|
|
|
self::IS_EXPRESS_NO => '否', |
|
|
|
self::IS_EXPRESS_YES => '是' |
|
|
|
]; |
|
|
|
public static $expressType = [ |
|
|
|
self::EXPRESS_TYPE_UNIFORM_POSTAGE => '统一邮费', |
|
|
|
self::EXPRESS_TYPE_EXPRESS_TEMPLAGE => '运费模板' |
|
|
|
]; |
|
|
|
public static $isSale = [ |
|
|
|
self::IS_SALE_NO => '不在售', |
|
|
|
self::IS_SALE_YES => '在售' |
|
|
@ -84,7 +110,7 @@ class Goods extends \yii\db\ActiveRecord |
|
|
|
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', 'sku_mode'], 'integer'], |
|
|
|
[['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', 'sku_mode', 'is_taking', 'is_express', 'express_type'], 'integer'], |
|
|
|
[['cat_id', 'brand_id', 'shop_cat_id', 'name'], 'required'], |
|
|
|
[['sn'], 'checkExist'], |
|
|
|
[['description', 'coverImageId', 'detailImageId'], 'string'], |
|
|
@ -93,7 +119,8 @@ class Goods extends \yii\db\ActiveRecord |
|
|
|
[['code'], 'string', 'max' => 50], |
|
|
|
[['unit'], 'string', 'max' => 16], |
|
|
|
[['brief'], 'string', 'max' => 255], |
|
|
|
[['weight', 'length', 'width', 'height', 'diameter', 'sold_count', 'market_price', 'price'], 'checkNegative'], |
|
|
|
[['weight', 'length', 'width', 'height', 'diameter', 'sold_count', 'market_price', 'price', 'uniform_postage'], 'checkNegative'], |
|
|
|
[['uniform_postage'], 'safe'] |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
@ -164,9 +191,14 @@ class Goods extends \yii\db\ActiveRecord |
|
|
|
'bouns_points' => '奖励积分', |
|
|
|
'experience_points' => '经验值', |
|
|
|
'is_delete' => '是否删除,1为已删除', |
|
|
|
'express_template' => '配送详情id', |
|
|
|
'express_template' => '配送详情', |
|
|
|
'created_at' => '创建时间', |
|
|
|
'updated_at' => '更新时间', |
|
|
|
'sku_mode' => 'sku类型', |
|
|
|
'is_taking' => '是否自提', |
|
|
|
'is_express' => '是否快递发货', |
|
|
|
'express_type' => '快递运费方式', |
|
|
|
'uniform_postage' => '统一邮费', |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|