<?php /** * Created by 2022/12/2. * User: Jone * Info: 2022/12/2 * Time: 上午10:27 */ namespace App\Model; use Illuminate\Database\Eloquent\Model; class SystemUpdateModel extends Model { protected $connection = 'messagemodel'; protected $table = 'system_update'; protected $primaryKey = 'smue_id'; public $timestamps = false; public function getWhereObj($data) { $obj = self::orderBy('smue_id','desc'); foreach ($data as $key=>$val){ if ($val === '')continue; switch ($key){ case 'system_name': case 'update_type': case 'version_num': case 'weonlt_id': $obj = $obj->where($key,$val);break; case 'update_title': case 'update_content': $obj = $obj->where($key,'like','%'.$val.'%');break; case 'begin_time': $obj = $obj->where('create_time','>',strtotime($val));break; case 'end_time': $obj = $obj->where('create_time','<=',strtotime($val));break; } } return $obj; } }