mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-01-13 07:01:20 +08:00
fixbugs
This commit is contained in:
@@ -216,7 +216,7 @@ Account.methods.updatePassword = (password, callback) ->
|
||||
# @param callback(err)
|
||||
Account.methods.incBalance = (amount, type, payload, callback) ->
|
||||
unless _.isNumber amount
|
||||
return callback new Error 'amount must be a number'
|
||||
return callback 'invalid_amount'
|
||||
|
||||
financials = new models.Financials
|
||||
account_id: @_id
|
||||
|
||||
@@ -11,7 +11,7 @@ Notification = mongoose.Schema
|
||||
type:
|
||||
required: true
|
||||
type: String
|
||||
enum: ['payment_success']
|
||||
enum: ['payment_success', 'ticket_create', 'ticket_reply']
|
||||
|
||||
level:
|
||||
required: true
|
||||
|
||||
@@ -13,6 +13,10 @@ exports.get '/', (req, res) ->
|
||||
accounts: accounts
|
||||
coupon_code_types: _.keys config.coupons_meta
|
||||
|
||||
exports.get '/account_details', (req, res) ->
|
||||
Account.findById req.query.account_id, (err, account) ->
|
||||
res.json _.omit account.toObject(), 'password', 'password_salt', 'tokens', '__v'
|
||||
|
||||
exports.get '/ticket', (req, res) ->
|
||||
LIMIT = 10
|
||||
|
||||
@@ -66,7 +70,8 @@ exports.post '/confirm_payment', (req, res) ->
|
||||
account.incBalance req.body.amount, 'deposit',
|
||||
type: req.body.type
|
||||
order_id: req.body.order_id
|
||||
, ->
|
||||
, (err) ->
|
||||
return res.error err if err
|
||||
res.json {}
|
||||
|
||||
exports.post '/delete_account', (req, res) ->
|
||||
|
||||
@@ -5,16 +5,23 @@ $ ->
|
||||
|
||||
$('.action-delete-account').click (e) ->
|
||||
e.preventDefault()
|
||||
$.post '/admin/delete_account', JSON.stringify
|
||||
account_id: $(@).parents('tr').data 'id'
|
||||
.success ->
|
||||
location.reload()
|
||||
if window.confirm 'Are you sure?'
|
||||
request '/admin/delete_account',
|
||||
account_id: $(@).parents('tr').data 'id'
|
||||
, ->
|
||||
location.reload()
|
||||
|
||||
$('.action-details').click ->
|
||||
request "/admin/account_details?account_id=#{$(@).parents('tr').data 'id'}", {}, {method: 'get'}, (account) ->
|
||||
$('.account-details-modal .label-account-id').text account._id
|
||||
$('.account-details-modal .label-details').html JSON.stringify account, null, ' '
|
||||
$('.account-details-modal').modal 'show'
|
||||
|
||||
$('.confirm-payment-modal .action-confirm-payment').click ->
|
||||
request '/admin/confirm_payment',
|
||||
account_id: $('.input-account-id').text()
|
||||
type: 'taobao'
|
||||
amount: $('.input-amount').val()
|
||||
amount: parseFloat $('.input-amount').val()
|
||||
order_id: $('.input-order-id').val()
|
||||
, ->
|
||||
location.reload()
|
||||
|
||||
@@ -6,4 +6,8 @@
|
||||
.output-coupon-code {
|
||||
margin-top: 50px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
|
||||
}
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
padding: 6px 12px;
|
||||
}
|
||||
|
||||
.img-avatar {
|
||||
width: 58px;
|
||||
height: 58px;
|
||||
}
|
||||
|
||||
.list-group-item {
|
||||
a {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
img.pull-left {
|
||||
width: 58px;
|
||||
height: 58px;
|
||||
}
|
||||
|
||||
.list-content {
|
||||
margin-left: 68px;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ block main
|
||||
td= account.billing.plans.join(', ')
|
||||
td= account.billing.balance.toFixed(2)
|
||||
td
|
||||
button.btn.btn-info.btn-sm(type='button')= t('common.details')
|
||||
button.btn.btn-info.btn-sm.action-details(type='button')= t('common.details')
|
||||
.btn-group
|
||||
button(type='button', data-toggle='dropdown').btn.btn-primary.btn-sm.dropdown-toggle
|
||||
| #{t('common.actions')}
|
||||
@@ -73,8 +73,18 @@ block main
|
||||
.col-sm-5
|
||||
button.action-generate-code.btn.btn-lg.btn-primary(type='button')= t('common.generate')
|
||||
|
||||
.output-coupon-code
|
||||
pre.output-coupon-code
|
||||
|
||||
.account-details-modal.modal.fade
|
||||
.modal-dialog
|
||||
.modal-content
|
||||
.modal-header
|
||||
button.close(type='button', data-dismiss='modal', aria-hidden='true') ×
|
||||
h4.label-account-id
|
||||
.modal-body
|
||||
pre.label-details
|
||||
.modal-footer
|
||||
button.btn.btn-danger(type='button', data-dismiss='modal')= t('common.close')
|
||||
|
||||
.confirm-payment-modal.modal.fade
|
||||
.modal-dialog
|
||||
@@ -98,7 +108,6 @@ block main
|
||||
input.input-order-id.form-control(type='order_id')
|
||||
|
||||
.modal-footer
|
||||
button.btn.btn-danger(type='button', data-dismiss='modal')= t('common.close')
|
||||
button.btn.btn-success.action-confirm-payment(type='button')= t('common.create')
|
||||
|
||||
prepend sidebar
|
||||
|
||||
@@ -31,12 +31,12 @@ block main
|
||||
for reply in ticket.replies
|
||||
li.list-group-item.clearfix
|
||||
a.pull-left
|
||||
img(src= reply.account.preferences.avatar_url)
|
||||
img.img-avatar(src= reply.account.preferences.avatar_url)
|
||||
.list-content
|
||||
p!= reply.content_html
|
||||
p
|
||||
span.label.label-info= reply.account.username
|
||||
span.label.label-default(title= reply.created_at)= moment(reply.created_at).fromNow()
|
||||
span.label.label-default(title=reply.created_at)= moment(reply.created_at).fromNow()
|
||||
|
||||
.row
|
||||
if ticket.status != 'closed'
|
||||
@@ -66,7 +66,7 @@ prepend sidebar
|
||||
header= t('ticket.creator')
|
||||
li.list-group-item.clearfix
|
||||
a.pull-left
|
||||
img(src= ticket.account.preferences.avatar_url)
|
||||
img.img-avatar(src= ticket.account.preferences.avatar_url)
|
||||
p
|
||||
span.label.label-info= ticket.account.username
|
||||
br
|
||||
@@ -76,7 +76,7 @@ prepend sidebar
|
||||
header= t('ticket.members')
|
||||
for member in ticket.members
|
||||
a.pull-left
|
||||
img(src= member.preferences.avatar_url, alt= member.username)
|
||||
img.img-avatar(src=member.preferences.avatar_url, alt=member.username)
|
||||
|
||||
append footer
|
||||
script(src='/script/ticket/view.js')
|
||||
|
||||
Reference in New Issue
Block a user