model = new Personnel(); } //获取教研管理文章列表 public function list($id,$table_type){ $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,url,exam_papers_id'; $order = 'id desc'; $LessonCourseTeaching = new LessonCourseTeaching(); $where = []; if ($table_type) { $where[] = ['table_type','=',$table_type]; } if ($id !== null && $id !== '') { $where[] = [Db::raw("FIND_IN_SET($id, user_permission)"), '>', 0]; } $search_model = $LessonCourseTeaching->where($where)->field($field)->order($order); $list = $this->pageQuery($search_model); return $list; } //获取教研管理文章详情 public function info($id){ $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,url,exam_papers_id'; $LessonCourseTeaching = new LessonCourseTeaching(); $info = $LessonCourseTeaching->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray(); if (is_array($info) && isset($info['type']) && $info['type'] == 2 && !empty($info['url']) && is_string($info['url'])) { $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://"; $domain = $_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME'] ?? 'localhost'; $info['url'] = $protocol . $domain . '/' . $info['url']; } return $info; } //获取能看的教研管理类型 public function lookType($id){ $LessonCourseTeaching = new LessonCourseTeaching(); $where = []; if ($id !== null && $id !== '') { $where[] = [Db::raw("FIND_IN_SET($id, user_permission)"), '>', 0]; } $list = $LessonCourseTeaching->where($where)->distinct(true)->column('table_type'); return $list; } }