68 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			68 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 *  +----------------------------------------------------------------------
							 | 
						|||
| 
								 | 
							
								 *  | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
							 | 
						|||
| 
								 | 
							
								 *  +----------------------------------------------------------------------
							 | 
						|||
| 
								 | 
							
								 *  | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
							 | 
						|||
| 
								 | 
							
								 *  +----------------------------------------------------------------------
							 | 
						|||
| 
								 | 
							
								 *  | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
							 | 
						|||
| 
								 | 
							
								 *  +----------------------------------------------------------------------
							 | 
						|||
| 
								 | 
							
								 *  | Author: CRMEB Team <admin@crmeb.com>
							 | 
						|||
| 
								 | 
							
								 *  +----------------------------------------------------------------------
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * 联系我们留言
							 | 
						|||
| 
								 | 
							
								 * @author crud自动生成代码
							 | 
						|||
| 
								 | 
							
								 * @date 2025/03/13 11:55:43
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace app\dao\crud;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								use app\dao\BaseDao;
							 | 
						|||
| 
								 | 
							
								use app\model\crud\LeaveWord;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								/**
							 | 
						|||
| 
								 | 
							
								 * Class LeaveWordDao
							 | 
						|||
| 
								 | 
							
								 * @date 2025/03/13
							 | 
						|||
| 
								 | 
							
								 * @package app\dao\crud
							 | 
						|||
| 
								 | 
							
								 */
							 | 
						|||
| 
								 | 
							
								class LeaveWordDao extends BaseDao
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    /**
							 | 
						|||
| 
								 | 
							
								     * 设置模型
							 | 
						|||
| 
								 | 
							
								     * @return string
							 | 
						|||
| 
								 | 
							
								     * @date 2025/03/13
							 | 
						|||
| 
								 | 
							
								     */
							 | 
						|||
| 
								 | 
							
								    protected function setModel(): string
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        return LeaveWord::class;
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								    /**
							 | 
						|||
| 
								 | 
							
								     * 搜索
							 | 
						|||
| 
								 | 
							
								     * @param array $where
							 | 
						|||
| 
								 | 
							
								     * @return \crmeb\basic\BaseModel
							 | 
						|||
| 
								 | 
							
								     * @throws \ReflectionException
							 | 
						|||
| 
								 | 
							
								     * @date {%DATE%}
							 | 
						|||
| 
								 | 
							
								     */
							 | 
						|||
| 
								 | 
							
								    public function searchCrudModel(array $where = [], $field = ['*'], string $order = '', array $with = [])
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        return $this->getModel()->field($field)->when($order !== '', function ($query) use ($order) {
							 | 
						|||
| 
								 | 
							
								            $query->order($order);
							 | 
						|||
| 
								 | 
							
								        })->when($with, function ($query) use ($with) {
							 | 
						|||
| 
								 | 
							
								            $query->with($with);
							 | 
						|||
| 
								 | 
							
								        })->when(!empty($where['name']), function($query) use ($where) {
							 | 
						|||
| 
								 | 
							
								            $query->whereLike('name', '%'.$where['name'].'%');
							 | 
						|||
| 
								 | 
							
								        })->when(!empty($where['mobile']), function($query) use ($where) {
							 | 
						|||
| 
								 | 
							
								            $query->whereLike('mobile', '%'.$where['mobile'].'%');
							 | 
						|||
| 
								 | 
							
								        })->when(!empty($where['content']), function($query) use ($where) {
							 | 
						|||
| 
								 | 
							
								            $query->whereLike('content', '%'.$where['content'].'%');
							 | 
						|||
| 
								 | 
							
								        })->when(!empty($where['create_time']), function($query) use ($where) {
							 | 
						|||
| 
								 | 
							
								            $query->whereBetween('create_time', $where['create_time']);
							 | 
						|||
| 
								 | 
							
								        });
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								}
							 |