Points.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\store\controller\market;
  3. use app\store\controller\Controller;
  4. use app\store\model\Setting as SettingModel;
  5. use app\store\model\user\PointsLog as PointsLogModel;
  6. /**
  7. * 积分管理
  8. * Class Points
  9. * @package app\store\controller\market
  10. */
  11. class Points extends Controller
  12. {
  13. /**
  14. * 积分设置
  15. * @return array|bool|mixed
  16. * @throws \think\exception\DbException
  17. */
  18. public function setting()
  19. {
  20. if (!$this->request->isAjax()) {
  21. $values = SettingModel::getItem('points');
  22. return $this->fetch('setting', compact('values'));
  23. }
  24. $model = new SettingModel;
  25. if ($model->edit('points', $this->postData('points'))) {
  26. return $this->renderSuccess('操作成功');
  27. }
  28. return $this->renderError($model->getError() ?: '操作失败');
  29. }
  30. /**
  31. * 积分明细
  32. * @return mixed
  33. * @throws \think\exception\DbException
  34. */
  35. public function log()
  36. {
  37. // 积分明细列表
  38. $model = new PointsLogModel;
  39. $list = $model->getList($this->request->param());
  40. return $this->fetch('log', compact('list'));
  41. }
  42. }