feat: 产品
refactor: 产品详情页seo
This commit is contained in:
28
app/index/model/ProductPurchaseLinkModel.php
Normal file
28
app/index/model/ProductPurchaseLinkModel.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\index\model;
|
||||
|
||||
use app\common\model\ProductPurchaseLinkBaseModel;
|
||||
|
||||
/**
|
||||
* 产品购买链接模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductPurchaseLinkModel extends ProductPurchaseLinkBaseModel
|
||||
{
|
||||
// 关联购买平台
|
||||
public function platform()
|
||||
{
|
||||
return $this->hasOne(ProductPurchasePlatformModel::class, 'id', 'platform_id');
|
||||
}
|
||||
|
||||
// 所属产品范围查询
|
||||
public function scopeByProductId($query, $product_id)
|
||||
{
|
||||
if (is_array($product_id)) {
|
||||
return $query->where('product_id', 'IN', $product_id);
|
||||
}
|
||||
return $query->where('product_id', '=', $product_id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user