| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 | 
							- <?php
 
- namespace app\common\controller;
 
- use app\BaseController;
 
- use app\common\middleware\Auth;
 
- use app\admin\model\Notice as NoticeModel;
 
- use think\facade\Db;
 
- /**
 
-  * Description of Tool
 
-  *
 
-  * @author sgq
 
-  */
 
- class Tool extends BaseController {
 
-     //protected $middleware = [Auth::class];
 
-     public function findChildDictBatch() {
 
-         $result = [];
 
-         for ($i = 0; $i < count($this->request->param()); $i++) {
 
-             if ($obj = $this->request->param($i)) {
 
-                 $code = $obj["code"];
 
-                 $dict = \app\common\model\Dict::where("code", $code)->findOrEmpty();
 
-                 $childs = \app\common\model\Dict::where("pid", $dict["id"])->order("num")->select();
 
-                 $result[$obj["name"]] = $childs;
 
-             }
 
-         }
 
-         return json(["code" => "200", "msg" => "", "obj" => $result]);
 
-     }
 
-     public function getProvinceSelect() {
 
-         $where = [];
 
-         $where[] = ["code", "like", "%0000"];
 
-         return json(Db::table("un_common_location")->where($where)->select()->toArray());
 
-     }
 
-     public function findCityByProvinceSelect() {
 
-         $code = $this->request->param("code");
 
-         $province_prefix = substr($code, 0, 2);
 
-         return json(Db::table("un_common_location")->where("code", "like", $province_prefix . "%00")->select()->toArray());
 
-     }
 
-     public function findCountyByCitySelect() {
 
-         $code = $this->request->param("code");
 
-         $city_prefix = substr($code, 0, 4);
 
-         return json(Db::table("un_common_location")->where("code", "like", $city_prefix . "%")->select()->toArray());
 
-     }
 
-     /**
 
-      * 通过地区编码找下级地区,比如传入35就找35**00,传入3505就找3505**
 
-      * @return type
 
-      */
 
-     public function findChildAreaByCode() {
 
-         $param = $this->request->param();
 
-         $code = $param["code"];
 
-         $where[] = ["code", "like", str_pad($code . "%%", 6, 0)];
 
-         $where[] = ["code", "<>", str_pad($code . "00", 6, 0)];
 
-         if (isset($param["no"])) {
 
-             $where[] = ["code", "<>", $param["no"]];
 
-         }
 
-         return json(Db::table("un_common_location")->where($where)->select()->toArray());
 
-     }
 
- }
 
 
  |