Servicetype.php 729 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. class Servicetype extends Api
  6. {
  7. protected $noNeedLogin = '*';
  8. protected $noNeedRight = '*';
  9. protected $model = null;
  10. public function _initialize()
  11. {
  12. parent::_initialize();
  13. $this->model = Db::name('servicetype');
  14. }
  15. /**
  16. * 服务类型列表
  17. * @return void
  18. */
  19. public function getList()
  20. {
  21. try {
  22. $field = 'id,title';
  23. $result = $this->model->field($field)->order('weigh asc createtime desc')->select();
  24. $this->success('获取成功',$result);
  25. } catch (Exception $e) {
  26. $this->error($e->getMessage());
  27. }
  28. }
  29. }