<?php namespace app\admin\model; use think\Model; class CfHotelInfo extends Model { // 表名 protected $name = 'cf_hotel_info'; // 自动写入时间戳字段 protected $autoWriteTimestamp = false; // 定义时间戳字段名 protected $createTime = false; protected $updateTime = false; protected $deleteTime = false; // 追加属性 protected $append = [ ]; public function getList($name='',$keyValue=''){ $this->field('id,hotel_name as name'); if($keyValue){ $this->where(['id'=>$keyValue]); }elseif($name){ $this->where(['hotel_name'=>['like','%'.$name.'%']]); } return $this->select(); } }