'ID', 'role_id' => 'Role ID', 'admin_id' => 'Admin ID', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } public static function setData(array $post){ try{ if(!empty($post['id'])){ $model = self::findOne(['id' => $post['id']]); if(empty($model)) throw new \Exception('服务不存在或已删除'); }else{ $model = new self(); $model->loadDefaultValues(); } isset($post['role_id']) && $model->role_id = $post['role_id']; isset($post['admin_id']) && $model->admin_id = $post['admin_id']; $res = $model->save(); if($res === false) throw new \Exception($model->getErrorMessage()); return $model; }catch(\Exception $e){ self::$static_error = $e->getMessage(); return false; } } }