Points.php 1.3 KB

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