商品库

This commit is contained in:
2025-12-17 10:40:58 +08:00
parent a02eddb0d0
commit 51b11b3437
13 changed files with 523 additions and 8 deletions
+6
View File
@@ -51,4 +51,10 @@ class PostFavorite extends Model
{
return $this->hasOne('app\common\model\Post', 'id', 'post_id');
}
protected function serializeDate(\DateTimeInterface $date)
{
// 此方法决定了模型日期字段序列化时的默认格式
return $date->format('Y-m-d H:i:s');
}
}
+49
View File
@@ -0,0 +1,49 @@
<?php
namespace app\common\model;
use support\Model;
class Sku extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'sku';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = true;
protected $dateFormat = 'U';
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'code', 'product_name', 'model', 'brand', 'category_id', 'main_image', 'image', 'unit', 'weight', 'size', 'spec_json', 'status', 'sort', 'price', 'desc', 'user_id', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}