Crontab.php 637 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. /**
  6. * 示例接口
  7. */
  8. class Crontab extends Api
  9. {
  10. // 无需登录的接口,*表示全部
  11. protected $noNeedLogin = ['user_path'];
  12. public function user_path($pid=0){
  13. $list=Db::table('fa_user')->where('pid',$pid)->select();
  14. foreach ($list as $k=>$v){
  15. if($pid==0){
  16. $path=$pid.'/';
  17. }else{
  18. $path=$v['path'].$v['id'].'/';
  19. }
  20. Db::table('fa_user')->where('id',$v['id'])->update(['path'=>$path]);
  21. $this->user_path($v['id']);
  22. }
  23. }
  24. }