Commit 459d00cf authored by 姜登's avatar 姜登

user

parent b0b840e8
Pipeline #9122 passed with stage
in 5 seconds
......@@ -47,26 +47,25 @@ class UserController extends Controller {
const { ctx, service } = this;
const Op = ctx.app.Sequelize.Op;
ctx.validate(this.indexRule, ctx.query);
const { type } = ctx.query;
const user = await service.user.getUserInfo();
const where = {};
if (type !== 'all') {
where.dd_id = user.id;
where.dd_name = user.name;
Object.keys(ctx.query).forEach(key => {
if (ctx.query[key] && this.indexRule.hasOwnProperty(key)) {
if (key === 'status') {
where[key] = ctx.query[key];
} else {
where[key] = {
[Op.like]: `%${ctx.query[key]}%`,
};
}
Object.keys(ctx.query).forEach(key => {
if (ctx.query[key] && this.indexRule.hasOwnProperty(key)) {
if (key === 'status') {
where[key] = ctx.query[key];
} else {
where[key] = {
[Op.like]: `%${ctx.query[key]}%`,
};
}
});
}
});
if (user.department[0].name === '战略合作组' || user.department[0].name === '数据项目组') {
where.dd_id = user.department[0].id;
where.dd_name = user.name;
}
const accountData = await service.user.fetchAccount(where, ctx.pagination);
const total = await service.user.count({ dd_id: user.id, dd_name: user.name, ...where });
const total = await service.user.count(where);
ctx.success({ data: accountData, total, ...ctx.pagination });
}
......
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