MdCategoryController.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace app\modules\admin\controllers;
  3. use app\models\MdCategory;
  4. use app\modules\admin\models\MdCategoryForm;
  5. class MdCategoryController extends BaseController
  6. {
  7. /**
  8. * 列表
  9. */
  10. public function actionList()
  11. {
  12. $form = new MdCategoryForm();
  13. $form->attributes = get_params();
  14. $form->store_id = get_store_id();
  15. return $this->asJson($form->list());
  16. }
  17. /**
  18. * 保存
  19. */
  20. public function actionSave()
  21. {
  22. $form = new MdCategoryForm();
  23. $form->attributes = post_params();
  24. $form->store_id = get_store_id();
  25. return $this->asJson($form->save());
  26. }
  27. /**
  28. * 删除
  29. */
  30. public function actionDel()
  31. {
  32. $form = new MdCategoryForm();
  33. $form->attributes = post_params();
  34. $form->store_id = get_store_id();
  35. return $this->asJson($form->del());
  36. }
  37. /**
  38. * 修改状态
  39. */
  40. public function actionSetStatus()
  41. {
  42. $form = new MdCategoryForm();
  43. $form->attributes = post_params();
  44. $form->store_id = get_store_id();
  45. return $this->asJson($form->setStatus());
  46. }
  47. /**
  48. * 获取门店分类数据(订单金额)
  49. */
  50. public function actionGetMdCategoryData()
  51. {
  52. $form = new MdCategoryForm();
  53. $form->attributes = get_params();
  54. $form->id = get_params('cat_id');
  55. $form->store_id = get_store_id();
  56. return $this->asJson($form->getMdCategoryData());
  57. }
  58. /**
  59. * 获取门店分类数据 详情
  60. */
  61. public function actionGetMdCategoryDataDetail()
  62. {
  63. $form = new MdCategoryForm();
  64. $form->attributes = get_params();
  65. $form->store_id = get_store_id();
  66. return $this->asJson($form->getMdCategoryDataDetail());
  67. }
  68. public function actionGetMdCategory()
  69. {
  70. $store_id = get_store_id();
  71. return $this->asJson([
  72. 'code' => 0,
  73. 'msg' => '',
  74. 'data' => [
  75. 'list' => MdCategory::getList($store_id)
  76. ]
  77. ]);
  78. }
  79. }