mirror of
https://github.com/kuaifan/dootask.git
synced 2026-10-30 14:30:49 +00:00
- 新增 contacts/departments 接口,返回部门树及成员数 - 通讯录搜索框右侧新增字母/部门视图切换,部门视图可折叠,展开时才加载成员 - users/search 的 keys.departments 改为参数绑定(修复 SQL 注入),0 表示未加入任何部门 - 同步翻译与 ai-kb
38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
||
|
||
namespace App\Http\Controllers\Api;
|
||
|
||
use App\Models\User;
|
||
use App\Module\Base;
|
||
use App\Module\ContactsDepartment;
|
||
|
||
/**
|
||
* @apiDefine contacts
|
||
*
|
||
* 通讯录
|
||
*/
|
||
class ContactsController extends AbstractController
|
||
{
|
||
/**
|
||
* @api {get} api/contacts/departments 通讯录部门树
|
||
*
|
||
* @apiDescription 需要token身份,返回深度优先展开的部门列表;部门成员通过 api/users/search(keys.departments)按需加载
|
||
* @apiVersion 1.0.0
|
||
* @apiGroup contacts
|
||
* @apiName departments
|
||
*
|
||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||
* @apiSuccess {Object} data 返回数据
|
||
* - total: 联系人总数
|
||
* - no_department_count: 未加入任何部门的联系人数
|
||
* - departments: 部门列表,字段 id、name、parent_id、owner_userid、level(层级,顶级为0)、member_count(直属成员数)、total_count(含下级部门的成员数)
|
||
*/
|
||
public function departments()
|
||
{
|
||
User::auth();
|
||
//
|
||
return Base::retSuccess('success', ContactsDepartment::tree());
|
||
}
|
||
}
|