Commit ae520181 authored by 任国军's avatar 任国军

ageToReportColumnDetail add catId

parent b5ab652c
Pipeline #22881 passed with stage
in 18 seconds
...@@ -13,6 +13,7 @@ module.exports = app => { ...@@ -13,6 +13,7 @@ module.exports = app => {
autoIncrement: true, autoIncrement: true,
}, },
age_id: INTEGER, age_id: INTEGER,
cat_id: INTEGER,
report_column_detail_id: INTEGER, report_column_detail_id: INTEGER,
status: INTEGER, status: INTEGER,
is_deleted: INTEGER, is_deleted: INTEGER,
......
...@@ -95,7 +95,7 @@ class ReportService extends Service { ...@@ -95,7 +95,7 @@ class ReportService extends Service {
const category = await ctx.classModel.V5.CourseV5Category.findOne({ where: { id: userReportInfo.cat_id }, attributes: [ 'id', 'name', 'url' ] }); const category = await ctx.classModel.V5.CourseV5Category.findOne({ where: { id: userReportInfo.cat_id }, attributes: [ 'id', 'name', 'url' ] });
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', 'baby_age' ] }); 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', 'baby_age' ] });
// 获取年龄对应的报告选项 // 获取年龄对应的报告选项
const ageToReport = await ctx.classModel.V5.CourseV5AgeToReportColumnDetail.findAll({ where: { age_id: userBabyInfo.baby_age, status: 1, is_deleted: 0 } }); const ageToReport = await ctx.classModel.V5.CourseV5AgeToReportColumnDetail.findAll({ where: { age_id: userBabyInfo.baby_age, cat_id: userReportInfo.cat_id, status: 1, is_deleted: 0 } });
const ageReportColumnDetailList = await ctx.classModel.V5.CourseV5ReportColumnDetail.findAll({ where: { id: { $in: R.pluck('report_column_detail_id', ageToReport) }, status: 1, is_deleted: 0 }, attributes: [ 'id', 'report_column_id', 'sub_title', 'level', 'content', 'advice' ], raw: true }); const ageReportColumnDetailList = await ctx.classModel.V5.CourseV5ReportColumnDetail.findAll({ where: { id: { $in: R.pluck('report_column_detail_id', ageToReport) }, status: 1, is_deleted: 0 }, attributes: [ 'id', 'report_column_id', 'sub_title', 'level', 'content', 'advice' ], raw: true });
let reportColumnDetailList = ctx.isEmpty(userReportInfo.report_column_detail_ids) ? [] : await ctx.classModel.V5.CourseV5ReportColumnDetail.findAll({ where: { id: { $in: eval(userReportInfo.report_column_detail_ids) }, status: 1, is_deleted: 0 }, attributes: [ 'id', 'report_column_id', 'sub_title', 'level', 'content', 'advice' ], raw: true }); let reportColumnDetailList = ctx.isEmpty(userReportInfo.report_column_detail_ids) ? [] : await ctx.classModel.V5.CourseV5ReportColumnDetail.findAll({ where: { id: { $in: eval(userReportInfo.report_column_detail_ids) }, status: 1, is_deleted: 0 }, attributes: [ 'id', 'report_column_id', 'sub_title', 'level', 'content', 'advice' ], raw: true });
...@@ -142,7 +142,7 @@ class ReportService extends Service { ...@@ -142,7 +142,7 @@ class ReportService extends Service {
const category = await ctx.classModel.V5.CourseV5Category.findOne({ where: { id: userReportInfo.cat_id }, attributes: [ 'id', 'name', 'url' ] }); const category = await ctx.classModel.V5.CourseV5Category.findOne({ where: { id: userReportInfo.cat_id }, attributes: [ 'id', 'name', 'url' ] });
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', 'baby_age' ] }); 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', 'baby_age' ] });
// 获取年龄对应的报告选项 // 获取年龄对应的报告选项
const ageToReport = await ctx.classModel.V5.CourseV5AgeToReportColumnDetail.findAll({ where: { age_id: userBabyInfo.baby_age, status: 1, is_deleted: 0 } }); const ageToReport = await ctx.classModel.V5.CourseV5AgeToReportColumnDetail.findAll({ where: { age_id: userBabyInfo.baby_age, cat_id: userReportInfo.cat_id, status: 1, is_deleted: 0 } });
const ageReportColumnDetailList = await ctx.classModel.V5.CourseV5ReportColumnDetail.findAll({ where: { id: { $in: R.pluck('report_column_detail_id', ageToReport) }, status: 1, is_deleted: 0 }, attributes: [ 'id', 'report_column_id', 'sub_title', 'level', 'content', 'advice' ], raw: true }); const ageReportColumnDetailList = await ctx.classModel.V5.CourseV5ReportColumnDetail.findAll({ where: { id: { $in: R.pluck('report_column_detail_id', ageToReport) }, status: 1, is_deleted: 0 }, attributes: [ 'id', 'report_column_id', 'sub_title', 'level', 'content', 'advice' ], raw: true });
let reportColumnDetailList = ctx.isEmpty(userReportInfo.report_column_detail_ids) ? [] : await ctx.classModel.V5.CourseV5ReportColumnDetail.findAll({ where: { id: { $in: eval(userReportInfo.report_column_detail_ids) }, status: 1, is_deleted: 0 }, attributes: [ 'id', 'report_column_id', 'sub_title', 'level', 'content', 'advice' ], raw: true }); let reportColumnDetailList = ctx.isEmpty(userReportInfo.report_column_detail_ids) ? [] : await ctx.classModel.V5.CourseV5ReportColumnDetail.findAll({ where: { id: { $in: eval(userReportInfo.report_column_detail_ids) }, status: 1, is_deleted: 0 }, attributes: [ 'id', 'report_column_id', 'sub_title', 'level', 'content', 'advice' ], raw: true });
......
...@@ -94,7 +94,7 @@ class UserService extends Service { ...@@ -94,7 +94,7 @@ class UserService extends Service {
}; };
await ctx.app.memcache.set(key, value, 7 * 24 * 3600); await ctx.app.memcache.set(key, value, 7 * 24 * 3600);
const authToken = await this.service.jwt.apply({ user_uuid: userInfo.uuid, openid: userInfo.openid }); const authToken = await this.service.jwt.apply({ user_uuid: userInfo.uuid, openid: userInfo.openid });
await app.memcache.set('course_auth_token_' + userInfo.uuid, authToken, 7 * 24 * 3600); await app.memcache.set('course_auth_token_' + userInfo.uuid, authToken, 30 * 24 * 3600);
const ret = { const ret = {
user_uuid: userInfo.uuid, user_uuid: userInfo.uuid,
...@@ -139,7 +139,7 @@ class UserService extends Service { ...@@ -139,7 +139,7 @@ class UserService extends Service {
await app.memcache.set(key, value, 7 * 24 * 3600); await app.memcache.set(key, value, 7 * 24 * 3600);
const authToken = ctx.isEmpty(userInfo.phone) ? '' : await this.service.jwt.apply({ user_uuid: userInfo.uuid, openid: userInfo.openid }); const authToken = ctx.isEmpty(userInfo.phone) ? '' : await this.service.jwt.apply({ user_uuid: userInfo.uuid, openid: userInfo.openid });
if (!ctx.isEmpty(authToken)) { if (!ctx.isEmpty(authToken)) {
await app.memcache.set('course_auth_token_' + userInfo.uuid, authToken, 7 * 24 * 3600); await app.memcache.set('course_auth_token_' + userInfo.uuid, authToken, 30 * 24 * 3600);
} }
const ret = { const ret = {
user_uuid: userInfo.uuid, user_uuid: userInfo.uuid,
...@@ -232,7 +232,7 @@ class UserService extends Service { ...@@ -232,7 +232,7 @@ class UserService extends Service {
}; };
await app.memcache.set(key, value, 7 * 24 * 3600); await app.memcache.set(key, value, 7 * 24 * 3600);
const authToken = await this.service.jwt.apply({ user_uuid: data.uuid, openid: user.openid }); const authToken = await this.service.jwt.apply({ user_uuid: data.uuid, openid: user.openid });
await app.memcache.set('course_auth_token_' + data.uuid, authToken, 7 * 24 * 3600); await app.memcache.set('course_auth_token_' + data.uuid, authToken, 30 * 24 * 3600);
const ret = { const ret = {
user_uuid: data.uuid, user_uuid: data.uuid,
......
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