Apph5.php 874 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. use app\common\enum\settings\SettingEnum;
  6. /**
  7. * 支付宝支付设置
  8. */
  9. class Apph5 extends Controller
  10. {
  11. /**
  12. * 支付宝支付设置
  13. */
  14. public function pay()
  15. {
  16. if($this->request->isGet()){
  17. return $this->fetchData();
  18. }
  19. $model = new SettingModel;
  20. if ($model->edit(SettingEnum::H5ALIPAY, $this->postData())) {
  21. return $this->renderSuccess('操作成功');
  22. }
  23. return $this->renderError($model->getError() ?: '操作失败');
  24. }
  25. /**
  26. * 获取支付宝支付
  27. */
  28. public function fetchData()
  29. {
  30. $data = SettingModel::getItem(SettingEnum::H5ALIPAY);
  31. return $this->renderSuccess('', compact('data'));
  32. }
  33. }