mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-04-28 19:45:45 +08:00
pluggable.createHelpers & payment_method pluggable
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
jade = require 'jade'
|
||||
path = require 'path'
|
||||
|
||||
bitcoin = require './bitcoin'
|
||||
|
||||
{mAccount} = app.models
|
||||
{pluggable, config} = app
|
||||
|
||||
module.exports =
|
||||
module.exports = exports = pluggable.createHelpers module.exports,
|
||||
name: 'bitcoin'
|
||||
type: 'extension'
|
||||
|
||||
pluggable.registerHook 'account.before_register', module.exports,
|
||||
exports.registerHook 'account.before_register',
|
||||
filter: (account, callback) ->
|
||||
bitcoin_secret = exports.randomSalt()
|
||||
|
||||
@@ -18,6 +21,13 @@ pluggable.registerHook 'account.before_register', module.exports,
|
||||
|
||||
callback()
|
||||
|
||||
exports.registerHook 'billing.payment_method',
|
||||
widget_generator: (account, callback) ->
|
||||
jade.renderFile path.join(__dirname, 'view/payment_method.jade'),
|
||||
account: account
|
||||
, (err, html) ->
|
||||
callback html
|
||||
|
||||
app.post '/bitcoin/coinbase_callback', (req, res) ->
|
||||
mAccount.findOne
|
||||
'pluggable.bitcoin.bitcoin_deposit_address': req.body.address
|
||||
|
||||
5
plugin/bitcoin/view/payment_method.jade
Normal file
5
plugin/bitcoin/view/payment_method.jade
Normal file
@@ -0,0 +1,5 @@
|
||||
div
|
||||
h2 比特币
|
||||
p 你可以直接向该地址发送比特币。在经过一次确认后,系统会实时地,自动为你折算充值金额,最小支付金额 0.0005。
|
||||
p 实时汇率:10 CNY = #{(exchange_rate * 10).toFixed(4)} BTC
|
||||
pre= account.attribute.bitcoin_deposit_address
|
||||
@@ -3,11 +3,11 @@ path = require 'path'
|
||||
{pluggable} = app
|
||||
{renderAccount} = app.middleware
|
||||
|
||||
module.exports =
|
||||
module.exports = exports = pluggable.createHelpers module.exports,
|
||||
name: 'rpvhost'
|
||||
type: 'extension'
|
||||
|
||||
pluggable.registerHook 'view.layout.menu_bar', module.exports,
|
||||
exports.registerHook 'view.layout.menu_bar',
|
||||
href: '//blog.rpvhost.net'
|
||||
target: '_blank'
|
||||
body: '官方博客'
|
||||
|
||||
4
plugin/rpvhost/view/payment_method.jade
Normal file
4
plugin/rpvhost/view/payment_method.jade
Normal file
@@ -0,0 +1,4 @@
|
||||
div
|
||||
h2 淘宝
|
||||
p 拍下对应宝贝后付款即可,购买时注意选择服务器节点选项,备注填写你的用户名。
|
||||
a.btn.btn-success(href='http://item.taobao.com/item.htm?id=#{config.billing.taobao_item_id}') 淘宝购买
|
||||
@@ -80,7 +80,7 @@ module.exports =
|
||||
|
||||
amount = billing_traffic / BILLING_BUCKET * config.plugins.shadowsocks.price_bucket
|
||||
|
||||
mAccount.update _id: account._id,
|
||||
mAccount.update {_id: account._id},
|
||||
$unset:
|
||||
'attribute.plugin.shadowsocks': true
|
||||
$inc:
|
||||
@@ -152,7 +152,7 @@ module.exports =
|
||||
if billing_bucket > 0
|
||||
amount = billing_bucket * config.plugins.shadowsocks.price_bucket
|
||||
|
||||
mAccount.update _id: account._id,
|
||||
mAccount.update {_id: account._id},
|
||||
$set:
|
||||
'attribute.plugin.shadowsocks.pending_traffic': new_pending_traffic
|
||||
'attribute.plugin.shadowsocks.last_traffic_value': bytes
|
||||
@@ -166,7 +166,7 @@ module.exports =
|
||||
, ->
|
||||
callback()
|
||||
else if pending_traffic != new_pending_traffic or last_traffic_value != bytes
|
||||
mAccount.update _id: account._id,
|
||||
mAccount.update {_id: account._id},
|
||||
$set:
|
||||
'attribute.plugin.shadowsocks.pending_traffic': new_pending_traffic
|
||||
'attribute.plugin.shadowsocks.last_traffic_value': bytes
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
wiki = require './wiki'
|
||||
|
||||
module.exports =
|
||||
module.exports = exports = pluggable.createHelpers module.exports,
|
||||
name: 'wiki'
|
||||
type: 'extension'
|
||||
|
||||
pluggable.registerHook 'view.layout.menu_bar', module.exports,
|
||||
exports.registerHook 'view.layout.menu_bar',
|
||||
href: '/wiki/'
|
||||
body: '用户手册'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user