feat: 添加批量采购询盘分页/导出接口
This commit is contained in:
46
app/admin/model/v1/BulkPurchaseInquiryModel.php
Normal file
46
app/admin/model/v1/BulkPurchaseInquiryModel.php
Normal 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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user