Tool.php 842 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace app\common\controller;
  3. use app\BaseController;
  4. use app\common\middleware\Auth;
  5. use app\admin\model\Notice as NoticeModel;
  6. /**
  7. * Description of Tool
  8. *
  9. * @author sgq
  10. */
  11. class Tool extends BaseController {
  12. protected $middleware = [Auth::class];
  13. public function findChildDictBatch() {
  14. $result = [];
  15. for ($i = 0; $i < count($this->request->param()); $i++) {
  16. if ($obj = $this->request->param($i)) {
  17. $code = $obj["code"];
  18. $dict = \app\common\model\Dict::where("code", $code)->findOrEmpty()->toArray();
  19. $childs = \app\common\model\Dict::where("pid", $dict["id"])->order("num")->select();
  20. $result[$obj["name"]] = $childs;
  21. }
  22. }
  23. return json(["code" => "200", "msg" => "", "obj" => $result]);
  24. }
  25. }