UserLabelController.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\modules\admin\controllers;
  3. use app\models\UserLabel;
  4. use app\modules\admin\models\UserLabelForm;
  5. class UserLabelController extends BaseController
  6. {
  7. //用户标签列表
  8. public function actionList() {
  9. $form = new UserLabelForm();
  10. $form->attributes = get_params();
  11. $form->store_id = get_store_id();
  12. return $this->asJson($form->list());
  13. }
  14. //添加修改用户标签
  15. public function actionSave() {
  16. $form = new UserLabelForm();
  17. $form->attributes = post_params();
  18. $form->store_id = get_store_id();
  19. return $this->asJson($form->save());
  20. }
  21. //删除用户标签
  22. public function actionDelete() {
  23. $form = new UserLabelForm();
  24. $form->attributes = post_params();
  25. $form->store_id = get_store_id();
  26. return $this->asJson($form->delete());
  27. }
  28. //修改用户标签状态
  29. public function actionSetStatus() {
  30. $form = new UserLabelForm();
  31. $form->attributes = post_params();
  32. $form->store_id = get_store_id();
  33. return $this->asJson($form->setStatus());
  34. }
  35. //获取无页码的标签
  36. public function actionGetUserLabel() {
  37. $store_id = get_store_id();
  38. return $this->asJson([
  39. 'code' => 0,
  40. 'msg' => '',
  41. 'data' => UserLabel::getList($store_id)
  42. ]);
  43. }
  44. }