<?php namespace app\api\controller; use app\common\controller\Api; use think\Db; class Servicetype extends Api { protected $noNeedLogin = '*'; protected $noNeedRight = '*'; protected $model = null; public function _initialize() { parent::_initialize(); $this->model = Db::name('servicetype'); } /** * 服务类型列表 * @return void */ public function getList() { try { $field = 'id,title'; $result = $this->model->field($field)->order('weigh asc createtime desc')->select(); $this->success('获取成功',$result); } catch (Exception $e) { $this->error($e->getMessage()); } } }