Commit 4c360823 authored by 任国军's avatar 任国军

change back orderList

parent 6bd82b60
Pipeline #25081 passed with stage
in 4 seconds
......@@ -164,14 +164,22 @@ class BackService extends Service {
const offset = (page - 1) * limit;
const userInfo = await ctx.classModel.CourseBackUser.findOne({ where: { id: userUuid, is_deleted: 0 } });
if (ctx.isEmpty(userInfo) || userInfo.is_admin === 0) {
if (ctx.isEmpty(userInfo)) {
ctx.failed('用户异常');
}
const filter = { where: { status: 1, is_deleted: 0 }, limit, offset, order: [[ 'id', 'desc' ]] };
let filterClassIds = [];
if (!ctx.isEmpty(input.class_name)) {
const classList = await ctx.classModel.V5.CourseV5Class.findAll({ where: { name: { $like: `%${input.class_name}%` } }, attributes: [ 'id' ] });
filter.where.class_id = { $in: R.pluck('id', classList) };
filterClassIds = R.pluck('id', classList);
filter.where.class_id = { $in: filterClassIds };
}
if (!ctx.isEmpty(userInfo.institution_id) && userInfo.institution_id > 0) {
const classList = await ctx.classModel.V5.CourseV5Class.findAll({ where: { institution_id: userInfo.institution_id }, attributes: [ 'id' ] });
filterClassIds = ctx.isEmpty(input.class_name) ? R.pluck('id', classList) : _.intersection(filterClassIds, R.pluck('id', classList));
filter.where.class_id = { $in: filterClassIds };
}
const redeemCodeList = await ctx.classModel.V5.CourseRedeemCode.findAndCountAll(filter);
......
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