Fullreduce.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace app\shop\controller\plus;
  3. use app\shop\controller\Controller;
  4. use app\shop\model\shop\FullReduce as FullReduceModel;
  5. /**
  6. * 满减
  7. */
  8. class Fullreduce extends Controller
  9. {
  10. /**
  11. * 会员等级列表
  12. */
  13. public function index()
  14. {
  15. $model = new FullReduceModel;
  16. $list = $model->getList($this->postData());
  17. return $this->renderSuccess('', compact('list'));
  18. }
  19. /**
  20. * 添加等级
  21. */
  22. public function add()
  23. {
  24. $model = new FullReduceModel;
  25. // 新增记录
  26. if ($model->add($this->postData())) {
  27. return $this->renderSuccess('添加成功');
  28. }
  29. return $this->renderError('添加失败');
  30. }
  31. /**
  32. * 编辑会员等级
  33. */
  34. public function edit($fullreduce_id)
  35. {
  36. $model = FullReduceModel::detail($fullreduce_id);
  37. // 修改记录
  38. if ($model->edit($this->postData())) {
  39. return $this->renderSuccess();
  40. }
  41. return $this->renderError();
  42. }
  43. /**
  44. * 删除会员等级
  45. */
  46. public function delete($fullreduce_id)
  47. {
  48. // 会员等级详情
  49. $model = FullReduceModel::detail($fullreduce_id);
  50. if ($model->setDelete()) {
  51. return $this->renderSuccess('删除成功');
  52. }
  53. return $this->renderError('删除失败');
  54. }
  55. }