refactor: 更新产品接口添加sku处理逻辑

This commit is contained in:
2025-02-13 11:57:54 +08:00
parent 39c0de87b7
commit a16e1a0ff1
6 changed files with 205 additions and 64 deletions

View File

@@ -0,0 +1,15 @@
<?php
declare (strict_types = 1);
namespace app\admin\model\v1;
use app\common\model\ProductSkuAttrBaseModel;
/**
* 产品 - sku属性模型
* @mixin \think\Model
*/
class ProductSkuAttrModel extends ProductSkuAttrBaseModel
{
//
}

View File

@@ -0,0 +1,24 @@
<?php
declare (strict_types = 1);
namespace app\admin\model\v1;
use app\common\model\ProductSkuBaseModel;
/**
* 产品 - sku模型
* @mixin \think\Model
*/
class ProductSkuModel extends ProductSkuBaseModel
{
// 设置json类型字段
protected $json = ['photo_album'];
// 设置JSON数据返回数组
protected $jsonAssoc = true;
// 所属产品查询
public function scopeProductId($query, $id)
{
$query->where('product_id', '=', $id);
}
}