管理员面板 删除账户

This commit is contained in:
jysperm
2014-08-10 18:47:36 +08:00
parent 6aac623d4d
commit 189383f436
3 changed files with 24 additions and 0 deletions

View File

@@ -82,6 +82,20 @@ exports.post '/create_payment', requireAdminAuthenticate, (req, res) ->
, ->
res.json {}
exports.post '/delete_account', requireAdminAuthenticate, (req, res) ->
mAccount.findId req.body.account_id, (err, account) ->
unless account
return res.error 'account_not_exist'
unless _.isEmpty account.attribute.plans
return res.error 'aleady_in_plan'
unless account.attribute.balance <= 0
return res.error 'balance_not_empty'
mAccount.remove _id: account._id, ->
res.json {}
exports.post '/update_site', requireAdminAuthenticate, (req, res) ->
mAccount.findOne
'attribute.plugin.nginx.sites._id': new ObjectID req.body.site_id

View File

@@ -3,6 +3,13 @@ $ ->
$('#account_id').html $(@).parents('tr').data 'id'
$('#create-payment-modal').modal 'show'
$('.action-delete-account').click (e) ->
e.preventDefault()
$.post '/admin/delete_account/', JSON.stringify
account_id: $(@).parents('tr').data 'id'
.success ->
location.reload()
$('.action-disable-site').click (e) ->
e.preventDefault()
$.post '/admin/update_site/', JSON.stringify

View File

@@ -29,6 +29,9 @@ block main
ul.dropdown-menu
li
a.action-create-payment(href='#') 创建充值记录
if account.attribute.balance <= 0 && account.attribute.plans.length == 0
li
a.action-delete-account(href='#') 删除账户
.row
header 网站列表