Activity.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. namespace app\admin\controller\index;
  3. use app\admin\controller\BaseController;
  4. use app\admin\server\index\ActivityServer;
  5. class Activity extends BaseController
  6. {
  7. /**
  8. * Notes:获取活动列表
  9. * @return \support\Response
  10. * User: YCP
  11. * Date: 2023/2/23
  12. */
  13. public function getActivityList()
  14. {
  15. [$page, $limit] = $this->getPage();
  16. $keywords = $this->request->get('keywords');
  17. $result = ActivityServer::getActivityList($page, $limit, $keywords);
  18. return json_success($result, '成功');
  19. }
  20. /**
  21. * Notes:修改套餐项目
  22. * @return \support\Response
  23. * User: YCP
  24. * Date: 2022/10/18
  25. */
  26. public function updateActivity()
  27. {
  28. $params = $this->request->post();
  29. $admin_id = $this->request->admin_id;
  30. /*$this->validateCheck('life\PackageGoodsValidate',
  31. [
  32. 'goods_id' => $params['goods_id']?? '',
  33. 'package_id' => $params['package_id']?? '',
  34. 'goods_name' => $params['goods_name']?? '',
  35. 'goods_num' => $params['goods_num']?? '',
  36. 'goods_price' => $params['goods_price']?? '',
  37. 'goods_weigh' => $params['goods_weigh']?? '',
  38. ],
  39. 'update');*/
  40. $result = ActivityServer::updateActivity($params, $admin_id);
  41. return json_success($result, '修改成功');
  42. }
  43. /**
  44. * Notes:删除套餐项目
  45. * @return \support\Response
  46. * User: YCP
  47. * Date: 2022/10/18
  48. */
  49. public function delActivity()
  50. {
  51. $config_id = $this->request->get('config_id');
  52. $admin_id = $this->request->admin_id;
  53. //$this->validateCheck('life\PackageGoodsValidate', ['goods_id' => $goods_id], 'info');
  54. $result = ActivityServer::delActivity($config_id,$admin_id);
  55. if ($result){
  56. return json_success($result, '删除成功');
  57. }else{
  58. throw new \Exception('删除失败!');
  59. }
  60. }
  61. /**
  62. * Notes:添加套餐项目
  63. * @return \support\Response
  64. * User: YCP
  65. * Date: 2022/10/18
  66. */
  67. public function addActivity()
  68. {
  69. $params = $this->request->post();
  70. $admin_id = $this->request->admin_id;
  71. /*$this->validateCheck('life\PackageGoodsValidate',
  72. [
  73. 'package_id' => $params['package_id']?? '',
  74. 'goods_name' => $params['goods_name']?? '',
  75. 'goods_num' => $params['goods_num']?? '',
  76. 'goods_price' => $params['goods_price']?? '',
  77. 'goods_weigh' => $params['goods_weigh']?? '',
  78. ],
  79. 'create');*/
  80. $result = ActivityServer::insertActivity($params, $admin_id);
  81. return json_success($result, '添加成功');
  82. }
  83. /**
  84. * Notes:查询套餐项目详情
  85. * @return \support\Response
  86. * User: YCP
  87. * Date: 2022/10/18
  88. */
  89. public function activityInfo()
  90. {
  91. $config_id = $this->request->get('config_id');
  92. //$this->validateCheck('life\PackageGoodsValidate', ['goods_id' => $goods_id], 'info');
  93. $result = ActivityServer::activityInfo($config_id);
  94. return json_success($result, '成功');
  95. }
  96. }