|
|
@@ -0,0 +1,41 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\shop\controller\setting;
|
|
|
+
|
|
|
+use app\shop\controller\Controller;
|
|
|
+use app\shop\model\settings\Setting as SettingModel;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 登录设置
|
|
|
+ */
|
|
|
+class Login extends Controller
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * 登录设置
|
|
|
+ */
|
|
|
+ public function index()
|
|
|
+ {
|
|
|
+ if($this->request->isGet()){
|
|
|
+ return $this->fetchData();
|
|
|
+ }
|
|
|
+
|
|
|
+ $model = new SettingModel;
|
|
|
+ $data = $this->postData();
|
|
|
+ $arr['is_open'] = $data['is_open'];
|
|
|
+ if ($model->edit('login', $arr)) {
|
|
|
+ return $this->renderSuccess('操作成功');
|
|
|
+ }
|
|
|
+ return $this->renderError($model->getError() ?: '操作失败');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取存储配置
|
|
|
+ */
|
|
|
+ public function fetchData()
|
|
|
+ {
|
|
|
+ $key = 'login';
|
|
|
+ $vars['values'] = SettingModel::getItem($key);
|
|
|
+ return $this->renderSuccess('', compact('vars'));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|