NewsCategory.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. namespace app\admin\controller\medical;
  3. use app\admin\controller\BaseController;
  4. use app\admin\server\medical\MedicalCarePostageServer;
  5. use app\admin\server\medical\MedicalCareProductServer;
  6. use app\admin\server\medical\NewsCategoryServer;
  7. use app\admin\server\package\PackageGoodsServer;
  8. class NewsCategory extends BaseController
  9. {
  10. /**
  11. * Notes:文章分类
  12. * @return \support\Response
  13. * User: QJF
  14. * Date: 2022/9/28
  15. */
  16. public function getCategoryList()
  17. {
  18. [$page, $limit] = $this->getPage();
  19. $keywords = $this->request->get('keywords');
  20. $result = NewsCategoryServer::getCategoryList($page, $limit,$keywords);
  21. return json_success($result, '成功');
  22. }
  23. /**
  24. * Notes:添加运费模板
  25. * @return \support\Response
  26. * User: QJF
  27. * Date: 2022/9/28
  28. *
  29. */
  30. public function addPostage()
  31. {
  32. $param = $this->request->post();
  33. $this->validateCheck('medical\MedicalCarePostagetValidate',
  34. [
  35. 'postage_name' => $param['postage_name'],
  36. 'postage_type_id' => $param['postage_type_id'],
  37. 'postage_first_weight' => $param['postage_first_weight'],
  38. 'postage_first_price' => $param['postage_first_price'],
  39. 'postage_extend_weight' => $param['postage_extend_weight'],
  40. 'postage_extend_price' => $param['postage_extend_price'],
  41. ],
  42. 'add');
  43. $result = MedicalCarePostageServer::insertPostage($param);
  44. return json_success($result, '添加成功');
  45. }
  46. /**
  47. * Notes:修改产品
  48. * @return \support\Response
  49. * User: QJF
  50. * Date: 2022/9/23
  51. */
  52. public function updatePostage()
  53. {
  54. $param = $this->request->post();
  55. $this->validateCheck('medical\MedicalCarePostagetValidate',
  56. [
  57. 'postage_id' => $param['postage_id'],
  58. 'postage_name' => $param['postage_name'],
  59. 'postage_type_id' => $param['postage_type_id'],
  60. 'postage_first_weight' => $param['postage_first_weight'],
  61. 'postage_first_price' => $param['postage_first_price'],
  62. 'postage_extend_weight' => $param['postage_extend_weight'],
  63. 'postage_extend_price' => $param['postage_extend_price'],
  64. ], 'update');
  65. $result = MedicalCarePostageServer::updatePostage($param);
  66. return json_success($result, '修改成功');
  67. }
  68. /**
  69. * Notes:删除权益包
  70. * @return \support\Response
  71. * User: QJF
  72. * Date: 2022/9/23
  73. */
  74. public function delPostage()
  75. {
  76. $postage_id = $this->request->get('postage_id');
  77. $this->validateCheck('medical\MedicalCarePostagetValidate', ['postage_id' => $postage_id], 'del');
  78. $result = MedicalCarePostageServer::delPostage($postage_id);
  79. if ($result){
  80. return json_success($result, '删除成功');
  81. }else{
  82. throw new \Exception('删除失败!');
  83. }
  84. }
  85. /**
  86. * Notes:查看模板详情
  87. * @return \support\Response
  88. * User: QJF
  89. * Date: 2022/9/28
  90. */
  91. public function infoPostage()
  92. {
  93. $postage_id = $this->request->get('postage_id');
  94. $this->validateCheck('medical\MedicalCarePostagetValidate', ['postage_id' => $postage_id], 'info');
  95. $result = MedicalCarePostageServer::infoPostage($postage_id);
  96. if ($result){
  97. return json_success($result, '获取成功');
  98. }else{
  99. throw new \Exception('获取失败!');
  100. }
  101. }
  102. //产品上下架
  103. public function showPostage(){
  104. $postage_id = $this->request->get('postage_id');
  105. $postage_status= $this->request->get('postage_status');
  106. $this->validateCheck('medical\MedicalCarePostagetValidate', ['postage_id' => $postage_id], 'del');
  107. $result = MedicalCarePostageServer::showPostage($postage_id,$postage_status);
  108. if ($result){
  109. return json_success($result, '成功');
  110. }else{
  111. throw new \Exception('失败!');
  112. }
  113. }
  114. }