feat: 添加批量采购询盘分页/导出接口

This commit is contained in:
2025-03-13 16:23:37 +08:00
parent 7a5df71aff
commit df22b9d87a
5 changed files with 202 additions and 5 deletions

View File

@@ -0,0 +1,46 @@
<?php
declare (strict_types = 1);
namespace app\admin\model\v1;
use app\common\model\BulkPurchaseInquiryBaseModel;
/**
* 批量采购询盘模型
* @mixin \think\Model
*/
class BulkPurchaseInquiryModel extends BulkPurchaseInquiryBaseModel
{
// 按语言查询
public function scopeLanguage($query, $value)
{
$query->where('language_id', '=', $value);
}
// 公司名称搜索
public function searchCorpNameAttr($query, $value)
{
if (is_null($value)) return;
$query->where('corp_name', 'like', "%{$value}%");
}
// 兴趣(感兴趣的产品分类)
public function searchInterestedAttr($query, $value)
{
if (is_null($value)) return;
$query->where('interested', 'like', "%{$value}%");
}
// 添加时间搜索
public function searchCreatedAtAttr($query, $value)
{
if (is_null($value)) return;
if (is_array($value)) {
if (count($value) > 1) {
$query->whereBetweenTime('created_at', $value[0], $value[1]);
} else {
$query->whereTime('created_at', $value[0]);
}
}
}
}