CountrysideController.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\modules\admin\controllers;
  8. use app\models\District;
  9. use app\modules\admin\models\CountrysideForm;
  10. /**
  11. * @file CountrysideController
  12. * @editor Created by vscode
  13. * @author WPing丶
  14. * @date 2023/06/25
  15. * @time 11:41:41
  16. *
  17. * 备注:村镇管理
  18. */
  19. class CountrysideController extends BaseController
  20. {
  21. /**
  22. * 模块名:actionGetCountryside
  23. * 代码描述:获取乡镇列表
  24. * 作者:WPing丶
  25. * 请求方式:GET
  26. * 创建时间:2023/06/25 11:45:34
  27. * @param int id
  28. * @param string str
  29. * @param bool bool
  30. */
  31. public function actionGetCountryside()
  32. {
  33. $param = get_params();
  34. $form = new CountrysideForm();
  35. $form->scenario = $form::SCENARIO_LIST;
  36. $form->attributes = $param;
  37. return $this->asJson($form->searchDistrict());
  38. }
  39. public function actionSaveCountryside()
  40. {
  41. $param = post_params();
  42. $form = new CountrysideForm();
  43. $form->attributes = $param;
  44. $res = $form->saveCountryside();
  45. return $this->asJson($res);
  46. }
  47. /**
  48. * 模块名:actionDelCountryside
  49. * 代码描述:删除村镇
  50. * 作者:WPing丶
  51. * 请求方式:GET
  52. * 创建时间:2023/06/25 19:59:22
  53. * @param int id
  54. * @param string str
  55. * @param bool bool
  56. */
  57. public function actionDelCountryside()
  58. {
  59. //主键id用key标识并进行获取
  60. $param = get_params('key');
  61. $form = new CountrysideForm();
  62. $form->scenario = $form::SCENARIO_DEL;
  63. $form->id = $param;
  64. $res = $form->delCountryside();
  65. return $this->asJson($res);
  66. }
  67. }