This commit is contained in:
Tokumeikoi
2020-04-25 19:44:47 +08:00
parent c17b614e13
commit 867f1760d3
15 changed files with 10537 additions and 553 deletions

View File

@ -81,10 +81,15 @@ class CheckOrder extends Command
abort(500, '开通失败');
}
}
if ((string)$order->cycle === 'onetime_price') {
$this->buyByOneTime($order, $user, $plan);
} else {
$this->buyByCycle($order, $user, $plan);
switch ((string)$order->cycle) {
case 'onetime_price':
$this->buyByOneTime($order, $user, $plan);
break;
case 'reset_price':
$this->buyReset($user);
break;
default:
$this->buyByCycle($order, $user, $plan);
}
if (!$user->save()) {
DB::rollBack();
@ -99,6 +104,12 @@ class CheckOrder extends Command
DB::commit();
}
private function buyReset(User $user)
{
$user->u = 0;
$user->d = 0;
}
private function buyByCycle(Order $order, User $user, Plan $plan)
{
// change plan process