diff --git a/app/data/controller/user/Admin.php b/app/data/controller/user/Admin.php index f0c530236..13f2743f3 100644 --- a/app/data/controller/user/Admin.php +++ b/app/data/controller/user/Admin.php @@ -61,14 +61,40 @@ class Admin extends Controller * 数据列表处理 * @param array $data */ - protected function _page_filter(array &$data) + protected function _index_page_filter(array &$data) { $this->upgrades = UserUpgradeService::instance()->levels(); UserAdminService::instance()->buildByUid($data, 'pid1', 'from'); } /** - * 修改用户上传 + * 用户团队关系 + * @auth true + * @menu true + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function teams() + { + $this->title = '用户团队关系'; + $map = ['pid1' => input('from', 0)]; + $this->_query($this->table)->where($map)->page(false); + } + + /** + * 数据列表处理 + * @param array $data + */ + protected function _teams_page_filter(array &$data) + { + $uids = array_unique(array_column($data, 'id')); + $subCount = $this->app->db->name($this->table)->whereIn('pid1', $uids)->group('pid1')->column('count(1) count', 'pid1'); + foreach ($data as &$vo) $vo['subCount'] = $subCount[$vo['id']] ?? 0; + } + + /** + * 修改用户推荐人 * @auth true * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException @@ -139,5 +165,4 @@ class Admin extends Controller 'status.require' => '状态值不能为空!', ])); } - } \ No newline at end of file diff --git a/app/data/view/user/admin/teams.html b/app/data/view/user/admin/teams.html new file mode 100644 index 000000000..7febf70d9 --- /dev/null +++ b/app/data/view/user/admin/teams.html @@ -0,0 +1,51 @@ +{extend name="../../admin/view/main"} + +{block name="content"} +