Dep.php 860 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. use think\Db;
  6. class Dep extends Base
  7. {
  8. public function list(){
  9. $lists = Db::name('dep')
  10. ->field('id,title')
  11. ->where('org_id',$this->orgId)
  12. ->where('enable',1)
  13. ->where('del',0)
  14. ->where('is_show',0)
  15. ->select();
  16. HelpHander::success($lists);
  17. }
  18. public function userByDep(){
  19. $depId = input('depId/d',0);
  20. $lists = Db::name('user')
  21. ->alias('u')
  22. ->field('u.id,u.account,u.real_name,u.mobile,u.head_image')
  23. ->join('user_dep ud','ud.user_id=u.id')
  24. ->where('u.del',0)
  25. ->where('u.del',0)
  26. ->where('ud.dep_id',$depId)
  27. ->select();
  28. HelpHander::success($lists);
  29. }
  30. }