You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
3.1 KiB
81 lines
3.1 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\service\api\apiService;
|
|
|
|
use app\model\campus_person_role\CampusPersonRole;
|
|
use app\model\departments\Departments;
|
|
use app\model\lesson_course_teaching\LessonCourseTeaching;
|
|
use app\model\member\Member;
|
|
use app\model\personnel\Personnel;
|
|
use app\model\sys\SysRole;
|
|
use app\service\core\member\CoreMemberService;
|
|
use core\base\BaseApiService;
|
|
use core\exception\ApiException;
|
|
use core\util\Barcode;
|
|
use think\Model;
|
|
use think\facade\Db;
|
|
|
|
/**
|
|
* 员工服务层
|
|
* Class MemberService
|
|
* @package app\service\api\member
|
|
*/
|
|
class TeachingResearchService extends BaseApiService
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->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';
|
|
$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';
|
|
$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;
|
|
}
|
|
}
|
|
|