Commit 9ea0fddc authored by 成旭东's avatar 成旭东

fix

parent ec51a6bc
Pipeline #28110 passed with stage
in 5 minutes 21 seconds
......@@ -395,6 +395,11 @@ export default class EstateListController extends Controller {
async tag() {
const { ctx, service, serviceGroupName, serviceName } = this;
const { type } = ctx.params;
const whereInfo = ctx.helper.switchQueryToWhere(ctx.query, {
in_house: (item: any) => Number(item),
in_business: (item: any) => Number(item),
in_office: (item: any) => Number(item),
}, [ 'in_house', 'in_business', 'in_office' ]);
const typeMap: any = {
house: 'is_house',
......@@ -402,7 +407,7 @@ export default class EstateListController extends Controller {
office: 'is_office',
};
const where = {};
const where = whereInfo;
where[typeMap[type]] = 1;
......
......@@ -59,20 +59,14 @@ export default class EstateTagController extends Controller {
async batchUpdate() {
const { ctx, service, serviceGroupName, serviceName } = this;
const { data, type } = ctx.request.body;
const typeMap = {
house: 'is_house',
business: 'is_business',
office: 'is_office',
};
const { data } = ctx.request.body;
for (let i = 0; i < data.length; i++) {
const item = data[i];
const updateId = item.id;
delete item.id;
await service[serviceGroupName][serviceName].update(item.id, {
[typeMap[type]]: item[typeMap[type]],
});
await service[serviceGroupName][serviceName].update(updateId, item);
}
ctx.success();
......
......@@ -33,6 +33,39 @@ module.exports = app => {
defaultValue: 1,
comment: '是否办公标签',
},
in_house: {
type: DataTypes.INTEGER(1),
allowNull: false,
defaultValue: 0,
comment: '是否在house下展示标签',
},
in_house_order: {
type: DataTypes.INTEGER(11),
allowNull: false,
defaultValue: 0,
},
in_business: {
type: DataTypes.INTEGER(1),
allowNull: false,
defaultValue: 0,
comment: '是否在business下展示标签',
},
in_business_order: {
type: DataTypes.INTEGER(11),
allowNull: false,
defaultValue: 0,
},
in_office: {
type: DataTypes.INTEGER(1),
allowNull: false,
defaultValue: 0,
comment: '是否在office下展示标签',
},
in_office_order: {
type: DataTypes.INTEGER(11),
allowNull: false,
defaultValue: 0,
},
status: {
type: DataTypes.ENUM('online', 'offline'),
allowNull: false,
......
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