Commit 319a7d4e authored by 任国军's avatar 任国军

report add userInfo

parent 79bfefd0
Pipeline #21796 passed with stage
in 12 seconds
...@@ -104,9 +104,12 @@ class ReportService extends Service { ...@@ -104,9 +104,12 @@ class ReportService extends Service {
const tags = await this.getReportTags(userReportInfo); const tags = await this.getReportTags(userReportInfo);
const recommendClassList = await this.getRecommendClassListByReport(userReportInfo.answer); const recommendClassList = await this.getRecommendClassListByReport(userReportInfo.answer);
const userBabyInfo = await ctx.classModel.V5.CourseV5UserBaby.findOne({ where: { user_uuid: userReportInfo.user_uuid, status: 1, is_deleted: 0 }, attributes: [ 'user_uuid', 'baby_sex', 'baby_name' ] });
const ret = { const ret = {
tags, tags,
report, report,
user: userBabyInfo,
recommend_class_list: recommendClassList, recommend_class_list: recommendClassList,
}; };
...@@ -116,7 +119,7 @@ class ReportService extends Service { ...@@ -116,7 +119,7 @@ class ReportService extends Service {
async getReportById(reportId) { async getReportById(reportId) {
const { ctx } = this; const { ctx } = this;
const userReportInfo = await ctx.classModel.V5.CourseUserReport.findOne({ user_uuid: ctx.userUuid, id: reportId, status: 1, is_deleted: 0 }); const userReportInfo = await ctx.classModel.V5.CourseUserReport.findOne({ id: reportId, status: 1, is_deleted: 0 });
if (ctx.isEmpty(userReportInfo)) { if (ctx.isEmpty(userReportInfo)) {
ctx.failed('尚未生成报告'); ctx.failed('尚未生成报告');
} }
...@@ -140,9 +143,12 @@ class ReportService extends Service { ...@@ -140,9 +143,12 @@ class ReportService extends Service {
const tags = await this.getReportTags(userReportInfo); const tags = await this.getReportTags(userReportInfo);
const recommendClassList = await this.getRecommendClassListByReport(userReportInfo.answer); const recommendClassList = await this.getRecommendClassListByReport(userReportInfo.answer);
const userBabyInfo = await ctx.classModel.V5.CourseV5UserBaby.findOne({ where: { user_uuid: userReportInfo.user_uuid, status: 1, is_deleted: 0 }, attributes: [ 'user_uuid', 'baby_sex', 'baby_name' ] });
const ret = { const ret = {
tags, tags,
report, report,
user: userBabyInfo,
recommend_class_list: recommendClassList, recommend_class_list: recommendClassList,
}; };
...@@ -186,7 +192,7 @@ class ReportService extends Service { ...@@ -186,7 +192,7 @@ class ReportService extends Service {
// 获取标签 // 获取标签
async getReportTags(report) { async getReportTags(report) {
const { ctx } = this; const { ctx } = this;
const userBabyInfo = await ctx.classModel.V5.CourseV5UserBaby.findOne({ where: { user_uuid: ctx.userUuid, status: 1, is_deleted: 0 } }); const userBabyInfo = await ctx.classModel.V5.CourseV5UserBaby.findOne({ where: { user_uuid: report.user_uuid, status: 1, is_deleted: 0 } });
const tags = []; const tags = [];
if (userBabyInfo.baby_sex === 1) { if (userBabyInfo.baby_sex === 1) {
......
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