mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-03-26 07:44:10 +08:00
refactor
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
config = require './../config'
|
||||
plan = require './plan'
|
||||
{config, plan} = app
|
||||
{mAccount, mBalance} = app.models
|
||||
|
||||
exports.triggerBilling = (account, callback) ->
|
||||
|
||||
|
||||
|
||||
mAccount = require './model/account'
|
||||
mBalance = require './model/balance_log'
|
||||
|
||||
exports.cyclicalBilling = ->
|
||||
mAccount.find
|
||||
|
||||
@@ -1,73 +1,75 @@
|
||||
{
|
||||
"app": {
|
||||
"name": "RootPanel",
|
||||
"description": "一个插件化的 Linux 虚拟主机管理系统。"
|
||||
},
|
||||
"plans": {
|
||||
"all": {
|
||||
"name": "所有服务(默认)",
|
||||
"description": "该套餐包含所有的服务"
|
||||
}
|
||||
},
|
||||
"common": {
|
||||
"error": "错误"
|
||||
},
|
||||
"account": {
|
||||
"": "帐号",
|
||||
"signup": "注册",
|
||||
"login": "登录",
|
||||
"username": "用户名",
|
||||
"email": "邮箱",
|
||||
"password": "密码",
|
||||
"logout": "注销"
|
||||
},
|
||||
"panel": {
|
||||
"": "管理面板",
|
||||
"overview": "概况"
|
||||
},
|
||||
"ticket": {
|
||||
"": "工单",
|
||||
"title": "标题",
|
||||
"status": "状态",
|
||||
"create": "创建",
|
||||
"reply": "回复",
|
||||
"replies": "全部回复",
|
||||
"create_ticket": "创建工单",
|
||||
"create_reply": "创建回复",
|
||||
"ticket_list": "工单列表",
|
||||
"close_ticket": "关闭",
|
||||
"finish_ticket": "完成",
|
||||
"reopen_ticket": "重新打开",
|
||||
"creator": "创建者",
|
||||
"members": "成员"
|
||||
},
|
||||
"plan": {
|
||||
"": "套餐",
|
||||
"subscribe": "订购",
|
||||
"unsubscribe": "退订",
|
||||
"balance": "余额",
|
||||
"remaining_time": "剩余时长",
|
||||
"currency": {
|
||||
"cny": "CNY"
|
||||
}
|
||||
},
|
||||
"admin": {
|
||||
"admin_panel": "管理员面板"
|
||||
},
|
||||
"time": {
|
||||
"day": "天"
|
||||
},
|
||||
"view": {
|
||||
"layout": {
|
||||
"navigation": "展开导航"
|
||||
"app": {
|
||||
"name": "RootPanel",
|
||||
"description": "一个插件化的 Linux 虚拟主机管理系统。"
|
||||
},
|
||||
"plans": {
|
||||
"sample": {
|
||||
"name": "示例",
|
||||
"description": "每月 8 元,按小时计费"
|
||||
},
|
||||
"test": {
|
||||
"name": "测试",
|
||||
"description": "按量付费,7 天不使用自动关闭"
|
||||
}
|
||||
},
|
||||
"common": {
|
||||
"error": "错误"
|
||||
},
|
||||
"account": {
|
||||
"password2": "重复",
|
||||
"already_signup": "已有帐号?",
|
||||
"no_account": "还没有账户?"
|
||||
}
|
||||
},
|
||||
"plugins": {
|
||||
|
||||
}
|
||||
"": "帐号",
|
||||
"signup": "注册",
|
||||
"login": "登录",
|
||||
"username": "用户名",
|
||||
"email": "邮箱",
|
||||
"password": "密码",
|
||||
"logout": "注销"
|
||||
},
|
||||
"panel": {
|
||||
"": "管理面板",
|
||||
"overview": "概况"
|
||||
},
|
||||
"ticket": {
|
||||
"": "工单",
|
||||
"title": "标题",
|
||||
"status": "状态",
|
||||
"create": "创建",
|
||||
"reply": "回复",
|
||||
"replies": "全部回复",
|
||||
"create_ticket": "创建工单",
|
||||
"create_reply": "创建回复",
|
||||
"ticket_list": "工单列表",
|
||||
"close_ticket": "关闭",
|
||||
"finish_ticket": "完成",
|
||||
"reopen_ticket": "重新打开",
|
||||
"creator": "创建者",
|
||||
"members": "成员"
|
||||
},
|
||||
"plan": {
|
||||
"": "套餐",
|
||||
"subscribe": "订购",
|
||||
"unsubscribe": "退订",
|
||||
"balance": "余额",
|
||||
"remaining_time": "剩余时长",
|
||||
"currency": {
|
||||
"cny": "CNY"
|
||||
}
|
||||
},
|
||||
"admin": {
|
||||
"admin_panel": "管理员面板"
|
||||
},
|
||||
"time": {
|
||||
"day": "天"
|
||||
},
|
||||
"view": {
|
||||
"layout": {
|
||||
"navigation": "展开导航"
|
||||
},
|
||||
"account": {
|
||||
"password2": "重复",
|
||||
"already_signup": "已有帐号?",
|
||||
"no_account": "还没有账户?"
|
||||
}
|
||||
},
|
||||
"plugins": {}
|
||||
}
|
||||
|
||||
0
core/notification.coffee
Normal file
0
core/notification.coffee
Normal file
@@ -8,7 +8,7 @@ mAccount = require '../model/account'
|
||||
|
||||
module.exports = exports = express.Router()
|
||||
|
||||
exports.post '/subscribe', requireAuthenticate, (req, res) ->
|
||||
exports.post '/join_plan', requireAuthenticate, (req, res) ->
|
||||
unless req.body.plan in _.keys(config.plans)
|
||||
return res.error 'invaild_plan'
|
||||
|
||||
@@ -27,7 +27,7 @@ exports.post '/subscribe', requireAuthenticate, (req, res) ->
|
||||
plan.joinPlan account, req.body.plan, ->
|
||||
res.json {}
|
||||
|
||||
exports.post '/unsubscribe', requireAuthenticate, (req, res) ->
|
||||
exports.post '/leave_plan', requireAuthenticate, (req, res) ->
|
||||
unless req.body.plan in req.account.attribute.plans
|
||||
return res.error 'not_in_plan'
|
||||
|
||||
|
||||
@@ -20,9 +20,7 @@ module.exports =
|
||||
billing:
|
||||
currency: 'CNY'
|
||||
|
||||
taobao_item_id: '41040606505'
|
||||
|
||||
force_unsubscribe:
|
||||
force_freeze:
|
||||
when_balance_below: 0
|
||||
when_arrears_above: 0
|
||||
|
||||
@@ -31,10 +29,24 @@ module.exports =
|
||||
|
||||
plans:
|
||||
sample:
|
||||
t_name: 'ShadowSocks'
|
||||
t_service: '按量付费'
|
||||
t_resources: '0.6 CNY / G'
|
||||
services: ['shadowsocks']
|
||||
t_name: 'plans.sample.name'
|
||||
t_description: 'plans.sample.name.description'
|
||||
|
||||
billing_by_time:
|
||||
unit: 3600 * 1000
|
||||
price: 10 / (30 * 24)
|
||||
|
||||
services: []
|
||||
resources: {}
|
||||
|
||||
test:
|
||||
t_name: 'plans.test.name'
|
||||
t_description: 'plans.test.name.description'
|
||||
|
||||
billing_by_usage:
|
||||
auto_leave: 7 * 24 * 3600 * 1000
|
||||
|
||||
services: []
|
||||
resources: {}
|
||||
|
||||
mongodb:
|
||||
|
||||
Reference in New Issue
Block a user