MemberGoods.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\store\controller\members;
  13. use app\common\enum\member\AuditStatus;
  14. use app\store\controller\Controller;
  15. use app\store\model\member\MemberGoods as MemberGoodsModel;
  16. /**
  17. * 会员价商品管理
  18. * Class Refund
  19. * @package app\store\controller\member
  20. */
  21. class MemberGoods extends Controller
  22. {
  23. /**
  24. * 列表
  25. * @return array
  26. * @throws \think\db\exception\DbException
  27. * @author: zjwhust
  28. * @Time: 2022/5/25 14:56
  29. */
  30. public function list()
  31. {
  32. $model = new MemberGoodsModel;
  33. $list = $model->getList($this->request->param());
  34. return $this->renderSuccess(compact('list'));
  35. }
  36. /**
  37. * 编辑
  38. * @return array
  39. * @author: zjwhust
  40. * @Time: 2022/5/25 16:56
  41. */
  42. public function edit()
  43. {
  44. $postData = $this->postForm();
  45. $model = MemberGoodsModel::find($postData['id']);
  46. if(!$model->edit($postData)){
  47. return $this->renderError($model->getError() ?: '操作失败');
  48. }
  49. return $this->renderSuccess([], '操作成功');
  50. }
  51. /**
  52. * 删除
  53. * @return array
  54. * @author: zjwhust
  55. * @Time: 2022/5/25 16:56
  56. */
  57. public function remove()
  58. {
  59. $postData = $this->postForm();
  60. $model = MemberGoodsModel::find($postData['id']);
  61. if(!$model->remove()){
  62. return $this->renderError($model->getError() ?: '移除失败');
  63. }
  64. return $this->renderSuccess([], '移除成功');
  65. }
  66. }