Appshare.php 799 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\shop\controller\appsetting;
  3. use app\shop\controller\Controller;
  4. use app\shop\model\settings\Setting as SettingModel;
  5. /**
  6. * app 分享设置
  7. */
  8. class Appshare extends Controller
  9. {
  10. /**
  11. * 存储设置
  12. */
  13. public function index()
  14. {
  15. if($this->request->isGet()){
  16. return $this->fetchData();
  17. }
  18. $model = new SettingModel;
  19. if ($model->edit('appshare', $this->postData())) {
  20. return $this->renderSuccess('操作成功');
  21. }
  22. return $this->renderError($model->getError() ?: '操作失败');
  23. }
  24. /**
  25. * 获取存储配置
  26. */
  27. public function fetchData()
  28. {
  29. $data = SettingModel::getItem('appshare');
  30. return $this->renderSuccess('', compact('data'));
  31. }
  32. }