于宏哲PHP 10 months ago
parent
commit
1dbd65e54b
  1. 6
      admin/src/app/api/course.ts
  2. 4
      admin/src/app/api/exam_papers.ts
  3. 14
      admin/src/app/api/sys.ts
  4. 28
      admin/src/app/views/auth/components/edit-role.vue
  5. 7
      admin/src/app/views/auth/role.vue
  6. 20
      admin/src/app/views/campus_person_role/campus_person_role.vue
  7. 34
      admin/src/app/views/campus_person_role/components/campus-person-role-edit.vue
  8. 28
      admin/src/app/views/communication_records/communication_records.vue
  9. 149
      admin/src/app/views/course/components/change_course.vue
  10. 12
      admin/src/app/views/course/course.vue
  11. 752
      admin/src/app/views/customer_resources/components/customer-resources-edit.vue
  12. 3
      admin/src/app/views/exam_papers/components/exam-papers-edit.vue
  13. 228
      admin/src/app/views/jlyj/jlyj.vue
  14. 11
      admin/src/app/views/login/index.vue
  15. 2
      admin/src/app/views/order_table/order_table.vue
  16. 12
      admin/src/app/views/service/components/service-edit.vue
  17. 188
      admin/src/app/views/statistics/home.vue
  18. 8
      niucloud/app/adminapi/controller/campus_person_role/CampusPersonRole.php
  19. 4
      niucloud/app/adminapi/controller/communication_records/CommunicationRecords.php
  20. 8
      niucloud/app/adminapi/controller/course/Course.php
  21. 5
      niucloud/app/adminapi/controller/exam_papers/ExamPapers.php
  22. 52
      niucloud/app/adminapi/controller/lesson_course_teaching/LessonCourseTeaching.php
  23. 2
      niucloud/app/adminapi/controller/sys/Role.php
  24. 28
      niucloud/app/adminapi/controller/sys/System.php
  25. 2
      niucloud/app/adminapi/route/course.php
  26. 1
      niucloud/app/adminapi/route/exam_papers.php
  27. 5
      niucloud/app/adminapi/route/sys.php
  28. 36
      niucloud/app/service/admin/campus_person_role/CampusPersonRoleService.php
  29. 31
      niucloud/app/service/admin/communication_records/CommunicationRecordsService.php
  30. 11
      niucloud/app/service/admin/course/CourseService.php
  31. 11
      niucloud/app/service/admin/exam_papers/ExamPapersService.php
  32. 28
      niucloud/app/service/admin/lesson_course_teaching/LessonCourseTeachingService.php
  33. 14
      niucloud/app/service/admin/sys/RoleService.php
  34. 77
      niucloud/app/service/admin/sys/SystemService.php
  35. 23
      niucloud/app/service/api/pay/PayService.php

6
admin/src/app/api/course.ts

@ -19,6 +19,12 @@ export function getCourseInfo(id: number) {
return request.get(`course/course/${id}`) return request.get(`course/course/${id}`)
} }
export function contractAll(params: Record<string, any>) {
return request.get(`course/contract_all`, { params })
}
/** /**
* *
* @param params * @param params

4
admin/src/app/api/exam_papers.ts

@ -50,5 +50,9 @@ export function deleteExamPapers(id: number) {
} }
export function getAll() {
return request.get(`exam_papers/all`)
}
// USER_CODE_END -- exam_papers // USER_CODE_END -- exam_papers

14
admin/src/app/api/sys.ts

@ -772,3 +772,17 @@ export function xsyjConfig(params: Record<string, any>) {
export function getXsyjConfig() { export function getXsyjConfig() {
return request.get('sys/get_xsyj_config') return request.get('sys/get_xsyj_config')
} }
export function jlyjConfig(params: Record<string, any>) {
return request.post(`sys/jlyj_config`, params)
}
export function getJlyjConfig() {
return request.get('sys/get_jlyj_config')
}
export function getHome(params: Record<string, any>) {
return request.post('sys/home', params)
}

28
admin/src/app/views/auth/components/edit-role.vue

@ -42,6 +42,25 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="部门" >
<el-select
class="input-width"
v-model="formData.dept_id"
clearable
placeholder="请选择部门"
>
<el-option label="请选择" value=""></el-option>
<el-option
v-for="(item, index) in parentDepartmentIdList"
:key="index"
:label="item['department_name']"
:value="item['id']"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('permission')" prop="rules"> <el-form-item :label="t('permission')" prop="rules">
<div class="flex items-center justify-between w-11/12"> <div class="flex items-center justify-between w-11/12">
<div> <div>
@ -86,6 +105,8 @@
<script lang="ts" setup async> <script lang="ts" setup async>
import {ref, reactive, computed, watch, toRaw} from 'vue' import {ref, reactive, computed, watch, toRaw} from 'vue'
import {t} from '@/lang' import {t} from '@/lang'
import {
getWithDepartmentsList} from '@/app/api/departments'
import type {FormInstance} from 'element-plus' import type {FormInstance} from 'element-plus'
import {addRole, editRole, getRoleInfo} from '@/app/api/sys' import {addRole, editRole, getRoleInfo} from '@/app/api/sys'
import {getAuthMenus} from '@/app/api/auth' import {getAuthMenus} from '@/app/api/auth'
@ -116,6 +137,12 @@ watch(selectAll, () => {
} }
}) })
const parentDepartmentIdList = ref([] as any[])
const setParentDepartmentIdList = async () => {
parentDepartmentIdList.value = await (await getWithDepartmentsList({})).data
}
setParentDepartmentIdList()
const roleKeyList = ref([]) const roleKeyList = ref([])
const getRolekeyDictList = async () => { const getRolekeyDictList = async () => {
roleKeyList.value = await ( roleKeyList.value = await (
@ -162,6 +189,7 @@ const initialFormData = {
role_name: '', role_name: '',
status: 1, status: 1,
role_key: '', role_key: '',
dept_id:'',
rules: [], rules: [],
} }
const formData: Record<string, any> = reactive({...initialFormData}) const formData: Record<string, any> = reactive({...initialFormData})

7
admin/src/app/views/auth/role.vue

@ -71,6 +71,13 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
prop="department_name"
label="部门"
></el-table-column>
<el-table-column <el-table-column
prop="create_time" prop="create_time"
:label="t('createTime')" :label="t('createTime')"

20
admin/src/app/views/campus_person_role/campus_person_role.vue

@ -34,7 +34,13 @@
</el-form-item> </el-form-item>
<el-form-item :label="t('personId')" prop="person_id"> <el-form-item :label="t('personId')" prop="person_id">
<el-select
<el-input
v-model="campusPersonRoleTable.searchParam.person_name"
:placeholder="t('personIdPlaceholder')"
/>
<!-- <el-select
class="w-[280px]" class="w-[280px]"
v-model="campusPersonRoleTable.searchParam.person_id" v-model="campusPersonRoleTable.searchParam.person_id"
clearable clearable
@ -46,7 +52,7 @@
:label="item['name']" :label="item['name']"
:value="item['id']" :value="item['id']"
/> />
</el-select> </el-select> -->
</el-form-item> </el-form-item>
<!-- <el-form-item :label="t('roleId')" prop="role_id"> <!-- <el-form-item :label="t('roleId')" prop="role_id">
@ -117,6 +123,14 @@
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
/> />
<el-table-column
prop="phone"
label="电话"
min-width="120"
:show-overflow-tooltip="true"
/>
<el-table-column <el-table-column
prop="role_id_name" prop="role_id_name"
:label="t('roleId')" :label="t('roleId')"
@ -194,7 +208,7 @@ let campusPersonRoleTable = reactive({
data: [], data: [],
searchParam: { searchParam: {
campus_id: '', campus_id: '',
person_id: '', person_name: '',
role_id: '', role_id: '',
dept_id: '', dept_id: '',
}, },

34
admin/src/app/views/campus_person_role/components/campus-person-role-edit.vue

@ -50,6 +50,18 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- <el-form-item :label="电话">
<el-input
v-model="formData.age_group"
type="number"
clearable
:placeholder="t('ageGroupPlaceholder')"
class="input-width"
/>
</el-form-item> -->
<el-form-item :label="t('roleId')" prop="role_id"> <el-form-item :label="t('roleId')" prop="role_id">
<el-select <el-select
class="input-width" class="input-width"
@ -67,7 +79,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="t('deptId')" v-if="!formData.dept_id"> <!-- <el-form-item :label="t('deptId')" v-if="!formData.dept_id">
<el-select <el-select
class="input-width" class="input-width"
v-model="formData.dept_id" v-model="formData.dept_id"
@ -81,8 +93,8 @@
:label="item['department_name']" :label="item['department_name']"
:value="item['id']" :value="item['id']"
/> />
</el-select> </el-select> -->
</el-form-item> <!-- </el-form-item> -->
</el-form> </el-form>
<template #footer> <template #footer>
@ -104,6 +116,8 @@ import { ref, reactive, computed, watch } from 'vue'
import { useDictionary } from '@/app/api/dict' import { useDictionary } from '@/app/api/dict'
import { t } from '@/lang' import { t } from '@/lang'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import { useRoute } from 'vue-router'
const route = useRoute()
import { import {
addCampusPersonRole, addCampusPersonRole,
editCampusPersonRole, editCampusPersonRole,
@ -116,6 +130,8 @@ import {
let showDialog = ref(false) let showDialog = ref(false)
const loading = ref(false) const loading = ref(false)
const pageName = route.meta.title
/** /**
* 表单数据 * 表单数据
@ -125,8 +141,16 @@ const initialFormData = {
campus_id: '', campus_id: '',
person_id: '', person_id: '',
role_id: '', role_id: '',
dept_id: '', dept_id: ''
} }
if(pageName == '市场人员列表'){
initialFormData.dept_id = 1;
}else if(pageName == '销售人员列表'){
initialFormData.dept_id = 2;
// campusPersonRoleTable.searchParam.role_id = 2;
}
const formData: Record<string, any> = reactive({ ...initialFormData }) const formData: Record<string, any> = reactive({ ...initialFormData })
const formRef = ref<FormInstance>() const formRef = ref<FormInstance>()
@ -192,7 +216,7 @@ const setPersonIdList = async () => {
setPersonIdList() setPersonIdList()
const roleIdList = ref([] as any[]) const roleIdList = ref([] as any[])
const setRoleIdList = async () => { const setRoleIdList = async () => {
roleIdList.value = await (await getWithSysRoleList({})).data roleIdList.value = await (await getWithSysRoleList({dept_id:formData.dept_id})).data
} }
setRoleIdList() setRoleIdList()
const deptIdList = ref([] as any[]) const deptIdList = ref([] as any[])

28
admin/src/app/views/communication_records/communication_records.vue

@ -3,9 +3,9 @@
<el-card class="box-card !border-none" shadow="never"> <el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<span class="text-lg">{{ pageName }}</span> <span class="text-lg">{{ pageName }}</span>
<el-button type="primary" @click="addEvent"> <!-- <el-button type="primary" @click="addEvent">
{{ t('addCommunicationRecords') }} {{ t('addCommunicationRecords') }}
</el-button> </el-button> -->
</div> </div>
<el-card <el-card
@ -17,7 +17,19 @@
:model="communicationRecordsTable.searchParam" :model="communicationRecordsTable.searchParam"
ref="searchFormRef" ref="searchFormRef"
> >
<el-form-item :label="t('resourceId')" prop="resource_id">
<el-form-item label="名称" prop="name">
<el-input v-model="communicationRecordsTable.searchParam.name" />
</el-form-item>
<el-form-item label="电话" prop="phone_number">
<el-input v-model="communicationRecordsTable.searchParam.phone_number" />
</el-form-item>
<el-form-item label="校区" prop="campus">
<el-input v-model="communicationRecordsTable.searchParam.campus" />
</el-form-item>
<!-- <el-form-item :label="t('resourceId')" prop="resource_id">
<el-select <el-select
class="w-[280px]" class="w-[280px]"
v-model="communicationRecordsTable.searchParam.resource_id" v-model="communicationRecordsTable.searchParam.resource_id"
@ -31,7 +43,7 @@
:value="item['id']" :value="item['id']"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item> -->
<el-form-item <el-form-item
:label="t('communicationType')" :label="t('communicationType')"
@ -155,9 +167,9 @@
<el-button type="primary" link @click="editEvent(row)">{{ <el-button type="primary" link @click="editEvent(row)">{{
t('edit') t('edit')
}}</el-button> }}</el-button>
<el-button type="primary" link @click="deleteEvent(row.id)">{{ <!-- <el-button type="primary" link @click="deleteEvent(row.id)">{{
t('delete') t('delete')
}}</el-button> }}</el-button> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -204,7 +216,9 @@ let communicationRecordsTable = reactive({
loading: true, loading: true,
data: [], data: [],
searchParam: { searchParam: {
resource_id: '', name: '',
phone_number: '',
campus: '',
communication_type: '', communication_type: '',
}, },
}) })

149
admin/src/app/views/course/components/change_course.vue

@ -0,0 +1,149 @@
<template>
<el-dialog
v-model="showDialog"
:title="formData.id ? t('updateCourse') : t('addCourse')"
width="50%"
class="diy-dialog-wrap"
:destroy-on-close="true"
>
<el-form
:model="formData"
label-width="120px"
ref="formRef"
:rules="formRules"
class="page-form"
v-loading="loading"
>
<el-form-item label="合同" prop="contract_id">
<el-select
class="input-width"
v-model="formData.contract_id"
placeholder="请选择合同"
>
<el-option
v-for="(item, index) in contractList"
:key="index"
:label="item.contract_name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
<el-button
type="primary"
:loading="loading"
@click="confirm(formRef)"
>{{ t('confirm') }}</el-button
>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, watch } from 'vue'
import { useDictionary } from '@/app/api/dict'
import { t } from '@/lang'
import type { FormInstance } from 'element-plus'
import { addCourse, editCourse, getCourseInfo,contractAll } from '@/app/api/course'
let showDialog = ref(false)
const loading = ref(false)
const contractList : any = ref(null)
//
const getContractAll = async () => {
contractList.value = await (await contractAll()).data
}
getContractAll()
/**
* 表单数据
*/
const initialFormData = {
id: '',
course_name: '',
course_type: '',
duration: '',
session_count: '',
single_session_count: '',
price: '',
internal_reminder: '',
customer_reminder: '',
remarks: '',
contract_id: '',
}
const formData: Record<string, any> = reactive({ ...initialFormData })
const formRef = ref<FormInstance>()
//
const formRules = computed(() => {
return {
}
})
const emit = defineEmits(['complete'])
/**
* 确认
* @param formEl
*/
const confirm = async (formEl: FormInstance | undefined) => {
if (loading.value || !formEl) return
let save = formData.id ? editCourse : addCourse
await formEl.validate(async (valid) => {
if (valid) {
loading.value = true
let data = formData
save(data)
.then((res) => {
loading.value = false
showDialog.value = false
emit('complete')
})
.catch((err) => {
loading.value = false
})
}
})
}
//
const setFormData = async (row: any = null) => {
Object.assign(formData, initialFormData)
loading.value = true
if (row) {
const data = await (await getCourseInfo(row.id)).data
if (data)
Object.keys(formData).forEach((key: string) => {
if (data[key] != undefined) formData[key] = data[key]
})
}
loading.value = false
}
defineExpose({
showDialog,
setFormData,
})
</script>
<style lang="scss" scoped></style>
<style lang="scss">
.diy-dialog-wrap .el-form-item__label {
height: auto !important;
}
</style>

12
admin/src/app/views/course/course.vue

@ -133,6 +133,8 @@
<el-button type="primary" link @click="deleteEvent(row.id)">{{ <el-button type="primary" link @click="deleteEvent(row.id)">{{
t('delete') t('delete')
}}</el-button> }}</el-button>
<el-button type="primary" link @click="contractEvent(row)">关联合同</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -149,6 +151,7 @@
</div> </div>
<edit ref="editCourseDialog" @complete="loadCourseList" /> <edit ref="editCourseDialog" @complete="loadCourseList" />
<contract ref="contractDialog" @complete="loadCourseList" />
</el-card> </el-card>
</div> </div>
</template> </template>
@ -161,6 +164,7 @@ import { getCourseList, deleteCourse } from '@/app/api/course'
import { img } from '@/utils/common' import { img } from '@/utils/common'
import { ElMessageBox, FormInstance } from 'element-plus' import { ElMessageBox, FormInstance } from 'element-plus'
import Edit from '@/app/views/course/components/course-edit.vue' import Edit from '@/app/views/course/components/course-edit.vue'
import Contract from '@/app/views/course/components/change_course.vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
const route = useRoute() const route = useRoute()
const pageName = route.meta.title const pageName = route.meta.title
@ -243,6 +247,14 @@ const editEvent = (data: any) => {
editCourseDialog.value.showDialog = true editCourseDialog.value.showDialog = true
} }
const contractDialog: Record<string, any> | null = ref(null)
const contractEvent = (data: any) => {
contractDialog.value.setFormData(data)
contractDialog.value.showDialog = true
}
/** /**
* 删除课程 * 删除课程
*/ */

752
admin/src/app/views/customer_resources/components/customer-resources-edit.vue

File diff suppressed because it is too large

3
admin/src/app/views/exam_papers/components/exam-papers-edit.vue

@ -80,6 +80,7 @@
<template #default="{ row }"> <template #default="{ row }">
<el-avatar v-if="row.question_content_type == 'image'" <el-avatar v-if="row.question_content_type == 'image'"
:src="img(row.question_content)" /> :src="img(row.question_content)" />
<div v-if="row.question_content_type == 'text'">{{ row.question_content }}</div> <div v-if="row.question_content_type == 'text'">{{ row.question_content }}</div>
</template> </template>
</el-table-column> </el-table-column>
@ -137,7 +138,7 @@
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import { addExamPapers, editExamPapers, getExamPapersInfo } from '@/app/api/exam_papers' import { addExamPapers, editExamPapers, getExamPapersInfo } from '@/app/api/exam_papers'
import { getExamQuestionsList,randomQuestionsList } from '@/app/api/exam_questions' import { getExamQuestionsList,randomQuestionsList } from '@/app/api/exam_questions'
import { img } from '@/utils/common'
let showDialog = ref(false) let showDialog = ref(false)
const loading = ref(false) const loading = ref(false)

228
admin/src/app/views/jlyj/jlyj.vue

@ -0,0 +1,228 @@
<template>
<div class="main-container">
<el-card class="box-card !border-none" shadow="never" v-loading="loading">
<div class="flex justify-between items-center">
<span class="text-lg">{{ pageName }}</span>
<el-button type="primary" @click="addStage"> 新增阶段 </el-button>
</div>
</el-card>
<el-card class="box-card !border-none" shadow="never">
<div
class="flex items-center justify-between p-[10px] table-item-border bg"
>
<span class="text-base w-[230px]">阶段名称</span>
<span class="text-base w-[110px] text-center">底薪</span>
</div>
<el-collapse v-model="activeNames" accordion>
<el-collapse-item
v-for="(stage, index) in stages"
:key="stage.id"
:name="stage.id"
>
<template #title>
<div class="collapse-title">
<span class="title-name">{{ stage.name }}</span>
<span class="arrow">{{ stage.price }} </span>
<!-- <span class="arrow">&gt;</span> -->
</div>
</template>
<el-form label-width="100px" style="margin-bottom: 10px">
<el-form-item label="阶段名称">
<el-input v-model="stage.name" placeholder="请输入阶段名称" />
</el-form-item>
</el-form>
<el-form label-width="100px" style="margin-bottom: 10px">
<el-form-item label="阶段底薪">
<el-input v-model="stage.price" placeholder="请输入阶段底薪" />
</el-form-item>
</el-form>
<el-button type="success" size="small" @click="addRule(stage)"
>新增规则</el-button
>
<el-table :data="stage.rules" border style="margin-top: 10px">
<el-table-column prop="renewal_standard_min" label="续费上限">
<template #default="{ row }">
<el-input
v-model="row.renewal_standard_min"
placeholder="请输入续费上限"
/>
</template>
</el-table-column>
<el-table-column prop="renewal_standard_max" label="续费下限">
<template #default="{ row }">
<el-input
v-model="row.renewal_standard_max"
placeholder="请输入续费下限"
/>
</template>
</el-table-column>
<el-table-column prop="renewal_commission" label="续费提成">
<template #default="{ row }">
<el-input v-model="row.renewal_commission" placeholder="%" />
</template>
</el-table-column>
<el-table-column prop="new_count_min" label="新单成交数上限">
<template #default="{ row }">
<el-input v-model="row.new_count_min" />
</template>
</el-table-column>
<el-table-column prop="new_count_max" label="新单成交数下限">
<template #default="{ row }">
<el-input v-model="row.new_count_max" />
</template>
</el-table-column>
<el-table-column prop="new_move_5" label="新招(5+1)x3">
<template #default="{ row }">
<el-input v-model="row.new_move_5" />
</template>
</el-table-column>
<el-table-column prop="new_move_7" label="新招(7+1)x3">
<template #default="{ row }">
<el-input v-model="row.new_move_7" />
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template #default="{ $index }">
<el-button
type="danger"
size="small"
@click="removeRule(stage, $index)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<el-button
type="danger"
size="small"
style="margin-top: 10px"
@click="removeStage(index)"
>删除该阶段</el-button
>
</el-collapse-item>
</el-collapse>
<div style="text-align: right; margin-top: 20px">
<el-button type="primary" @click="onSave">提交保存</el-button>
</div>
</el-card>
</div>
</template>
<script lang="ts" setup>
import { jlyjConfig, getJlyjConfig } from '@/app/api/sys'
import { reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import { useRoute } from 'vue-router'
const route = useRoute()
const pageName = route.meta.title
const loading = ref(true)
const stages = ref([])
const activeNames = ref(null)
function addStage() {
const newStage = {
name: '默认阶段',
price: 0,
rules: [
{
renewal_standard_min: '',
renewal_standard_max: '',
renewal_commission: '',
new_count_min: '',
new_count_max: '',
new_move_5: '',
new_move_7: '',
},
],
}
stages.value.push(newStage)
activeNames.value = newStage.name
}
function removeStage(index) {
stages.value.splice(index, 1)
}
function addRule(stage) {
stage.rules.push({
renewal_standard_min: '',
renewal_standard_max: '',
renewal_commission: '',
new_count_min: '',
new_count_max: '',
new_move_5: '',
new_move_7: '',
})
}
function removeRule(stage, ruleIndex) {
if (stage.rules.length === 1) {
ElMessage.warning('至少保留一条规则')
return
}
stage.rules.splice(ruleIndex, 1)
}
const setFormData = async () => {
const data = await (await getJlyjConfig()).data
stages.value = data
loading.value = false
}
setFormData()
const onSave = async () => {
jlyjConfig(stages.value)
.then(() => {
loading.value = true
setFormData()
})
.catch(() => {
loading.value = false
})
}
</script>
<style lang="scss" scoped>
.collapse-title {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
font-size: 14px;
font-weight: 500;
padding-right: 10px;
color: #333;
padding: 10px;
}
.title-name {
width: 230px;
}
.title-salary {
width: 110px;
text-align: center;
color: #7438d5;
}
.arrow {
margin-left: auto;
color: #999;
font-size: 14px;
}
</style>

11
admin/src/app/views/login/index.vue

@ -187,6 +187,14 @@ const handleLogin = async (formEl: FormInstance | undefined) => {
}) })
} }
// const {
// query: { redirect },
// } = route
// const path = typeof redirect === 'string' ? redirect : '/'
// const url = router.resolve(path)
// console.log(url);
// console.log(route);
// data // data
const loginFn = (data = {}) => { const loginFn = (data = {}) => {
loading.value = true loading.value = true
@ -198,7 +206,8 @@ const loginFn = (data = {}) => {
} = route } = route
const path = typeof redirect === 'string' ? redirect : '/' const path = typeof redirect === 'string' ? redirect : '/'
const url = router.resolve(path) const url = router.resolve(path)
location.href = url.href // console.log(url);
location.href = '/'
}) })
.catch(() => { .catch(() => {
loading.value = false loading.value = false

2
admin/src/app/views/order_table/order_table.vue

@ -83,7 +83,7 @@
<el-table-column :label="t('operation')" fixed="right" min-width="120"> <el-table-column :label="t('operation')" fixed="right" min-width="120">
<template #default="{ row }"> <template #default="{ row }">
<el-button type="primary" link @click="startPayment(row.id)" v-if="row.order_status == 'pending'">支付</el-button> <el-button type="primary" link @click="startPayment(row.id)" v-if="row.order_status == 'pending' && row.payment_type == 'scan_code'">支付</el-button>
<el-button type="primary" link @click="editEvent(row)">{{ <el-button type="primary" link @click="editEvent(row)">{{
t('edit') t('edit')

12
admin/src/app/views/service/components/service-edit.vue

@ -28,7 +28,7 @@
v-for="(item, index) in staff_reminderList" v-for="(item, index) in staff_reminderList"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="item.value" :value="Number(item.value)"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -40,7 +40,7 @@
v-for="(item, index) in customer_reminderList" v-for="(item, index) in customer_reminderList"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="item.value" :value="Number(item.value)"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -52,14 +52,14 @@
v-for="(item, index) in customer_confirmationList" v-for="(item, index) in customer_confirmationList"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="item.value" :value="Number(item.value)"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="t('customerFeedback')" > <!-- <el-form-item :label="t('customerFeedback')" >
<el-input v-model="formData.customer_feedback" clearable :placeholder="t('customerFeedbackPlaceholder')" class="input-width" /> <el-input v-model="formData.customer_feedback" clearable :placeholder="t('customerFeedbackPlaceholder')" class="input-width" />
</el-form-item> </el-form-item> -->
<el-form-item :label="t('status')" prop="status"> <el-form-item :label="t('status')" prop="status">
<el-select class="input-width" v-model="formData.status" clearable :placeholder="t('statusPlaceholder')"> <el-select class="input-width" v-model="formData.status" clearable :placeholder="t('statusPlaceholder')">
@ -109,7 +109,7 @@ const initialFormData = {
staff_reminder: '', staff_reminder: '',
customer_reminder: '', customer_reminder: '',
customer_confirmation: '', customer_confirmation: '',
customer_feedback: '', // customer_feedback: '',
status: '', status: '',
} }
const formData: Record<string, any> = reactive({ ...initialFormData }) const formData: Record<string, any> = reactive({ ...initialFormData })

188
admin/src/app/views/statistics/home.vue

@ -0,0 +1,188 @@
<template>
<div class="main-container">
<!-- 实时概况 -->
<el-card shadow="never" class="!border-none">
<template #header>
<span class="text-lg font-extrabold mr-[10px]">统计概括</span>
<span class="text-sm text-[#a19f98]">查看校区员工资源和学员的实时数据</span>
</template>
<el-row :gutter="20">
<el-col :span="6">
<div class="text-sm text-[#a19f98] leading-8 ">
<el-statistic :value="info.campus_count">
<template #title>
<div style="display: inline-flex; align-items: center">
<span class="mr-[5px]">校区数量</span>
</div>
</template>
</el-statistic>
<div class="text-sm text-[#a19f98] leading-8">
</div>
</div>
</el-col>
<el-col :span="6">
<div class="text-sm text-[#a19f98] leading-8 ">
<el-statistic :value="info.personnel_count">
<template #title>
<div style="display: inline-flex; align-items: center">
<span class="mr-[5px]">员工数量</span>
</div>
</template>
</el-statistic>
<div class="text-sm text-[#a19f98] leading-8">
</div>
</div>
</el-col>
<el-col :span="6">
<div class="text-sm text-[#a19f98] leading-8 ">
<el-statistic :value="info.customerResources_count">
<template #title>
<div style="display: inline-flex; align-items: center">
<span class="mr-[5px]">资源数量</span>
</div>
</template>
</el-statistic>
<div class="text-sm text-[#a19f98] leading-8">
<span>昨日新增</span>
<span>{{info.customerResources_day_count}}</span>
</div>
</div>
</el-col>
<el-col :span="6">
<div class="text-sm text-[#a19f98] leading-8 ">
<el-statistic :value="info.student_count">
<template #title>
<div style="display: inline-flex; align-items: center">
<span class="mr-[5px]">学员数量</span>
</div>
</template>
</el-statistic>
<div class="text-sm text-[#a19f98] leading-8">
<span>昨日新增</span>
<span>{{info.student_day_count}}</span>
</div>
</div>
</el-col>
</el-row>
</el-card>
<!-- 实时概况 end -->
<el-row :gutter="15" class="mt-[15px]">
<el-col :span="24">
<el-card shadow="never" class="!border-none">
<template #header>
<span class="text-lg font-extrabold">资源增长趋势</span>
</template>
<div >
<el-button :type="activeRange === 'week' ? 'primary' : 'default'" size="small"
@click="changeRange('week')"></el-button>
<el-button :type="activeRange === 'month' ? 'primary' : 'default'" size="small"
@click="changeRange('month')"></el-button>
<el-button :type="activeRange === 'year' ? 'primary' : 'default'" size="small"
@click="changeRange('year')"></el-button>
</div>
<div ref="visitStat" :style="{ width: '100%', height: '300px' }">
</div>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script lang="ts" setup>
import { ref, reactive } from 'vue'
import { getHome } from '@/app/api/sys'
import * as echarts from 'echarts'
const visitStat = ref<any>(null)
const activeRange = ref<'week' | 'month' | 'year'>('week')
const info = reactive({
campus_count: 0,
personnel_count: 0,
customerResources_count: 0,
customerResources_day_count: 0,
student_count: 0,
student_day_count: 0,
customer: []
})
const changeRange = (range) => {
activeRange.value = range
Init(range) //
}
const Init = (range) => {
getHome({'date':range})
.then((res) => {
info.campus_count = res.data.campus_count
info.personnel_count = res.data.personnel_count
info.customerResources_count = res.data.customerResources_count
info.customerResources_day_count = res.data.customerResources_day_count
info.student_count = res.data.student_count
info.student_day_count = res.data.student_day_count
info.customer = res.data.customer
drawChart('');
})
.catch(() => {
})
}
Init();
const drawChart = (item : any) => {
let value = info.customer.value
if (item) value = item
if (!visitStat.value) return
const visitStatChart = echarts.init(visitStat.value)
const visitStatOption = ref({
// title: {
// text: ''
// },
legend: {},
xAxis: {
data: []
},
yAxis: {},
tooltip: {
trigger: 'axis'
},
series: [
{
type: 'line',
data: []
}
]
})
visitStatOption.value.xAxis.data = info.customer.time
visitStatOption.value.series[0].data = value
visitStatChart.setOption(visitStatOption.value)
}
</script>
<style lang="scss" scoped></style>

8
niucloud/app/adminapi/controller/campus_person_role/CampusPersonRole.php

@ -29,7 +29,7 @@ class CampusPersonRole extends BaseAdminController
public function lists(){ public function lists(){
$data = $this->request->params([ $data = $this->request->params([
["campus_id",""], ["campus_id",""],
["person_id",""], ["person_name",""],
["role_id",""], ["role_id",""],
["dept_id",""] ["dept_id",""]
]); ]);
@ -100,7 +100,11 @@ class CampusPersonRole extends BaseAdminController
} }
public function getSysRoleAll(){ public function getSysRoleAll(){
return success(( new CampusPersonRoleService())->getSysRoleAll()); $data = $this->request->params([
["dept_id",0]
]);
return success(( new CampusPersonRoleService())->getSysRoleAll($data));
} }
public function getDepartmentsAll(){ public function getDepartmentsAll(){

4
niucloud/app/adminapi/controller/communication_records/CommunicationRecords.php

@ -28,7 +28,9 @@ class CommunicationRecords extends BaseAdminController
*/ */
public function lists(){ public function lists(){
$data = $this->request->params([ $data = $this->request->params([
["resource_id",""], ["name",""],
["phone_number",""],
["campus",""],
["communication_type",""] ["communication_type",""]
]); ]);
return success((new CommunicationRecordsService())->getPage($data)); return success((new CommunicationRecordsService())->getPage($data));

8
niucloud/app/adminapi/controller/course/Course.php

@ -88,9 +88,9 @@ class Course extends BaseAdminController
["internal_reminder",0], ["internal_reminder",0],
["customer_reminder",0], ["customer_reminder",0],
["remarks",""], ["remarks",""],
["contract_id",""],
]); ]);
$this->validate($data, 'app\validate\course\Course.edit'); // $this->validate($data, 'app\validate\course\Course.edit');
(new CourseService())->edit($id, $data); (new CourseService())->edit($id, $data);
return success('EDIT_SUCCESS'); return success('EDIT_SUCCESS');
} }
@ -105,4 +105,8 @@ class Course extends BaseAdminController
return success('DELETE_SUCCESS'); return success('DELETE_SUCCESS');
} }
public function contract_all(){
return success((new CourseService())->contract_all());
}
} }

5
niucloud/app/adminapi/controller/exam_papers/ExamPapers.php

@ -34,6 +34,11 @@ class ExamPapers extends BaseAdminController
return success((new ExamPapersService())->getPage($data)); return success((new ExamPapersService())->getPage($data));
} }
public function all(){
return success((new ExamPapersService())->all());
}
/** /**
* 试卷详情 * 试卷详情
* @param int $id * @param int $id

52
niucloud/app/adminapi/controller/lesson_course_teaching/LessonCourseTeaching.php

@ -50,7 +50,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",1], ["table_type",1],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->add($data); $id = (new LessonCourseTeachingService())->add($data);
@ -69,7 +69,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->edit($id, $data); (new LessonCourseTeachingService())->edit($id, $data);
@ -104,7 +104,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",2], ["table_type",2],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->jumpAdd($data); $id = (new LessonCourseTeachingService())->jumpAdd($data);
@ -123,7 +123,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->jumpEdit($id, $data); (new LessonCourseTeachingService())->jumpEdit($id, $data);
@ -159,7 +159,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",3], ["table_type",3],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->enAdd($data); $id = (new LessonCourseTeachingService())->enAdd($data);
@ -178,7 +178,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->enEdit($id, $data); (new LessonCourseTeachingService())->enEdit($id, $data);
@ -214,7 +214,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",4], ["table_type",4],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->basketballAdd($data); $id = (new LessonCourseTeachingService())->basketballAdd($data);
@ -233,7 +233,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->basketballEdit($id, $data); (new LessonCourseTeachingService())->basketballEdit($id, $data);
@ -269,7 +269,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",5], ["table_type",5],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->strengAdd($data); $id = (new LessonCourseTeachingService())->strengAdd($data);
@ -288,7 +288,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->strengEdit($id, $data); (new LessonCourseTeachingService())->strengEdit($id, $data);
@ -323,7 +323,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",6], ["table_type",6],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->ninjaAdd($data); $id = (new LessonCourseTeachingService())->ninjaAdd($data);
@ -342,7 +342,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->ninjaEdit($id, $data); (new LessonCourseTeachingService())->ninjaEdit($id, $data);
@ -377,7 +377,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",7], ["table_type",7],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->securityAdd($data); $id = (new LessonCourseTeachingService())->securityAdd($data);
@ -396,7 +396,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->securityEdit($id, $data); (new LessonCourseTeachingService())->securityEdit($id, $data);
@ -432,7 +432,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",8], ["table_type",8],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->physicalAdd($data); $id = (new LessonCourseTeachingService())->physicalAdd($data);
@ -451,7 +451,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->physicalEdit($id, $data); (new LessonCourseTeachingService())->physicalEdit($id, $data);
@ -486,7 +486,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",9], ["table_type",9],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->actionAdd($data); $id = (new LessonCourseTeachingService())->actionAdd($data);
@ -505,7 +505,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->actionEdit($id, $data); (new LessonCourseTeachingService())->actionEdit($id, $data);
@ -540,7 +540,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",10], ["table_type",10],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->fitnessAdd($data); $id = (new LessonCourseTeachingService())->fitnessAdd($data);
@ -559,7 +559,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->fitnessEdit($id, $data); (new LessonCourseTeachingService())->fitnessEdit($id, $data);
@ -594,7 +594,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",11], ["table_type",11],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->gamesAdd($data); $id = (new LessonCourseTeachingService())->gamesAdd($data);
@ -613,7 +613,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->gamesEdit($id, $data); (new LessonCourseTeachingService())->gamesEdit($id, $data);
@ -648,7 +648,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",12], ["table_type",12],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->relaxationAdd($data); $id = (new LessonCourseTeachingService())->relaxationAdd($data);
@ -667,7 +667,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->relaxationEdit($id, $data); (new LessonCourseTeachingService())->relaxationEdit($id, $data);
@ -694,7 +694,7 @@ class LessonCourseTeaching extends BaseAdminController
["content",""], ["content",""],
["status",0], ["status",0],
["table_type",0], ["table_type",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.add');
$id = (new LessonCourseTeachingService())->publicAdd($data); $id = (new LessonCourseTeachingService())->publicAdd($data);
@ -707,7 +707,7 @@ class LessonCourseTeaching extends BaseAdminController
["type",0], ["type",0],
["content",""], ["content",""],
["status",0], ["status",0],
["url",''] ["url",''],["exam_papers_id",""]
]); ]);
$this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit'); $this->validate($data, 'app\validate\lesson_course_teaching\LessonCourseTeaching.edit');
(new LessonCourseTeachingService())->publicEdit($id, $data); (new LessonCourseTeachingService())->publicEdit($id, $data);

2
niucloud/app/adminapi/controller/sys/Role.php

@ -58,6 +58,7 @@ class Role extends BaseAdminController
['role_name', ''], ['role_name', ''],
['rules', []], ['rules', []],
['role_key',''], ['role_key',''],
['dept_id',''],
['status', RoleStatusDict::ON], ['status', RoleStatusDict::ON],
]); ]);
$this->validate($data, 'app\validate\sys\Role.add'); $this->validate($data, 'app\validate\sys\Role.add');
@ -75,6 +76,7 @@ class Role extends BaseAdminController
['role_name', ''], ['role_name', ''],
['rules', []], ['rules', []],
['role_key',''], ['role_key',''],
['dept_id',''],
['status', RoleStatusDict::ON], ['status', RoleStatusDict::ON],
]); ]);
$this->validate($data, 'app\validate\sys\Role.edit'); $this->validate($data, 'app\validate\sys\Role.edit');

28
niucloud/app/adminapi/controller/sys/System.php

@ -138,4 +138,32 @@ class System extends BaseAdminController
} }
public function jlyj_config(){
$data = $this->request->post();
return success(data: (new SystemService())->jlyj_config($data));
}
public function get_jlyj_config(){
return success(data: (new SystemService())->get_jlyj_config());
}
public function home(){
// $data = $this->request->params([
// ['start_date', date('Y-m-d', strtotime('-6 day')) ],
// ['end_date', date('Y-m-d', strtotime('+1 day'))],
// ''
// ]);
$data = $this->request->params([
['date', 'week'],
]);
return success(data: (new SystemService())->home($data));
}
} }

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

@ -29,6 +29,8 @@ Route::group('course', function () {
//删除课程 //删除课程
Route::delete('course/:id', 'course.Course/del'); Route::delete('course/:id', 'course.Course/del');
Route::get('contract_all', 'course.Course/contract_all');
})->middleware([ })->middleware([
AdminCheckToken::class, AdminCheckToken::class,
AdminCheckRole::class, AdminCheckRole::class,

1
niucloud/app/adminapi/route/exam_papers.php

@ -30,6 +30,7 @@ Route::group('exam_papers', function () {
//删除试卷 //删除试卷
Route::delete('exam_papers/:id', 'exam_papers.ExamPapers/del'); Route::delete('exam_papers/:id', 'exam_papers.ExamPapers/del');
Route::get('all', 'exam_papers.ExamPapers/all');
})->middleware([ })->middleware([
AdminCheckToken::class, AdminCheckToken::class,
AdminCheckRole::class, AdminCheckRole::class,

5
niucloud/app/adminapi/route/sys.php

@ -334,6 +334,11 @@ Route::group('sys', function() {
Route::post('xsyj_config', 'sys.System/xsyj_config'); Route::post('xsyj_config', 'sys.System/xsyj_config');
Route::get('get_xsyj_config', 'sys.System/get_xsyj_config'); Route::get('get_xsyj_config', 'sys.System/get_xsyj_config');
//教练业绩
Route::post('jlyj_config', 'sys.System/jlyj_config');
Route::get('get_jlyj_config', 'sys.System/get_jlyj_config');
Route::post('home', 'sys.System/home');
})->middleware([ })->middleware([
AdminCheckToken::class, AdminCheckToken::class,

36
niucloud/app/service/admin/campus_person_role/CampusPersonRoleService.php

@ -38,12 +38,36 @@ class CampusPersonRoleService extends BaseAdminService
* @param array $where * @param array $where
* @return array * @return array
*/ */
public function getPage(array $where = []) public function getPage(array $data = [])
{ {
$field = 'id,campus_id,person_id,role_id,dept_id,created_at,updated_at,deleted_at'; $field = 'a.*,b.phone';
$order = 'id desc'; $order = 'a.id desc';
$where = [];
if($data['campus_id']){
$where[] = ['a.campus_id','=',$data['campus_id']];
}
if($data['role_id']){
$where[] = ['a.role_id','=',$data['role_id']];
}
if($data['dept_id']){
$where[] = ['a.dept_id','=',$data['dept_id']];
}
if($data['person_name']){
$where[] = ['b.name','like','%'.$data['person_name'].'%'];
}
$search_model = $this->model
->alias("a")
->join(['school_personnel' => 'b'],'a.person_id = b.id','left')
->where($where)
->with(['campus','personnel','sysRole','departments'])
->field($field)->order($order);
$search_model = $this->model->withSearch(["id","campus_id","person_id","role_id","dept_id"], $where)->with(['campus','personnel','sysRole','departments'])->field($field)->order($order);
$list = $this->pageQuery($search_model); $list = $this->pageQuery($search_model);
return $list; return $list;
} }
@ -109,9 +133,9 @@ class CampusPersonRoleService extends BaseAdminService
return $personnelModel->select()->toArray(); return $personnelModel->select()->toArray();
} }
public function getSysRoleAll(){ public function getSysRoleAll($data){
$sysRoleModel = new SysRole(); $sysRoleModel = new SysRole();
return $sysRoleModel->select()->toArray(); return $sysRoleModel->where(['dept_id' => $data['dept_id']])->select()->toArray();
} }
public function getDepartmentsAll(){ public function getDepartmentsAll(){

31
niucloud/app/service/admin/communication_records/CommunicationRecordsService.php

@ -36,12 +36,35 @@ class CommunicationRecordsService extends BaseAdminService
* @param array $where * @param array $where
* @return array * @return array
*/ */
public function getPage(array $where = []) public function getPage(array $data = [])
{ {
$field = 'id,staff_id,resource_id,resource_type,communication_type,communication_result,communication_time,remarks,tag,business_id,created_at,updated_at'; $field = 'a.*';
$order = 'id desc'; $order = 'a.id desc';
$where = [];
if($data['name']){
$where[] = ['b.name','like','%'.$data['name'].'%'];
}
if($data['phone_number']){
$where[] = ['b.phone_number','like','%'.$data['phone_number'].'%'];
}
if($data['campus']){
$where[] = ['c.name','like','%'.$data['campus'].'%'];
}
if($data['communication_type']){
$where[] = ['a.communication_type','=',$data['communication_type']];
}
$search_model = $this->model->withSearch(["resource_id","communication_type"], $where)->with(['customerResources'])->field($field)->order($order); $search_model = $this->model
->alias("a")
->join(['school_customer_resources' => 'b'],'a.resource_id = b.id','left')
->join(['school_campus' => 'c'],'b.campus = c.id','left')
->where($where)
->with(['customerResources'])
->field($field)
->order($order);
$list = $this->pageQuery($search_model); $list = $this->pageQuery($search_model);
return $list; return $list;
} }

11
niucloud/app/service/admin/course/CourseService.php

@ -11,6 +11,7 @@
namespace app\service\admin\course; namespace app\service\admin\course;
use app\model\contract\Contract;
use app\model\course\Course; use app\model\course\Course;
use core\base\BaseAdminService; use core\base\BaseAdminService;
@ -36,7 +37,7 @@ class CourseService extends BaseAdminService
*/ */
public function getPage(array $where = []) public function getPage(array $where = [])
{ {
$field = 'id,course_name,course_type,duration,session_count,single_session_count,price,internal_reminder,customer_reminder,remarks,created_at,updated_at,deleted_at'; $field = 'id,course_name,course_type,duration,session_count,contract_id,single_session_count,price,internal_reminder,customer_reminder,remarks,created_at,updated_at,deleted_at';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["id","course_name","course_type","duration","session_count","single_session_count","price","internal_reminder","customer_reminder","remarks"], $where)->field($field)->order($order); $search_model = $this->model->withSearch(["id","course_name","course_type","duration","session_count","single_session_count","price","internal_reminder","customer_reminder","remarks"], $where)->field($field)->order($order);
@ -44,6 +45,12 @@ class CourseService extends BaseAdminService
return $list; return $list;
} }
public function contract_all(){
$contract = new Contract();
$list = $contract->select()->toArray();
return $list;
}
/** /**
* 获取课程信息 * 获取课程信息
* @param int $id * @param int $id
@ -51,7 +58,7 @@ class CourseService extends BaseAdminService
*/ */
public function getInfo(int $id) public function getInfo(int $id)
{ {
$field = 'id,course_name,course_type,duration,session_count,single_session_count,price,internal_reminder,customer_reminder,remarks,created_at,updated_at,deleted_at'; $field = 'id,course_name,course_type,duration,session_count,contract_id,single_session_count,price,internal_reminder,customer_reminder,remarks,created_at,updated_at,deleted_at';
$info = $this->model->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray(); $info = $this->model->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray();
return $info; return $info;

11
niucloud/app/service/admin/exam_papers/ExamPapersService.php

@ -44,6 +44,17 @@ class ExamPapersService extends BaseAdminService
return $list; return $list;
} }
public function all()
{
$field = 'id,title';
$order = 'id desc';
$list = $this->model->field($field)->order($order)->select()->toArray();
return $list;
}
/** /**
* 获取试卷信息 * 获取试卷信息
* @param int $id * @param int $id

28
niucloud/app/service/admin/lesson_course_teaching/LessonCourseTeachingService.php

@ -37,7 +37,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function getPage(array $where = []) public function getPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order);
@ -84,7 +84,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function jumpPetPage(array $where = []) public function jumpPetPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $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); $list = $this->pageQuery($search_model);
@ -128,7 +128,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function enPetPage(array $where = []) public function enPetPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $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); $list = $this->pageQuery($search_model);
@ -173,7 +173,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function basketballPetPage(array $where = []) public function basketballPetPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $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); $list = $this->pageQuery($search_model);
@ -217,7 +217,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function strengPetPage(array $where = []) public function strengPetPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $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); $list = $this->pageQuery($search_model);
@ -261,7 +261,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function ninjaPetPage(array $where = []) public function ninjaPetPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $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); $list = $this->pageQuery($search_model);
@ -305,7 +305,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function securityPetPage(array $where = []) public function securityPetPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $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); $list = $this->pageQuery($search_model);
@ -349,7 +349,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function physicalPetPage(array $where = []) public function physicalPetPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $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); $list = $this->pageQuery($search_model);
@ -397,7 +397,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function actionPetPage(array $where = []) public function actionPetPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $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); $list = $this->pageQuery($search_model);
@ -442,7 +442,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function gamesPetPage(array $where = []) public function gamesPetPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $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); $list = $this->pageQuery($search_model);
@ -488,7 +488,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function fitnessPetPage(array $where = []) public function fitnessPetPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $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); $list = $this->pageQuery($search_model);
@ -533,7 +533,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function relaxationPetPage(array $where = []) public function relaxationPetPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $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); $list = $this->pageQuery($search_model);
@ -573,7 +573,7 @@ class LessonCourseTeachingService extends BaseAdminService
public function publicPetPage(array $where = []) public function publicPetPage(array $where = [])
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission'; $field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,exam_papers_id';
$order = 'id desc'; $order = 'id desc';
$search_model = $this->model->withSearch(["title","status","create_time","update_time","table_type"], $where)->with(['personnelData'])->field($field)->order($order); $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); $list = $this->pageQuery($search_model);
@ -610,7 +610,7 @@ class LessonCourseTeachingService extends BaseAdminService
*/ */
public function getInfo(int $id) public function getInfo(int $id)
{ {
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,url'; $field = 'id,title,image,type,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 = $this->model->field($field)->where([['id', "=", $id]])->with(['personnelData'])->findOrEmpty()->toArray();
$info['status'] = strval($info['status']); $info['status'] = strval($info['status']);
$info['type'] = strval($info['type']); $info['type'] = strval($info['type']);

14
niucloud/app/service/admin/sys/RoleService.php

@ -44,10 +44,16 @@ class RoleService extends BaseAdminService
{ {
$where = []; $where = [];
if(isset($data['role_name']) && $data['role_name'] !== '') { if(isset($data['role_name']) && $data['role_name'] !== '') {
$where[] = ['role_name', 'like', "%".$this->model->handelSpecialCharacter($data['role_name'])."%"]; $where[] = ['a.role_name', 'like', "%".$this->model->handelSpecialCharacter($data['role_name'])."%"];
} }
$field = 'role_id,role_name,role_key,status,create_time'; $field = 'a.role_id,a.role_name,a.role_key,a.status,a.create_time,b.department_name';
$search_model = $this->model->where($where)->field($field)->order('create_time desc')->append(['status_name']); $search_model = $this->model
->alias("a")
->join(['school_departments' => 'b'],'a.dept_id = b.id','left')
->where($where)
->field($field)
->order('a.create_time desc')
->append(['status_name']);
return $this->pageQuery($search_model); return $this->pageQuery($search_model);
} }
/** /**

77
niucloud/app/service/admin/sys/SystemService.php

@ -11,7 +11,12 @@
namespace app\service\admin\sys; namespace app\service\admin\sys;
use addon\shop\app\model\ShopStat;
use app\job\sys\CheckJob; use app\job\sys\CheckJob;
use app\model\campus\Campus;
use app\model\customer_resources\CustomerResources;
use app\model\personnel\Personnel;
use app\model\student\Student;
use app\model\sys\SysConfig; use app\model\sys\SysConfig;
use app\service\core\sys\CoreSysConfigService; use app\service\core\sys\CoreSysConfigService;
use core\base\BaseAdminService; use core\base\BaseAdminService;
@ -208,4 +213,76 @@ class SystemService extends BaseAdminService
return $data; return $data;
} }
public function jlyj_config(array $data){
$config = new SysConfig();
$config->where(['config_key' => 'JLYJ'])->update([
'value' => json_encode($data)
]);
return true;
}
public function get_jlyj_config(){
$config = new SysConfig();
$data = $config->where(['config_key' => 'JLYJ'])->value("value");
return $data;
}
public function home(array $arr){
$campus = new Campus();
$personnel = new Personnel();
$customerResources = new CustomerResources();
$student = new Student();
$data = [];
$data['campus_count'] = $campus->count();
$data['personnel_count'] = $personnel->count();
$data['customerResources_count'] = $customerResources->count();
$data['customerResources_day_count'] = $customerResources->whereTime('created_at', 'yesterday')->count();
$data['student_count'] = $student->count();
$data['student_day_count'] = $student->whereTime('created_at', 'yesterday')->count();
if ($arr['date'] == 'week') {
$start_date = date('Y-m-d', strtotime('-6 days'));
$end_date = date('Y-m-d',strtotime('+1 days'));
} elseif ($arr['date'] == 'month') {
$start_date = date('Y-m-01');
$end_date = date('Y-m-d');
} elseif ($arr['date'] == 'year') {
$start_date = date('Y-01-01');
$end_date = date('Y-m-d');
} else {
$start_date = date('Y-m-d', strtotime('-6 days'));
$end_date = date('Y-m-d',strtotime('+1 days'));
}
$stat_data = $customerResources
->where([ ['create_date', '>=', $start_date], ['create_date', '<=', $end_date] ])
->field('create_date, COUNT(*) as count')
->group('create_date')
->select()->toArray();
$stat_data = !empty($stat_data) ? array_column($stat_data, 'count', 'create_date') : [];
$day = ceil((strtotime($end_date) - strtotime($start_date)) / 86400);
$value = [];
$time = [];
for ($i = 0; $i < $day; $i++) {
$date = date('Y-m-d', strtotime($start_date) + $i * 86400);
$time[] = $date;
$value[] = isset($stat_data[ $date ]) ? $stat_data[ $date ] : 0;
}
$data['customer'][ 'value' ] = $value;
$data['customer'][ 'time' ] = $time;
return $data;
}
} }

23
niucloud/app/service/api/pay/PayService.php

@ -27,6 +27,7 @@ use core\exception\ApiException;
use think\db\exception\DataNotFoundException; use think\db\exception\DataNotFoundException;
use think\db\exception\DbException; use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException; use think\db\exception\ModelNotFoundException;
use think\facade\Db;
use think\facade\Log; use think\facade\Log;
/** /**
@ -182,10 +183,8 @@ class PayService extends BaseApiService
$order->where(['payment_id' => $info['out_trade_no']])->update(['order_status' => 'paid','payment_time' => date("Y-m-d H:i:s")]); $order->where(['payment_id' => $info['out_trade_no']])->update(['order_status' => 'paid','payment_time' => date("Y-m-d H:i:s")]);
$order_count = $order->where(['resource_id' => $order_info['resource_id']])->count(); $order_count = $order->where(['resource_id' => $order_info['resource_id']])->count();
if($order_count <= 1){
$cust_info = $cust->where(['id' => $order_info['resource_id']])->find(); $cust_info = $cust->where(['id' => $order_info['resource_id']])->find();
if($order_count <= 1){
$sex_arr = ['male' => 1, 'female' => 2, 'other' => 0]; $sex_arr = ['male' => 1, 'female' => 2, 'other' => 0];
//首次支付创建学员 //首次支付创建学员
$student->insert([ $student->insert([
@ -198,6 +197,24 @@ class PayService extends BaseApiService
'user_id' => $order_info['resource_id'] 'user_id' => $order_info['resource_id']
]); ]);
} }
$is_rel = Db::name("class_resources_rel")->where(
['resource_id' => $order_info['resource_id'],'class_id' => $order_info['class_id']]
)->find();
if($is_rel){
Db::name("class_resources_rel")->where(['id' => $is_rel['id']])->update(['status' => 2]);
}else{
Db::name("class_resources_rel")->insert([
'class_id' => $order_info['class_id'],
'resource_id' => $order_info['resource_id'],
'campus_id' => $cust_info['campus'],
'source_type' => 'student',
'join_time' => time(),
'status' => 1,
'create_time' => date("Y-m-d H:i:s"),
'update_time' => date("Y-m-d H:i:s")
]);
}
} }
} }

Loading…
Cancel
Save