mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-04-24 03:35:59 +08:00
管理员面板 删除账户
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 网站列表
|
||||
|
||||
Reference in New Issue
Block a user