Skillcate.php 797 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\api\controller\service;
  3. use app\common\controller\Api;
  4. /**
  5. * 首页接口
  6. */
  7. class SkillCate extends Api
  8. {
  9. protected $noNeedLogin = ['*'];
  10. protected $noNeedRight = ['*'];
  11. /**
  12. * 获取服务分类
  13. * @return void
  14. * @throws \think\db\exception\DataNotFoundException
  15. * @throws \think\db\exception\ModelNotFoundException
  16. * @throws \think\exception\DbException
  17. */
  18. public function getList()
  19. {
  20. $list = model('app\api\model\service\SkillCate')
  21. ->where(['state'=>1])
  22. ->field('id,name')
  23. ->cache(true,60)
  24. ->select();
  25. !$list && $this->error('管理员未设置服务分类');
  26. $this->success('信息返回成功',$list);
  27. }
  28. }