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.
688 lines
21 KiB
688 lines
21 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\service\admin\lesson_course_teaching;
|
|
|
|
use app\model\lesson_course_teaching\LessonCourseTeaching;
|
|
use app\model\personnel_data\PersonnelData;
|
|
use app\model\exam_papers\ExamPapers;
|
|
|
|
use core\base\BaseAdminService;
|
|
|
|
|
|
/**
|
|
* 教研管理服务层
|
|
* Class LessonCourseTeachingService
|
|
* @package app\service\admin\lesson_course_teaching
|
|
*/
|
|
class LessonCourseTeachingService extends BaseAdminService
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->model = new LessonCourseTeaching();
|
|
}
|
|
|
|
/**
|
|
* 获取课程教学大纲列表
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public function getPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
|
|
/**
|
|
* 添加课程教学大纲
|
|
* @param array $data
|
|
* @return mixed
|
|
*/
|
|
public function add(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
|
|
/**
|
|
* 课程教学大纲编辑
|
|
* @param int $id
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function edit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取跳绳教案库列表
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public function jumpPetPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 添加跳绳教案库
|
|
* @param array $data
|
|
* @return mixed
|
|
*/
|
|
public function jumpAdd(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
|
|
/**
|
|
* 跳绳教案库编辑
|
|
* @param int $id
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function jumpEdit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* 获取增高教案库列表
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public function enPetPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 添加增高教案库
|
|
* @param array $data
|
|
* @return mixed
|
|
*/
|
|
public function enAdd(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
|
|
/**
|
|
* 跳绳增高教案库
|
|
* @param int $id
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function enEdit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取跳高教案库列表
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public function basketballPetPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 添加跳高教案库
|
|
* @param array $data
|
|
* @return mixed
|
|
*/
|
|
public function basketballAdd(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
|
|
/**
|
|
* 跳绳跳高教案库
|
|
* @param int $id
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function basketballEdit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* 获取跳高教案库列表
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public function strengPetPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 添加跳高教案库
|
|
* @param array $data
|
|
* @return mixed
|
|
*/
|
|
public function strengAdd(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
|
|
/**
|
|
* 跳绳跳高教案库
|
|
* @param int $id
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function strengEdit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* 获取跳高教案库列表
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public function ninjaPetPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 添加跳高教案库
|
|
* @param array $data
|
|
* @return mixed
|
|
*/
|
|
public function ninjaAdd(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
|
|
/**
|
|
* 跳绳跳高教案库
|
|
* @param int $id
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function ninjaEdit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* 获取跳高教案库列表
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public function securityPetPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 添加跳高教案库
|
|
* @param array $data
|
|
* @return mixed
|
|
*/
|
|
public function securityAdd(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
|
|
/**
|
|
* 跳绳跳高教案库
|
|
* @param int $id
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function securityEdit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* 获取体能教案库列表
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public function physicalPetPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 添加体能教案库
|
|
* @param array $data
|
|
* @return mixed
|
|
*/
|
|
public function physicalAdd(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
|
|
/**
|
|
* 跳绳体能教案库
|
|
* @param int $id
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function physicalEdit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 获取热身动做列表
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public function actionPetPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 添加热身动做
|
|
* @param array $data
|
|
* @return mixed
|
|
*/
|
|
public function actionAdd(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
|
|
/**
|
|
* 热身动做
|
|
* @param int $id
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function actionEdit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取趣味游戏列表
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public function gamesPetPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 添加趣味游戏
|
|
* @param array $data
|
|
* @return mixed
|
|
*/
|
|
public function gamesAdd(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
|
|
/**
|
|
* 趣味游戏
|
|
* @param int $id
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function gamesEdit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* 获取趣味游戏列表
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public function fitnessPetPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 添加趣味游戏
|
|
* @param array $data
|
|
* @return mixed
|
|
*/
|
|
public function fitnessAdd(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
|
|
/**
|
|
* 趣味游戏
|
|
* @param int $id
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function fitnessEdit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取趣味游戏列表
|
|
* @param array $where
|
|
* @return array
|
|
*/
|
|
public function relaxationPetPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 添加趣味游戏
|
|
* @param array $data
|
|
* @return mixed
|
|
*/
|
|
public function relaxationAdd(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
|
|
/**
|
|
* 趣味游戏
|
|
* @param int $id
|
|
* @param array $data
|
|
* @return bool
|
|
*/
|
|
public function relaxationEdit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
|
|
public function publicPetPage(array $where = [])
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
|
|
$order = 'id desc';
|
|
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
public function publicAdd(array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$res = $this->model->create($data);
|
|
return $res->id;
|
|
|
|
}
|
|
public function publicEdit(int $id, array $data)
|
|
{
|
|
if (isset($data['user_permission']) && is_array($data['user_permission'])) {
|
|
$data['user_permission'] = implode(',', $data['user_permission']);
|
|
}
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
|
|
public function bindingModuleAdd(int $id, array $data)
|
|
{
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
/**
|
|
* 获取教研管理信息
|
|
* @param int $id
|
|
* @return array
|
|
*/
|
|
public function getInfo(int $id)
|
|
{
|
|
$field = 'id,title,image,type,url,content,status,create_time,update_time,delete_time,table_type,user_permission,url,exam_papers_id';
|
|
$info = $this->model->field($field)->where([['id', "=", $id]])->with(['personnelData'])->findOrEmpty()->toArray();
|
|
$info['status'] = strval($info['status']);
|
|
$info['type'] = strval($info['type']);
|
|
return $info;
|
|
}
|
|
|
|
/**
|
|
* 删除教研管理
|
|
* @param int $id
|
|
* @return bool
|
|
*/
|
|
public function del(int $id)
|
|
{
|
|
$model = $this->model->where([['id', '=', $id]])->find();
|
|
$res = $model->delete();
|
|
return $res;
|
|
}
|
|
|
|
|
|
public function getPersonnelDataAll(array $where = []){
|
|
$personnelDataModel = new PersonnelData();
|
|
// $field = 'id,name,gender,phone,status,status,sys_user_id,create_time,update_time';
|
|
$order = 'a.id desc';
|
|
$whereArr = [];
|
|
if (!empty($where['name'])) {
|
|
$whereArr[] = ['a.name','like',"'%'".$where['name']."'%'"];
|
|
}
|
|
if (!empty($where['phone'])) {
|
|
$whereArr[] = ['a.phone','like',"'%'".$where['phone']."'%'"];
|
|
}
|
|
|
|
if (!empty($where['role_id'])) {
|
|
$whereArr[] = ['b.role_id','=',$where['role_id']];
|
|
}
|
|
if (!empty($where['dept_id'])) {
|
|
$whereArr[] = ['b.dept_id','=',$where['dept_id']];
|
|
}
|
|
|
|
$search_model = $personnelDataModel
|
|
->alias("a")
|
|
->join(['school_campus_person_role' => 'b'],'a.id = b.person_id','left')
|
|
->where('a.is_sys_user', 1)
|
|
->field("a.*,b.role_id,b.dept_id")
|
|
->where($whereArr)
|
|
->group("a.id")
|
|
->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
return $list;
|
|
}
|
|
|
|
public function getTestPaperList(array $where = []){
|
|
$ExamPapersModel = new ExamPapers();
|
|
$field = 'id,selection_mode,total_score,passing_score,created_at';
|
|
$order = 'id desc';
|
|
$whereArr = [];
|
|
if (!empty($where['total_score'])) {
|
|
$whereArr[] = ['total_score','=',$where['total_score']];
|
|
}
|
|
if (!empty($where['selection_mode'])) {
|
|
$whereArr[] = ['selection_mode','=',$where['selection_mode']];
|
|
}
|
|
$search_model = $ExamPapersModel->where($whereArr)->field($field)->order($order);
|
|
$list = $this->pageQuery($search_model);
|
|
|
|
return $list;
|
|
}
|
|
|
|
public function bindingTestModule(int $id, array $data)
|
|
{
|
|
$this->model->where([['id', '=', $id]])->update($data);
|
|
return true;
|
|
}
|
|
|
|
}
|
|
|