Skip to content

Commit

Permalink
check repeat shop name
Browse files Browse the repository at this point in the history
  • Loading branch information
bailicangdu committed Jul 23, 2018
1 parent dafba45 commit 690d8ba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions controller/shopping/shop.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ class Shop extends AddressComponent{
})
return
}
const exists = await ShopModel.findOne({name: fields.name});
if (exists) {
res.send({
status: 0,
type: 'RESTURANT_EXISTS',
message: '店铺已存在,请尝试其他店铺名称'
})
return
}
const opening_hours = fields.startTime&&fields.endTime? fields.startTime + '/' + fields.endTime : "8:30/20:30";
const newShop = {
name: fields.name,
Expand Down

0 comments on commit 690d8ba

Please sign in to comment.