This commit is contained in:
root 2019-11-27 19:55:53 +08:00
parent b9a6bca502
commit ffe7f0b3ec
4 changed files with 19 additions and 7 deletions

View File

@ -31,7 +31,7 @@ class ConfigController extends Controller
'app_url' => config('v2board.app_url'),
'subscribe_url' => config('v2board.subscribe_url'),
'plan_update_fee' => config('v2board.plan_update_fee', 0.5),
'plan_is_update' => config('v2board.plan_is_update', 1)
'plan_is_update' => (int)config('v2board.plan_is_update', 1)
],
'pay' => [
// alipay

View File

@ -41,7 +41,9 @@ class UserController extends Controller
'password',
'transfer_enable',
'expired_at',
'banned',
'banned',
'plan_id',
'commission_rate',
'is_admin'
]);
$user = User::find($request->input('id'));
@ -57,6 +59,13 @@ class UserController extends Controller
unset($updateData['password']);
}
$updateData['transfer_enable'] = $updateData['transfer_enable'] * 1073741824;
if ($updateData['plan_id']) {
$plan = Plan::find($updateData['plan_id']);
if (!$plan) {
abort(500, '订阅计划不存在');
}
$updateData['group_id'] = $plan->group_id;
}
if (!$user->update($updateData)) {
abort(500, '保存失败');
}

View File

@ -23,6 +23,7 @@ CREATE TABLE `v2_order` (
`invite_user_id` int(11) DEFAULT NULL,
`user_id` int(11) NOT NULL,
`plan_id` int(11) NOT NULL,
`type` int(11) NOT NULL COMMENT '1新购2续费3升级',
`cycle` varchar(255) NOT NULL,
`trade_no` varchar(36) NOT NULL,
`callback_no` varchar(255) DEFAULT NULL,
@ -55,13 +56,11 @@ CREATE TABLE `v2_plan` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET NAMES utf8mb4;
DROP TABLE IF EXISTS `v2_server`;
CREATE TABLE `v2_server` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` varchar(255) NOT NULL,
`name` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
`name` varchar(255) NOT NULL,
`host` varchar(255) NOT NULL,
`port` int(11) NOT NULL,
`server_port` int(11) NOT NULL,
@ -106,6 +105,7 @@ CREATE TABLE `v2_user` (
`invite_user_id` int(11) DEFAULT NULL,
`email` varchar(64) NOT NULL,
`password` varchar(64) NOT NULL,
`commission_rate` int(11) DEFAULT NULL,
`commission_balance` int(11) NOT NULL DEFAULT '0',
`t` int(11) NOT NULL DEFAULT '0',
`u` bigint(20) NOT NULL DEFAULT '0',
@ -132,4 +132,4 @@ CREATE TABLE `v2_user` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- 2019-11-23 14:25:15
-- 2019-11-27 11:46:36

View File

@ -12,4 +12,7 @@ ALTER TABLE `v2_user`
CHANGE `enable` `enable` tinyint(1) NOT NULL DEFAULT '1' AFTER `transfer_enable`;
/* 2019-11-25 */
ALTER TABLE `v2_order`
ADD `type` int(11) NOT NULL COMMENT '1新购2续费3升级' AFTER `plan_id`;
ADD `type` int(11) NOT NULL COMMENT '1新购2续费3升级' AFTER `plan_id`;
/* 2019-11-27 */
ALTER TABLE `v2_user`
ADD `commission_rate` int(11) NULL AFTER `password`;