feat: 添加留言记录(联系我们)分页/导出接口
This commit is contained in:
32
app/admin/model/v1/LeaveMessageModel.php
Normal file
32
app/admin/model/v1/LeaveMessageModel.php
Normal 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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user