Commit 63ee2e9c authored by 任国军's avatar 任国军

fix bug && add oss_config

parent 0dbab1e8
Pipeline #21843 passed with stage
in 13 seconds
......@@ -166,21 +166,16 @@ class InstitutionSubService extends Service {
const page_size = Number(input.page_size) || 10;
const offset = (page - 1) * page_size;
const attributes = [ 'id', 'institution_id', 'name', 'logo', 'age', 'price', 'price_type', 'mode', 'time', 'class_amount', 'multi_classes', 'cycle', 'description', 'sort' ];
const filter = { where: { status: 1, is_deleted: 0 }, order: [[ 'sort', 'asc' ], [ 'id', 'desc' ]], page_size, offset, attributes };
const classList = await ctx.classModel.V5.CourseV5Class.findAndCountAll(filter);
// 用户收藏的课程
const userCollection = await ctx.classModel.V5.CourseUserCollection.findAll({ where: { user_uuid: ctx.userUuid, is_deleted: 0, type: 3 }, raw: true });
const collectedIds = R.pluck('type_id', userCollection);
for (const i in classList.rows) {
classList.rows[i].is_collected = collectedIds.includes(classList.rows[i].id) ? 1 : 0;
}
const userCollection = await ctx.classModel.V5.CourseUserCollection.findAndCountAll({ where: { user_uuid: ctx.userUuid, is_deleted: 0, type: 3 }, raw: true });
const collectedIds = R.pluck('type_id', userCollection.rows);
const filter = { where: { id: { $in: collectedIds }, status: 1, is_deleted: 0 }, page_size, offset, attributes, raw: true };
const classList = await ctx.classModel.V5.CourseV5Class.findAll(filter);
const ret = {
list: classList.rows,
total_count: classList.count,
list: classList,
total_count: userCollection.count,
page,
page_size,
};
......
......@@ -124,6 +124,16 @@ module.exports = appInfo => {
},
};
exports.oss = {// sdfsdfsd
client: {
accessKeyId: 'LTAIxEMB8ucstyi8',
accessKeySecret: 'sCVJSCPyfaSIlS5R8fH4Xl77yHKR3z',
bucket: '51shequ',
endpoint: 'oss-cn-hangzhou.aliyuncs.com',
timeout: '60s',
},
};
config.CDN_BASE_URL = 'https://r.51gjj.com/image/';
config.NODE_URL = process.env.NODE_URL;
config.NODE_BASE_URL = process.env.NODE_BASE_URL;
......
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