问题修复02

parent 3fbd2a23
...@@ -66,8 +66,8 @@ export async function teacherInfo(teacherId: string) { ...@@ -66,8 +66,8 @@ export async function teacherInfo(teacherId: string) {
* @param teacherId 导师ID * @param teacherId 导师ID
* @param param 修改参数 * @param param 修改参数
* @param param.political_status 政治面貌 * @param param.political_status 政治面貌
* @param param.is_class_teacher 是否班主任 * @param user_name 教师姓名
* @param param.max_students 最大可带学生数 * @param gender 教师性别
* @param param.class_ids 任教班级ID数组 * @param param.class_ids 任教班级ID数组
* @param param.subjects 任教科目数组 * @param param.subjects 任教科目数组
* @param param.semester_id 学期ID(可选,默认使用当前学期) * @param param.semester_id 学期ID(可选,默认使用当前学期)
...@@ -93,8 +93,8 @@ export async function teacherUpdate(teacherId: string, param: any) { ...@@ -93,8 +93,8 @@ export async function teacherUpdate(teacherId: string, param: any) {
/**更新导师扩展信息 */ /**更新导师扩展信息 */
let updateData: any = {}; let updateData: any = {};
if (param.political_status !== undefined) updateData.political_status = param.political_status; if (param.political_status !== undefined) updateData.political_status = param.political_status;
if (param.is_class_teacher !== undefined) updateData.is_class_teacher = param.is_class_teacher; // if (param.is_class_teacher !== undefined) updateData.is_class_teacher = param.is_class_teacher;
if (param.max_students !== undefined) updateData.max_students = param.max_students; // if (param.max_students !== undefined) updateData.max_students = param.max_students;
if (Object.keys(updateData).length > 0) { if (Object.keys(updateData).length > 0) {
await updateManyData(TABLENAME.用户扩展信息表, { user_id: teacherId }, updateData); await updateManyData(TABLENAME.用户扩展信息表, { user_id: teacherId }, updateData);
...@@ -136,6 +136,16 @@ export async function teacherUpdate(teacherId: string, param: any) { ...@@ -136,6 +136,16 @@ export async function teacherUpdate(teacherId: string, param: any) {
} }
} }
/**更新用户信息 */
let userParams: any = {};
if (param.user_name !== undefined) userParams.user_name = param.user_name;
if (param.user_name !== undefined) userParams.nickname = param.user_name;
if (param.gender !== undefined) userParams.gender = param.gender;
if (Object.keys(updateData).length > 0) {
await updateManyData(TABLENAME.统一用户表, { user_id: teacherId }, userParams);
}
return { isSuccess: true }; return { isSuccess: true };
} }
......
...@@ -890,7 +890,7 @@ async function teacherDashboard(req, res) { ...@@ -890,7 +890,7 @@ async function teacherDashboard(req, res) {
*/ */
async function teacherInfo(req, res) { async function teacherInfo(req, res) {
const userInfo = req.userInfo; const userInfo = req.userInfo;
let result = await teacherInfoBiz.teacherInfo(userInfo.user_id); let result = await teacherInfoBiz.teacherInfo(userInfo.userId);
res.success(result); res.success(result);
} }
...@@ -898,27 +898,27 @@ async function teacherInfo(req, res) { ...@@ -898,27 +898,27 @@ async function teacherInfo(req, res) {
* 修改导师信息 * 修改导师信息
* @param teacherId 教师user_id * @param teacherId 教师user_id
* @param political_status 政治面貌 * @param political_status 政治面貌
* @param is_class_teacher 是否班主任 * @param user_name 教师姓名
* @param max_students 最大可带学生数 * @param user_sex 教师性别
* @param class_ids 班级ID数组 * @param class_ids 班级ID数组
* @param subjects 任教科目数组 * @param subjects 任教科目数组
*/ */
async function teacherUpdate(req, res) { async function teacherUpdate(req, res) {
const userInfo = req.userInfo; const userInfo = req.userInfo;
let reqConf = {political_status:'String', is_class_teacher:'Boolean', max_students:'Number', class_ids:'[Number]', subjects:'[String]'}; let reqConf = {user_name:'String', political_status:'String', gender:'String', class_ids:'[Number]', subjects:'[String]'};
const NotMustHaveKeys = ['political_status', 'is_class_teacher', 'max_students', 'class_ids', 'subjects']; const NotMustHaveKeys = ['user_name', 'political_status', 'gender', 'class_ids', 'subjects'];
let { political_status, is_class_teacher, max_students, class_ids, subjects } = eccReqParamater(reqConf, req.body, NotMustHaveKeys); let { user_name, political_status, gender, class_ids, subjects } = eccReqParamater(reqConf, req.body, NotMustHaveKeys);
let updateData = { let updateData = {
political_status, political_status,
is_class_teacher, user_name,
max_students, gender,
class_ids, class_ids,
subjects subjects
}; };
let result = await teacherInfoBiz.teacherUpdate(userInfo.user_id, updateData); let result = await teacherInfoBiz.teacherUpdate(userInfo.userId, updateData);
res.success(result); res.success(result);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment