diff --git a/app/Http/Admin/Controllers/SettingController.php b/app/Http/Admin/Controllers/SettingController.php index 1a79a60e..cae94452 100644 --- a/app/Http/Admin/Controllers/SettingController.php +++ b/app/Http/Admin/Controllers/SettingController.php @@ -282,7 +282,7 @@ class SettingController extends Controller if ($this->request->isPost()) { - $data = $this->request->getPost('vip', 'string'); + $data = $this->request->getPost('vip'); $settingService->updateVipSettings($data); @@ -290,9 +290,9 @@ class SettingController extends Controller } else { - $vips = $settingService->getVipSettings(); + $items = $settingService->getVipSettings(); - $this->view->setVar('vips', $vips); + $this->view->setVar('items', $items); } } diff --git a/app/Http/Admin/Services/Setting.php b/app/Http/Admin/Services/Setting.php index 5989b2ac..a1340246 100644 --- a/app/Http/Admin/Services/Setting.php +++ b/app/Http/Admin/Services/Setting.php @@ -91,7 +91,7 @@ class Setting extends Service { $vipRepo = new VipRepo(); - return $vipRepo->findAll(['deleted' => 0]); + return $vipRepo->findAll(); } public function getLiveSettings($section) @@ -198,9 +198,13 @@ class Setting extends Service { $vipRepo = new VipRepo(); - foreach ($items as $id => $price) { + foreach ($items as $id => $item) { $vip = $vipRepo->findById($id); - $vip->price = $price; + if (!$vip) continue; + $vip->title = sprintf('%s个月', $item['expiry']); + $vip->expiry = (int)$item['expiry']; + $vip->price = (float)$item['price']; + $vip->deleted = (int)$item['deleted']; $vip->update(); } } diff --git a/app/Http/Admin/Views/setting/point.volt b/app/Http/Admin/Views/setting/point.volt index 93fc26cd..ff566cb7 100644 --- a/app/Http/Admin/Views/setting/point.volt +++ b/app/Http/Admin/Views/setting/point.volt @@ -36,7 +36,7 @@
-启用 | +期限 | +价格(元) | +
---|---|---|
+ + + | ++ + | ++ |