feat: 产品相关接口
This commit is contained in:
31
app/common/model/BaseModel.php
Normal file
31
app/common/model/BaseModel.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class BaseModel extends Model
|
||||
{
|
||||
/**
|
||||
* 根据主键查询
|
||||
*/
|
||||
public function scopeBypk($query, $pk)
|
||||
{
|
||||
$query->where((new static)->pk, '=', $pk);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据多主键查询
|
||||
*/
|
||||
public function scopeBypks($query, $pks)
|
||||
{
|
||||
if (!is_array($pks) && (is_string($pks) && false === strpos($pks, ','))) {
|
||||
throw new \Exception('pks参数为级数或逗号分隔字符串');
|
||||
}
|
||||
$query->where((new static)->pk, 'in', $pks);
|
||||
}
|
||||
}
|
||||
28
app/common/model/ProductAttrBaseModel.php
Normal file
28
app/common/model/ProductAttrBaseModel.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 产品属性模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductAttrBaseModel extends BaseModel
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'product_attr';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'language_id' => 'int',
|
||||
'attr_name' => 'string',
|
||||
'is_system' => 'string',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
26
app/common/model/ProductAttrPropBaseModel.php
Normal file
26
app/common/model/ProductAttrPropBaseModel.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 产品属性特征模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductAttrPropBaseModel extends BaseModel
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'product_attr_prop';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'prop_name' => 'string',
|
||||
'prop_value' => 'string',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
43
app/common/model/ProductBaseModel.php
Normal file
43
app/common/model/ProductBaseModel.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 产品spu模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductBaseModel extends BaseModel
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'product';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'language_id' => 'int',
|
||||
'category_id' => 'int',
|
||||
'spu' => 'string',
|
||||
'name' => 'string',
|
||||
'short_name' => 'string',
|
||||
'cover_image' => 'string',
|
||||
'desc' => 'string',
|
||||
'video_img' => 'string',
|
||||
'video_url' => 'string',
|
||||
'is_sale' => 'int',
|
||||
'is_new' => 'int',
|
||||
'is_hot' => 'int',
|
||||
'sort' => 'int',
|
||||
'detail' => 'string',
|
||||
'status' => 'int',
|
||||
'seo_title' => 'string',
|
||||
'seo_keywords' => 'string',
|
||||
'seo_desc' => 'string',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime'
|
||||
];
|
||||
}
|
||||
38
app/common/model/ProductCategoryBaseModel.php
Normal file
38
app/common/model/ProductCategoryBaseModel.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 产品分类模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductCategoryBaseModel extends BaseModel
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'product_category';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'language_id' => 'int',
|
||||
'unique_id' => 'string',
|
||||
'pid' => 'int',
|
||||
'name' => 'string',
|
||||
'icon' => 'string',
|
||||
'desc' => 'string',
|
||||
'related_tco_category' => 'string',
|
||||
'sort' => 'int',
|
||||
'level' => 'int',
|
||||
'is_show' => 'int',
|
||||
'seo_title' => 'string',
|
||||
'seo_keywords' => 'string',
|
||||
'seo_desc' => 'string',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
32
app/common/model/ProductInquiryBaseModel.php
Normal file
32
app/common/model/ProductInquiryBaseModel.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 产品询盘记录模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductInquiryBaseModel extends BaseModel
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'product_inquiry';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'language_id' => 'int',
|
||||
'corp_name' => 'string',
|
||||
'fisrt_name' => 'string',
|
||||
'last_name' => 'string',
|
||||
'email' => 'string',
|
||||
'phone' => 'string',
|
||||
'country_name' => 'string',
|
||||
'industry' => 'string',
|
||||
'message' => 'string',
|
||||
'created_at' => 'datetime'
|
||||
];
|
||||
}
|
||||
27
app/common/model/ProductParamsBaseModel.php
Normal file
27
app/common/model/ProductParamsBaseModel.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 产品参数模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductParamsBaseModel extends BaseModel
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'product_params';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'product_id' => 'int',
|
||||
'name' => 'string',
|
||||
'value' => 'string',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
28
app/common/model/ProductPurchaseLinkBaseModel.php
Normal file
28
app/common/model/ProductPurchaseLinkBaseModel.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 产品购买链接模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductPurchaseLinkBaseModel extends BaseModel
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'product_purchase_link';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'language_id' => 'int',
|
||||
'product_id' => 'int',
|
||||
'platform_id' => 'int',
|
||||
'link' => 'string',
|
||||
'sort' => 'int',
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
27
app/common/model/ProductPurchasePlatformBaseModel.php
Normal file
27
app/common/model/ProductPurchasePlatformBaseModel.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 产品购买平台模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductPurchasePlatformBaseModel extends BaseModel
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'product_purchase_platform';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'language_id' => 'int',
|
||||
'platform' => 'string',
|
||||
'desc' => 'string',
|
||||
'sort' => 'int',
|
||||
'created_at' => 'datetime'
|
||||
];
|
||||
}
|
||||
28
app/common/model/ProductRelatedBaseModel.php
Normal file
28
app/common/model/ProductRelatedBaseModel.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 产品 - 关联产品模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductRelatedBaseModel extends BaseModel
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'product_related';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'product_id' => 'int',
|
||||
'related_product_id' => 'int',
|
||||
'desc' => 'string',
|
||||
'sort' => 'int',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
23
app/common/model/ProductSkuAttrBaseModel.php
Normal file
23
app/common/model/ProductSkuAttrBaseModel.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 产品sku属性模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductSkuAttrBaseModel extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'product_sku_attr';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'sku_id' => 'int',
|
||||
'attr_id' => 'int',
|
||||
'prop_id' => 'int',
|
||||
];
|
||||
}
|
||||
29
app/common/model/ProductSkuBaseModel.php
Normal file
29
app/common/model/ProductSkuBaseModel.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 产品sku模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductSkuBaseModel extends BaseModel
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'product_sku';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'product_id' => 'int',
|
||||
'sku' => 'string',
|
||||
'main_image' => 'string',
|
||||
'photo_album' => 'string',
|
||||
'sort' => 'int',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime'
|
||||
];
|
||||
}
|
||||
35
app/common/model/ProductTcoCategoryBaseModel.php
Normal file
35
app/common/model/ProductTcoCategoryBaseModel.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 产品 - 产品目录分类同步记录模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductTcoCategoryBaseModel extends BaseModel
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'product_tco_category';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'language_id' => 'int',
|
||||
'name' => 'int',
|
||||
'tco_id' => 'int',
|
||||
'tco_pid' => 'int',
|
||||
'tco_path' => 'string',
|
||||
'erp_id' => 'int',
|
||||
'erp_pid' => 'int',
|
||||
'erp_path' => 'string',
|
||||
'disabled' => 'int',
|
||||
'sync_time' => 'int',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user