|
|
@ -666,4 +666,49 @@ class CustomerResourcesService extends BaseApiService |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function updateUserCourseInfo($data) |
|
|
|
|
|
{ |
|
|
|
|
|
// 验证必要参数 |
|
|
|
|
|
if (empty($data['id'])) { |
|
|
|
|
|
return ['code' => false, 'msg' => '缺少必要参数id']; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
// 更新school_student_courses表中的字段 |
|
|
|
|
|
$update_data = []; |
|
|
|
|
|
|
|
|
|
|
|
// 更新主教练ID |
|
|
|
|
|
if (isset($data['main_coach_id'])) { |
|
|
|
|
|
$update_data['main_coach_id'] = $data['main_coach_id']; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 更新助教IDs |
|
|
|
|
|
if (isset($data['assistant_ids'])) { |
|
|
|
|
|
$update_data['assistant_ids'] = $data['assistant_ids']; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 更新教务ID |
|
|
|
|
|
if (isset($data['education_id'])) { |
|
|
|
|
|
$update_data['education_id'] = $data['education_id']; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 如果没有需要更新的数据,直接返回成功 |
|
|
|
|
|
if (empty($update_data)) { |
|
|
|
|
|
return ['code' => true, 'msg' => '更新成功']; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 执行更新操作 |
|
|
|
|
|
$res = \think\facade\Db::name('student_courses') |
|
|
|
|
|
->where('id', $data['id']) |
|
|
|
|
|
->update($update_data); |
|
|
|
|
|
|
|
|
|
|
|
if ($res !== false) { |
|
|
|
|
|
return ['code' => true, 'msg' => '更新成功']; |
|
|
|
|
|
} else { |
|
|
|
|
|
return ['code' => false, 'msg' => '更新失败']; |
|
|
|
|
|
} |
|
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
|
return ['code' => false, 'msg' => '更新失败:' . $e->getMessage()]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|