Balance.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace app\shop\controller\user;
  3. use app\common\enum\settings\SettingEnum;
  4. use app\shop\controller\Controller;
  5. use app\shop\model\settings\Setting as SettingModel;
  6. use app\shop\model\user\BalanceLog as BalanceLogModel;
  7. /**
  8. * 余额明细
  9. */
  10. class Balance extends Controller
  11. {
  12. /**
  13. * 余额明细
  14. */
  15. public function log()
  16. {
  17. $model = new BalanceLogModel;
  18. return $this->renderSuccess('', [
  19. // 充值记录列表
  20. 'list' => $model->getList($this->postData('Params')),
  21. // 属性集
  22. 'attributes' => $model::getAttributes(),
  23. ]);
  24. }
  25. /**
  26. * 充值设置
  27. */
  28. public function setting()
  29. {
  30. if ($this->request->isGet()) {
  31. $values = SettingModel::getItem(SettingEnum::BALANCE);
  32. return $this->renderSuccess('', compact('values'));
  33. }
  34. $model = new SettingModel;
  35. if ($model->edit(SettingEnum::BALANCE, $this->postData())) {
  36. return $this->renderSuccess('操作成功');
  37. }
  38. return $this->renderError($model->getError() ?: '操作失败');
  39. }
  40. }