22 changed files with 1338 additions and 25 deletions
@ -0,0 +1,122 @@ |
|||||
|
<template> |
||||
|
<div class="main-container"> |
||||
|
<el-card class="box-card !border-none" shadow="never"> |
||||
|
<div class="flex justify-between items-center"> |
||||
|
</div> |
||||
|
|
||||
|
<div class="mt-[10px]"> |
||||
|
<el-table |
||||
|
:data="customerResourceChangesTable.data" |
||||
|
size="large" |
||||
|
v-loading="customerResourceChangesTable.loading" |
||||
|
> |
||||
|
<template #empty> |
||||
|
<span>{{ |
||||
|
!customerResourceChangesTable.loading ? t('emptyData') : '' |
||||
|
}}</span> |
||||
|
</template> |
||||
|
|
||||
|
<el-table-column prop="created_at" label="时间" /> |
||||
|
|
||||
|
<el-table-column prop="name" label="操作人员" /> |
||||
|
|
||||
|
|
||||
|
<el-table-column prop="type" label="操作类型"> |
||||
|
<template #default="scope"> |
||||
|
<div v-html="scope.row.type"></div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column prop="values" label="详细信息"> |
||||
|
<template #default="scope"> |
||||
|
<div v-html="scope.row.values"></div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
|
||||
|
</el-table> |
||||
|
<div class="mt-[16px] flex justify-end"> |
||||
|
<el-pagination |
||||
|
v-model:current-page="customerResourceChangesTable.page" |
||||
|
v-model:page-size="customerResourceChangesTable.limit" |
||||
|
layout="total, sizes, prev, pager, next, jumper" |
||||
|
:total="customerResourceChangesTable.total" |
||||
|
@size-change="loadCustomerResourceChangesList()" |
||||
|
@current-change="loadCustomerResourceChangesList" |
||||
|
/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</el-card> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import { reactive, ref, watch } from 'vue' |
||||
|
import { t } from '@/lang' |
||||
|
import { useDictionary } from '@/app/api/dict' |
||||
|
import { |
||||
|
getLogList, |
||||
|
} from '@/app/api/customer_resources' |
||||
|
import { img } from '@/utils/common' |
||||
|
import { ElMessageBox, FormInstance } from 'element-plus' |
||||
|
import { useRoute } from 'vue-router' |
||||
|
const route = useRoute() |
||||
|
const pageName = route.meta.title |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
value: Number |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
let customerResourceChangesTable = reactive({ |
||||
|
page: 1, |
||||
|
limit: 10, |
||||
|
total: 0, |
||||
|
loading: true, |
||||
|
data: [], |
||||
|
searchParam: { |
||||
|
customer_resource_id: props.value, |
||||
|
}, |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 获取客户资源表变更记录列表 |
||||
|
*/ |
||||
|
const loadCustomerResourceChangesList = (page: number = 1) => { |
||||
|
customerResourceChangesTable.loading = true |
||||
|
customerResourceChangesTable.page = page |
||||
|
|
||||
|
getLogList({ |
||||
|
page: customerResourceChangesTable.page, |
||||
|
limit: customerResourceChangesTable.limit, |
||||
|
...customerResourceChangesTable.searchParam, |
||||
|
}) |
||||
|
.then((res) => { |
||||
|
customerResourceChangesTable.loading = false |
||||
|
customerResourceChangesTable.data = res.data.data |
||||
|
customerResourceChangesTable.total = res.data.total |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
customerResourceChangesTable.loading = false |
||||
|
}) |
||||
|
} |
||||
|
loadCustomerResourceChangesList() |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
/* 多行超出隐藏 */ |
||||
|
.multi-hidden { |
||||
|
word-break: break-all; |
||||
|
text-overflow: ellipsis; |
||||
|
overflow: hidden; |
||||
|
display: -webkit-box; |
||||
|
-webkit-line-clamp: 2; |
||||
|
-webkit-box-orient: vertical; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,118 @@ |
|||||
|
<template> |
||||
|
<div class="main-container"> |
||||
|
<el-card class="box-card !border-none" shadow="never"> |
||||
|
<div class="flex justify-between items-center"> |
||||
|
</div> |
||||
|
|
||||
|
<div class="mt-[10px]"> |
||||
|
<el-table |
||||
|
:data="customerResourceChangesTable.data" |
||||
|
size="large" |
||||
|
v-loading="customerResourceChangesTable.loading" |
||||
|
> |
||||
|
<template #empty> |
||||
|
<span>{{ |
||||
|
!customerResourceChangesTable.loading ? t('emptyData') : '' |
||||
|
}}</span> |
||||
|
</template> |
||||
|
|
||||
|
<el-table-column prop="payment_id" label="订单号" /> |
||||
|
|
||||
|
<el-table-column prop="course_name" label="课程名称" /> |
||||
|
|
||||
|
|
||||
|
<el-table-column prop="order_amount" label="金额" /> |
||||
|
|
||||
|
<el-table-column prop="order_status" label="状态" /> |
||||
|
|
||||
|
<el-table-column prop="created_at" label="下单时间" /> |
||||
|
|
||||
|
<el-table-column prop="type" label="支付方式" /> |
||||
|
|
||||
|
|
||||
|
</el-table> |
||||
|
<div class="mt-[16px] flex justify-end"> |
||||
|
<el-pagination |
||||
|
v-model:current-page="customerResourceChangesTable.page" |
||||
|
v-model:page-size="customerResourceChangesTable.limit" |
||||
|
layout="total, sizes, prev, pager, next, jumper" |
||||
|
:total="customerResourceChangesTable.total" |
||||
|
@size-change="loadCustomerResourceChangesList()" |
||||
|
@current-change="loadCustomerResourceChangesList" |
||||
|
/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</el-card> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import { reactive, ref, watch } from 'vue' |
||||
|
import { |
||||
|
getOrderTableList, |
||||
|
} from '@/app/api/customer_resources' |
||||
|
import { useRoute } from 'vue-router' |
||||
|
const route = useRoute() |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
value: Number |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
let customerResourceChangesTable = reactive({ |
||||
|
page: 1, |
||||
|
limit: 10, |
||||
|
total: 0, |
||||
|
loading: true, |
||||
|
data: [], |
||||
|
searchParam: { |
||||
|
customer_resource_id: props.value, |
||||
|
}, |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
const getProgress = (row) => { |
||||
|
if (!row.total) return 0; |
||||
|
return Math.round((row.used / row.total) * 100); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取客户资源表变更记录列表 |
||||
|
*/ |
||||
|
const loadCustomerResourceChangesList = (page: number = 1) => { |
||||
|
customerResourceChangesTable.loading = true |
||||
|
customerResourceChangesTable.page = page |
||||
|
|
||||
|
getOrderTableList({ |
||||
|
page: customerResourceChangesTable.page, |
||||
|
limit: customerResourceChangesTable.limit, |
||||
|
...customerResourceChangesTable.searchParam, |
||||
|
}) |
||||
|
.then((res) => { |
||||
|
customerResourceChangesTable.loading = false |
||||
|
customerResourceChangesTable.data = res.data.data |
||||
|
customerResourceChangesTable.total = res.data.total |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
customerResourceChangesTable.loading = false |
||||
|
}) |
||||
|
} |
||||
|
loadCustomerResourceChangesList() |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
/* 多行超出隐藏 */ |
||||
|
.multi-hidden { |
||||
|
word-break: break-all; |
||||
|
text-overflow: ellipsis; |
||||
|
overflow: hidden; |
||||
|
display: -webkit-box; |
||||
|
-webkit-line-clamp: 2; |
||||
|
-webkit-box-orient: vertical; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,131 @@ |
|||||
|
<template> |
||||
|
<div class="main-container"> |
||||
|
<el-card class="box-card !border-none" shadow="never"> |
||||
|
<div class="flex justify-between items-center"> |
||||
|
</div> |
||||
|
|
||||
|
<div class="mt-[10px]"> |
||||
|
<el-table |
||||
|
:data="customerResourceChangesTable.data" |
||||
|
size="large" |
||||
|
v-loading="customerResourceChangesTable.loading" |
||||
|
> |
||||
|
<template #empty> |
||||
|
<span>{{ |
||||
|
!customerResourceChangesTable.loading ? t('emptyData') : '' |
||||
|
}}</span> |
||||
|
</template> |
||||
|
|
||||
|
<el-table-column prop="course_name" label="课程名称" /> |
||||
|
|
||||
|
<el-table-column label="学习进度"> |
||||
|
<template #default="{ row }"> |
||||
|
<div style="display: flex; align-items: center; justify-content: space-between;"> |
||||
|
<el-progress |
||||
|
:percentage="getProgress(row)" |
||||
|
:text-inside="true" |
||||
|
stroke-width="18" |
||||
|
status="success" |
||||
|
style="flex: 1; max-width: 80%;" |
||||
|
/> |
||||
|
<span style="margin-left: 2px; white-space: nowrap; font-size: 14px; color: #666;"> |
||||
|
{{ row.used }}/{{ row.total }} |
||||
|
</span> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
|
||||
|
<el-table-column prop="status" label="状态" /> |
||||
|
|
||||
|
<el-table-column prop="start_date" label="开始时间" /> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
</el-table> |
||||
|
<div class="mt-[16px] flex justify-end"> |
||||
|
<el-pagination |
||||
|
v-model:current-page="customerResourceChangesTable.page" |
||||
|
v-model:page-size="customerResourceChangesTable.limit" |
||||
|
layout="total, sizes, prev, pager, next, jumper" |
||||
|
:total="customerResourceChangesTable.total" |
||||
|
@size-change="loadCustomerResourceChangesList()" |
||||
|
@current-change="loadCustomerResourceChangesList" |
||||
|
/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</el-card> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import { reactive, ref, watch } from 'vue' |
||||
|
import { |
||||
|
getStudentCoursesList, |
||||
|
} from '@/app/api/customer_resources' |
||||
|
import { useRoute } from 'vue-router' |
||||
|
const route = useRoute() |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
value: Number |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
let customerResourceChangesTable = reactive({ |
||||
|
page: 1, |
||||
|
limit: 10, |
||||
|
total: 0, |
||||
|
loading: true, |
||||
|
data: [], |
||||
|
searchParam: { |
||||
|
customer_resource_id: props.value, |
||||
|
}, |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
const getProgress = (row) => { |
||||
|
if (!row.total) return 0; |
||||
|
return Math.round((row.used / row.total) * 100); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取客户资源表变更记录列表 |
||||
|
*/ |
||||
|
const loadCustomerResourceChangesList = (page: number = 1) => { |
||||
|
customerResourceChangesTable.loading = true |
||||
|
customerResourceChangesTable.page = page |
||||
|
|
||||
|
getStudentCoursesList({ |
||||
|
page: customerResourceChangesTable.page, |
||||
|
limit: customerResourceChangesTable.limit, |
||||
|
...customerResourceChangesTable.searchParam, |
||||
|
}) |
||||
|
.then((res) => { |
||||
|
customerResourceChangesTable.loading = false |
||||
|
customerResourceChangesTable.data = res.data.data |
||||
|
customerResourceChangesTable.total = res.data.total |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
customerResourceChangesTable.loading = false |
||||
|
}) |
||||
|
} |
||||
|
loadCustomerResourceChangesList() |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
/* 多行超出隐藏 */ |
||||
|
.multi-hidden { |
||||
|
word-break: break-all; |
||||
|
text-overflow: ellipsis; |
||||
|
overflow: hidden; |
||||
|
display: -webkit-box; |
||||
|
-webkit-line-clamp: 2; |
||||
|
-webkit-box-orient: vertical; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,119 @@ |
|||||
|
<?php |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | Niucloud-admin 企业快速开发的多应用管理平台 |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | 官方网址:https://www.niucloud.com |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | niucloud团队 版权所有 开源版本可自由商用 |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | Author: Niucloud Team |
||||
|
// +---------------------------------------------------------------------- |
||||
|
|
||||
|
namespace app\api\controller\apiController; |
||||
|
|
||||
|
use app\dict\member\MemberLoginTypeDict; |
||||
|
use app\model\member\Member; |
||||
|
use app\Request; |
||||
|
use app\service\api\apiService\CustomerResourcesService; |
||||
|
use app\service\api\login\LoginService; |
||||
|
use core\base\BaseApiService; |
||||
|
|
||||
|
/** |
||||
|
* 学员登陆控制器相关接口 |
||||
|
* Class Personnel |
||||
|
* @package app\api\controller\apiController |
||||
|
*/ |
||||
|
class customerResourcesAuth extends BaseApiService |
||||
|
{ |
||||
|
|
||||
|
//获取字典 |
||||
|
public function login(Request $request) |
||||
|
{ |
||||
|
$phone = $request->param('phone', ''); //手机号 |
||||
|
$password = $request->param('password', ''); //密码 |
||||
|
$openid = $request->param('openid', ''); //微信小程序openid |
||||
|
|
||||
|
if (empty($phone)) { |
||||
|
return fail('请输入手机号'); |
||||
|
} |
||||
|
if (empty($password)) { |
||||
|
return fail('请输入密码'); |
||||
|
} |
||||
|
|
||||
|
$member_info = Member::where('mobile', $phone)->find();//查账户表信息是否存在 |
||||
|
|
||||
|
|
||||
|
if (!$member_info) { |
||||
|
return fail('账户手机号有误'); |
||||
|
} |
||||
|
|
||||
|
$customerResources = \app\model\customer_resources\CustomerResources::where('member_id', $member_info['member_id'])->find();//查客户资源表信息是否存在 |
||||
|
if (!$customerResources) { |
||||
|
return fail('账户信息有误'); |
||||
|
} |
||||
|
|
||||
|
//创建密码 |
||||
|
//$a = create_password($password); |
||||
|
//验证密码 |
||||
|
if (!check_password($password, $member_info->password)) { |
||||
|
return fail('手机号或密码不正确'); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$res = (new LoginService())->login($member_info, MemberLoginTypeDict::MOBILE); |
||||
|
if (!$res) { |
||||
|
return fail('账户信息有误'); |
||||
|
} |
||||
|
$res['user_type'] = '3';//用户类型|3=学员 |
||||
|
return success($res); |
||||
|
} |
||||
|
|
||||
|
//学生详情 |
||||
|
public function info(){ |
||||
|
$member_id = $this->member_id; |
||||
|
$where = [ |
||||
|
'member_id'=>$member_id |
||||
|
]; |
||||
|
$res = (new CustomerResourcesService())->getInfo($where); |
||||
|
if (!$res['code']) { |
||||
|
return fail($res['msg']); |
||||
|
} |
||||
|
return success($res['data']); |
||||
|
} |
||||
|
|
||||
|
//学生详情-修改 |
||||
|
public function edit(Request $request){ |
||||
|
$member_id = $this->member_id; |
||||
|
$where = [ |
||||
|
'member_id'=>$member_id |
||||
|
]; |
||||
|
$data = [ |
||||
|
'headimg' => $request->param('headimg', ''), |
||||
|
'name' => $request->param('name', ''), |
||||
|
'gender' => $request->param('gender', ''), |
||||
|
'age' => $request->param('age', ''), |
||||
|
'phone_number' => $request->param('phone_number', ''), |
||||
|
]; |
||||
|
|
||||
|
// 验证必填字段 |
||||
|
if (empty($data['name'])) { |
||||
|
return fail('姓名不能为空'); |
||||
|
} |
||||
|
if (empty($data['gender'])) { |
||||
|
return fail('性别不能为空'); |
||||
|
} |
||||
|
if (empty($data['age'])) { |
||||
|
return fail('年龄不能为空'); |
||||
|
} |
||||
|
if (empty($data['phone_number'])) { |
||||
|
return fail('手机号不能为空'); |
||||
|
} |
||||
|
|
||||
|
$res = (new CustomerResourcesService())->editInfo($where,$data); |
||||
|
if (!$res['code']) { |
||||
|
return fail($res['msg']); |
||||
|
} |
||||
|
return success([]); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,65 @@ |
|||||
|
<?php |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | Niucloud-admin 企业快速开发的多应用管理平台 |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | 官方网址:https://www.niucloud.com |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | niucloud团队 版权所有 开源版本可自由商用 |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | Author: Niucloud Team |
||||
|
// +---------------------------------------------------------------------- |
||||
|
|
||||
|
namespace app\api\controller\apiController; |
||||
|
|
||||
|
use app\Request; |
||||
|
use app\service\api\apiService\ChatService; |
||||
|
use app\service\api\apiService\PhysicalTestService; |
||||
|
use core\base\BaseApiService; |
||||
|
|
||||
|
/** |
||||
|
* 体测报告-控制器相关接口 |
||||
|
* Class Personnel |
||||
|
* @package app\api\controller\apiController |
||||
|
*/ |
||||
|
class PhysicalTest extends BaseApiService |
||||
|
{ |
||||
|
|
||||
|
//列表 |
||||
|
public function index(Request $request) |
||||
|
{ |
||||
|
$resource_id = $request->param('resource_id', '');//学生资源表id |
||||
|
if (empty($resource_id)) { |
||||
|
return fail('缺少参数'); |
||||
|
} |
||||
|
|
||||
|
$where = [ |
||||
|
'resource_id' => $resource_id, |
||||
|
]; |
||||
|
|
||||
|
$res = (new PhysicalTestService())->getList($where); |
||||
|
|
||||
|
return success($res); |
||||
|
} |
||||
|
|
||||
|
//详情 |
||||
|
public function info(Request $request) |
||||
|
{ |
||||
|
$id = $request->param('id', '');//体测报告的id |
||||
|
|
||||
|
if (empty($id)) { |
||||
|
return fail('缺少参数'); |
||||
|
} |
||||
|
|
||||
|
$where = [ |
||||
|
'id' => $id, |
||||
|
]; |
||||
|
|
||||
|
$res = (new PhysicalTestService())->getInfo($where); |
||||
|
|
||||
|
if(!$res['code']){ |
||||
|
return fail($res['msg']); |
||||
|
} |
||||
|
|
||||
|
return success($res['data']); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,46 @@ |
|||||
|
<?php |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | Niucloud-admin 企业快速开发的多应用管理平台 |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | 官方网址:https://www.niucloud.com |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | niucloud团队 版权所有 开源版本可自由商用 |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | Author: Niucloud Team |
||||
|
// +---------------------------------------------------------------------- |
||||
|
|
||||
|
namespace app\api\controller\apiController; |
||||
|
|
||||
|
use app\Request; |
||||
|
use app\service\api\apiService\CampusService; |
||||
|
use app\service\api\apiService\ChatService; |
||||
|
use app\service\api\apiService\CommonService; |
||||
|
use core\base\BaseApiService; |
||||
|
|
||||
|
/** |
||||
|
* 测试控制器相关接口 |
||||
|
* Class Personnel |
||||
|
* @package app\api\controller\apiController |
||||
|
*/ |
||||
|
class Test extends BaseApiService |
||||
|
{ |
||||
|
|
||||
|
//测试控制器Demo |
||||
|
public function index(Request $request) |
||||
|
{ |
||||
|
$personnel_id = $request->param('personnel_id', '');//员工人力资源表id(两个参数2选1) |
||||
|
$customer_resources_id = $request->param('customer_resources_id', '');//学生资源表id(两个参数2选1) |
||||
|
if (empty($personnel_id) && empty($customer_resources_id)) { |
||||
|
return fail('缺少参数'); |
||||
|
} |
||||
|
|
||||
|
$where = [ |
||||
|
'personnel_id' => $personnel_id, |
||||
|
'customer_resources_id' => $customer_resources_id, |
||||
|
]; |
||||
|
|
||||
|
$res = (new ChatService())->getChatFriendsPage($where); |
||||
|
|
||||
|
return success($res); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
<?php |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | Niucloud-admin 企业快速开发的多应用管理平台 |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | 官方网址:https://www.niucloud.com |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | niucloud团队 版权所有 开源版本可自由商用 |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | Author: Niucloud Team |
||||
|
// +---------------------------------------------------------------------- |
||||
|
|
||||
|
namespace app\api\controller\apiController; |
||||
|
|
||||
|
use app\Request; |
||||
|
use core\base\BaseApiService; |
||||
|
|
||||
|
/** |
||||
|
* 学生用户反馈控制器相关接口 |
||||
|
* Class Personnel |
||||
|
* @package app\api\controller\apiController |
||||
|
*/ |
||||
|
class UserFeedback extends BaseApiService |
||||
|
{ |
||||
|
|
||||
|
//学生用户反馈-添加 |
||||
|
public function add(Request $request) |
||||
|
{ |
||||
|
// 接受参数 |
||||
|
$user_id = $request->post('user_id', ''); // 用户ID(对应school_customer_resources表id) |
||||
|
$feedback_text = $request->post('feedback_text', ''); // 反馈内容 |
||||
|
$attachment_url = $request->post('attachment_url', null); // 附件URL(OSS对象存储),允许为空 |
||||
|
|
||||
|
|
||||
|
//验证必填 |
||||
|
if (empty($user_id) || empty($feedback_text)) { |
||||
|
return fail('必填参数不能为空'); |
||||
|
} |
||||
|
|
||||
|
$data = [ |
||||
|
'user_id' => $user_id, |
||||
|
'feedback_text' => $feedback_text, |
||||
|
'attachment_url' => $attachment_url ?? null, |
||||
|
]; |
||||
|
|
||||
|
$add = \app\model\user_feedback\UserFeedback::create($data); |
||||
|
|
||||
|
if (!$add) { |
||||
|
return fail('添加失败'); |
||||
|
} |
||||
|
|
||||
|
return success([]); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,115 @@ |
|||||
|
<?php |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | Niucloud-admin 企业快速开发的多应用管理平台 |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | 官方网址:https://www.niucloud.com |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | niucloud团队 版权所有 开源版本可自由商用 |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | Author: Niucloud Team |
||||
|
// +---------------------------------------------------------------------- |
||||
|
|
||||
|
namespace app\service\api\apiService; |
||||
|
|
||||
|
use app\model\campus\Campus; |
||||
|
use app\model\campus_person_role\CampusPersonRole; |
||||
|
use app\model\chat_friends\ChatFriends; |
||||
|
use app\model\physical_test\PhysicalTest; |
||||
|
use core\base\BaseApiService; |
||||
|
|
||||
|
/** |
||||
|
* 体测报告-控制器服务层 |
||||
|
* Class MemberService |
||||
|
* @package app\service\api\member |
||||
|
*/ |
||||
|
class PhysicalTestService extends BaseApiService |
||||
|
{ |
||||
|
public function __construct() |
||||
|
{ |
||||
|
parent::__construct(); |
||||
|
} |
||||
|
|
||||
|
//查询列表 |
||||
|
public function getList(array $where,string $field = '*') |
||||
|
{ |
||||
|
$page_params = $this->getPageParam();//获取请求参数中的页码+分页数 |
||||
|
$page = $page_params['page']; |
||||
|
$limit = $page_params['limit']; |
||||
|
|
||||
|
$model = new PhysicalTest(); |
||||
|
//判断用没有员工id |
||||
|
if (!empty($where['resource_id'])) { |
||||
|
$model = $model->where('resource_id', $where['resource_id']); |
||||
|
} |
||||
|
|
||||
|
$data = $model |
||||
|
->field($field) |
||||
|
->order('id','desc') |
||||
|
->append([ |
||||
|
'customerResources' |
||||
|
]) |
||||
|
->with([ |
||||
|
'customerResourcesHasOne' |
||||
|
]) |
||||
|
->paginate([ |
||||
|
'list_rows' => $limit, |
||||
|
'page' => $page, |
||||
|
])->toArray(); |
||||
|
|
||||
|
|
||||
|
foreach ($data['data'] as &$v) { |
||||
|
$age = $v['customerResourcesHasOne']['age'];//年龄 |
||||
|
$gender = $v['customerResourcesHasOne']['gender'] == 'female' ? 2:1 ;//性别( 1:男,2:女) |
||||
|
$height = $v['height'];//身高 |
||||
|
$weight = $v['weight'];//体重 |
||||
|
$v['calculateChildHealthScore'] = calculateChildHealthScore($age, $gender, $height, $weight);//综合评分 |
||||
|
} |
||||
|
|
||||
|
return $data; |
||||
|
} |
||||
|
|
||||
|
//查询详情 |
||||
|
public function getInfo(array $where,string $field = '*') |
||||
|
{ |
||||
|
$model = new PhysicalTest(); |
||||
|
//判断用没有体测报告id |
||||
|
if (!empty($where['id'])) { |
||||
|
$model = $model->where('id', $where['id']); |
||||
|
} |
||||
|
|
||||
|
$data = $model |
||||
|
->field($field) |
||||
|
->append([ |
||||
|
'customerResources' |
||||
|
]) |
||||
|
->with([ |
||||
|
'customerResourcesHasOne' |
||||
|
]) |
||||
|
->find(); |
||||
|
|
||||
|
|
||||
|
if ($data) { |
||||
|
$data = $data->toArray(); |
||||
|
|
||||
|
$age = $data['customerResourcesHasOne']['age'];//年龄 |
||||
|
$gender = $data['customerResourcesHasOne']['gender'] == 'female' ? 2 : 1;//性别( 1:男,2:女) |
||||
|
$height = $data['height'];//身高 |
||||
|
$weight = $data['weight'];//体重 |
||||
|
$data['calculateChildHealthScore'] = calculateChildHealthScore($age, $gender, $height, $weight);//综合评分 |
||||
|
|
||||
|
$res = [ |
||||
|
'code' => 1, |
||||
|
'msg' => '操作成功', |
||||
|
'data' => $data |
||||
|
]; |
||||
|
return $res; |
||||
|
} else { |
||||
|
$res = [ |
||||
|
'code' => 0, |
||||
|
'msg' => '暂无数据', |
||||
|
'data' => [] |
||||
|
]; |
||||
|
return $res; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,95 @@ |
|||||
|
<?php |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | Niucloud-admin 企业快速开发的多应用管理平台 |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | 官方网址:https://www.niucloud.com |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | niucloud团队 版权所有 开源版本可自由商用 |
||||
|
// +---------------------------------------------------------------------- |
||||
|
// | Author: Niucloud Team |
||||
|
// +---------------------------------------------------------------------- |
||||
|
|
||||
|
namespace app\service\api\apiService; |
||||
|
|
||||
|
use app\model\campus\Campus; |
||||
|
use app\model\campus_person_role\CampusPersonRole; |
||||
|
use app\model\chat_friends\ChatFriends; |
||||
|
use app\model\chat_messages\ChatMessages; |
||||
|
use app\model\dict\Dict; |
||||
|
use core\base\BaseApiService; |
||||
|
use think\facade\Db; |
||||
|
|
||||
|
/** |
||||
|
* 测试-控制器服务层 |
||||
|
* Class MemberService |
||||
|
* @package app\service\api\member |
||||
|
*/ |
||||
|
class TestService extends BaseApiService |
||||
|
{ |
||||
|
public function __construct() |
||||
|
{ |
||||
|
parent::__construct(); |
||||
|
} |
||||
|
|
||||
|
//查询列表 |
||||
|
public function getTestList(array $where) |
||||
|
{ |
||||
|
$page_params = $this->getPageParam();//获取请求参数中的页码+分页数 |
||||
|
$page = $page_params['page']; |
||||
|
$limit = $page_params['limit']; |
||||
|
|
||||
|
$model = new ChatFriends(); |
||||
|
//判断用没有员工id |
||||
|
if (!empty($where['personnel_id'])) { |
||||
|
$model = $model->where('personnel_id', $where['personnel_id']); |
||||
|
} |
||||
|
|
||||
|
if (!empty($where['customer_resources_id'])) { |
||||
|
$model = $model->where('customer_resources_id', $where['customer_resources_id']); |
||||
|
} |
||||
|
|
||||
|
$data = $model |
||||
|
->with([ |
||||
|
'personnel', |
||||
|
'customer', |
||||
|
]) |
||||
|
->paginate([ |
||||
|
'list_rows' => $limit, |
||||
|
'page' => $page, |
||||
|
])->toArray(); |
||||
|
|
||||
|
return $data; |
||||
|
} |
||||
|
|
||||
|
//查询详情 |
||||
|
public function getTestInfo(array $where) |
||||
|
{ |
||||
|
$model = new ChatFriends(); |
||||
|
//判断用没有员工id |
||||
|
if (!empty($where['personnel_id'])) { |
||||
|
$model = $model->where('personnel_id', $where['personnel_id']); |
||||
|
} |
||||
|
if (!empty($where['customer_resources_id'])) { |
||||
|
$model = $model->where('customer_resources_id', $where['customer_resources_id']); |
||||
|
} |
||||
|
$data = $model->find(); |
||||
|
|
||||
|
|
||||
|
if ($data) { |
||||
|
$data = $data->toArray(); |
||||
|
$res = [ |
||||
|
'code' => 1, |
||||
|
'msg' => '操作成功', |
||||
|
'data' => $data |
||||
|
]; |
||||
|
return $res; |
||||
|
} else { |
||||
|
$res = [ |
||||
|
'code' => 0, |
||||
|
'msg' => '暂无数据', |
||||
|
'data' => [] |
||||
|
]; |
||||
|
return $res; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue