Files
orico-official-website/app/index/model/ProductPurchaseLinkModel.php
jsasg e2265629f9 feat: 产品
refactor: 产品详情页seo
2025-04-27 16:46:05 +08:00

29 lines
682 B
PHP

<?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);
}
}