fix(日报): "提醒未提交成员"改用组织架构接口凑候选名单,不再必现400
后端问题清单"新增2"记录过:POST /reports/daily/reminders 要求调用方传入完整候选 user_ids 名单(服务端只做"从候选里筛出未交的人再提醒",不会自己算全公司名单), 但前端一直传空数组,必然命中服务端"user_ids为空"的400校验。 重新核实时发现这条其实不是后端缺口——GET /organization/members 不传 q/department_id 时就会返回调用者可见范围内的全部在职成员(分页),这个接口本来就在会议参会人选择器 里用着,只是"提醒未提交成员"这个按钮没有复用它。改为点击时先分页拉取全部组织成员 user_id,再传给提醒接口;组织架构为空时给出明确提示而不是让请求再次落入400。 已在浏览器验证请求格式(limit=100,与后端实际接受的参数一致)和空组织架构下的 兜底提示;当前测试租户组织架构数据本身为空,未能覆盖"真的有人被提醒"这条路径, 但接口契约已对照 im_be 源码逐字段核实。
This commit is contained in:
+18
-3
@@ -4384,11 +4384,13 @@ const getOrganizationDepartmentMembers = (departmentId, cursor = '') => imGet('/
|
||||
const getOrganizationMembers = ({
|
||||
query = '',
|
||||
departmentId = '',
|
||||
cursor = ''
|
||||
cursor = '',
|
||||
limit = ''
|
||||
} = {}) => imGet('/organization/members' + qs({
|
||||
q: query,
|
||||
department_id: departmentId,
|
||||
cursor
|
||||
cursor,
|
||||
limit
|
||||
}));
|
||||
const searchOrganization = (query = '', types = 'department,user', cursor = '') => imGet('/organization/search' + qs({
|
||||
q: query,
|
||||
@@ -21816,7 +21818,20 @@ function DailyReportList({
|
||||
return hay.includes(query);
|
||||
});
|
||||
const remindMissing = () => {
|
||||
(0,_lib_im_api_js__WEBPACK_IMPORTED_MODULE_3__.sendDailyReminders)(toDateInputValue(new Date())).then(_ => onToast('已提醒未提交成员')).catch(err => onToast(err.message || '提醒失败'));
|
||||
const collectAllMembers = (cursor, acc) => (0,_lib_im_api_js__WEBPACK_IMPORTED_MODULE_3__.getOrganizationMembers)({
|
||||
cursor,
|
||||
limit: 100
|
||||
}).then(d => {
|
||||
const next = acc.concat((d.items || []).map(m => m.user_id));
|
||||
return d.has_more && d.next_cursor ? collectAllMembers(d.next_cursor, next) : next;
|
||||
});
|
||||
collectAllMembers('', []).then(userIds => {
|
||||
if (!userIds.length) {
|
||||
onToast('组织架构里没有可提醒的成员');
|
||||
return;
|
||||
}
|
||||
return (0,_lib_im_api_js__WEBPACK_IMPORTED_MODULE_3__.sendDailyReminders)(toDateInputValue(new Date()), userIds).then(_ => onToast('已提醒未提交成员'));
|
||||
}).catch(err => onToast(err.message || '提醒失败'));
|
||||
};
|
||||
return (0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxDEV)("div", {
|
||||
className: "workplace-page report-list-page",
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user