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 @@
行为奖励规则
- +
diff --git a/app/Http/Admin/Views/setting/vip.volt b/app/Http/Admin/Views/setting/vip.volt index 4c39a072..3631a9a2 100644 --- a/app/Http/Admin/Views/setting/vip.volt +++ b/app/Http/Admin/Views/setting/vip.volt @@ -6,15 +6,39 @@
会员设置
- {% for item in vips %} -
- -
- -
-
-
- {% endfor %} +
+ + + + + + + + + + + + + + {% for item in items %} + + + + + + {% endfor %} + +
启用期限价格(元)
+ + + + +
+
diff --git a/app/Models/Vip.php b/app/Models/Vip.php index b6a8446e..5f998438 100644 --- a/app/Models/Vip.php +++ b/app/Models/Vip.php @@ -22,7 +22,7 @@ class Vip extends Model public $title = ''; /** - * 期限(天) + * 期限(月) * * @var int */