Browse Source

合并wangzeyan

wangzeyan
王泽彦 11 months ago
parent
commit
dfaaa51b00
  1. 58
      admin/package-lock.json
  2. 5
      admin/package.json
  3. 6
      admin/src/app/views/classroom/classroom.vue
  4. 5
      admin/src/app/views/classroom/components/classroom-edit.vue
  5. 127
      admin/src/app/views/timetables/timetables.vue
  6. 81
      admin/src/app/views/yjpz_config/yjpz_config.vue
  7. 7620
      admin/yarn.lock
  8. 2
      niucloud/app/adminapi/route/class.php
  9. 2
      niucloud/app/adminapi/route/classroom.php
  10. 123
      niucloud/app/common.php
  11. 12
      niucloud/app/model/classroom/Classroom.php
  12. 6
      niucloud/app/service/admin/classroom/ClassroomService.php
  13. 2
      niucloud/app/service/admin/personnel/PersonnelService.php

58
admin/package-lock.json

@ -9,6 +9,11 @@
"version": "1.0.0",
"dependencies": {
"@element-plus/icons-vue": "2.0.10",
"@fullcalendar/core": "^6.1.17",
"@fullcalendar/daygrid": "^6.1.17",
"@fullcalendar/interaction": "^6.1.17",
"@fullcalendar/timegrid": "^6.1.17",
"@fullcalendar/vue3": "^6.1.17",
"@highlightjs/vue-plugin": "2.1.0",
"@types/lodash-es": "4.17.6",
"@vueuse/core": "9.12.0",
@ -962,6 +967,50 @@
"resolved": "https://registry.npmmirror.com/@floating-ui/utils/-/utils-0.1.6.tgz",
"integrity": "sha512-OfX7E2oUDYxtBvsuS4e/jSn4Q9Qb6DzgeYtsAdkPZ47znpoNsMgZw0+tVijiv3uGNR6dgNlty6r9rzIzHjtd/A=="
},
"node_modules/@fullcalendar/core": {
"version": "6.1.17",
"resolved": "https://registry.npmmirror.com/@fullcalendar/core/-/core-6.1.17.tgz",
"integrity": "sha512-0W7lnIrv18ruJ5zeWBeNZXO8qCWlzxDdp9COFEsZnyNjiEhUVnrW/dPbjRKYpL0edGG0/Lhs0ghp1z/5ekt8ZA==",
"dependencies": {
"preact": "~10.12.1"
}
},
"node_modules/@fullcalendar/daygrid": {
"version": "6.1.17",
"resolved": "https://registry.npmmirror.com/@fullcalendar/daygrid/-/daygrid-6.1.17.tgz",
"integrity": "sha512-K7m+pd7oVJ9fW4h7CLDdDGJbc9szJ1xDU1DZ2ag+7oOo1aCNLv44CehzkkknM6r8EYlOOhgaelxQpKAI4glj7A==",
"peerDependencies": {
"@fullcalendar/core": "~6.1.17"
}
},
"node_modules/@fullcalendar/interaction": {
"version": "6.1.17",
"resolved": "https://registry.npmmirror.com/@fullcalendar/interaction/-/interaction-6.1.17.tgz",
"integrity": "sha512-AudvQvgmJP2FU89wpSulUUjeWv24SuyCx8FzH2WIPVaYg+vDGGYarI7K6PcM3TH7B/CyaBjm5Rqw9lXgnwt5YA==",
"peerDependencies": {
"@fullcalendar/core": "~6.1.17"
}
},
"node_modules/@fullcalendar/timegrid": {
"version": "6.1.17",
"resolved": "https://registry.npmmirror.com/@fullcalendar/timegrid/-/timegrid-6.1.17.tgz",
"integrity": "sha512-K4PlA3L3lclLOs3IX8cvddeiJI9ZVMD7RA9IqaWwbvac771971foc9tFze9YY+Pqesf6S+vhS2dWtEVlERaGlQ==",
"dependencies": {
"@fullcalendar/daygrid": "~6.1.17"
},
"peerDependencies": {
"@fullcalendar/core": "~6.1.17"
}
},
"node_modules/@fullcalendar/vue3": {
"version": "6.1.17",
"resolved": "https://registry.npmmirror.com/@fullcalendar/vue3/-/vue3-6.1.17.tgz",
"integrity": "sha512-0+qi/PK/xCkTQXh2CaeN2AkP+SvQTznPhwBXuIyrtsR0Ua8UpmGEXI+my3qQ6o003r8gPUY2e785ywIyhX2zCA==",
"peerDependencies": {
"@fullcalendar/core": "~6.1.17",
"vue": "^3.0.11"
}
},
"node_modules/@highlightjs/vue-plugin": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/@highlightjs/vue-plugin/-/vue-plugin-2.1.0.tgz",
@ -4997,6 +5046,15 @@
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==",
"dev": true
},
"node_modules/preact": {
"version": "10.12.1",
"resolved": "https://registry.npmmirror.com/preact/-/preact-10.12.1.tgz",
"integrity": "sha512-l8386ixSsBdbreOAkqtrwqHwdvR35ID8c3rKPa8lCWuO86dBi32QWHV4vfsZK1utLLFMvw+Z5Ad4XLkZzchscg==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/preact"
}
},
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmmirror.com/prelude-ls/-/prelude-ls-1.2.1.tgz",

5
admin/package.json

@ -10,6 +10,11 @@
},
"dependencies": {
"@element-plus/icons-vue": "2.0.10",
"@fullcalendar/core": "^6.1.17",
"@fullcalendar/daygrid": "^6.1.17",
"@fullcalendar/interaction": "^6.1.17",
"@fullcalendar/timegrid": "^6.1.17",
"@fullcalendar/vue3": "^6.1.17",
"@highlightjs/vue-plugin": "2.1.0",
"@types/lodash-es": "4.17.6",
"@vueuse/core": "9.12.0",

6
admin/src/app/views/classroom/classroom.vue

@ -79,6 +79,7 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadClassroomList()">{{ t('search') }}</el-button>
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button>
@ -119,6 +120,7 @@
<el-table-column prop="sort_order" :label="t('sortOrder')" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column :label="t('operation')" fixed="right" min-width="120">
<template #default="{ row }">
<el-button type="primary" link @click="editEvent(row)">{{ t('edit') }}</el-button>
@ -143,8 +145,7 @@
import { reactive, ref, watch } from 'vue'
import { t } from '@/lang'
import { useDictionary } from '@/app/api/dict'
import { getClassroomList, deleteClassroom, getWithCampusList, getWithPersonnelList, getWithPersonnelList } from '@/app/api/classroom'
import { img } from '@/utils/common'
import { getClassroomList, deleteClassroom, getWithCampusList, getWithPersonnelList } from '@/app/api/classroom'
import { ElMessageBox,FormInstance } from 'element-plus'
import Edit from '@/app/views/classroom/components/classroom-edit.vue'
import { useRoute } from 'vue-router'
@ -185,6 +186,7 @@ const selectData = ref<any[]>([])
}
statusDictList();
/**
* 获取场地管理列表
*/

5
admin/src/app/views/classroom/components/classroom-edit.vue

@ -75,6 +75,7 @@
<el-input v-model="formData.remarks" clearable :placeholder="t('remarksPlaceholder')" class="input-width" />
</el-form-item>
</el-form>
<template #footer>
@ -93,7 +94,7 @@ import { ref, reactive, computed, watch } from 'vue'
import { useDictionary } from '@/app/api/dict'
import { t } from '@/lang'
import type { FormInstance } from 'element-plus'
import { addClassroom, editClassroom, getClassroomInfo, getWithCampusList, getWithPersonnelList, getWithPersonnelList } from '@/app/api/classroom'
import { addClassroom, editClassroom, getClassroomInfo, getWithCampusList, getWithPersonnelList } from '@/app/api/classroom'
let showDialog = ref(false)
const loading = ref(false)
@ -112,6 +113,7 @@ const initialFormData = {
status: '',
sort_order: '',
remarks: '',
}
const formData: Record<string, any> = reactive({ ...initialFormData })
@ -210,6 +212,7 @@ const confirm = async (formEl: FormInstance | undefined) => {
watch(() => statusList.value, () => { formData.status = statusList.value[0].value })
const campusIdList = ref([] as any[])
const setCampusIdList = async () => {
campusIdList.value = await (await getWithCampusList({})).data

127
admin/src/app/views/timetables/timetables.vue

@ -0,0 +1,127 @@
<template>
<div class="schedule-container">
<!-- 周视图日历 -->
<FullCalendar
:options="calendarOptions"
ref="fullCalendar"
class="calendar"
/>
<!-- 课程详情弹窗 -->
<el-dialog
v-model="dialogVisible"
title="课程人员安排"
width="30%"
:before-close="handleClose"
>
<div v-if="selectedEvent">
<h3>{{ selectedEvent.title }}</h3>
<p>时间{{ selectedEvent.time }}</p>
<h4>参与人员</h4>
<ul>
<li v-for="person in selectedEvent.people" :key="person.id">
{{ person.name }} - {{ person.role }}
</li>
</ul>
</div>
</el-dialog>
</div>
</template>
<script setup>
import {ref} from 'vue';
import FullCalendar from '@fullcalendar/vue3';
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import interactionPlugin from '@fullcalendar/interaction'; //
import zhLocale from '@fullcalendar/core/locales/zh-cn';
//
const courses = ref([
{
id: 1,
title: '数学课',
start: '2025-05-18 08:00:00',
end: '2025-05-18 09:00:00',
people: [
{id: 1, name: '张老师', role: '主讲'},
{id: 2, name: '李同学', role: '学生'}
]
},
{
id: 2,
title: '英语课',
start: '2025-05-18 10:00:00',
end: '2025-05-18 11:00:00',
people: [
{id: 3, name: '王老师', role: '主讲'}
]
}
]);
//
const dialogVisible = ref(false);
const selectedEvent = ref(null);
// FullCalendar
const calendarOptions = ref({
locale: zhLocale,
plugins: [
dayGridPlugin,
timeGridPlugin,
interactionPlugin //
],
initialView: 'timeGridWeek', //
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'timeGridWeek,timeGridDay' //
},
events: courses.value,
eventClick: (info) => {
selectedEvent.value = {
title: info.event.title,
time: `${info.event.start.toLocaleTimeString()} - ${info.event.end.toLocaleTimeString()}`,
people: info.event.extendedProps.people
};
dialogVisible.value = true;
},
eventContent: (arg) => {
//
return {html: `<div class="fc-event-title">${arg.event.title}</div>`};
},
allDaySlot: false, //
slotDuration: '01:00', // 1
slotLabelFormat: {
hour: 'numeric',
minute: '2-digit',
omitZeroMinute: false,
meridiem: 'short'
}
});
//
const handleClose = () => {
dialogVisible.value = false;
selectedEvent.value = null;
};
</script>
<style>
.schedule-container {
padding: 20px;
}
.calendar {
margin-bottom: 20px;
}
.fc-event-title {
white-space: normal !important;
font-size: 14px;
}
.fc-timegrid-event {
cursor: pointer;
}
</style>

81
admin/src/app/views/yjpz_config/yjpz_config.vue

@ -1,49 +1,54 @@
<template>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never">
<el-form
class="page-form"
:model="formData"
label-width="150px"
ref="ruleFormRef"
:rules="formRules"
v-loading="loading"
>
<el-form-item
v-for="day in weekDays"
:key="day.key"
:label="day.label"
:prop="`priceRules.${day.key}`"
<div class="flex justify-between items-center">
<span class="text-lg">市场人员绩效配置</span>
</div>
<div style="margin-top: 20px">
<el-form
class="page-form"
:model="formData"
label-width="150px"
ref="ruleFormRef"
:rules="formRules"
v-loading="loading"
>
<span style="margin: 0 8px">每个</span>
<el-input
v-model.number="formData.priceRules[day.key].basePrice"
placeholder="请输入"
class="input-width"
clearable
/>
<span style="margin: 0 8px"> 超过</span>
<el-input
v-model.number="formData.priceRules[day.key].limitCount"
placeholder="请输入"
class="input-width"
clearable
/>
<span style="margin: 0 8px"></span>
<el-input
v-model.number="formData.priceRules[day.key].extraPrice"
placeholder="请输入"
class="input-width"
clearable
/>
<span style="margin-left: 4px"></span>
</el-form-item>
</el-form>
<el-form-item
v-for="day in weekDays"
:key="day.key"
:label="day.label"
:prop="`priceRules.${day.key}`"
>
<span style="margin: 0 8px">每个</span>
<el-input
v-model.number="formData.priceRules[day.key].basePrice"
placeholder="请输入"
class="input-width"
clearable
/>
<span style="margin: 0 8px"> 超过</span>
<el-input
v-model.number="formData.priceRules[day.key].limitCount"
placeholder="请输入"
class="input-width"
clearable
/>
<span style="margin: 0 8px"></span>
<el-input
v-model.number="formData.priceRules[day.key].extraPrice"
placeholder="请输入"
class="input-width"
clearable
/>
<span style="margin-left: 4px"></span>
</el-form-item>
</el-form>
</div>
</el-card>
<div class="fixed-footer-wrap">
<div class="fixed-footer">
<el-button type="primary" @click="onSave()">提交</el-button>
<el-button type="primary" @click="onSave()">保存</el-button>
</div>
</div>
</div>

7620
admin/yarn.lock

File diff suppressed because it is too large

2
niucloud/app/adminapi/route/class.php

@ -57,8 +57,6 @@ Route::group('class', function () {
Route::get('personnel_all','class.Class/getPersonnelAll');
Route::get('personnel_all','class.Class/getPersonnelAll');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,

2
niucloud/app/adminapi/route/classroom.php

@ -33,8 +33,6 @@ Route::group('classroom', function () {
Route::get('personnel_all','classroom.Classroom/getPersonnelAll');
Route::get('personnel_all','classroom.Classroom/getPersonnelAll');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,

123
niucloud/app/common.php

@ -21,13 +21,13 @@ use app\service\core\sys\CoreSysConfigService;
* @param int $http_code
* @return Response
*/
function success($msg = 'SUCCESS', $data = [], int $code = 1, int $http_code = 200) : Response
function success($msg = 'SUCCESS', $data = [], int $code = 1, int $http_code = 200): Response
{
if (is_array($msg)) {
$data = $msg;
$msg = 'SUCCESS';
}
return Response::create([ 'data' => $data, 'msg' => get_lang($msg), 'code' => $code ], 'json', $http_code);
return Response::create(['data' => $data, 'msg' => get_lang($msg), 'code' => $code], 'json', $http_code);
}
@ -39,13 +39,13 @@ function success($msg = 'SUCCESS', $data = [], int $code = 1, int $http_code = 2
* @param int $http_code
* @return Response
*/
function fail($msg = 'FAIL', ?array $data = [], int $code = 0, int $http_code = 200) : Response
function fail($msg = 'FAIL', ?array $data = [], int $code = 0, int $http_code = 200): Response
{
if (is_array($msg)) {
$data = $msg;
$msg = 'FAIL';
}
return Response::create([ 'data' => $data, 'msg' => get_lang($msg), 'code' => $code ], 'json', $http_code);
return Response::create(['data' => $data, 'msg' => get_lang($msg), 'code' => $code], 'json', $http_code);
}
/**
@ -76,17 +76,17 @@ function list_to_tree($list, $pk = 'id', $pid = 'pid', $child = 'child', $root =
// 创建基于主键的数组引用
$refer = array();
foreach ($list as $key => $data) {
$refer[ $data[ $pk ] ] =& $list[ $key ];
$refer[$data[$pk]] =& $list[$key];
}
foreach ($list as $key => $data) {
// 判断是否存在parent
$parent_id = $data[ $pid ];
$parent_id = $data[$pid];
if ($root == $parent_id) {
$tree[] =& $list[ $key ];
$tree[] =& $list[$key];
} else {
if (isset($refer[ $parent_id ])) {
$parent =& $refer[ $parent_id ];
$parent[ $child ][] =& $list[ $key ];
if (isset($refer[$parent_id])) {
$parent =& $refer[$parent_id];
$parent[$child][] =& $list[$key];
}
}
}
@ -137,11 +137,11 @@ function array_keys_search($array, $keys, $index = '', $is_sort = true)
$list = array();
foreach ($keys as $key) {
if (isset($array[ $key ])) {
if (isset($array[$key])) {
if ($is_sort) {
$list[] = $array[ $key ];
$list[] = $array[$key];
} else {
$list[ $key ] = $array[ $key ];
$list[$key] = $array[$key];
}
}
@ -166,7 +166,7 @@ function del_target_dir($path, $delDir)
//打开目录句柄
$handle = opendir($path);
if ($handle) {
while (false !== ( $item = readdir($handle) )) {
while (false !== ($item = readdir($handle))) {
if ($item != "." && $item != "..") {
if (is_dir("$path/$item")) {
del_target_dir("$path/$item", $delDir);
@ -200,7 +200,7 @@ function system_name(?string $key = '')
'channel_name' => env('system.channel_name', 'channel'),
];
if (!empty($key)) {
return $params[ $key ];
return $params[$key];
} else {
return $params;
}
@ -219,11 +219,11 @@ function get_date_by_time(?int $time = null)
function get_start_and_end_time_by_day($day = '')
{
$date = $day ? : date('Y-m-d');
$date = $day ?: date('Y-m-d');
$day_start_time = strtotime($date);
//当天结束之间
$day_end_time = $day_start_time + 86400;
return [ $day_start_time, $day_end_time ];
return [$day_start_time, $day_end_time];
}
/**
@ -361,7 +361,7 @@ function format_money($number)
function format_float_money($number, $precision = 2)
{
if ($precision > 0) {
return sprintf('%.' . $precision . 'f', floor($number * ( 10 ** $precision )) / ( 10 ** $precision ));
return sprintf('%.' . $precision . 'f', floor($number * (10 ** $precision)) / (10 ** $precision));
} else {
return sprintf('%.' . $precision . 'f', floor($number));
}
@ -491,19 +491,19 @@ function array_merge2(array $array1, array $array2)
if (array_key_exists($array2_k, $array1)) {
if (is_array($array2_v)) {
foreach ($array2_v as $array2_kk => $array2_vv) {
if (array_key_exists($array2_kk, $array1[ $array2_k ])) {
if (array_key_exists($array2_kk, $array1[$array2_k])) {
if (is_array($array2_vv)) {
$array1[ $array2_k ][ $array2_kk ] = array_merge($array1[ $array2_k ][ $array2_kk ], $array2_vv);
$array1[$array2_k][$array2_kk] = array_merge($array1[$array2_k][$array2_kk], $array2_vv);
}
} else {
$array1[ $array2_k ][ $array2_kk ] = $array2_vv;
$array1[$array2_k][$array2_kk] = $array2_vv;
}
}
} else {
$array1[ $array2_k ] = $array2_v;
$array1[$array2_k] = $array2_v;
}
} else {
$array1[ $array2_k ] = $array2_v;
$array1[$array2_k] = $array2_v;
}
}
return $array1;
@ -550,8 +550,8 @@ function dir_copy(string $src = '', string $dst = '', &$files = [], $exclude_dir
}
$dir = opendir($src);
dir_mkdir($dst);
while (false !== ( $file = readdir($dir) )) {
if (( $file != '.' ) && ( $file != '..' )) {
while (false !== ($file = readdir($dir))) {
if (($file != '.') && ($file != '..')) {
if (is_dir($src . '/' . $file)) {
// 排除目录
if (count($exclude_dirs) && in_array($file, $exclude_dirs)) continue;
@ -631,7 +631,7 @@ function parse_sql($content = '', $string = false, $replace = [])
// 多行注释标记
$comment = false;
// 按行分割,兼容多个平台
$content = str_replace([ "\r\n", "\r" ], "\n", $content);
$content = str_replace(["\r\n", "\r"], "\n", $content);
$content = explode("\n", trim($content));
// 循环处理每一行
foreach ($content as $line) {
@ -723,10 +723,10 @@ function getFileMap($path, $arr = [])
if ($file_path != '.' && $file_path != '..') {
$temp_path = $path . '/' . $file_path;
if (is_dir($temp_path)) {
$arr[ $temp_path ] = $file_path;
$arr[$temp_path] = $file_path;
$arr = getFileMap($temp_path, $arr);
} else {
$arr[ $temp_path ] = $file_path;
$arr[$temp_path] = $file_path;
}
}
}
@ -751,9 +751,9 @@ function cache_remember(string $name = null, $value = '', $tag = null, $options
$value = Container::getInstance()->invokeFunction($value);
}
if (is_null($tag)) {
Cache::set($name, $value, $options[ 'expire' ] ?? null);
Cache::set($name, $value, $options['expire'] ?? null);
} else {
Cache::tag($tag)->set($name, $value, $options[ 'expire' ] ?? null);
Cache::tag($tag)->set($name, $value, $options['expire'] ?? null);
}
return $value;
@ -778,7 +778,7 @@ function image_to_base64(string $path, $is_delete = false)
{
if (!file_exists($path)) return 'image not exist';
$mime = getimagesize($path)[ 'mime' ];
$mime = getimagesize($path)['mime'];
$image_data = file_get_contents($path);
// 将图片转换为 base64
$base64_data = base64_encode($image_data);
@ -799,7 +799,7 @@ function image_to_base64(string $path, $is_delete = false)
function get_thumb_images($image, $thumb_type = 'all', bool $is_throw_exception = false)
{
return ( new CoreImageService() )->thumb($image, $thumb_type, $is_throw_exception);
return (new CoreImageService())->thumb($image, $thumb_type, $is_throw_exception);
}
/**
@ -811,10 +811,10 @@ function version_to_int($version)
{
$version_array = explode(".", $version);
$v1 = sprintf('%03s', (int) $version_array[ 0 ] ?? 0);
$v2 = sprintf('%03s', (int) $version_array[ 1 ] ?? 0);
$v3 = sprintf('%03s', (int) $version_array[ 2 ] ?? 0);
return (int) "{$v1}{$v2}{$v3}";
$v1 = sprintf('%03s', (int)$version_array[0] ?? 0);
$v2 = sprintf('%03s', (int)$version_array[1] ?? 0);
$v3 = sprintf('%03s', (int)$version_array[2] ?? 0);
return (int)"{$v1}{$v2}{$v3}";
}
/**
@ -827,13 +827,13 @@ function version_to_string($ver)
if ($ver > 999) {
if ($ver > 999999) {
$ver .= "";
$v3 = (int) substr($ver, -3);
$v2 = (int) substr($ver, -6, 3);
$v1 = (int) substr($ver, 0, -6);
$v3 = (int)substr($ver, -3);
$v2 = (int)substr($ver, -6, 3);
$v1 = (int)substr($ver, 0, -6);
} else {
$ver .= "";
$v3 = (int) substr($ver, -3);
$v2 = (int) substr($ver, 0, -3);
$v3 = (int)substr($ver, -3);
$v2 = (int)substr($ver, 0, -3);
$v1 = 0;
}
} else {
@ -889,10 +889,10 @@ function file_copy(string $source_file, string $to_file)
* @param $size
* @return string
*/
function qrcode($url, $page, $data, $dir = '', $channel = 'h5', $style = [ 'is_transparent' => true ], $outfile = true)
function qrcode($url, $page, $data, $dir = '', $channel = 'h5', $style = ['is_transparent' => true], $outfile = true)
{
if ($outfile) {
$dir = $dir ? : 'upload' . '/' . 'qrcode/';//二维码默认存储位置
$dir = $dir ?: 'upload' . '/' . 'qrcode/';//二维码默认存储位置
if (!is_dir($dir) && !mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir));
}
@ -911,8 +911,8 @@ function qrcode($url, $page, $data, $dir = '', $channel = 'h5', $style = [ 'is_t
'channel' => $channel,
'outfile' => $outfile
])));
if (!empty($result[ 0 ])) {
$path = $result[ 0 ];
if (!empty($result[0])) {
$path = $result[0];
}
return $path;
}
@ -928,7 +928,7 @@ function qrcode($url, $page, $data, $dir = '', $channel = 'h5', $style = [ 'is_t
*/
function poster($id, $type, array $param = [], string $channel = '', bool $is_throw_exception = true)
{
return ( new \app\service\core\poster\CorePosterService() )->get($id, $type, $param, $channel, $is_throw_exception);
return (new \app\service\core\poster\CorePosterService())->get($id, $type, $param, $channel, $is_throw_exception);
}
/**
@ -949,7 +949,7 @@ function is_url($string)
* 获取站点插件
* @return array
*/
function get_site_addons() : array
function get_site_addons(): array
{
$addons = Cache::get("local_install_addons");
return is_null($addons) ? [] : $addons;
@ -957,7 +957,7 @@ function get_site_addons() : array
function get_wap_domain()
{
$wap_url = ( new CoreSysConfigService() )->getSceneDomain()[ 'wap_url' ];
$wap_url = (new CoreSysConfigService())->getSceneDomain()['wap_url'];
return $wap_url;
}
@ -970,7 +970,7 @@ function get_wap_domain()
*/
function str_sub($str, $length = 10, $is_need_apostrophe = true)
{
return mb_substr($str, 0, $length, 'UTF-8') . ( $is_need_apostrophe ? '...' : '' );
return mb_substr($str, 0, $length, 'UTF-8') . ($is_need_apostrophe ? '...' : '');
}
/**
@ -1010,10 +1010,10 @@ function get_last_time($time = null)
$text = floor($t / 60) . '分钟前'; //一小时内
break;
case $t < 60 * 60 * 24:
$text = floor($t / ( 60 * 60 )) . '小时前'; // 一天内
$text = floor($t / (60 * 60)) . '小时前'; // 一天内
break;
case $t < 60 * 60 * 24 * 3:
$text = floor($time / ( 60 * 60 * 24 )) == 1 ? '昨天' . date('H:i', $time) : '前天' . date('H:i', $time); //昨天和前天
$text = floor($time / (60 * 60 * 24)) == 1 ? '昨天' . date('H:i', $time) : '前天' . date('H:i', $time); //昨天和前天
break;
case $t < 60 * 60 * 24 * 30:
$text = date('m-d H:i', $time); //一个月内
@ -1028,21 +1028,22 @@ function get_last_time($time = null)
return $text;
}
function get_campus_where($user_id){
function get_campus_where($user_id)
{
$where = [];
if($user_id == 1){
if ($user_id == 1) {
return $where;
}
$personnel = new Personnel();
$role = new CampusPersonRole();
$personnel_id = $personnel->where(['sys_user_id' => $user_id])->value('id');
if(!$personnel_id){
$where[] = ['campus_id','in',[]];
if (!$personnel_id) {
$where[] = ['campus_id', 'in', []];
}
$campus_ids = $role->where(['person_id' => $personnel_id])->column('campus_id');
$where[] = ['campus_id','in',$campus_ids];
$where[] = ['campus_id', 'in', $campus_ids];
return $where;
}
@ -1074,3 +1075,13 @@ function getModifiedFields(array $oldData, array $newData): array
'new_values' => json_encode($newValues, JSON_UNESCAPED_UNICODE),
];
}
// 获取员工编号
function getEmployeeNumber()
{
$personnel = new Personnel();
// 获取最新id
$max_id = $personnel->max('id') + 1;
$max_id = str_pad($max_id, 5, '0', STR_PAD_LEFT);
return date('Ymd') . $max_id;
}

12
niucloud/app/model/classroom/Classroom.php

@ -15,12 +15,9 @@ use core\base\BaseModel;
use think\model\concern\SoftDelete;
use think\model\relation\HasMany;
use think\model\relation\HasOne;
use app\model\campus\Campus;
use app\model\personnel\Personnel;
use app\model\personnel\Personnel;
/**
* 场地管理模型
@ -140,11 +137,6 @@ class Classroom extends BaseModel
}
}
public function campus(){
return $this->hasOne(Campus::class, 'id', 'campus_id')->joinType('left')->withField('campus_name,id')->bind(['campus_id_name'=>'campus_name']);
}
@ -153,8 +145,4 @@ class Classroom extends BaseModel
return $this->hasOne(Personnel::class, 'id', 'head_coach')->joinType('left')->withField('name,id')->bind(['head_coach_name'=>'name']);
}
public function personnel(){
return $this->hasOne(Personnel::class, 'id', 'assistant_coach')->joinType('left')->withField('name,id')->bind(['assistant_coach_name'=>'name']);
}
}

6
niucloud/app/service/admin/classroom/ClassroomService.php

@ -14,7 +14,6 @@ namespace app\service\admin\classroom;
use app\model\classroom\Classroom;
use app\model\campus\Campus;
use app\model\personnel\Personnel;
use app\model\personnel\Personnel;
use core\base\BaseAdminService;
@ -109,10 +108,5 @@ class ClassroomService extends BaseAdminService
return $personnelModel->select()->toArray();
}
public function getPersonnelAll(){
$personnelModel = new Personnel();
return $personnelModel->select()->toArray();
}
}

2
niucloud/app/service/admin/personnel/PersonnelService.php

@ -88,6 +88,8 @@ class PersonnelService extends BaseAdminService
]);
$data['sys_user_id'] = $uid;
}
// 员工编号
$data['employee_number'] = getEmployeeNumber();
$res = $this->model->create($data);
Db::commit();
return $res->id;

Loading…
Cancel
Save