12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?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 {
- $isUpkeep = $this->request->param('is_upkeep',-1);
- $field = 'id,title';
- $where = [];
- if ($isUpkeep != -1) {
- $where['is_upkeep'] = $isUpkeep;
- }
- $result = $this->model->field($field)->where($where)->order('weigh asc createtime desc')->select();
- $this->success('获取成功',$result);
- } catch (Exception $e) {
- $this->error($e->getMessage());
- }
- }
- }
|