chaoyu/app/model/Message.php

27 lines
831 B
PHP

<?php
namespace app\model;
class Message extends Base
{
// 获取留言列表
public static function getPaginateList($per = 20, $keyword = '', $isSimple = false)
{
$paginate = [
'list_rows' => $per,
'query' => [
'keyword' => $keyword,
]
];
return self::when(!empty($keyword), function ($query) use ($keyword) {
$map = [
['company_name', 'like', '%'.$keyword.'%'],
['name', 'like', '%'.$keyword.'%'],
['phone', 'like', '%'.$keyword.'%'],
['email', 'like', '%'.$keyword.'%'],
];
$query->whereOr($map);
})
->order('create_time', 'desc')
->paginate($paginate, $isSimple);
}
}