Browse Source

fix(api): 修复客户资源手机号重复添加问题

- 在添加客户资源前增加手机号存在性检查- 通过修改 CustomerResourcesService 类实现手机号查询功能
master
liutong 10 months ago
parent
commit
75afc844b9
  1. 19
      niucloud/app/api/controller/apiController/Assignment.php
  2. 3
      niucloud/app/api/route/route.php
  3. 24
      niucloud/app/service/api/apiService/AssignmentService.php

19
niucloud/app/api/controller/apiController/Assignment.php

@ -72,4 +72,23 @@ class Assignment extends BaseApiService
return success([$res['data']]);
}
//学生作业详情
public function info(Request $request)
{
$id = $request->param('id', '');//作业表id
if(empty($id)){
return fail('缺少参数');
}
$where = [
'id'=>$id,
];
$res = (new AssignmentService())->getInfo($where);
if (!$res['code']){
return fail($res['msg']);
}
return success($res['data']);
}
}

3
niucloud/app/api/route/route.php

@ -379,7 +379,10 @@ Route::group(function () {
//学生端-学生作业-作业列表
Route::get('xy/assignment', 'apiController.Assignment/index');
//学生端-提交作业
Route::get('xy/assignment/submitObj', 'apiController.Assignment/submitObj');
//学生端-作业详情
Route::get('xy/assignment/info', 'apiController.Assignment/info');

24
niucloud/app/service/api/apiService/AssignmentService.php

@ -100,18 +100,24 @@ class AssignmentService extends BaseApiService
}
//查询详情
public function getTestInfo(array $where)
public function getInfo(array $where)
{
$model = new ChatFriends();
//判断用没有员工id
if (!empty($where['personnel_id'])) {
$model = $model->where('personnel_id', $where['personnel_id']);
$model = new Assignment();
if (!empty($where['id'])) {
$model = $model->where('id', $where['id']);
}
if (!empty($where['customer_resources_id'])) {
$model = $model->where('customer_resources_id', $where['customer_resources_id']);
}
$data = $model->find();
$data = $model->with([
'student' => function ($query) {
$query->with([
'customerResources' => function ($query2) {
$query2->with([
'member'
]);
}
]);
},
])->find();
if ($data) {
$data = $data->toArray();

Loading…
Cancel
Save