Browse Source

2023-5-22-1 新增服务区-2

yingzi 1 year ago
parent
commit
332eebf3b4
1 changed files with 44 additions and 0 deletions
  1. 44 0
      app/api/controller/User.php

+ 44 - 0
app/api/controller/User.php

@@ -166,6 +166,50 @@ class User extends BaseController
     }
 
 
+//    public function getInviterRanking(Request $request)
+//    {
+//        $time = $request->param('time');
+//        $times = $request->param('times');
+//        $users = (new UserModel())
+//            ->leftJoin('user u', 'u.uid = user.parent_uid')
+//            ->where('user.parent_uid', '<>', 0)
+//            ->where('user.regtime', '>=', $time)
+//            ->where('user.regtime', '<=', $times)
+//            ->field('user.parent_uid as uid, IFNULL(count(u.uid), 0) as invite_count')
+//            ->group('user.parent_uid')
+//            ->order('invite_count', 'desc')
+//            ->order('user.parent_uid', 'asc')
+//            ->select();
+//        $rankList = [];
+//        foreach ($users as $key => $value) {
+//            $userInfo = (new UserModel)->where('uid', $value['uid'])->find();
+//            $auth = (new InfoAudit)->where('uid', $value['uid'])->find();
+//            $user_work_type_title = (new UserWorkType)->where('id', $auth['user_work_type_id'])->find();
+//            $rankList[] = [
+//                'rank' => $key + 1,
+//                'uid' => $value['uid'],
+//                'nickname' => $userInfo['nickname'],
+//                'avatar' => $userInfo['avatar'],
+//                'invite_count' => $value['invite_count'],
+//                'is_type_audit' => $auth && $auth['status'] == 1 ? 1 : 0,
+//                'ancestral_place' => $auth ? $auth['ancestral_place'] : '',
+//                'auth_info' => $auth ? $auth->toArray() : [],
+//                'user_work_type_id' => $user_work_type_title['title'],
+//            ];
+//        }
+//
+//        $rankList = array_values(array_filter($rankList, function ($item) {
+//            return empty($item['auth_info']['service_area']);
+//        }));
+//
+//        $inviteCount = array_column($rankList, 'invite_count');
+//        $uid = array_column($rankList, 'uid');
+//        array_multisort($inviteCount, SORT_DESC, $uid, SORT_ASC, $rankList);
+//
+//        $data['list'] = $rankList;
+//
+//        return app('json')->success($data);
+//    }
 
 
     /**