PackageGoodsCategory.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. namespace app\admin\controller\package;
  3. use app\admin\controller\BaseController;
  4. use app\admin\server\package\PackageGoodsCategoryServer;
  5. use app\admin\server\package\PackageGoodsServer;
  6. class PackageGoodsCategory extends BaseController
  7. {
  8. /**
  9. * Notes:获取产品分类
  10. * @return \support\Response
  11. * User: QJF
  12. * Date: 2022/9/21
  13. */
  14. public function getPackageGoodsCategoryList()
  15. {
  16. [$page, $limit] = $this->getPage();
  17. $keywords = $this->request->get('keywords');
  18. $result = PackageGoodsCategoryServer::getPackageGoodsCategoryList($page, $limit, $keywords);
  19. return json_success($result, '成功');
  20. }
  21. /**
  22. * Notes:添加产品分类
  23. * @return \support\Response
  24. * User: QJF
  25. * Date: 2022/9/21
  26. *
  27. */
  28. public function addPackageGoodsCategory()
  29. {
  30. $param = $this->request->post();
  31. $this->validateCheck('package\PackageGoodsCategoryValidate',
  32. [
  33. 'category_name' => $param['category_name'],
  34. 'category_title' => $param['category_title'],
  35. 'category_num' => $param['category_num'],
  36. ],
  37. 'add');
  38. $result = PackageGoodsCategoryServer::insertPackageGoodsCategory($param);
  39. return json_success($result, '添加成功');
  40. }
  41. /**
  42. * Notes:修改权产品分类
  43. * @return \support\Response
  44. * User: QJF
  45. * Date: 2022/9/19
  46. */
  47. public function updatePackageGoodsCategory()
  48. {
  49. $param = $this->request->post();
  50. $this->validateCheck('package\PackageGoodsCategoryValidate',
  51. [
  52. 'category_id' => $param['category_id'],
  53. 'category_name' => $param['category_name'],
  54. 'category_title' => $param['category_title'],
  55. 'category_num' => $param['category_num'],
  56. ], 'update');
  57. $result = PackageGoodsCategoryServer::updatePackageGoodsCategory($param);
  58. return json_success($result, '修改成功');
  59. }
  60. /**
  61. * Notes:删除权益包
  62. * @return \support\Response
  63. * User: QJF
  64. * Date: 2022/9/19
  65. */
  66. public function delPackageGoodsCategory()
  67. {
  68. $category_id = $this->request->get('category_id');
  69. $this->validateCheck('package\PackageGoodsCategoryValidate', ['category_id' => $category_id], 'del');
  70. $result = PackageGoodsCategoryServer::delPackageGoodsCategory($category_id);
  71. if ($result){
  72. return json_success($result, '成功');
  73. }else{
  74. throw new \Exception('失败!');
  75. }
  76. }
  77. /**
  78. * Notes:查看权益包详情
  79. * @return \support\Response
  80. * User: QJF
  81. * Date: 2022/9/19
  82. */
  83. public function infoPackageGoodsCategory()
  84. {
  85. $category_id = $this->request->get('category_id');
  86. $this->validateCheck('package\PackageGoodsCategoryValidate', ['category_id' => $category_id], 'info');
  87. $result = PackageGoodsCategoryServer::infoPackageCategory($category_id);
  88. if ($result){
  89. return json_success($result, '获取成功');
  90. }else{
  91. throw new \Exception('获取失败!');
  92. }
  93. }
  94. }