于宏哲PHP 6 months ago
parent
commit
15b1f5674b
  1. 24
      niucloud/app/api/controller/apiController/CustomerResources.php
  2. 1
      niucloud/app/api/controller/member/Member.php
  3. 32
      niucloud/app/api/controller/student/StudentController.php
  4. 2
      niucloud/app/api/route/member.php
  5. 4
      niucloud/app/api/route/student.php
  6. 14
      niucloud/app/listener/personnel/Student.php
  7. 2
      niucloud/app/service/admin/customer_resources/CustomerResourcesService.php
  8. 13
      niucloud/app/service/admin/person_course_schedule/PersonCourseScheduleService.php
  9. 4
      niucloud/app/service/admin/physical_test/PhysicalTestService.php
  10. 36
      niucloud/app/service/api/apiService/PersonnelService.php
  11. 66
      niucloud/app/service/api/student/StudentService.php
  12. 6
      uniapp/api/member.js
  13. 142
      uniapp/pages-coach/coach/my/teaching_management_info.vue
  14. 16
      uniapp/pages-market/clue/add_clues.vue
  15. 1
      uniapp/pages-market/clue/class_arrangement_detail.vue
  16. 3484
      uniapp/pages-market/clue/clue_info.vue
  17. 10
      uniapp/pages-market/clue/edit_clues.vue
  18. 26
      uniapp/pages-market/clue/index.vue
  19. 1
      uniapp/pages-student/schedule/index.vue

24
niucloud/app/api/controller/apiController/CustomerResources.php

@ -66,15 +66,15 @@ class CustomerResources extends BaseApiService
$date = date('Y-m-d');
$param = $request->param();
$promised_visit_time = $request->param('promised_visit_time', '');
if ($promised_visit_time) {
$promised_visit_time = date('Y-m-d H:i:s', strtotime($promised_visit_time));
}
// if ($promised_visit_time) {
// $promised_visit_time = date('Y-m-d H:i:s', strtotime($promised_visit_time));
// }
$optional_class_time = $request->param('optional_class_time', '');
if ($optional_class_time) {
$optional_class_time = date('Y-m-d H:i:s', strtotime($optional_class_time));
}
// if ($optional_class_time) {
// $optional_class_time = date('Y-m-d H:i:s', strtotime($optional_class_time));
// }
$personnel = new Personnel();
$role_id = $personnel->alias("a")
->join(['school_campus_person_role' => 'b'], 'a.id = b.person_id', 'left')
@ -157,15 +157,15 @@ class CustomerResources extends BaseApiService
$customer_resources_id = $request->param('id', '');//客户资源表id
$promised_visit_time = $request->param('promised_visit_time', '');
if ($promised_visit_time) {
$promised_visit_time = date('Y-m-d H:i:s', strtotime($promised_visit_time));
}
// if ($promised_visit_time) {
// $promised_visit_time = date('Y-m-d H:i:s', strtotime($promised_visit_time));
// }
$optional_class_time = $request->param('optional_class_time', '');
if ($optional_class_time) {
$optional_class_time = date('Y-m-d H:i:s', strtotime($optional_class_time));
}
// if ($optional_class_time) {
// $optional_class_time = date('Y-m-d H:i:s', strtotime($optional_class_time));
// }
if (empty($customer_resources_id)) {

1
niucloud/app/api/controller/member/Member.php

@ -212,4 +212,5 @@ class Member extends BaseApiController
public function get_classes_list(){
return success(( new MemberService() )->get_classes_list());
}
}

32
niucloud/app/api/controller/student/StudentController.php

@ -9,6 +9,8 @@
namespace app\api\controller\student;
use app\Request;
use app\service\api\apiService\PersonnelService;
use app\service\api\parent\ParentService;
use app\service\api\student\StudentService;
use core\base\BaseController;
@ -342,4 +344,34 @@ class StudentController extends BaseController
return fail($e->getMessage());
}
}
public function is_pass(Request $request){
//获取员工信息
$old_password = $request->param('password','');
if(empty($old_password)){
return fail('请输入旧密码');
}
$res = (new StudentService())->checkMemberOldPwd($old_password);
if(!$res['code']){
return fail('旧密码不正确');
}
return success($res['data']);
}
public function set_pass(Request $request){
$new_password = $request->param('old_password','');
$password = $request->param('password','');
if($new_password != $password){
return fail('二次密码输入不正确');
}
$res = (new StudentService())->updatePassword($new_password);
if(!$res['code']){
return fail('旧密码不正确');
}
return success($res['data']);
}
}

2
niucloud/app/api/route/member.php

@ -131,6 +131,8 @@ Route::group('member', function () {
//员工工资详情
Route::get('salary/info/:id', 'member.Salary/info');
})->middleware(ApiChannel::class)
->middleware(ApiPersonnelCheckToken::class, true)
->middleware(ApiLog::class);

4
niucloud/app/api/route/student.php

@ -35,6 +35,10 @@ Route::group('student', function () {
Route::get('contract/download', 'student.StudentContract/downloadContract');
Route::get('contract/download-file', 'student.StudentContract/downloadFile');
Route::get('student-info', 'student.StudentContract/getStudentInfo');
Route::post('is_pass', 'app\api\controller\student\StudentController@is_pass');
Route::post('set_pass', 'app\api\controller\student\StudentController@set_pass');
})->middleware(['ApiCheckToken']);
// 体测数据管理

14
niucloud/app/listener/personnel/Student.php

@ -49,13 +49,17 @@ class Student
$studentCourses = new StudentCourses();
$student_course_usage = new StudentCourseUsage();
$schedule_info = $courseSchedule->where(['id' => $data['schedule_id']])->find();
$studentCourses_info = $studentCourses->where(['student_id' => $data['student_id'], 'course_id' => $schedule_info['course_id']])->find();
$student_course_usage->insert([
'student_course_id' => $studentCourses_info['id'],
'used_hours' => $studentCourses_info['single_session_count'],
'usage_date' => date("Y-m-d")
]);
if($studentCourses_info){
$student_course_usage->insert([
'student_course_id' => $studentCourses_info['id'],
'used_hours' => $studentCourses_info['single_session_count'],
'usage_date' => date("Y-m-d")
]);
}
}

2
niucloud/app/service/admin/customer_resources/CustomerResourcesService.php

@ -232,7 +232,7 @@ class CustomerResourcesService extends BaseAdminService
$personnel = new Personnel();
$data['consultant'] = $personnel->where(['sys_user_id' => $this->uid])->value("id");
if(!$data['consultant']){
return fail("操作失败");
return fail("超级管理员不允许修改资源");
}
if ($this->model->where([

13
niucloud/app/service/admin/person_course_schedule/PersonCourseScheduleService.php

@ -236,4 +236,17 @@ class PersonCourseScheduleService extends BaseAdminService
$customerResourcesModel = new CustomerResources();
return $customerResourcesModel->select()->toArray();
}
public function xk(int $id)
{
$data = $this->model->where([['id', '=', $id]])->find()->toArray();
event('Student', [
'event_type' => 'xiaoke',
'data' => $data
]);
return true;
}
}

4
niucloud/app/service/admin/physical_test/PhysicalTestService.php

@ -39,7 +39,7 @@ class PhysicalTestService extends BaseAdminService
*/
public function getPage(array $where = [])
{
$field = 'id,resource_id,student_id,height,weight,coach_id,created_at,updated_at,seated_forward_bend,sit_ups,push_ups,flamingo_balance,thirty_sec_jump,standing_long_jump,agility_run,balance_beam,tennis_throw,ten_meter_shuttle_run,physical_test_report';
$field = '*';
$order = 'id desc';
$search_model = $this->model->withSearch(["resource_id","student_id"], $where)->with(['customerResources','student','personnel'])->field($field)->order($order);
@ -55,7 +55,7 @@ class PhysicalTestService extends BaseAdminService
*/
public function getInfo(int $id)
{
$field = 'id,resource_id,student_id,height,weight,coach_id,created_at,updated_at,seated_forward_bend,sit_ups,push_ups,flamingo_balance,thirty_sec_jump,standing_long_jump,agility_run,balance_beam,tennis_throw,ten_meter_shuttle_run,physical_test_report';
$field = '*';
$info = $this->model->field($field)->where([['id', "=", $id]])->with(['customerResources','student','personnel'])->findOrEmpty()->toArray();
return $info;

36
niucloud/app/service/api/apiService/PersonnelService.php

@ -12,6 +12,7 @@
namespace app\service\api\apiService;
use app\model\campus_person_role\CampusPersonRole;
use app\model\customer_resources\CustomerResources;
use app\model\departments\Departments;
use app\model\member\Member;
use app\model\personnel\Personnel;
@ -263,6 +264,9 @@ class PersonnelService extends BaseApiService
return $res;
}
//设置新密码
public function edidPassword($phone, $new_password, $key_value)
{
@ -922,22 +926,22 @@ class PersonnelService extends BaseApiService
$where = [];
// 查询销售部门(dept_id=3)下的所有角色ID
// $salesRoleIds = SysRole::where('dept_id', 3)
// ->where('status', 1)
// ->column('role_id');
//
// if (empty($salesRoleIds)) {
// return [
// 'code' => 1,
// 'msg' => '暂无销售部门角色',
// 'data' => []
// ];
// }
//
// // 构建校区人员角色关系查询条件
// $campusPersonWhere = [
// ['role_id', 'in', $salesRoleIds]
// ];
$salesRoleIds = SysRole::where('dept_id', 3)
->where('status', 1)
->column('role_id');
if (empty($salesRoleIds)) {
return [
'code' => 1,
'msg' => '暂无销售部门角色',
'data' => []
];
}
// 构建校区人员角色关系查询条件
$campusPersonWhere = [
['role_id', 'in', $salesRoleIds]
];
// 根据传入的校区进行筛选
if (!empty($campus)) {

66
niucloud/app/service/api/student/StudentService.php

@ -9,6 +9,8 @@ use app\model\customer_resources\CustomerResources;
use app\model\student\Student;
use app\model\member\Member;
use app\model\student_label\StudentLabel;
use app\model\sys\SysUser;
use think\facade\Cache;
use think\facade\Db;
use core\base\BaseService;
use core\exception\CommonException;
@ -805,4 +807,68 @@ class StudentService extends BaseService
'cancelled_courses' => $cancelledCourses
];
}
public function checkMemberOldPwd(string $old_passowrd)
{
$res = [
'code' => 0,
'msg' => '操作失败',
'data' => []
];
$customerResources = new CustomerResources();
$personnel_id = $this->getUserId();
$member = new Member();
$phone = $customerResources->where('id', $personnel_id)->value('phone_number');
$password = $customerResources->where('id', $personnel_id)->value('password');
if (!check_password($old_passowrd, $password)) {
$res['msg'] = '旧密码错误';
return $res;
}
$res['code'] = 1;
$res['msg'] = '密码正确';
$res['data'] = [
'key_value' => $this->setEditPasswordKey($phone)
];
return $res;
}
public function updatePassword($new_password){
$customerResources = new CustomerResources();
$personnel_id = $this->getUserId();
$update = $customerResources->where('id', $personnel_id)->update([
'password' => create_password($new_password)
]);
if (!$update) {
$res = [
'code' => 0,
'msg' => '操作失败',
'data' => []
];
} else {
$res = [
'code' => 1,
'msg' => '操作成功',
'data' => []
];
}
return $res;
}
public function setEditPasswordKey(string $phone)
{
$key_name = 'edit_password_' . $phone;
//生成字符串,存入cache中
//check_password()//验证
//create_password()//创建
$key_value = create_password($key_name);
// 缓存在3600秒之后过期
Cache::set($key_name, $key_value, 3600);
return $key_value;
}
}

6
uniapp/api/member.js

@ -149,4 +149,10 @@ export default {
async getSalaryInfo(data = {}) {
return await http.get(`/member/salary/info/${data.id}`);
},
async is_pass(data = {}) {
return await http.post('/student/is_pass', data)
},
async set_pass(data = {}) {
return await http.post('/student/set_pass', data)
},
}

142
uniapp/pages-coach/coach/my/teaching_management_info.vue

@ -191,8 +191,9 @@ export default {
if (url.startsWith('http://') || url.startsWith('https://')) {
return url;
}
// URL
return 'http://localhost:20080' + (url.startsWith('/') ? url : '/' + url);
return 'https://api.hnhbty.cn' + (url.startsWith('/') ? url : '/' + url);
},
//
@ -204,74 +205,91 @@ export default {
},
//
downloadFile(url) {
uni.showLoading({
title: '下载中...'
});
uni.downloadFile({
url: url,
success: (res) => {
if (res.statusCode === 200) {
//
const extension = this.getFileExtension(url);
const fileName = this.getFileName(url);
//
if (['jpg', 'jpeg', 'png', 'gif', 'webp'].includes(extension.toLowerCase())) {
//
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => {
uni.showToast({
title: '保存成功',
icon: 'success'
});
},
fail: (error) => {
console.error('保存图片失败:', error);
uni.showToast({
title: '保存失败',
icon: 'none'
});
}
downloadFile(url) {
uni.showLoading({
title: '下载中...'
});
//
// #ifdef H5
// H5
const link = document.createElement('a');
link.href = url;
link.download = this.getFileName(url); //
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
uni.hideLoading();
uni.showToast({
title: '开始下载',
icon: 'success'
});
// #endif
// #ifndef H5
// / App uni.downloadFile
uni.downloadFile({
url: url,
success: (res) => {
if (res.statusCode === 200) {
const extension = this.getFileExtension(url);
if (['jpg', 'jpeg', 'png', 'gif', 'webp'].includes(extension.toLowerCase())) {
//
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => {
uni.showToast({
title: '保存成功',
icon: 'success'
});
} else {
//
uni.openDocument({
filePath: res.tempFilePath,
showMenu: true,
success: () => {
console.log('打开文档成功');
},
fail: (error) => {
console.error('打开文档失败:', error);
uni.showToast({
title: '无法打开文件',
icon: 'none'
});
}
},
fail: (error) => {
console.error('保存图片失败:', error);
uni.showToast({
title: '保存失败',
icon: 'none'
});
}
});
} else {
//
uni.openDocument({
filePath: res.tempFilePath,
showMenu: true,
success: () => {
console.log('打开文档成功');
},
fail: (error) => {
console.error('打开文档失败:', error);
uni.showToast({
title: '无法打开文件',
icon: 'none'
});
}
} else {
uni.showToast({
title: '下载失败',
icon: 'none'
});
}
},
fail: (error) => {
console.error('下载失败:', error);
uni.showToast({
title: '下载失败',
icon: 'none'
});
},
complete: () => {
uni.hideLoading();
}
} else {
uni.showToast({
title: '下载失败',
icon: 'none'
});
}
},
fail: (error) => {
console.error('下载失败:', error);
uni.showToast({
title: '下载失败',
icon: 'none'
});
},
complete: () => {
uni.hideLoading();
}
});
// #endif
},
//
getFileName(url) {

16
uniapp/pages-market/clue/add_clues.vue

@ -390,12 +390,24 @@
:bottomBorder='false'
>
<view class="input-title" style="margin-right:14rpx;">
<view
<fui-input
:borderBottom="false"
:padding="[0]"
placeholder="填写承诺到访时间"
v-model="formData.promised_visit_time"
backgroundColor="#434544"
size="26"
color="#fff"
></fui-input>
<!-- <view
class="input-title"
style="margin-right:14rpx;"
@click="openDateTime(`promised_visit_time`)">
{{ (formData.promised_visit_time) ? formData.promised_visit_time : '点击选择' }}
</view>
</view> -->
</view>
</fui-form-item>
<!--距离-->

1
uniapp/pages-market/clue/class_arrangement_detail.vue

@ -486,6 +486,7 @@
return;
}
console.log(this.selectedStudent);
// 2.
if (!this.selectedStudent.name || !this.selectedStudent.phone) {
uni.showToast({

3484
uniapp/pages-market/clue/clue_info.vue

File diff suppressed because it is too large

10
uniapp/pages-market/clue/edit_clues.vue

@ -165,12 +165,18 @@
</view>
</fui-form-item>
<!-- 承诺到访时间 -->
<fui-form-item labelWidth="240" label="2、承诺到访时间" labelSize='26' prop="promised_visit_time" background='#434544' labelColor='#fff' :bottomBorder='false'>
<!-- <fui-form-item labelWidth="240" label="2、承诺到访时间" labelSize='26' prop="promised_visit_time" background='#434544' labelColor='#fff' :bottomBorder='false'>
<view class="input-title" style="margin-right:14rpx;">
<view class="input-title" style="margin-right:14rpx;" @click="openDateTime('promised_visit_time')">
{{ formData.promised_visit_time ? formData.promised_visit_time : '点击选择' }}
</view>
</view>
</fui-form-item> -->
<fui-form-item labelWidth="240" label="2、承诺到访时间" labelSize='26' prop="promised_visit_time" background='#434544' labelColor='#fff' :bottomBorder='false'>
<view class="input-title" style="margin-right:14rpx;">
<fui-input :borderBottom="false" :padding="[0]" placeholder="填写承诺到访时间" v-model="formData.promised_visit_time" backgroundColor="#434544" size="26" color="#fff" ></fui-input>
</view>
</fui-form-item>
<!-- 距离 -->
<fui-form-item label="3、距离" label-width="210" labelSize='26' prop="distance" background='#434544' labelColor='#fff' :bottomBorder='false'>
@ -309,7 +315,7 @@
<fui-date-picker :show="date_picker_show" type="5" @change="change_date" @cancel="cancel_date" :value="default_date_value"></fui-date-picker>
<!-- 日期时间选择器 -->
<fui-date-picker :show="datetime_picker_show" type="1" @change="change_datetime" @cancel="cancel_datetime" :value="default_datetime_value"></fui-date-picker>
<fui-date-picker :show="datetime_picker_show" type="5" @change="change_datetime" @cancel="cancel_datetime" :value="default_datetime_value"></fui-date-picker>
<fui-picker :linkage='picker_linkage' :options="picker_options" :layer="1" :show="picker_show" @change="changeCicker" @cancel="cancelCicker"></fui-picker>

26
uniapp/pages-market/clue/index.vue

@ -18,10 +18,10 @@
</view>
<view class="card" v-for="(v,k) in tableList_1" :key="k">
<!-- 状态水印 -->
<view class="status-watermark" v-if="!v.customerResource.communication_time">
<view class="status-watermark" v-if="v.customerResource && !v.customerResource.communication_time">
新资源
</view>
<view class="card-content">
<view class="card-content" v-if="v.customerResource">
<view class="card-left" @click="clue_info(v)">
<view class="user-info-row">
<view class="user-avatar">
@ -79,14 +79,14 @@
</view>
<view class="card-footer">
<view class="card-date">
<view class="card-con" v-if="v.customerResource.communication_time">
<view class="card-con" v-if="v.customerResource && v.customerResource.communication_time">
{{ $util.formatToDateTime((v.customerResource.communication_time || ''), 'm-d H:i') }}
拨打电话
</view>
<view class="card-con" v-else>
暂未联系
</view>
<view style="margin-left: 30rpx;">
<view style="margin-left: 30rpx;" v-if="v.customerResource">
<view style="display: flex;align-items: center;">
<view class="title-x">
是否有效{{ v.sixSpeed && v.sixSpeed.efficacious === 1 ? '有效' : '无效' }}
@ -134,7 +134,7 @@
</view>
<view class="card" v-for="(v,k) in tableList_2" :key="k" @click="batchMode ? toggleItemSelection(v) : null">
<!-- 状态水印 -->
<view class="status-watermark" v-if="!v.customerResource.communication_time">
<view class="status-watermark" v-if="v.customerResource && !v.customerResource.communication_time">
新资源
</view>
<view class="card-content">
@ -153,6 +153,18 @@
</view>
<!-- <view class="card-label">{{v.is_status == 1 ? '试听' : '成交'}}</view>-->
</view>
<view class="card-con">
所属校区{{ v.customerResource.campus_name }}
</view>
<view class="card-con">
市场老师{{ v.customerResource.consultant_name }}
</view>
<view class="card-con">
决策人{{v.customerResource.name}} <span
class="card-con-span">{{v.customerResource.decision_maker}}</span>
@ -169,13 +181,13 @@
</view>
<view class="card-footer">
<view class="card-date">
<view class="card-con" v-if="v.customerResource.communication_time">
<view class="card-con" v-if="v.customerResource && v.customerResource.communication_time">
{{ $util.formatToDateTime((v.customerResource.communication_time || ''),'m-d H:i') }} 拨打电话
</view>
<view class="card-con" v-else>
暂未联系
</view>
<view style="margin-left: 30rpx;">
<view style="margin-left: 30rpx;" v-if="v.customerResource">
<view style="display: flex;align-items: center;">
<view style="padding: 12rpx;">
<image v-if="v.customerResource.initial_intent == 'high'"

1
uniapp/pages-student/schedule/index.vue

@ -498,6 +498,7 @@
},
async requestLeave() {
this.showCoursePopup = false
if (!this.selectedCourse) return
uni.showModal({

Loading…
Cancel
Save