['请求方法' => ['字段1','字段2'],], // 'post' => ['add' => ['data']] ]; // public function city() // { // try { // $District_model = new \app\admin\model\District(); // $result = $District_model->city(); // tojson(200, '请求成功', $result); // } catch (\Exception $e) { // tojson(10000, $e->getMessage()); // } catch (\Throwable $e) { // tojson(10000, $e->getMessage()); // } // } public function province() { //获取城市接口地址 try { $District_model = new \app\admin\model\District(); $result = $District_model->province(); tojson(200, '请求成功', $result); } catch (\Exception $e) { tojson(10000, $e->getMessage()); } catch (\Throwable $e) { tojson(10000, $e->getMessage()); } } public function area() { //获取城市接口地址 try { $District_model = new \app\admin\model\District(); $result = $District_model->area(); tojson(200, '请求成功', $result); } catch (\Exception $e) { tojson(10000, $e->getMessage()); } catch (\Throwable $e) { tojson(10000, $e->getMessage()); } } // public function read() // { // try { // $District_model = new \app\admin\model\District(); // $result = $District_model->read($_GET); // tojson(200, '请求成功', $result); // } catch (\Exception $e) { // tojson(10000, $e->getMessage()); // } // } // // public function getAll() // { // try { // $District_model = new \app\admin\model\District(); // $result = $District_model->getAll($_GET, $this->request->page, $this->request->pageSize); // tojson(200, '请求成功', $result); // } catch (\Exception $e) { // tojson(10000, $e->getMessage()); // } // } // // public function save() // { // try { // $District_model = new \app\admin\model\District(); // $result = $District_model->save($_POST); // if ($result) { // tojson(200, '添加成功'); // } else { // tojson(10000, '添加失败'); // } // } catch (\Exception $e) { // tojson(10000, $e->getMessage()); // } // } // // public function update() // { // try { // $District_model = new \app\admin\model\District(); // $result = $District_model->where([$District_model->getPk() => $this->param[$District_model->getPk()]])->update($this->param); // if ($result) { // tojson(200, '修改成功'); // } else { // tojson(10000, '修改失败'); // } // } catch (\Exception $e) { // tojson(10000, $e->getMessage()); // } // } // // public function delete() // { // try { // $District_model = new \app\admin\model\District(); // $result = $District_model->where($District_model->getPk(), $this->param[$District_model->getPk()])->delete(); // if ($result) { // tojson(200, '删除成功'); // } else { // tojson(10000, '删除失败'); // } // } catch (\Exception $e) { // tojson(10000, $e->getMessage()); // } // } }