update($params); } public function getStartTimeAttr($data){ if ($data > 0){ return date('Y-m-d H:i:s',$data); } return ''; } public function getEndTimeAttr($data){ if ($data > 0){ return date('Y-m-d H:i:s',$data); } return ''; } public static function lists() { $data = static::where('is_delete',0)->where('home_type',1) ->field('id,home_type,start_time,end_time,open_status')->find(); if ($data && strtotime($data['start_time']) < time() && strtotime($data['end_time']) > time() && $data['open_status'] == 1){ $data['real_open_status'] = 1; }else{ $data['real_open_status'] = 0; } return ['act'=>$data]; } public static function settingUpdate($settings){ return static::where('id',1)->where('home_type',1) ->update(['setting'=>$settings]); } public function getSettingAttr($data){ if ($data){ return json_decode($data); } return null; } public static function getPage(){ return self::where(['home_type'=>1]) ->field('id,home_type,setting,file_id,open_status') ->find(); } }