feat: 添加留言记录(联系我们)分页/导出接口

This commit is contained in:
2025-03-13 11:54:42 +08:00
parent ea3ca9f954
commit 640d3afd53
5 changed files with 147 additions and 2 deletions

View File

@@ -0,0 +1,32 @@
<?php
declare (strict_types = 1);
namespace app\admin\model\v1;
use app\common\model\LeaveMessageBaseModel;
/**
* 留言记录(联系我们)模型
* @mixin \think\Model
*/
class LeaveMessageModel extends LeaveMessageBaseModel
{
// 根据语言查询
public function scopeLanguage($query, $value)
{
$query->where('language_id', '=', $value);
}
// 按添加时间搜索
public function searchCreatedAtAttr($query, $value, $data)
{
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]);
}
}
}
}