Fullreduce.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace app\supplier\controller\setting;
  3. use app\supplier\controller\Controller;
  4. use app\supplier\model\settings\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. $data = $this->postData();
  17. $data['shop_supplier_id'] = $this->getSupplierId();
  18. $list = $model->getList($data);
  19. return $this->renderSuccess('', compact('list'));
  20. }
  21. /**
  22. * 添加等级
  23. */
  24. public function add()
  25. {
  26. $model = new FullReduceModel;
  27. // 新增记录
  28. $data = $this->postData();
  29. $data['shop_supplier_id'] = $this->getSupplierId();
  30. if ($model->add($data)) {
  31. return $this->renderSuccess('添加成功');
  32. }
  33. return $this->renderError('添加失败');
  34. }
  35. /**
  36. * 编辑会员等级
  37. */
  38. public function edit($fullreduce_id)
  39. {
  40. $model = FullReduceModel::detail($fullreduce_id);
  41. // 修改记录
  42. if ($model->edit($this->postData())) {
  43. return $this->renderSuccess();
  44. }
  45. return $this->renderError();
  46. }
  47. /**
  48. * 删除会员等级
  49. */
  50. public function delete($fullreduce_id)
  51. {
  52. // 会员等级详情
  53. $model = FullReduceModel::detail($fullreduce_id);
  54. if ($model->setDelete()) {
  55. return $this->renderSuccess('删除成功');
  56. }
  57. return $this->renderError('删除失败');
  58. }
  59. }