6
0
Fork 0

修改商品SPU和商品SKU表结构

release
李静 2021-11-26 14:25:43 +08:00
parent 5d1f06ed6d
commit 79a086cb89
4 changed files with 52 additions and 10 deletions

View File

@ -18,9 +18,30 @@ class ProductSku extends Model
'sell_price' => Price::class,
'market_price' => Price::class,
'cost_price' => Price::class,
'user_price' => Price::class,
'vip_price' => Price::class,
'attrs' => JsonArray::class,
'specs' => 'json',
'online_at' => 'datetime',
'release_at' => 'datetime',
];
/**
* @var array
*/
protected $fillable = [
'name',
'subtitle',
'category_id',
'codcovere',
'images',
'sell_price',
'market_price',
'cost_price',
'vip_price',
'media',
'weight',
'attrs',
'stock',
'sales',
'release_at',
];
}

View File

@ -16,8 +16,29 @@ class ProductSpu extends Model
'sell_price' => Price::class,
'market_price' => Price::class,
'cost_price' => Price::class,
'user_price' => Price::class,
'vip_price' => Price::class,
'attrs' => JsonArray::class,
'online_at' => 'datetime',
'release_at' => 'datetime',
];
/**
* @var array
*/
protected $fillable = [
'name',
'subtitle',
'category_id',
'codcovere',
'images',
'sell_price',
'market_price',
'cost_price',
'vip_price',
'media',
'weight',
'attrs',
'stock',
'sales',
'release_at',
];
}

View File

@ -24,17 +24,17 @@ class CreateProductSpusTable extends Migration
$table->bigInteger('sell_price')->unsigned()->default(0)->comment('销售价格:分');
$table->bigInteger('market_price')->unsigned()->default(0)->comment('市场价格:分');
$table->bigInteger('cost_price')->unsigned()->default(0)->comment('成本价格:分');
$table->bigInteger('user_price')->unsigned()->nullable()->comment('会员价格:分');
$table->bigInteger('vip_price')->unsigned()->nullable()->comment('会员价格:分');
$table->string('media')->nullable()->comment('媒体地址');
$table->integer('weight')->unsigned()->nullable()->comment('重量:g');
$table->json('attrs')->nullable()->comment('属性文本');
$table->integer('stock')->unsigned()->default(0)->comment('库存');
$table->integer('sales')->unsigned()->default(0)->comment('销量');
$table->timestamp('online_at')->nullable()->comment('上线时间');
$table->timestamp('release_at')->nullable()->comment('上时间');
$table->timestamps();
$table->index('category_id');
$table->index('online_at');
$table->index('release_at');
});
}

View File

@ -25,19 +25,19 @@ class CreateProductSkusTable extends Migration
$table->bigInteger('sell_price')->unsigned()->default(0)->comment('销售价格:分');
$table->bigInteger('market_price')->unsigned()->default(0)->comment('市场价格:分');
$table->bigInteger('cost_price')->unsigned()->default(0)->comment('成本价格:分');
$table->bigInteger('user_price')->unsigned()->nullable()->comment('会员价格:分');
$table->bigInteger('vip_price')->unsigned()->nullable()->comment('会员价格:分');
$table->string('media')->nullable()->comment('媒体地址');
$table->integer('weight')->unsigned()->nullable()->comment('重量:g');
$table->json('attrs')->nullable()->comment('属性文本');
$table->json('specs')->nullable()->comment('规格属性');
$table->integer('stock')->unsigned()->default(0)->comment('库存');
$table->integer('sales')->unsigned()->default(0)->comment('销量');
$table->timestamp('online_at')->nullable()->comment('上线时间');
$table->timestamp('release_at')->nullable()->comment('上时间');
$table->timestamps();
$table->index('spu_id');
$table->index('category_id');
$table->index('online_at');
$table->index('release_at');
});
}