diff --git a/app/service/main.js b/app/service/main.js index 1644c26..7a1a728 100644 --- a/app/service/main.js +++ b/app/service/main.js @@ -434,109 +434,7 @@ class MainService extends Service { } /** - * debug 模式下确保 API 权限存在,并绑定到 role_id=2 - * @param {string} apiPath - API路径 - * @param {Object} user - 当前用户 - * @return {Promise<{ensured:boolean, permissionId:number|null}>} 同步结果 - */ - async ensureApiPermissionInDebugMode(apiPath, user = null) { - const { ctx, app } = this; - if (app.config.debug !== true) { - return { - ensured: false, - permissionId: null, - }; - } - - const normalizedPath = String(apiPath || '').trim(); - if (!normalizedPath) { - return { - ensured: false, - permissionId: null, - }; - } - - const template = await ctx.model.Permission.findOne({ - where: { - type: 'api', - }, - attributes: [ - 'component', - 'name', - 'redirect', - 'meta_title', - 'meta_icon', - 'hidden', - 'always_show', - 'parent_id', - 'sort', - 'status', - ], - order: [[ 'id', 'ASC' ]], - raw: true, - }); - - const [ permission, created ] = await ctx.model.Permission.findOrCreate({ - where: { - path: normalizedPath, - type: 'api', - }, - defaults: { - path: normalizedPath, - type: 'api', - component: template ? template.component : null, - name: template && template.name ? template.name : normalizedPath, - redirect: template ? template.redirect : null, - meta_title: template && template.meta_title ? template.meta_title : `API:${normalizedPath}`, - meta_icon: template ? template.meta_icon : null, - hidden: template ? template.hidden : 0, - always_show: template ? template.always_show : 0, - parent_id: template ? template.parent_id : null, - sort: template ? template.sort : 0, - status: 1, - }, - }); - - if (!permission || !permission.id) { - return { - ensured: false, - permissionId: null, - }; - } - - await ctx.service.systems.auth.rolePermission.bulkAssign(2, [ Number(permission.id) ]); - - // 仅在新建权限时清理当前用户缓存,避免继续使用旧权限快照。 - if (created && user && user.id) { - await ctx.service.systems.auth.user.clearUserCache(user.id); - } - - return { - ensured: true, - permissionId: permission.id, - }; - } - - async hasRole2(employeeId) { - const { ctx } = this; - if (!employeeId) { - return false; - } - - const link = await ctx.model.EmployeeRole.findOne({ - where: { - employee_id: employeeId, - role_id: 2, - }, - attributes: [ 'id' ], - raw: true, - }); - - return !!link; - } - - /** - * 检查用户是否有 API 访问权限(只检查 type=api) + * 检查用户是否有API访问权限(只检查类型为api的权限) * @param {Object} user - 用户信息 * @param {string} apiPath - API路径 * @return {Promise} 是否有权限 @@ -548,16 +446,7 @@ class MainService extends Service { if (user.permissions && Array.isArray(user.permissions)) { // 用户权限列表中可能包含所有权限,需要过滤出api权限 console.log('user.permissions', user.permissions); - if (user.permissions.includes('*') || user.permissions.includes(apiPath)) { - return true; - } - - const ensureResult = await this.ensureApiPermissionInDebugMode(apiPath, user); - if (!ensureResult.ensured) { - return false; - } - - return await this.hasRole2(user.employees_id); + return user.permissions.includes(apiPath); } return false; } catch (error) { diff --git a/app/service/systemMethods/setting/permission.js b/app/service/systemMethods/setting/permission.js index c6159ee..d2f7b61 100644 --- a/app/service/systemMethods/setting/permission.js +++ b/app/service/systemMethods/setting/permission.js @@ -6,9 +6,15 @@ class permissionService extends MainService { constructor(ctx) { super(ctx); const _noNeedLogin = ''; +<<<<<<< HEAD const _noNeedRight = 'list,add,delete,update'; const _noNeedLog = '*'; const _noNeedAuth = 'list,add,delete,update'; +======= + const _noNeedRight = 'list'; + const _noNeedLog = '*'; + const _noNeedAuth = 'list'; +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth); } diff --git a/app/service/systemMethods/setting/role.js b/app/service/systemMethods/setting/role.js index 5128999..f5be600 100644 --- a/app/service/systemMethods/setting/role.js +++ b/app/service/systemMethods/setting/role.js @@ -6,9 +6,15 @@ class roleService extends MainService { constructor(ctx) { super(ctx); const _noNeedLogin = ''; +<<<<<<< HEAD const _noNeedRight = 'list,add,delete,update,permission'; const _noNeedLog = '*'; const _noNeedAuth = 'list,add,delete,update,permission'; +======= + const _noNeedRight = 'list,add,delete,update'; + const _noNeedLog = '*'; + const _noNeedAuth = 'list,add,delete,update'; +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth); } @@ -33,6 +39,7 @@ class roleService extends MainService { } /** +<<<<<<< HEAD * 角色权限列表(兼容旧入口)。 * @param {*} data */ @@ -41,6 +48,8 @@ class roleService extends MainService { } /** +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 * 新增角色。 * @param {*} data */ diff --git a/app/service/systemMethods/user.js b/app/service/systemMethods/user.js index b7b901c..2c6ff78 100644 --- a/app/service/systemMethods/user.js +++ b/app/service/systemMethods/user.js @@ -6,8 +6,10 @@ class userService extends MainService { constructor(ctx) { super(ctx); const _noNeedLogin = 'login,loginByCode,register,getLoginWechatCode'; + const _noNeedLogin = 'login,loginByCode,register,getLoginWechatCode'; const _noNeedRight = '*'; const _noNeedLog = 'info,getBindWechatCode,getLoginWechatCode'; + const _noNeedLog = 'info,getBindWechatCode,getLoginWechatCode'; const _noNeedAuth = '*'; this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth); } @@ -56,6 +58,14 @@ class userService extends MainService { } return this.fail('获取微信登录码失败:' + result.message, result); } + async getLoginWechatCode(data) { + const { service } = this; + const result = await service.systems.auth.user.getLoginWechatCode(data); + if (result.code) { + return this.success('获取微信登录码成功', result); + } + return this.fail('获取微信登录码失败:' + result.message, result); + } async unbindWechat(data) { const { service } = this; const result = await service.systems.auth.user.unbindWechat(data); diff --git a/app/service/systems/auth/user.js b/app/service/systems/auth/user.js index 4fa7d94..d34baa7 100644 --- a/app/service/systems/auth/user.js +++ b/app/service/systems/auth/user.js @@ -493,6 +493,7 @@ class UserService extends Service { } /** +<<<<<<< HEAD * 登录码登录:使用Ye4s登录码进行登录 * @param {string} code 登录码(WECHAT_LOGIN_CODE) * @return {Object} 登录结果 @@ -503,6 +504,18 @@ class UserService extends Service { try { const rawCode = typeof code === 'string' ? code.trim() : ''; if (!rawCode) { +======= + * 登录码登录:使用本系统缓存登录码完成登录 + * @param {string} code 登录码(WECHAT_LOGIN_CODE) + * @return {Object} 登录结果 + */ + async loginByCode(code) { + const { app } = this; + + try { + const normalizedCode = this.parseWechatBindCode(code); + if (!normalizedCode) { +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 return { success: false, data: null, @@ -511,6 +524,7 @@ class UserService extends Service { }; } +<<<<<<< HEAD const candidateSet = new Set([ rawCode ]); try { const decoded = Buffer.from(rawCode, 'base64').toString('utf8').trim(); @@ -551,6 +565,17 @@ class UserService extends Service { }); if (!rows || rows.length === 0) { +======= + const codeCacheKey = this.getWechatLoginCodeCacheKey(normalizedCode); + let codeState = null; + try { + codeState = await this.app.getCacheAsync(codeCacheKey); + } catch (cacheErr) { + app.coreLogger.warn(`读取登录码缓存失败: ${cacheErr.message}`); + } + + if (!codeState) { +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 return { success: false, data: null, @@ -559,6 +584,7 @@ class UserService extends Service { }; } +<<<<<<< HEAD const ye4sUserId = Number(rows[0].id); if (!Number.isFinite(ye4sUserId) || ye4sUserId <= 0) { return { @@ -570,6 +596,44 @@ class UserService extends Service { } return await this.loginByYe4sUserId(ye4sUserId); +======= + const codeStateWithCode = { + ...(codeState || {}), + code: normalizedCode, + }; + + let loginResponse = await this.tryBuildWechatLoginTokenFromState(codeState.client_code || '', codeStateWithCode); + if (loginResponse && loginResponse.success) { + return loginResponse; + } + + const clientCode = this.parseWechatBindCode(codeState && codeState.client_code); + if (clientCode) { + let clientState = null; + try { + clientState = await this.app.getCacheAsync(this.getWechatLoginClientCacheKey(clientCode)); + } catch (cacheErr) { + app.coreLogger.warn(`读取客户端登录状态缓存失败: ${cacheErr.message}`); + } + + if (clientState) { + loginResponse = await this.tryBuildWechatLoginTokenFromState(clientCode, { + ...clientState, + code: normalizedCode, + }); + if (loginResponse && loginResponse.success) { + return loginResponse; + } + } + } + + return { + success: false, + data: null, + code: 0, + message: '登录码尚未授权,请扫码确认后重试', + }; +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 } catch (error) { app.coreLogger.error(`登录码登录异常: ${error.message}`); return { @@ -1047,7 +1111,11 @@ class UserService extends Service { }; } +<<<<<<< HEAD const cacheKey = this.getWechatBindCacheKey(normalizedAccountId); +======= + const cacheKey = this.getWechatBindCacheKey(accountId); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 const useLongPoll = this.shouldUseWechatBindLongPoll(data); const waitTimeoutMs = this.getWechatLongPollTimeoutMs(); @@ -1058,7 +1126,11 @@ class UserService extends Service { app.coreLogger.warn(`读取微信绑定缓存失败: ${cacheErr.message}`); } +<<<<<<< HEAD const refreshed = await this.refreshWechatBindState(normalizedAccountId, cachedState, { +======= + const refreshed = await this.refreshWechatBindState(accountId, cachedState, { +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 forceNewCode: false, }); @@ -1071,14 +1143,22 @@ class UserService extends Service { }; } +<<<<<<< HEAD const waitResult = await this.waitForWechatBindEvent(normalizedAccountId, waitTimeoutMs); +======= + const waitResult = await this.waitForWechatBindEvent(accountId, waitTimeoutMs); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 try { cachedState = await this.app.getCacheAsync(cacheKey); } catch (cacheErr) { app.coreLogger.warn(`读取微信绑定缓存失败: ${cacheErr.message}`); } +<<<<<<< HEAD const nextState = await this.refreshWechatBindState(normalizedAccountId, cachedState, { +======= + const nextState = await this.refreshWechatBindState(accountId, cachedState, { +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 forceNewCode: waitResult.timed_out, }); @@ -1392,7 +1472,11 @@ class UserService extends Service { } } +<<<<<<< HEAD const cacheKey = this.getWechatBindCacheKey(normalizedAccountId); +======= + const cacheKey = this.getWechatBindCacheKey(accountId); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 await this.setWechatBindCache(cacheKey, null, 1); await this.publishWechatBindEvent(normalizedAccountId, { status: 'unbound', diff --git a/app/service/systems/setting/account.js b/app/service/systems/setting/account.js index 6cd2314..0d02989 100644 --- a/app/service/systems/setting/account.js +++ b/app/service/systems/setting/account.js @@ -360,6 +360,7 @@ class SettingAccountService extends Service { return employeeRoleMap; } +<<<<<<< HEAD async buildWechatBindingMap(accountIds) { if (!Array.isArray(accountIds) || accountIds.length === 0) { return new Map(); @@ -450,6 +451,8 @@ class SettingAccountService extends Service { throw this.createError('目标账号超出当前操作范围', 403); } +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 async formatEmployeeRow(employee, options = {}) { let account = options.account || null; if (!account) { @@ -562,10 +565,13 @@ class SettingAccountService extends Service { .map(employee => Number(employee.id)) .filter(employeeId => Number.isFinite(employeeId) && employeeId > 0); const employeeRoleMap = await this.buildEmployeeRoleGroupMap(employeeIds); +<<<<<<< HEAD const accountIds = employees .map(employee => Number(employee.account_id)) .filter(accountId => Number.isFinite(accountId) && accountId > 0); const wechatBindingMap = await this.buildWechatBindingMap(accountIds); +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 const list = []; for (const employee of employees) { @@ -586,17 +592,23 @@ class SettingAccountService extends Service { continue; } +<<<<<<< HEAD const wechatBinding = wechatBindingMap.get(Number(employee.account_id)) || { is_wechat_bound: false, ye4s_user_id: null, }; +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 list.push({ ...await this.formatEmployeeRow(employee, { account: employee.account, }), +<<<<<<< HEAD is_wechat_bound: wechatBinding.is_wechat_bound, ye4s_user_id: wechatBinding.ye4s_user_id, +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 role_ids: roleGroup.role_ids, roles: roleGroup.roles, }); diff --git a/app/service/systems/setting/permission.js b/app/service/systems/setting/permission.js index 1b5d03b..b616abc 100644 --- a/app/service/systems/setting/permission.js +++ b/app/service/systems/setting/permission.js @@ -151,22 +151,49 @@ class SettingPermissionService extends Service { return new Set(rows.map(item => Number(item.id)).filter(id => Number.isFinite(id) && id > 0)); } +<<<<<<< HEAD async ensureParentPermissionExists(parentId) { +======= + async ensureParentPermissionInScope(parentId) { +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 if (!parentId) { return; } await this.getPermission(parentId, false); +<<<<<<< HEAD } async ensurePermissionsExist(permissionIds) { const { ctx } = this; +======= + + const availableSet = await this.getAvailablePermissionIdSet({ includeDisabled: false }); + if (!availableSet.has(Number(parentId))) { + throw this.createError(`parent_id 超出当前登录工号可用权限集:${parentId}`, 400); + } + } + + async ensurePermissionsInAvailableScope(permissionIds, options = {}) { + const { ctx, app } = this; + const { Op } = app.Sequelize; + const includeDisabled = options.includeDisabled === true; + + const availableSet = await this.getAvailablePermissionIdSet({ includeDisabled }); + if (availableSet.size === 0) { + throw this.createError('当前登录工号可用权限集为空,无法操作权限', 400); + } +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 const targetRows = await ctx.model.Permission.findAll({ where: { id: permissionIds, }, +<<<<<<< HEAD attributes: [ 'id' ], +======= + attributes: [ 'id', 'parent_id' ], +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 raw: true, }); if (targetRows.length !== permissionIds.length) { @@ -175,7 +202,68 @@ class SettingPermissionService extends Service { throw this.createError(`权限不存在:${missing.join(',')}`, 404); } +<<<<<<< HEAD return targetRows; +======= + const parentMap = new Map(targetRows.map(item => [ Number(item.id), item.parent_id === null ? null : Number(item.parent_id) ])); + let pendingParentIds = Array.from(new Set(targetRows + .map(item => item.parent_id === null ? null : Number(item.parent_id)) + .filter(parentId => Number.isFinite(parentId) && parentId > 0))); + + while (pendingParentIds.length > 0) { + const fetchIds = pendingParentIds.filter(parentId => !parentMap.has(parentId)); + if (fetchIds.length === 0) { + break; + } + + const parentRows = await ctx.model.Permission.findAll({ + where: { + id: { + [Op.in]: fetchIds, + }, + }, + attributes: [ 'id', 'parent_id' ], + raw: true, + }); + + for (const row of parentRows) { + parentMap.set(Number(row.id), row.parent_id === null ? null : Number(row.parent_id)); + } + + pendingParentIds = Array.from(new Set(parentRows + .map(row => row.parent_id === null ? null : Number(row.parent_id)) + .filter(parentId => Number.isFinite(parentId) && parentId > 0 && !parentMap.has(parentId)))); + } + + const outOfScopeIds = []; + for (const permissionId of permissionIds) { + let currentId = Number(permissionId); + let inScope = false; + const visited = new Set(); + + while (Number.isFinite(currentId) && currentId > 0 && !visited.has(currentId)) { + visited.add(currentId); + if (availableSet.has(currentId)) { + inScope = true; + break; + } + + const parentId = parentMap.has(currentId) ? parentMap.get(currentId) : null; + if (!Number.isFinite(parentId) || parentId <= 0) { + break; + } + currentId = Number(parentId); + } + + if (!inScope) { + outOfScopeIds.push(Number(permissionId)); + } + } + + if (outOfScopeIds.length > 0) { + throw this.createError(`包含超出当前登录工号可用权限集的权限ID:${outOfScopeIds.join(',')}`, 400); + } +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 } normalizePermissionIds(inputPermissionIds) { @@ -271,7 +359,12 @@ class SettingPermissionService extends Service { } async getCurrentEmployeePermissionIds() { +<<<<<<< HEAD const { ctx } = this; +======= + const { ctx, app } = this; + const { Op } = app.Sequelize; +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 const currentEmployeeId = this.getCurrentEmployeeId(); if (!currentEmployeeId) { return []; @@ -303,9 +396,25 @@ class SettingPermissionService extends Service { return []; } +<<<<<<< HEAD return await ctx.service.systems.auth.rolePermission.getPermissionIdsForRoles(roleIds, { includeDisabled: false, }); +======= + const rolePermissions = await ctx.model.RolePermission.findAll({ + where: { + role_id: { + [Op.in]: roleIds, + }, + }, + attributes: [ 'permission_id' ], + raw: true, + }); + + return Array.from(new Set(rolePermissions + .map(item => Number(item.permission_id)) + .filter(id => Number.isFinite(id) && id > 0))); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 } async getCurrentRoleId() { @@ -342,6 +451,7 @@ class SettingPermissionService extends Service { return roleId; } +<<<<<<< HEAD async resolveVisiblePermissionRows({ includeDisabled = false, type = null, keyword = '', scopeMode = 'available' } = {}) { const { ctx, app } = this; const { Op } = app.Sequelize; @@ -359,6 +469,26 @@ class SettingPermissionService extends Service { [Op.in]: currentPermissionIds, }; } +======= + async resolveVisiblePermissionRows({ includeDisabled = false, type = null, keyword = '' } = {}) { + const { ctx, app } = this; + const { Op } = app.Sequelize; + + const currentPermissionIds = await this.getCurrentEmployeePermissionIds(); + if (currentPermissionIds.length === 0) { + return []; + } + + const where = { + id: { + [Op.in]: currentPermissionIds, + }, + status: includeDisabled ? { [Op.in]: [ 0, 1 ] } : 1, + type: { + [Op.notLike]: '%_pages', + }, + }; +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 if (type) { where.type = type; } @@ -380,12 +510,16 @@ class SettingPermissionService extends Service { 'status', 'parent_id', 'sort', +<<<<<<< HEAD 'component', 'redirect', 'meta_title', 'meta_icon', 'hidden', 'always_show', +======= + 'meta_title', +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 ], order: [ [ 'sort', 'ASC' ], @@ -414,11 +548,15 @@ class SettingPermissionService extends Service { role = await this.getRole(roleId); } +<<<<<<< HEAD // 权限管理页需要展示全量权限树,不能再按当前登录工号已分配权限做裁剪。 +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 const permissionRows = await this.resolveVisiblePermissionRows({ includeDisabled, type, keyword, +<<<<<<< HEAD scopeMode: 'all', }); @@ -431,6 +569,20 @@ class SettingPermissionService extends Service { } else if (directPermissionIds.length > 0) { selectedPermissionSet = new Set(directPermissionIds.map(item => Number(item))); } +======= + }); + + let selectedPermissionSet = new Set(); + if (role) { + const rolePermissions = await ctx.model.RolePermission.findAll({ + where: { + role_id: role.id, + }, + attributes: [ 'permission_id' ], + }); + + selectedPermissionSet = new Set(rolePermissions.map(item => Number(item.permission_id))); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 } const permissions = permissionRows.map(item => ({ @@ -441,6 +593,7 @@ class SettingPermissionService extends Service { status: Number(item.status), parent_id: item.parent_id === null ? null : Number(item.parent_id), sort: Number(item.sort || 0), +<<<<<<< HEAD component: item.component || '', redirect: item.redirect || '', meta_title: item.meta_title || '', @@ -448,6 +601,10 @@ class SettingPermissionService extends Service { hidden: Number(item.hidden || 0), always_show: Number(item.always_show || 0), selected: role ? (selectAllPermissions || selectedPermissionSet.has(Number(item.id))) : false, +======= + meta_title: item.meta_title || '', + selected: role ? selectedPermissionSet.has(Number(item.id)) : false, +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 })); return { @@ -482,7 +639,11 @@ class SettingPermissionService extends Service { status: this.normalizeStatus(data.status), }; +<<<<<<< HEAD await this.ensureParentPermissionExists(permissionData.parent_id); +======= + await this.ensureParentPermissionInScope(permissionData.parent_id); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 let created = null; try { @@ -507,7 +668,13 @@ class SettingPermissionService extends Service { const { ctx } = this; const permissionIds = this.normalizeIds(data.ids, 'ids'); +<<<<<<< HEAD await this.ensurePermissionsExist(permissionIds); +======= + await this.ensurePermissionsInAvailableScope(permissionIds, { + includeDisabled: true, + }); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 const permissions = await ctx.model.Permission.findAll({ where: { @@ -539,7 +706,14 @@ class SettingPermissionService extends Service { transaction, }); +<<<<<<< HEAD await ctx.service.systems.auth.rolePermission.removePermissionsFromAllRoles(deletedIds, { +======= + await ctx.model.RolePermission.destroy({ + where: { + permission_id: deletedIds, + }, +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 transaction, }); } @@ -562,8 +736,17 @@ class SettingPermissionService extends Service { } async update(data = {}) { +<<<<<<< HEAD const permissionId = this.toPositiveNumber(data.permission_id || data.permissionId, 'permission_id'); await this.ensurePermissionsExist([ permissionId ]); +======= + const { ctx } = this; + + const permissionId = this.toPositiveNumber(data.permission_id || data.permissionId, 'permission_id'); + await this.ensurePermissionsInAvailableScope([ permissionId ], { + includeDisabled: true, + }); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 const permission = await this.getPermission(permissionId, true); @@ -617,7 +800,11 @@ class SettingPermissionService extends Service { if (parentId && parentId === permissionId) { throw this.createError('parent_id 不能等于 permission_id', 400); } +<<<<<<< HEAD await this.ensureParentPermissionExists(parentId); +======= + await this.ensureParentPermissionInScope(parentId); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 updates.parent_id = parentId; } if (hasSort) { diff --git a/app/service/systems/setting/role.js b/app/service/systems/setting/role.js index 2103bf6..e0a6d3d 100644 --- a/app/service/systems/setting/role.js +++ b/app/service/systems/setting/role.js @@ -145,6 +145,7 @@ class SettingRoleService extends Service { return visited; } +<<<<<<< HEAD async buildRolePermissionMap(roleRows) { const { service } = this.ctx; const rows = Array.isArray(roleRows) ? roleRows : []; @@ -164,6 +165,9 @@ class SettingRoleService extends Service { } buildRoleTree(roleRows, rootRoleIds, selectedRoleIdSet, rolePermissionMap = new Map()) { +======= + buildRoleTree(roleRows, rootRoleIds, selectedRoleIdSet) { +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 const nodeMap = new Map(); for (const row of roleRows) { const roleId = Number(row.id); @@ -179,7 +183,10 @@ class SettingRoleService extends Service { store_id: row.store_id === null ? null : Number(row.store_id), pid: Number(row.pid || 0), selected: selectedRoleIdSet.has(roleId), +<<<<<<< HEAD permission_ids: rolePermissionMap.get(roleId) || [], +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 children: [], }); } @@ -242,6 +249,7 @@ class SettingRoleService extends Service { } normalizePermissionIds(inputPermissionIds) { +<<<<<<< HEAD if (inputPermissionIds === '*') { return [ '*' ]; } @@ -266,21 +274,32 @@ class SettingRoleService extends Service { } } +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 if (!Array.isArray(inputPermissionIds)) { throw this.createError('permission_ids 参数不能为空', 400); } +<<<<<<< HEAD if (inputPermissionIds.some(item => typeof item === 'string' && item.trim() === '*')) { return [ '*' ]; } +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 const permissionIds = []; for (const permissionId of inputPermissionIds) { const normalized = Number(permissionId); if (!Number.isFinite(normalized) || normalized <= 0) { +<<<<<<< HEAD throw this.createError('permission_ids 必须是正整数数组或 ["*"]', 400); } permissionIds.push(Math.floor(normalized)); +======= + throw this.createError('permission_ids 必须是正整数数组', 400); + } + permissionIds.push(normalized); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 } return Array.from(new Set(permissionIds)); @@ -320,11 +339,15 @@ class SettingRoleService extends Service { async validatePermissionSet(permissionIds) { const { ctx } = this; +<<<<<<< HEAD if (!Array.isArray(permissionIds) || permissionIds.length === 0) { return; } if (permissionIds.includes('*')) { +======= + if (permissionIds.length === 0) { +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 return; } @@ -341,12 +364,46 @@ class SettingRoleService extends Service { const missing = permissionIds.filter(id => !found.has(id)); throw this.createError(`权限不存在或已禁用:${missing.join(',')}`, 400); } +<<<<<<< HEAD } async replaceRolePermissions(roleId, permissionIds, transaction) { return await this.ctx.service.systems.auth.rolePermission.assignPermissions(roleId, permissionIds, { transaction, }); +======= + + const visiblePermissions = await this.ctx.service.systems.setting.permission.resolveVisiblePermissionRows({ + includeDisabled: false, + type: null, + keyword: '', + }); + const availableSet = new Set(visiblePermissions.map(item => Number(item.id))); + const outOfScopeIds = permissionIds.filter(id => !availableSet.has(id)); + if (outOfScopeIds.length > 0) { + throw this.createError(`包含超出可用权限集的权限ID:${outOfScopeIds.join(',')}`, 400); + } + } + + async replaceRolePermissions(roleId, permissionIds, transaction) { + const { ctx } = this; + + await ctx.model.RolePermission.destroy({ + where: { + role_id: roleId, + }, + transaction, + }); + + if (permissionIds.length > 0) { + const rows = permissionIds.map(permissionId => ({ + role_id: roleId, + permission_id: permissionId, + })); + + await ctx.model.RolePermission.bulkCreate(rows, { transaction }); + } +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 } async clearRoleUsersCache(roleId) { @@ -398,7 +455,11 @@ class SettingRoleService extends Service { // 先拉取当前主体 + 系统角色域,后续按可见规则二次收敛。 const roleWhere = { +<<<<<<< HEAD status: includeDisabled ? { [Op.in]: [0, 1] } : 1, +======= + status: includeDisabled ? { [Op.in]: [ 0, 1 ] } : 1, +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 [Op.or]: [ { store_id: storeId }, { store_id: 0 }, { store_id: null } ], }; @@ -415,7 +476,10 @@ class SettingRoleService extends Service { 'status', 'store_id', 'pid', +<<<<<<< HEAD 'permissions', +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 ], order: [ [ 'is_system', 'DESC' ], @@ -449,6 +513,7 @@ class SettingRoleService extends Service { }; } +<<<<<<< HEAD const currentRoleIdSet = new Set(currentRoleRows.map(item => Number(item.id))); // 仅返回当前角色的下级角色树,不返回自己及同级角色。 @@ -468,12 +533,34 @@ class SettingRoleService extends Service { } const visibleRoleIds = this.collectDescendantRoleIds(roleRows, Array.from(subordinateRootRoleIds)); +======= + const sameLevelParentIds = new Set(currentRoleRows.map(item => Number(item.pid || 0))); + const currentRoleIdSet = new Set(currentRoleRows.map(item => Number(item.id))); + const hasSystemCurrentRole = currentRoleRows + .some(item => this.normalizeStoreScope(item.store_id) === 0); + + // 默认场景下,若当前角色在系统域(store_id=0/null),只保留当前角色本身作为根, + // 避免暴露其他系统同级角色。 + const sameLevelRoleIds = hasSystemCurrentRole && !includeSystem + ? new Set(currentRoleIdSet) + : new Set(roleRows + .filter(item => sameLevelParentIds.has(Number(item.pid || 0))) + .filter(item => this.isRoleVisibleInScope(item, currentRoleRows, storeId, includeSystem)) + .map(item => Number(item.id))); + + const descendantRoleIds = this.collectDescendantRoleIds(roleRows, currentRoleRows.map(item => Number(item.id))); + const visibleRoleIds = new Set([ ...sameLevelRoleIds, ...descendantRoleIds ]); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 const visibleRoleRows = roleRows .filter(item => visibleRoleIds.has(Number(item.id))) .filter(item => this.isRoleVisibleInScope(item, currentRoleRows, storeId, includeSystem)); const rootRoleIds = new Set(visibleRoleRows +<<<<<<< HEAD .filter(item => subordinateRootRoleIds.has(Number(item.id))) +======= + .filter(item => sameLevelRoleIds.has(Number(item.id))) +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 .map(item => Number(item.id))); let selectedRoleIdSet = new Set(); @@ -486,8 +573,12 @@ class SettingRoleService extends Service { selectedRoleIdSet = new Set(employeeRoles.map(item => Number(item.role_id))); } +<<<<<<< HEAD const rolePermissionMap = await this.buildRolePermissionMap(visibleRoleRows); const roles = this.buildRoleTree(visibleRoleRows, rootRoleIds, selectedRoleIdSet, rolePermissionMap); +======= + const roles = this.buildRoleTree(visibleRoleRows, rootRoleIds, selectedRoleIdSet); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 return { code: 200, @@ -498,10 +589,13 @@ class SettingRoleService extends Service { }; } +<<<<<<< HEAD async permission(data = {}) { return this.ctx.service.systems.setting.permission.list(data); } +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 async add(data = {}) { const { ctx } = this; @@ -597,6 +691,18 @@ class SettingRoleService extends Service { deletedIds.push(roleId); } +<<<<<<< HEAD +======= + if (deletedIds.length > 0) { + await ctx.model.RolePermission.destroy({ + where: { + role_id: deletedIds, + }, + transaction, + }); + } + +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 await transaction.commit(); } catch (error) { await transaction.rollback(); diff --git a/methods/system.json b/methods/system.json index 67c9e18..d7c9e13 100644 --- a/methods/system.json +++ b/methods/system.json @@ -1,4897 +1,4419 @@ { - "module": "system", - "description": "系统接口标准入口,method 对应系统内置方法,全部使用 POST 请求,参数统一放在 body 内", - "version": "0.3.0", - "updatedAt": "2026-03-22", - "headers": [ - { - "name": "platform", - "type": "string", - "required": true, - "description": "客户端平台标识,如 web/pda/app", - "list": [ + "module": "system", + "description": "系统接口标准入口,method 对应系统内置方法,全部使用 POST 请求,参数统一放在 body 内", + "version": "0.3.0", + "updatedAt": "2026-03-23", + "headers": [ { - "value": "web", - "name": "网页端" + "name": "platform", + "type": "string", + "required": true, + "description": "客户端平台标识,如 web/pda/app", + "list": [ + { + "value": "web", + "name": "网页端" + }, + { + "value": "pda", + "name": "PDA端" + }, + { + "value": "app", + "name": "APP端" + }, + { + "value": "wx", + "name": "微信端" + }, + { + "value": "miniProgram", + "name": "小程序端" + }, + { + "value": "other", + "name": "其他" + } + ] }, { - "value": "pda", - "name": "PDA端" - }, - { - "value": "app", - "name": "APP端" - }, - { - "value": "wx", - "name": "微信端" - }, - { - "value": "miniProgram", - "name": "小程序端" - }, - { - "value": "other", - "name": "其他" + "type": "string", + "required": true, + "name": "project", + "description": "项目标识,如 all/warehouse/store/tms", + "list": [ + { + "value": "all", + "name": "全部" + }, + { + "value": "warehouse", + "name": "仓库" + }, + { + "value": "store", + "name": "货主" + }, + { + "value": "tms", + "name": "物流" + } + ] } - ] - }, - { - "type": "string", - "required": true, - "name": "project", - "description": "项目标识,如 all/warehouse/store/tms", - "list": [ - { - "value": "all", - "name": "全部" - }, - { - "value": "warehouse", - "name": "仓库" - }, - { - "value": "store", - "name": "货主" - }, - { - "value": "tms", - "name": "物流" - } - ] + ], + "methods": { + "groups": [ + { + "groupName": "配置模块", + "module": "config", + "list": [ + { + "method": "config.list", + "description": "config.list 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "看板模块", + "module": "dashboard", + "list": [ + { + "method": "dashboard.storeStats", + "description": "dashboard.storeStats 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "dashboard.warehouseStats", + "description": "dashboard.warehouseStats 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "dashboard.hot_order_rank", + "description": "dashboard.hot_order_rank 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "dashboard.express_ratio", + "description": "dashboard.express_ratio 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "dashboard.platform_distribution", + "description": "dashboard.platform_distribution 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "dashboard.order_trend", + "description": "dashboard.order_trend 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "基础模块", + "module": "index", + "list": [ + { + "method": "index.fastWhereTree", + "description": "index.fastWhereTree 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "type", + "type": "string", + "required": false, + "source": "body", + "description": "type 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "index.loadStores", + "description": "index.loadStores 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.getCOSUploadConfig", + "description": "index.getCOSUploadConfig 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "data", + "type": "object", + "required": false, + "source": "body", + "description": "data 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "index.getImages", + "description": "index.getImages 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.uploadSuccessNotify", + "description": "index.uploadSuccessNotify 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.ReferenceFile", + "description": "index.ReferenceFile 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.getMessageDetail", + "description": "index.getMessageDetail 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.getI18nMessage", + "description": "index.getI18nMessage 接口", + "isNeedAuth": false, + "isNeedLogin": false, + "headers": [], + "params": [ + { + "name": "language", + "type": "string", + "required": false, + "source": "body|query", + "description": "language 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "index.putI18nCollect", + "description": "index.putI18nCollect 接口", + "isNeedAuth": false, + "isNeedLogin": false, + "headers": [], + "params": [ + { + "name": "keys", + "type": "array", + "required": false, + "source": "body", + "description": "keys 参数" + }, + { + "name": "locale", + "type": "string", + "required": false, + "source": "body", + "description": "locale 参数" + }, + { + "name": "project", + "type": "string", + "required": false, + "source": "body", + "description": "project 参数" + }, + { + "name": "source", + "type": "string", + "required": false, + "source": "body", + "description": "source 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "index.tryAutoTranslateNewKeys", + "description": "index.tryAutoTranslateNewKeys 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.searchSpace", + "description": "index.searchSpace 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "index.getExpressList", + "description": "index.getExpressList 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "订单模块", + "module": "order", + "list": [ + { + "method": "order.getOrderModels", + "description": "order.getOrderModels 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "order.list", + "description": "分页查询订单列表", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "pagination 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;常用字段包括 delivery_order_code、status、outbound_status、buyer_nick、mobile 与日期区间字段。示例:where.delivery_order_code={operator:like,value:SO202603}; where.status={operator:in,value:[created,pedding]}。" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.detail", + "description": "查询订单详情", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "delivery_order_code", + "type": "string", + "required": false, + "source": "body", + "description": "delivery_order_code 参数" + }, + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.listItems", + "description": "查询订单商品明细", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "delivery_order_code", + "type": "string", + "required": false, + "source": "body", + "description": "delivery_order_code 参数" + }, + { + "name": "order_id", + "type": "number", + "required": false, + "source": "body", + "description": "order_id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.stats", + "description": "订单统计", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;统计口径与 order.list 共用筛选字段。示例:where.status={operator:eq,value:fin}; where.create_time_start={value:2026-03-01}; where.create_time_end={value:2026-03-31}。" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.getreviewOrderlist", + "description": "分页查询订单审核列表", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "pagination 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;支持 inspection_status、operator_name、operate_time_start、operate_time_end 等字段。示例:where.inspection_status={operator:eq,value:pending}; where.operator_name={operator:like,value:张}; where.operate_time_start={value:2026-03-01}。" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.updateStatus", + "description": "更新订单状态", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "claim_status", + "type": "string", + "required": false, + "source": "body", + "description": "claim_status 参数" + }, + { + "name": "delivery_order_code", + "type": "string", + "required": false, + "source": "body", + "description": "delivery_order_code 参数" + }, + { + "name": "delivery_time", + "type": "string", + "required": false, + "source": "body", + "description": "delivery_time 参数" + }, + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + }, + { + "name": "inspection_status", + "type": "string", + "required": false, + "source": "body", + "description": "inspection_status 参数" + }, + { + "name": "intercept_status", + "type": "string", + "required": false, + "source": "body", + "description": "intercept_status 参数" + }, + { + "name": "lock_status", + "type": "string", + "required": false, + "source": "body", + "description": "lock_status 参数" + }, + { + "name": "outbound_status", + "type": "string", + "required": false, + "source": "body", + "description": "outbound_status 参数" + }, + { + "name": "pack_status", + "type": "string", + "required": false, + "source": "body", + "description": "pack_status 参数" + }, + { + "name": "pick_status", + "type": "string", + "required": false, + "source": "body", + "description": "pick_status 参数" + }, + { + "name": "post_status", + "type": "string", + "required": false, + "source": "body", + "description": "post_status 参数" + }, + { + "name": "print_status", + "type": "string", + "required": false, + "source": "body", + "description": "print_status 参数" + }, + { + "name": "status", + "type": "string", + "required": false, + "source": "body", + "description": "status 参数" + }, + { + "name": "storage_status", + "type": "string", + "required": false, + "source": "body", + "description": "storage_status 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.updateDeliveryTime", + "description": "更新发货时间", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "delivery_time", + "type": "string", + "required": true, + "source": "body", + "description": "delivery_time 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.reviewOrder", + "description": "订单审核", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "delivery_order_code", + "type": "string", + "required": false, + "source": "body", + "description": "delivery_order_code 参数" + }, + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + }, + { + "name": "inspection_status", + "type": "string", + "required": false, + "source": "body", + "description": "inspection_status 参数(兼容入参)" + }, + { + "name": "review_status", + "type": "string", + "required": false, + "source": "body", + "description": "review_status 参数,默认 fin" + }, + { + "name": "operator_name", + "type": "string", + "required": false, + "source": "body", + "description": "operator_name 参数" + }, + { + "name": "operate_time", + "type": "string", + "required": false, + "source": "body", + "description": "operate_time 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.reviewOrder.getreviewOrderlist", + "description": "分页查询订单审核列表(目录化路由)", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "pagination 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;支持 inspection_status、operator_name、operate_time_start、operate_time_end 等字段。示例:where.inspection_status={operator:eq,value:pending}; where.operator_name={operator:like,value:张}; where.operate_time_start={value:2026-03-01}。" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.reviewOrder.reviewOrder", + "description": "订单审核(目录化路由)", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "delivery_order_code", + "type": "string", + "required": false, + "source": "body", + "description": "delivery_order_code 参数" + }, + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + }, + { + "name": "inspection_status", + "type": "string", + "required": false, + "source": "body", + "description": "inspection_status 参数(兼容入参)" + }, + { + "name": "review_status", + "type": "string", + "required": false, + "source": "body", + "description": "review_status 参数,默认 fin" + }, + { + "name": "operator_name", + "type": "string", + "required": false, + "source": "body", + "description": "operator_name 参数" + }, + { + "name": "operate_time", + "type": "string", + "required": false, + "source": "body", + "description": "operate_time 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.deliveryOrder.getdeliveryOrderlist", + "description": "分页查询已进入出库流程的订单列表", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "pagination 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传 outbound_status 时默认过滤 outbound_status != none。示例:where.outbound_status={operator:in,value:[created,processing]}; where.store_id={operator:eq,value:1001}。" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.pendingOrder.getpendingOrderlist", + "description": "分页查询待处理订单列表", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "pagination 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传时默认 status in [pedding, created] 且 outbound_status = none。示例:where.status={operator:in,value:[pedding,created]}; where.outbound_status={operator:eq,value:none}。" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.expectionOrder.getexpectionOrderlist", + "description": "分页查询异常订单列表", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "pagination 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传时默认筛选各流程 error 或拦截 exception。示例:where.status={operator:eq,value:error}; where.outbound_status={operator:eq,value:exception}。" + } + ], + "response": [], + "errors": [] + }, + { + "method": "order.archiveOrder.getarchiveOrderlist", + "description": "分页查询归档订单列表(暂使用当前订单表完成态数据)", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "pagination 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传 outbound_status 时默认过滤 outbound_status = fin。示例:where.outbound_status={operator:eq,value:fin}; where.store_id={operator:eq,value:1001}。" + } + ], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "打印模块", + "module": "print", + "list": [ + { + "method": "print.send", + "description": "print.send 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "computerId", + "type": "string", + "required": false, + "source": "body", + "description": "computerId 参数" + }, + { + "name": "count", + "type": "number", + "required": false, + "source": "body", + "description": "count 参数" + }, + { + "name": "data", + "type": "object", + "required": false, + "source": "body", + "description": "data 参数" + }, + { + "name": "printer", + "type": "string", + "required": false, + "source": "body", + "description": "printer 参数" + }, + { + "name": "template", + "type": "object", + "required": false, + "source": "body", + "description": "template 参数" + }, + { + "name": "timestamp", + "type": "string", + "required": false, + "source": "body", + "description": "timestamp 参数" + }, + { + "name": "type", + "type": "string", + "required": false, + "source": "body", + "description": "type 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.getPrintResult", + "description": "print.getPrintResult 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "printId", + "type": "string", + "required": true, + "source": "body", + "description": "printId 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.getPrintRecordItem", + "description": "print.getPrintRecordItem 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.getList", + "description": "print.getList 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "page", + "type": "number", + "required": false, + "source": "body", + "description": "page 参数" + }, + { + "name": "pageSize", + "type": "number", + "required": false, + "source": "body", + "description": "pageSize 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;当前支持 id、name、computer_id、custom_barcode。示例:where.name={operator:like,value:热敏}; where.computer_id={operator:eq,value:PC-01}。" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.getItem", + "description": "print.getItem 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.add", + "description": "print.add 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "computer_id", + "type": "number", + "required": true, + "source": "body", + "description": "computer_id 参数" + }, + { + "name": "name", + "type": "string", + "required": true, + "source": "body", + "description": "name 参数" + }, + { + "name": "custom_barcode", + "type": "string", + "required": false, + "source": "body", + "description": "custom_barcode 参数" + }, + { + "name": "default_printer_name", + "type": "string", + "required": false, + "source": "body", + "description": "default_printer_name 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.hasName", + "description": "print.hasName 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "name", + "type": "string", + "required": true, + "source": "body", + "description": "name 参数" + }, + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.updateItem", + "description": "print.updateItem 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + }, + { + "name": "computer_id", + "type": "number", + "required": false, + "source": "body", + "description": "computer_id 参数" + }, + { + "name": "custom_barcode", + "type": "string", + "required": false, + "source": "body", + "description": "custom_barcode 参数" + }, + { + "name": "name", + "type": "string", + "required": false, + "source": "body", + "description": "name 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.del", + "description": "print.del 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "ids", + "type": "array", + "required": false, + "source": "body", + "description": "ids 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.getComputer", + "description": "print.getComputer 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "print.getComputerPrinter", + "description": "print.getComputerPrinter 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "print.savePrinters", + "description": "print.savePrinters 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "defaultPrinter", + "type": "string", + "required": true, + "source": "body", + "description": "defaultPrinter 参数" + }, + { + "name": "express", + "type": "array", + "required": false, + "source": "body", + "description": "express 参数" + }, + { + "name": "print_station_id", + "type": "number", + "required": false, + "source": "body", + "description": "print_station_id 参数" + } + ], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "打印机站点模块", + "module": "printer.station", + "list": [ + { + "method": "printer.station.list", + "description": "获取打印站点列表", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "打印模板模块", + "module": "setting.printTemplate", + "list": [ + { + "method": "setting.printTemplate.list", + "description": "获取打印模板树", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "setting.printTemplate.save", + "description": "保存打印模板", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "setting.printTemplate.create", + "description": "创建打印模板(platform 固定为 default,template_type 固定为 CUSTOM,template_url 固定为空字符串)", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "template_name", + "type": "string", + "required": true, + "source": "body", + "description": "模板名称" + }, + { + "name": "business_type", + "type": "string", + "required": true, + "source": "body", + "description": "业务类型" + }, + { + "name": "page_width", + "type": "number", + "required": true, + "source": "body", + "description": "页面宽度(mm)" + }, + { + "name": "page_height", + "type": "number", + "required": true, + "source": "body", + "description": "页面高度(mm)" + }, + { + "name": "template_content", + "type": "array", + "required": false, + "source": "body", + "description": "模板内容,可省略;省略时默认创建空模板内容" + } + ], + "response": [ + { + "name": "id", + "type": "number", + "required": true, + "description": "新建模板ID" + } + ], + "errors": [ + { + "code": "400", + "description": "参数错误(缺少 template_name、business_type、page_width 或 page_height)" + }, + { + "code": "409", + "description": "同一业务类型和平台下已存在自定义模板" + } + ] + }, + { + "method": "setting.printTemplate.delete", + "description": "删除打印模板(软删除)", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "模板ID" + } + ], + "response": [ + { + "name": "id", + "type": "number", + "required": true, + "description": "删除的模板ID" + } + ], + "errors": [ + { + "code": "400", + "description": "参数错误(缺少 id)" + }, + { + "code": "404", + "description": "模板不存在或无权限" + } + ] + }, + { + "method": "setting.printTemplate.listTemplatesByType", + "description": "按业务类型查询模板", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "businessType", + "type": "string", + "required": true, + "source": "body", + "description": "businessType 参数" + } + ], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "账号管理模块", + "module": "setting.account", + "list": [ + { + "method": "setting.account.list", + "description": "查询当前主体下的工号基础信息列表", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "status", + "type": "number", + "required": false, + "source": "body", + "description": "状态筛选,默认 1,仅查有效工号" + }, + { + "name": "includeDisabled", + "type": "boolean", + "required": false, + "source": "body", + "description": "是否包含已删除工号" + } + ], + "response": [ + { + "name": "data[]", + "type": "object", + "required": true, + "description": "工号列表项" + }, + { + "name": "data[].employee_id", + "type": "number", + "required": true, + "description": "工号ID" + }, + { + "name": "data[].account_id", + "type": "number", + "required": true, + "description": "账号ID" + }, + { + "name": "data[].store_id", + "type": "number", + "required": true, + "description": "主体ID" + }, + { + "name": "data[].real_name", + "type": "string", + "required": true, + "description": "工号姓名" + }, + { + "name": "data[].status", + "type": "number", + "required": true, + "description": "工号状态:1=启用,0=停用" + }, + { + "name": "data[].username", + "type": "string", + "required": true, + "description": "账号用户名" + }, + { + "name": "data[].phone", + "type": "string", + "required": true, + "description": "账号手机号" + }, + { + "name": "data[].email", + "type": "string", + "required": true, + "description": "账号邮箱" + }, + { + "name": "data[].avatar_file_id", + "type": "number", + "required": false, + "description": "头像文件ID,为空表示未设置" + }, + { + "name": "data[].avatar_url", + "type": "string", + "required": true, + "description": "头像访问地址" + } + ], + "errors": [ + { + "code": "400", + "description": "当前登录态缺少主体上下文(store_id)" + }, + { + "code": "500", + "description": "查询失败" + } + ] + }, + { + "method": "setting.account.add", + "description": "新增工号,按手机号复用或创建账号后绑定到当前主体", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "phone", + "type": "string", + "required": true, + "source": "body", + "description": "手机号,作为账号复用/创建依据" + }, + { + "name": "real_name", + "type": "string", + "required": true, + "source": "body", + "description": "工号姓名,新增时禁止直接使用保留名称" + }, + { + "name": "username", + "type": "string", + "required": false, + "source": "body", + "description": "新账号用户名,不传时系统自动生成" + }, + { + "name": "password", + "type": "string", + "required": false, + "source": "body", + "description": "新账号密码,不传默认 111111" + }, + { + "name": "role_id", + "type": "number", + "required": false, + "source": "body", + "description": "工号角色,不传时继承当前操作人工号角色" + }, + { + "name": "email", + "type": "string", + "required": false, + "source": "body", + "description": "新账号邮箱,不传时按 username 自动生成" + } + ], + "response": [ + { + "name": "employee_id", + "type": "number", + "required": true, + "description": "新增或复用后的工号ID" + }, + { + "name": "account_id", + "type": "number", + "required": true, + "description": "绑定账号ID" + }, + { + "name": "role_id", + "type": "number", + "required": true, + "description": "绑定后的角色ID" + }, + { + "name": "is_new_account", + "type": "boolean", + "required": true, + "description": "是否为本次新建账号" + }, + { + "name": "phone", + "type": "string", + "required": true, + "description": "绑定账号手机号" + }, + { + "name": "username", + "type": "string", + "required": true, + "description": "绑定账号用户名" + } + ], + "errors": [ + { + "code": "400", + "description": "参数错误、手机号格式错误、或直接使用保留名称" + }, + { + "code": "409", + "description": "手机号对应账号已禁用、手机号已绑定当前主体工号、或用户名重复" + }, + { + "code": "500", + "description": "新增失败" + } + ] + }, + { + "method": "setting.account.delete", + "description": "删除工号绑定关系,仅停用工号,不删除账号", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "employee_id", + "type": "number", + "required": true, + "source": "body", + "description": "要删除的工号ID" + } + ], + "response": [ + { + "name": "employee_id", + "type": "number", + "required": true, + "description": "被停用的工号ID" + }, + { + "name": "account_id", + "type": "number", + "required": true, + "description": "关联账号ID" + }, + { + "name": "status", + "type": "string", + "required": true, + "description": "固定返回 deleted" + }, + { + "name": "already_deleted", + "type": "boolean", + "required": false, + "description": "可选,true 表示该工号原本已停用" + } + ], + "errors": [ + { + "code": "400", + "description": "参数错误或尝试删除当前登录工号" + }, + { + "code": "404", + "description": "工号不存在或无权限删除" + }, + { + "code": "500", + "description": "删除失败" + } + ] + }, + { + "method": "setting.account.update", + "description": "更新工号姓名和头像引用", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "employee_id", + "type": "number", + "required": true, + "source": "body", + "description": "要更新的工号ID" + }, + { + "name": "real_name", + "type": "string", + "required": false, + "source": "body", + "description": "更新后的工号姓名" + }, + { + "name": "file_id", + "type": "number", + "required": false, + "source": "body", + "description": "已有文件ID,作为头像引用" + } + ], + "response": [ + { + "name": "employee_id", + "type": "number", + "required": true, + "description": "更新后的工号ID" + }, + { + "name": "real_name", + "type": "string", + "required": true, + "description": "更新后的工号姓名" + }, + { + "name": "avatar_file_id", + "type": "number", + "required": false, + "description": "更新后的头像文件ID" + }, + { + "name": "avatar_url", + "type": "string", + "required": true, + "description": "更新后的头像地址" + } + ], + "errors": [ + { + "code": "400", + "description": "参数错误,未提供更新项" + }, + { + "code": "404", + "description": "工号或头像文件不存在" + }, + { + "code": "500", + "description": "更新失败" + } + ] + } + ] + }, + { + "groupName": "商品模块", + "module": "stock", + "list": [ + { + "method": "stock.warehouse.list", + "description": "仓库商品列表查询(支持 where 条件与分页)", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "pagination 参数" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;支持 quickWhere、barcode、prohibited_type 等商品筛选字段。示例:where.barcode={operator:like,value:69}; where.prohibited_type={operator:eq,value:liquid}。" + } + ], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.getProhibitedType", + "description": "查询违禁品类型列表(系统预设+仓库自定义)", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.getInfo", + "description": "查询仓库商品详情", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.saveWarehouseStock", + "description": "更新仓库商品资料", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.createWarehouseStock", + "description": "新建仓库商品资料", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.getBarcodes", + "description": "查询商品条码列表", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.saveWarehouseStockBarcode", + "description": "保存商品条码信息", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.getStoreStocks", + "description": "查询仓库商品与货主关联列表", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.bindItem", + "description": "绑定货主商品关系", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.unbindItem", + "description": "解绑货主商品关系", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.checkItemCodeUnique", + "description": "校验商品编码在货主维度唯一性", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "item_code", + "type": "string", + "required": true, + "source": "body", + "description": "item_code 参数" + }, + { + "name": "store_id", + "type": "number", + "required": true, + "source": "body", + "description": "store_id 参数" + }, + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.queryStockLogs", + "description": "查询库存操作日志", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "warehouseId", + "type": "string", + "required": false, + "source": "body", + "description": "warehouseId 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.handleBatchDelete", + "description": "批量删除仓库商品资料", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.deleteUnit", + "description": "删除库存单位", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.deleteProhibited", + "description": "删除违禁品类型", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.handleBatchChange", + "description": "批量修改仓库商品字段", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.getStockUnits", + "description": "查询可用库存单位(系统+仓库)", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.getUnitList", + "description": "查询当前仓库自定义单位列表", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.createProhibited", + "description": "新增违禁品类型", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "name", + "type": "string", + "required": true, + "source": "body", + "description": "name 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.createUnit", + "description": "新增库存单位", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "name", + "type": "string", + "required": true, + "source": "body", + "description": "name 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "stock.warehouse.search", + "description": "仓库商品关键字搜索", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "库存模块", + "module": "storage", + "list": [ + { + "method": "storage.receiving.getReceivingList", + "description": "storage.receiving.getReceivingList 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "分页参数,支持 page/pageSize" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;支持 quickWhere、status、store_id、日期区间等字段。示例:where.status={operator:eq,value:finished}; where.store_id={operator:eq,value:1001}; where.create_time_start={value:2026-03-01}。" + } + ], + "response": [ + { + "name": "list", + "type": "array", + "required": true, + "description": "收货单列表" + }, + { + "name": "pagination", + "type": "object", + "required": true, + "description": "分页信息(page、pageSize、total、totalPages、hasPrevious、hasNext)" + }, + { + "name": "summary", + "type": "object", + "required": true, + "description": "汇总信息(total_quantity、total_locked、total_available、total_items)" + } + ], + "errors": [ + { + "code": "500", + "description": "查询失败" + } + ] + }, + { + "method": "storage.receiving.getReceivingDetail", + "description": "storage.receiving.getReceivingDetail 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "收货单ID" + }, + { + "name": "pagination", + "type": "object", + "required": true, + "source": "body", + "description": "明细分页参数,支持 page/pageSize" + } + ], + "response": [ + { + "name": "receiving", + "type": "object", + "required": true, + "description": "收货单详情(含 details、images、pagination)" + } + ], + "errors": [ + { + "code": "0", + "description": "无记录或无权访问" + }, + { + "code": "500", + "description": "服务器错误" + } + ] + }, + { + "method": "storage.receiving.batchCancelReceiving", + "description": "storage.receiving.batchCancelReceiving 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "ids", + "type": "array", + "required": true, + "source": "body", + "description": "待作废收货单ID数组" + } + ], + "response": [ + { + "name": "message", + "type": "string", + "required": true, + "description": "批量作废处理结果" + } + ], + "errors": [ + { + "code": "0", + "description": "部分单据不存在、无权访问或状态不允许作废" + }, + { + "code": "500", + "description": "服务器错误" + } + ] + }, + { + "method": "storage.receiving.create", + "description": "storage.receiving.create 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "delivery_method", + "type": "string", + "required": true, + "source": "body", + "description": "到货方式:truck/express/air_freight/sea_freight/other" + }, + { + "name": "loading_method", + "type": "string", + "required": true, + "source": "body", + "description": "装卸方式:with_pallet/without_pallet" + }, + { + "name": "license_plate", + "type": "string", + "required": false, + "source": "body", + "description": "车牌号(delivery_method=truck 时建议传)" + }, + { + "name": "tracking_number", + "type": "string", + "required": false, + "source": "body", + "description": "物流单号(非 truck/other 场景建议传)" + }, + { + "name": "store_id", + "type": "number", + "required": false, + "source": "body", + "description": "货主ID" + }, + { + "name": "total_boxes", + "type": "number", + "required": false, + "source": "body", + "description": "总箱数" + }, + { + "name": "total_pallets", + "type": "number", + "required": false, + "source": "body", + "description": "总托盘数" + }, + { + "name": "remark", + "type": "string", + "required": false, + "source": "body", + "description": "备注" + } + ], + "response": [ + { + "name": "id", + "type": "number", + "required": true, + "description": "新建收货单ID" + }, + { + "name": "receiving_number", + "type": "string", + "required": true, + "description": "收货单号" + } + ], + "errors": [ + { + "code": "0", + "description": "创建失败(如字段枚举不合法、数据库约束异常)" + } + ] + }, + { + "method": "storage.receiving.addItem", + "description": "storage.receiving.addItem 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + }, + { + "name": "item", + "type": "object", + "required": false, + "source": "body", + "description": "item 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.removeItem", + "description": "storage.receiving.removeItem 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + }, + { + "name": "item_id", + "type": "number", + "required": false, + "source": "body", + "description": "item_id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.saveReceiving", + "description": "storage.receiving.saveReceiving 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.get", + "description": "storage.receiving.get 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.addDetail", + "description": "storage.receiving.addDetail 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.deleteDetail", + "description": "storage.receiving.deleteDetail 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.detailChange", + "description": "storage.receiving.detailChange 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.cancel", + "description": "storage.receiving.cancel 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.receiving.completeReceiving", + "description": "storage.receiving.completeReceiving 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "storage.entry.list", + "description": "入库单列表查询", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "pagination", + "type": "object", + "required": false, + "source": "body", + "description": "分页参数,支持 page/pageSize" + }, + { + "name": "where", + "type": "object", + "required": false, + "source": "body", + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;支持 quickWhere、order_status、store_id、order_type、日期区间等字段。示例:where.order_status={operator:eq,value:waiting}; where.order_type={operator:eq,value:purchase}; where.create_time_start={value:2026-03-01}。" + }, + { + "name": "sort", + "type": "object", + "required": false, + "source": "body", + "description": "排序参数,支持 sortField/sortOrder" + } + ], + "response": [ + { + "name": "list", + "type": "array", + "required": true, + "description": "入库单列表" + }, + { + "name": "pagination", + "type": "object", + "required": true, + "description": "分页信息(page、pageSize、total、totalPages、hasPrevious、hasNext)" + }, + { + "name": "summary", + "type": "object", + "required": true, + "description": "状态汇总(total、pending、creating、created、completed、cancelled)" + } + ], + "errors": [ + { + "code": "400", + "description": "筛选条件格式错误" + }, + { + "code": "500", + "description": "查询失败" + } + ] + }, + { + "method": "storage.entry.get", + "description": "查询入库单详情", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "入库单ID,与 entry_order_code 二选一" + }, + { + "name": "entry_order_code", + "type": "string", + "required": false, + "source": "body", + "description": "入库单号,与 id 二选一" + } + ], + "response": [ + { + "name": "entryOrder", + "type": "object", + "required": true, + "description": "入库单详情(含 items 明细)" + } + ], + "errors": [ + { + "code": "400", + "description": "id 与 entry_order_code 均未传" + }, + { + "code": "0", + "description": "无记录或无权访问" + } + ] + }, + { + "method": "storage.entry.create", + "description": "创建入库单", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "order_type", + "type": "string", + "required": true, + "source": "body", + "description": "业务类型:SCRK/LYRK/CCRK/CGRK/DBRK/QTRK/B2BRK/XNRK" + }, + { + "name": "store_id", + "type": "number", + "required": false, + "source": "body", + "description": "货主ID,不传默认使用当前用户 store_id" + }, + { + "name": "entry_order_code", + "type": "string", + "required": false, + "source": "body", + "description": "入库单号,不传时系统自动生成" + }, + { + "name": "purchase_order_code", + "type": "string", + "required": false, + "source": "body", + "description": "采购单号" + }, + { + "name": "remark", + "type": "string", + "required": false, + "source": "body", + "description": "备注" + } + ], + "response": [ + { + "name": "id", + "type": "number", + "required": true, + "description": "新建入库单ID" + }, + { + "name": "entry_order_code", + "type": "string", + "required": true, + "description": "入库单号" + } + ], + "errors": [ + { + "code": "400", + "description": "参数缺失或业务类型不合法" + }, + { + "code": "409", + "description": "入库单号已存在" + } + ] + }, + { + "method": "storage.entry.addDetail", + "description": "新增入库明细", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "order_id", + "type": "number", + "required": true, + "source": "body", + "description": "入库单ID" + }, + { + "name": "count", + "type": "number", + "required": true, + "source": "body", + "description": "计划入库数量,必须大于0" + }, + { + "name": "item_code", + "type": "string", + "required": false, + "source": "body", + "description": "商品编码" + } + ], + "response": [ + { + "name": "id", + "type": "number", + "required": true, + "description": "新建明细ID" + }, + { + "name": "order_id", + "type": "number", + "required": true, + "description": "所属入库单ID" + } + ], + "errors": [ + { + "code": "400", + "description": "参数不合法或状态不允许新增明细" + }, + { + "code": "404", + "description": "入库单不存在或无权访问" + } + ] + }, + { + "method": "storage.entry.deleteDetail", + "description": "删除入库明细", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "明细ID" + } + ], + "response": [ + { + "name": "id", + "type": "number", + "required": true, + "description": "删除成功的明细ID" + } + ], + "errors": [ + { + "code": "400", + "description": "参数不合法或明细已有收货数量" + }, + { + "code": "404", + "description": "明细或入库单不存在" + } + ] + }, + { + "method": "storage.entry.detailChange", + "description": "修改入库明细", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "明细ID" + }, + { + "name": "count", + "type": "number", + "required": false, + "source": "body", + "description": "计划入库数量,必须大于0且不能小于已收货数量" + } + ], + "response": [ + { + "name": "id", + "type": "number", + "required": true, + "description": "修改成功的明细ID" + } + ], + "errors": [ + { + "code": "400", + "description": "参数不合法或没有可更新字段" + }, + { + "code": "404", + "description": "明细或入库单不存在" + } + ] + }, + { + "method": "storage.entry.cancel", + "description": "作废入库单", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "入库单ID" + } + ], + "response": [ + { + "name": "id", + "type": "number", + "required": true, + "description": "作废成功的入库单ID" + } + ], + "errors": [ + { + "code": "400", + "description": "参数不合法或已完成单据不允许作废" + }, + { + "code": "404", + "description": "入库单不存在或无权访问" + } + ] + }, + { + "method": "storage.entry.completeEntry", + "description": "完成入库单", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "入库单ID" + } + ], + "response": [ + { + "name": "id", + "type": "number", + "required": true, + "description": "完成成功的入库单ID" + } + ], + "errors": [ + { + "code": "400", + "description": "参数不合法、已作废或缺少明细" + }, + { + "code": "404", + "description": "入库单不存在或无权访问" + } + ] + } + ] + }, + { + "groupName": "主体模块", + "module": "store", + "list": [ + { + "method": "store.createStore", + "description": "store.createStore 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "store.createWarehouse", + "description": "store.createWarehouse 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "store.joinStore", + "description": "store.joinStore 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "store.joinWarehouse", + "description": "store.joinWarehouse 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "store.getStoreRoles", + "description": "store.getStoreRoles 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "code", + "type": "string", + "required": true, + "source": "body", + "description": "申请码(join_token)" + } + ], + "response": [], + "errors": [] + }, + { + "method": "store.auditApply", + "description": "store.auditApply 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "audit_status", + "type": "string", + "required": true, + "source": "body", + "description": "审核状态(approved/rejected)" + }, + { + "name": "code", + "type": "string", + "required": true, + "source": "body", + "description": "申请码(join_token)" + }, + { + "name": "store_id", + "type": "number", + "required": true, + "source": "body", + "description": "当前审批门店ID" + }, + { + "name": "role_ids", + "type": "array", + "required": true, + "source": "body", + "description": "分配角色ID数组" + }, + { + "name": "reject_reason", + "type": "string", + "required": false, + "source": "body", + "description": "拒绝原因(audit_status=rejected 时可传)" + } + ], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "用户模块", + "module": "user", + "list": [ + { + "method": "user.login", + "description": "用户登录(仅返回 token)", + "isNeedAuth": false, + "isNeedLogin": false, + "headers": [], + "params": [ + { + "name": "password", + "type": "string", + "required": false, + "source": "body", + "description": "password 参数" + }, + { + "name": "username", + "type": "string", + "required": false, + "source": "body", + "description": "username 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "user.loginByCode", + "description": "登录码登录(使用 ye4s_user.tmp_code)", + "isNeedAuth": false, + "isNeedLogin": false, + "headers": [], + "params": [ + { + "name": "code", + "type": "string", + "required": true, + "source": "body", + "description": "登录码,对应 ye4s_user.tmp_code" + } + ], + "response": [], + "errors": [] + }, + { + "method": "user.getBindWechatCode", + "description": "获取微信绑定码(默认立即返回;显式开启长轮询后,最长等待60秒,状态变化立即返回)", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "forceRefresh", + "type": "boolean", + "required": false, + "source": "body", + "description": "是否强制刷新状态,true 时跳过缓存等待窗口" + }, + { + "name": "waitForChange", + "type": "boolean", + "required": false, + "source": "body", + "description": "是否显式开启长轮询等待(推荐字段);true 时进入最长60秒等待" + }, + { + "name": "longPoll", + "type": "boolean", + "required": false, + "source": "body", + "description": "长轮询开关(兼容字段);true 时进入最长60秒等待" + }, + { + "name": "waitTimeoutMs", + "type": "number", + "required": false, + "source": "body", + "description": "等待超时毫秒数;后端自动封顶60000" + }, + { + "name": "init", + "type": "boolean", + "required": false, + "source": "body", + "description": "初始化请求标记;true 时强制立即返回,不进入长等待" + } + ], + "response": [], + "errors": [] + }, + { + "method": "user.unbindWechat", + "description": "解绑微信账号(清理 ye4s 关联账号数据)", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "user.logout", + "description": "用户登出", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "user.info", + "description": "获取当前用户信息", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "user.changeRole", + "description": "user.changeRole 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "user.register", + "description": "user.register 接口", + "isNeedAuth": false, + "isNeedLogin": false, + "headers": [], + "params": [], + "response": [], + "errors": [] + } + ] + }, + { + "groupName": "仓库模块", + "module": "warehouse", + "list": [ + { + "method": "warehouse.getWarehouseZones", + "description": "warehouse.getWarehouseZones 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getWarehouseTree", + "description": "warehouse.getWarehouseTree 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "warehouseId", + "type": "number", + "required": true, + "source": "body", + "description": "warehouseId 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getChildren", + "description": "warehouse.getChildren 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "zoneId", + "type": "number", + "required": true, + "source": "body", + "description": "zoneId 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.create", + "description": "warehouse.create 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [], + "response": [], + "errors": [] + }, + { + "method": "warehouse.update", + "description": "warehouse.update 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + }, + { + "name": "aisles", + "type": "string", + "required": false, + "source": "body", + "description": "aisles 参数" + }, + { + "name": "cell_height", + "type": "string", + "required": false, + "source": "body", + "description": "cell_height 参数" + }, + { + "name": "cell_length", + "type": "string", + "required": false, + "source": "body", + "description": "cell_length 参数" + }, + { + "name": "cell_width", + "type": "string", + "required": false, + "source": "body", + "description": "cell_width 参数" + }, + { + "name": "direction", + "type": "string", + "required": false, + "source": "body", + "description": "direction 参数" + }, + { + "name": "height", + "type": "number", + "required": false, + "source": "body", + "description": "height 参数" + }, + { + "name": "length", + "type": "number", + "required": false, + "source": "body", + "description": "length 参数" + }, + { + "name": "rack_columns", + "type": "string", + "required": false, + "source": "body", + "description": "rack_columns 参数" + }, + { + "name": "rack_levels", + "type": "string", + "required": false, + "source": "body", + "description": "rack_levels 参数" + }, + { + "name": "rack_rows", + "type": "string", + "required": false, + "source": "body", + "description": "rack_rows 参数" + }, + { + "name": "width", + "type": "number", + "required": false, + "source": "body", + "description": "width 参数" + }, + { + "name": "x", + "type": "number", + "required": false, + "source": "body", + "description": "x 参数" + }, + { + "name": "y", + "type": "number", + "required": false, + "source": "body", + "description": "y 参数" + }, + { + "name": "z", + "type": "number", + "required": false, + "source": "body", + "description": "z 参数" + }, + { + "name": "zone_code", + "type": "string", + "required": false, + "source": "body", + "description": "zone_code 参数" + }, + { + "name": "zone_name", + "type": "string", + "required": false, + "source": "body", + "description": "zone_name 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.delete", + "description": "warehouse.delete 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.detail", + "description": "warehouse.detail 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.checkBarcodeUnique", + "description": "warehouse.checkBarcodeUnique 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "barcode", + "type": "string", + "required": true, + "source": "body", + "description": "barcode 参数" + }, + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.toggleActive", + "description": "warehouse.toggleActive 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + }, + { + "name": "isActive", + "type": "string", + "required": false, + "source": "body", + "description": "isActive 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getPath", + "description": "warehouse.getPath 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.createRack", + "description": "warehouse.createRack 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "height", + "type": "number", + "required": true, + "source": "body", + "description": "height 参数" + }, + { + "name": "length", + "type": "number", + "required": true, + "source": "body", + "description": "length 参数" + }, + { + "name": "rack_columns", + "type": "number", + "required": true, + "source": "body", + "description": "rack_columns 参数" + }, + { + "name": "rack_levels", + "type": "number", + "required": true, + "source": "body", + "description": "rack_levels 参数" + }, + { + "name": "rack_rows", + "type": "number", + "required": true, + "source": "body", + "description": "rack_rows 参数" + }, + { + "name": "warehouse_id", + "type": "number", + "required": true, + "source": "body", + "description": "warehouse_id 参数" + }, + { + "name": "width", + "type": "number", + "required": true, + "source": "body", + "description": "width 参数" + }, + { + "name": "x", + "type": "number", + "required": true, + "source": "body", + "description": "x 参数" + }, + { + "name": "y", + "type": "number", + "required": true, + "source": "body", + "description": "y 参数" + }, + { + "name": "zone_code", + "type": "string", + "required": true, + "source": "body", + "description": "zone_code 参数" + }, + { + "name": "zone_name", + "type": "string", + "required": true, + "source": "body", + "description": "zone_name 参数" + }, + { + "name": "color", + "type": "string", + "required": false, + "source": "body", + "description": "color 参数" + }, + { + "name": "direction", + "type": "string", + "required": false, + "source": "body", + "description": "direction 参数" + }, + { + "name": "parent_id", + "type": "number", + "required": false, + "source": "body", + "description": "parent_id 参数" + }, + { + "name": "z", + "type": "number", + "required": false, + "source": "body", + "description": "z 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getPickPath", + "description": "warehouse.getPickPath 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "warehouse_id", + "type": "number", + "required": true, + "source": "query", + "description": "warehouse_id 参数" + }, + { + "name": "include_spaces", + "type": "string", + "required": false, + "source": "query", + "description": "include_spaces 参数" + }, + { + "name": "limit", + "type": "number", + "required": false, + "source": "query", + "description": "limit 参数" + }, + { + "name": "sort_by", + "type": "string", + "required": false, + "source": "query", + "description": "sort_by 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.updateRackPosition", + "description": "warehouse.updateRackPosition 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "x", + "type": "number", + "required": true, + "source": "body", + "description": "x 参数" + }, + { + "name": "y", + "type": "number", + "required": true, + "source": "body", + "description": "y 参数" + }, + { + "name": "rack_id", + "type": "number", + "required": false, + "source": "path", + "description": "rack_id 参数" + }, + { + "name": "z", + "type": "number", + "required": false, + "source": "body", + "description": "z 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.recalculatePickPath", + "description": "warehouse.recalculatePickPath 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "warehouse_id", + "type": "number", + "required": true, + "source": "body", + "description": "warehouse_id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.updateNeighbors", + "description": "warehouse.updateNeighbors 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "warehouse_id", + "type": "number", + "required": true, + "source": "body", + "description": "warehouse_id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getAreaRacks", + "description": "warehouse.getAreaRacks 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "area_id", + "type": "number", + "required": true, + "source": "query", + "description": "area_id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getSpacesByRack", + "description": "warehouse.getSpacesByRack 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.createRackWithSpaces", + "description": "warehouse.createRackWithSpaces 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.getSpaceInfo", + "description": "warehouse.getSpaceInfo 接口", + "isNeedAuth": false, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": false, + "source": "body", + "description": "id 参数" + } + ], + "response": [], + "errors": [] + }, + { + "method": "warehouse.updateSpaceInfo", + "description": "warehouse.updateSpaceInfo 接口", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "id 参数" + }, + { + "name": "custom_barcode", + "type": "string", + "required": false, + "source": "body", + "description": "custom_barcode 参数" + }, + { + "name": "custom_name", + "type": "string", + "required": false, + "source": "body", + "description": "custom_name 参数" + }, + { + "name": "location_type_id", + "type": "number", + "required": false, + "source": "body", + "description": "location_type_id 参数" + }, + { + "name": "pick_sequence", + "type": "string", + "required": false, + "source": "body", + "description": "pick_sequence 参数" + }, + { + "name": "space_status", + "type": "string", + "required": false, + "source": "body", + "description": "space_status 参数" + } + ], + "response": [], + "errors": [] + } + ] + } + ] } - ], - "methods": { - "groups": [ - { - "groupName": "配置模块", - "module": "config", - "list": [ - { - "method": "config.list", - "description": "config.list 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - } - ] - }, - { - "groupName": "看板模块", - "module": "dashboard", - "list": [ - { - "method": "dashboard.storeStats", - "description": "dashboard.storeStats 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "dashboard.warehouseStats", - "description": "dashboard.warehouseStats 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "dashboard.hot_order_rank", - "description": "dashboard.hot_order_rank 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "dashboard.express_ratio", - "description": "dashboard.express_ratio 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "dashboard.platform_distribution", - "description": "dashboard.platform_distribution 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "dashboard.order_trend", - "description": "dashboard.order_trend 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - } - ] - }, - { - "groupName": "基础模块", - "module": "index", - "list": [ - { - "method": "index.fastWhereTree", - "description": "index.fastWhereTree 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "type", - "type": "string", - "required": false, - "source": "body", - "description": "type 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "index.loadStores", - "description": "index.loadStores 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "index.getCOSUploadConfig", - "description": "index.getCOSUploadConfig 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "data", - "type": "object", - "required": false, - "source": "body", - "description": "data 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "index.getImages", - "description": "index.getImages 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "index.uploadSuccessNotify", - "description": "index.uploadSuccessNotify 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "index.ReferenceFile", - "description": "index.ReferenceFile 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "index.getMessageDetail", - "description": "index.getMessageDetail 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "index.getI18nMessage", - "description": "index.getI18nMessage 接口", - "isNeedAuth": false, - "isNeedLogin": false, - "headers": [], - "params": [ - { - "name": "language", - "type": "string", - "required": false, - "source": "body|query", - "description": "language 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "index.putI18nCollect", - "description": "index.putI18nCollect 接口", - "isNeedAuth": false, - "isNeedLogin": false, - "headers": [], - "params": [ - { - "name": "keys", - "type": "array", - "required": false, - "source": "body", - "description": "keys 参数" - }, - { - "name": "locale", - "type": "string", - "required": false, - "source": "body", - "description": "locale 参数" - }, - { - "name": "project", - "type": "string", - "required": false, - "source": "body", - "description": "project 参数" - }, - { - "name": "source", - "type": "string", - "required": false, - "source": "body", - "description": "source 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "index.tryAutoTranslateNewKeys", - "description": "index.tryAutoTranslateNewKeys 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "index.searchSpace", - "description": "index.searchSpace 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "index.getExpressList", - "description": "index.getExpressList 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - } - ] - }, - { - "groupName": "订单模块", - "module": "order", - "list": [ - { - "method": "order.getOrderModels", - "description": "order.getOrderModels 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "order.list", - "description": "分页查询订单列表", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "order.detail", - "description": "查询订单详情", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "order.listItems", - "description": "查询订单商品明细", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "order.stats", - "description": "订单统计", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "order.getreviewOrderlist", - "description": "分页查询订单审核列表", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "order.updateStatus", - "description": "更新订单状态", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "order.updateDeliveryTime", - "description": "更新发货时间", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "order.reviewOrder", - "description": "订单审核", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "order.reviewOrder.getreviewOrderlist", - "description": "分页查询订单审核列表(目录化路由)", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "pagination", - "type": "object", - "required": false, - "source": "body", - "description": "pagination 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "order.reviewOrder.reviewOrder", - "description": "订单审核(目录化路由)", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "inspection_status", - "type": "string", - "required": false, - "source": "body", - "description": "inspection_status 参数" - }, - { - "name": "operate_time", - "type": "string", - "required": false, - "source": "body", - "description": "operate_time 参数" - }, - { - "name": "operator_name", - "type": "string", - "required": false, - "source": "body", - "description": "operator_name 参数" - }, - { - "name": "review_status", - "type": "string", - "required": false, - "source": "body", - "description": "review_status 参数" - }, - { - "name": "reviewStatus", - "type": "string", - "required": false, - "source": "body", - "description": "reviewStatus 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "order.deliveryOrder.getdeliveryOrderlist", - "description": "分页查询已进入出库流程的订单列表", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "pagination", - "type": "object", - "required": false, - "source": "body", - "description": "pagination 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "order.pendingOrder.getpendingOrderlist", - "description": "分页查询待处理订单列表", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "pagination", - "type": "object", - "required": false, - "source": "body", - "description": "pagination 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "order.expectionOrder.getexpectionOrderlist", - "description": "分页查询异常订单列表", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "pagination", - "type": "object", - "required": false, - "source": "body", - "description": "pagination 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "order.archiveOrder.getarchiveOrderlist", - "description": "分页查询归档订单列表(暂使用当前订单表完成态数据)", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "pagination", - "type": "object", - "required": false, - "source": "body", - "description": "pagination 参数" - } - ], - "response": [], - "errors": [] - } - ] - }, - { - "groupName": "打印模块", - "module": "print", - "list": [ - { - "method": "print.send", - "description": "print.send 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "computerId", - "type": "string", - "required": false, - "source": "body", - "description": "computerId 参数" - }, - { - "name": "count", - "type": "number", - "required": false, - "source": "body", - "description": "count 参数" - }, - { - "name": "data", - "type": "object", - "required": false, - "source": "body", - "description": "data 参数" - }, - { - "name": "printer", - "type": "string", - "required": false, - "source": "body", - "description": "printer 参数" - }, - { - "name": "template", - "type": "object", - "required": false, - "source": "body", - "description": "template 参数" - }, - { - "name": "timestamp", - "type": "string", - "required": false, - "source": "body", - "description": "timestamp 参数" - }, - { - "name": "type", - "type": "string", - "required": false, - "source": "body", - "description": "type 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "print.getPrintResult", - "description": "print.getPrintResult 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "printId", - "type": "string", - "required": true, - "source": "body", - "description": "printId 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "print.getPrintRecordItem", - "description": "print.getPrintRecordItem 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "print.getList", - "description": "print.getList 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "print.getItem", - "description": "print.getItem 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "print.add", - "description": "print.add 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "computer_id", - "type": "number", - "required": true, - "source": "body", - "description": "computer_id 参数" - }, - { - "name": "name", - "type": "string", - "required": true, - "source": "body", - "description": "name 参数" - }, - { - "name": "custom_barcode", - "type": "string", - "required": false, - "source": "body", - "description": "custom_barcode 参数" - }, - { - "name": "default_printer_name", - "type": "string", - "required": false, - "source": "body", - "description": "default_printer_name 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "print.hasName", - "description": "print.hasName 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "name", - "type": "string", - "required": true, - "source": "body", - "description": "name 参数" - }, - { - "name": "id", - "type": "number", - "required": false, - "source": "body", - "description": "id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "print.updateItem", - "description": "print.updateItem 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - }, - { - "name": "computer_id", - "type": "number", - "required": false, - "source": "body", - "description": "computer_id 参数" - }, - { - "name": "custom_barcode", - "type": "string", - "required": false, - "source": "body", - "description": "custom_barcode 参数" - }, - { - "name": "name", - "type": "string", - "required": false, - "source": "body", - "description": "name 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "print.del", - "description": "print.del 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "ids", - "type": "array", - "required": false, - "source": "body", - "description": "ids 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "print.getComputer", - "description": "print.getComputer 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "print.getComputerPrinter", - "description": "print.getComputerPrinter 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "print.savePrinters", - "description": "print.savePrinters 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "defaultPrinter", - "type": "string", - "required": true, - "source": "body", - "description": "defaultPrinter 参数" - }, - { - "name": "express", - "type": "array", - "required": false, - "source": "body", - "description": "express 参数" - }, - { - "name": "print_station_id", - "type": "number", - "required": false, - "source": "body", - "description": "print_station_id 参数" - } - ], - "response": [], - "errors": [] - } - ] - }, - { - "groupName": "打印机站点模块", - "module": "printer.station", - "list": [ - { - "method": "printer.station.list", - "description": "获取打印站点列表", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - } - ] - }, - { - "groupName": "打印模板模块", - "module": "setting.printTemplate", - "list": [ - { - "method": "setting.printTemplate.list", - "description": "获取打印模板树", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "setting.printTemplate.save", - "description": "保存打印模板", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "setting.printTemplate.create", - "description": "创建打印模板(platform 固定为 default,template_type 固定为 CUSTOM,template_url 固定为空字符串)", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "business_type", - "type": "string", - "required": true, - "source": "body", - "description": "business_type 参数" - }, - { - "name": "template_name", - "type": "string", - "required": true, - "source": "body", - "description": "template_name 参数" - }, - { - "name": "page_height", - "type": "string", - "required": false, - "source": "body", - "description": "page_height 参数" - }, - { - "name": "page_width", - "type": "string", - "required": false, - "source": "body", - "description": "page_width 参数" - } - ], - "response": [ - { - "name": "id", - "type": "number", - "required": true, - "description": "新建模板ID" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误(缺少 template_name、business_type、page_width 或 page_height)" - }, - { - "code": "409", - "description": "同一业务类型和平台下已存在自定义模板" - } - ] - }, - { - "method": "setting.printTemplate.delete", - "description": "删除打印模板(软删除)", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": false, - "source": "body", - "description": "id 参数" - } - ], - "response": [ - { - "name": "id", - "type": "number", - "required": true, - "description": "删除的模板ID" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误(缺少 id)" - }, - { - "code": "404", - "description": "模板不存在或无权限" - } - ] - }, - { - "method": "setting.printTemplate.listTemplatesByType", - "description": "按业务类型查询模板", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "businessType", - "type": "string", - "required": true, - "source": "body", - "description": "businessType 参数" - } - ], - "response": [], - "errors": [] - } - ] - }, - { - "groupName": "账号管理模块", - "module": "setting.account", - "list": [ - { - "method": "setting.account.list", - "description": "查询当前主体下且在当前账号角色组可操作范围内的工号列表", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "data[]", - "type": "object", - "required": true, - "description": "工号列表项" - }, - { - "name": "data[].employee_id", - "type": "number", - "required": true, - "description": "工号ID" - }, - { - "name": "data[].account_id", - "type": "number", - "required": true, - "description": "账号ID" - }, - { - "name": "data[].store_id", - "type": "number", - "required": true, - "description": "主体ID" - }, - { - "name": "data[].real_name", - "type": "string", - "required": true, - "description": "工号姓名" - }, - { - "name": "data[].status", - "type": "number", - "required": true, - "description": "工号状态:1=启用,0=停用" - }, - { - "name": "data[].username", - "type": "string", - "required": true, - "description": "账号用户名" - }, - { - "name": "data[].phone", - "type": "string", - "required": true, - "description": "账号手机号" - }, - { - "name": "data[].email", - "type": "string", - "required": true, - "description": "账号邮箱" - }, - { - "name": "data[].avatar_file_id", - "type": "number", - "required": false, - "description": "头像文件ID,为空表示未设置" - }, - { - "name": "data[].avatar_url", - "type": "string", - "required": true, - "description": "头像访问地址" - }, - { - "name": "data[].is_wechat_bound", - "type": "boolean", - "required": true, - "description": "账号是否已绑定微信" - }, - { - "name": "data[].ye4s_user_id", - "type": "number", - "required": false, - "description": "已绑定时对应的 ye4s 用户ID,未绑定为空" - }, - { - "name": "data[].role_ids", - "type": "number[]", - "required": true, - "description": "工号绑定的角色ID数组" - }, - { - "name": "data[].roles[]", - "type": "object", - "required": true, - "description": "工号绑定的角色组详情" - }, - { - "name": "data[].roles[].role_id", - "type": "number", - "required": true, - "description": "角色ID" - }, - { - "name": "data[].roles[].role_code", - "type": "string", - "required": true, - "description": "角色编码" - }, - { - "name": "data[].roles[].role_name", - "type": "string", - "required": true, - "description": "角色名称" - }, - { - "name": "data[].roles[].pid", - "type": "number", - "required": true, - "description": "父级角色ID" - }, - { - "name": "data[].roles[].status", - "type": "number", - "required": true, - "description": "角色状态:1=启用,0=停用" - } - ], - "errors": [ - { - "code": "400", - "description": "当前登录态缺少主体上下文(store_id)或 where 参数解析失败" - }, - { - "code": "500", - "description": "查询失败" - } - ] - }, - { - "method": "setting.account.add", - "description": "新增工号,按手机号复用或创建账号后绑定到当前主体,并校验角色组 ids 不超出当前角色范围", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "employee_id", - "type": "number", - "required": true, - "description": "新增或复用后的工号ID" - }, - { - "name": "account_id", - "type": "number", - "required": true, - "description": "绑定账号ID" - }, - { - "name": "role_id", - "type": "number", - "required": true, - "description": "绑定后的角色ID" - }, - { - "name": "role_ids", - "type": "number[]", - "required": true, - "description": "绑定后的角色组ID数组" - }, - { - "name": "is_new_account", - "type": "boolean", - "required": true, - "description": "是否为本次新建账号" - }, - { - "name": "phone", - "type": "string", - "required": true, - "description": "绑定账号手机号" - }, - { - "name": "username", - "type": "string", - "required": true, - "description": "绑定账号用户名" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误、手机号格式错误、直接使用保留名称、或 ids 超出当前角色范围" - }, - { - "code": "409", - "description": "手机号对应账号已禁用、手机号已绑定当前主体工号、或用户名重复" - }, - { - "code": "500", - "description": "新增失败" - } - ] - }, - { - "method": "setting.account.delete", - "description": "删除工号绑定关系,仅停用工号,不删除账号", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "employee_id", - "type": "number", - "required": true, - "description": "被停用的工号ID" - }, - { - "name": "account_id", - "type": "number", - "required": true, - "description": "关联账号ID" - }, - { - "name": "status", - "type": "string", - "required": true, - "description": "固定返回 deleted" - }, - { - "name": "already_deleted", - "type": "boolean", - "required": false, - "description": "可选,true 表示该工号原本已停用" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误或尝试删除当前登录工号" - }, - { - "code": "404", - "description": "工号不存在或无权限删除" - }, - { - "code": "500", - "description": "删除失败" - } - ] - }, - { - "method": "setting.account.update", - "description": "更新工号姓名、头像引用和角色组 ids(含当前角色范围校验)", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "employee_id", - "type": "number", - "required": true, - "description": "更新后的工号ID" - }, - { - "name": "real_name", - "type": "string", - "required": true, - "description": "更新后的工号姓名" - }, - { - "name": "avatar_file_id", - "type": "number", - "required": false, - "description": "更新后的头像文件ID" - }, - { - "name": "avatar_url", - "type": "string", - "required": true, - "description": "更新后的头像地址" - }, - { - "name": "role_ids", - "type": "number[]", - "required": true, - "description": "更新后的角色组ID数组" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误、未传 ids、或 ids 超出当前角色范围" - }, - { - "code": "404", - "description": "工号或头像文件不存在" - }, - { - "code": "500", - "description": "更新失败" - } - ] - }, - { - "method": "setting.account.getBindWechatCode", - "description": "为当前账号可操作范围内的其他账号获取微信绑定状态与绑定码,复用个人绑定微信逻辑", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "account_id", - "type": "number", - "required": true, - "description": "目标账号ID" - }, - { - "name": "code", - "type": "string", - "required": true, - "description": "绑定码(已绑定时为空字符串)" - }, - { - "name": "status", - "type": "string", - "required": true, - "description": "绑定状态:pending/scanned/bound" - }, - { - "name": "is_bound", - "type": "boolean", - "required": true, - "description": "是否已绑定微信" - }, - { - "name": "updated_at", - "type": "string", - "required": true, - "description": "状态更新时间(ISO 时间)" - }, - { - "name": "expires_at", - "type": "number", - "required": false, - "description": "过期时间戳(毫秒),bound 状态可为空" - }, - { - "name": "expire_after_ms", - "type": "number", - "required": true, - "description": "距离过期剩余毫秒数" - }, - { - "name": "scanned_at", - "type": "string", - "required": false, - "description": "扫码时间(未扫码可为空)" - }, - { - "name": "source", - "type": "string", - "required": true, - "description": "数据来源,如 cache/generated/refreshed/db" - }, - { - "name": "ye4s_user_id", - "type": "number", - "required": false, - "description": "已绑定的 ye4s 用户ID(未绑定可为空)" - } - ], - "errors": [ - { - "code": "400", - "description": "缺少 user_id 或当前账号角色范围为空" - }, - { - "code": "403", - "description": "目标账号超出当前操作范围" - }, - { - "code": "404", - "description": "目标账号不存在或不在当前主体下" - }, - { - "code": "500", - "description": "获取绑定码失败" - } - ] - }, - { - "method": "setting.account.unbindWechat", - "description": "为当前账号可操作范围内的其他账号解除微信绑定,复用个人解绑微信逻辑", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "account_id", - "type": "number", - "required": true, - "description": "目标账号ID" - }, - { - "name": "status", - "type": "string", - "required": true, - "description": "固定返回 unbound" - }, - { - "name": "matched_rows", - "type": "number", - "required": true, - "description": "匹配到的 ye4s 绑定记录数" - }, - { - "name": "affected_rows", - "type": "number", - "required": true, - "description": "实际更新的 ye4s 记录数" - }, - { - "name": "updated_at", - "type": "string", - "required": true, - "description": "解绑时间(ISO 时间)" - } - ], - "errors": [ - { - "code": "400", - "description": "缺少 user_id 或当前账号角色范围为空" - }, - { - "code": "403", - "description": "目标账号超出当前操作范围" - }, - { - "code": "404", - "description": "目标账号不存在或不在当前主体下" - }, - { - "code": "500", - "description": "解绑失败" - } - ] - } - ] - }, - { - "groupName": "角色管理模块", - "module": "setting.role", - "list": [ - { - "method": "setting.role.list", - "description": "查询当前登录工号的下级角色列表,不返回自己及同级角色,并携带各角色的 permission_ids 权限集;返回 [\"*\"] 表示拥有全部权限", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "employee_id", - "type": "number", - "required": false, - "description": "当前登录工号ID,未识别到登录工号时为 null" - }, - { - "name": "roles[]", - "type": "object", - "required": true, - "description": "下级角色树列表(第一层为当前登录工号角色的直接下级)" - }, - { - "name": "roles[].role_id", - "type": "number", - "required": true, - "description": "角色ID" - }, - { - "name": "roles[].role_name", - "type": "string", - "required": true, - "description": "角色名称" - }, - { - "name": "roles[].selected", - "type": "boolean", - "required": true, - "description": "表示当前登录工号是否已绑定该角色" - }, - { - "name": "roles[].permission_ids", - "type": "number[]|string[]", - "required": true, - "description": "该角色已绑定的权限ID集合;返回 [\"*\"] 表示拥有全部权限,嵌套 children 节点结构相同" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误" - }, - { - "code": "404", - "description": "工号不存在或无权限" - }, - { - "code": "500", - "description": "查询失败" - } - ] - }, - { - "method": "setting.role.permission", - "description": "查询全量角色权限列表(不按当前登录工号权限集筛选),兼容旧入口,用于总管理员管理权限", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "role_id", - "type": "number", - "required": false, - "description": "查询目标角色ID,未传 role_id 时返回当前登录工号的当前角色ID" - }, - { - "name": "permissions[]", - "type": "object[]", - "required": true, - "description": "全量权限列表(不按当前登录工号权限集裁剪)" - }, - { - "name": "permissions[].permission_id", - "type": "number", - "required": true, - "description": "权限ID" - }, - { - "name": "permissions[].selected", - "type": "boolean", - "required": true, - "description": "当传入或解析出 role_id 时,表示该角色是否已绑定该权限" - } - ], - "errors": [ - { - "code": "400", - "description": "role_id/type 参数错误或当前主体无可用权限" - }, - { - "code": "404", - "description": "角色不存在或无权限操作" - }, - { - "code": "500", - "description": "查询失败" - } - ] - }, - { - "method": "setting.role.add", - "description": "新增角色并一次性提交权限集(permission_ids);传 [\"*\"] 表示所有权限", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "role_id", - "type": "number", - "required": true, - "description": "新建角色ID" - }, - { - "name": "role_code", - "type": "string", - "required": true, - "description": "角色编码" - }, - { - "name": "role_name", - "type": "string", - "required": true, - "description": "角色名称" - }, - { - "name": "permission_ids", - "type": "number[]|string[]", - "required": true, - "description": "提交后的权限ID集合;返回 [\"*\"] 表示所有权限" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误、permission_ids 非法,或目标权限不存在/已禁用" - }, - { - "code": "409", - "description": "role_code 冲突" - }, - { - "code": "500", - "description": "新增失败" - } - ] - }, - { - "method": "setting.role.delete", - "description": "批量删除角色(软删除)", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "ids", - "type": "number[]", - "required": true, - "description": "请求的角色ID数组" - }, - { - "name": "deleted_ids", - "type": "number[]", - "required": true, - "description": "本次实际删除(由启用变为停用)的角色ID数组" - }, - { - "name": "already_deleted_ids", - "type": "number[]", - "required": true, - "description": "本就处于删除状态的角色ID数组" - }, - { - "name": "status", - "type": "string", - "required": true, - "description": "固定返回 deleted" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误,ids 必须为正整数数组" - }, - { - "code": "404", - "description": "角色不存在、无权限操作或为系统预设角色(任一ID不满足即失败)" - }, - { - "code": "500", - "description": "删除失败" - } - ] - }, - { - "method": "setting.role.update", - "description": "更新角色信息并一次性重置角色权限(permission_ids);传 [\"*\"] 表示所有权限", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "role_id", - "type": "number", - "required": true, - "description": "角色ID" - }, - { - "name": "permission_ids", - "type": "number[]|string[]", - "required": true, - "description": "更新后的权限ID集合;返回 [\"*\"] 表示所有权限" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误、permission_ids 非法,或目标权限不存在/已禁用" - }, - { - "code": "404", - "description": "角色不存在、无权限操作或为系统预设角色" - }, - { - "code": "409", - "description": "角色信息冲突" - }, - { - "code": "500", - "description": "更新失败" - } - ] - } - ] - }, - { - "groupName": "权限管理模块", - "module": "setting.permission", - "list": [ - { - "method": "setting.permission.list", - "description": "查询全量权限集合(不按当前登录工号权限集筛选),可选按角色返回已绑定权限选中状态,用于总管理员管理权限", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "role_id", - "type": "number", - "required": false, - "description": "查询目标角色ID,未传 role_id 时返回当前登录工号的当前角色ID" - }, - { - "name": "permissions[]", - "type": "object", - "required": true, - "description": "全量权限列表(不按当前登录工号权限集裁剪)" - }, - { - "name": "permissions[].permission_id", - "type": "number", - "required": true, - "description": "权限ID" - }, - { - "name": "permissions[].path", - "type": "string", - "required": true, - "description": "权限路径" - }, - { - "name": "permissions[].name", - "type": "string", - "required": true, - "description": "权限名称" - }, - { - "name": "permissions[].type", - "type": "string", - "required": true, - "description": "权限类型" - }, - { - "name": "permissions[].component", - "type": "string", - "required": false, - "description": "前端路由组件路径" - }, - { - "name": "permissions[].redirect", - "type": "string", - "required": false, - "description": "前端路由重定向路径" - }, - { - "name": "permissions[].meta_title", - "type": "string", - "required": false, - "description": "菜单/页面标题" - }, - { - "name": "permissions[].meta_icon", - "type": "string", - "required": false, - "description": "菜单图标" - }, - { - "name": "permissions[].hidden", - "type": "number", - "required": true, - "description": "是否隐藏菜单:1=隐藏,0=显示" - }, - { - "name": "permissions[].always_show", - "type": "number", - "required": true, - "description": "是否总是显示父级菜单:1=是,0=否" - }, - { - "name": "permissions[].selected", - "type": "boolean", - "required": true, - "description": "当传入 role_id 时,表示该权限是否已绑定" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误" - }, - { - "code": "404", - "description": "角色不存在或无权限" - }, - { - "code": "500", - "description": "查询失败" - } - ] - }, - { - "method": "setting.permission.add", - "description": "新增权限;仅校验请求参数与父级权限是否存在,不再校验当前账号是否覆盖该权限", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "permission_id", - "type": "number", - "required": true, - "description": "权限ID" - }, - { - "name": "path", - "type": "string", - "required": true, - "description": "权限路径" - }, - { - "name": "type", - "type": "string", - "required": true, - "description": "权限类型" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误或 parent_id 不存在/不可用" - }, - { - "code": "404", - "description": "父级权限不存在" - }, - { - "code": "500", - "description": "新增失败" - } - ] - }, - { - "method": "setting.permission.delete", - "description": "批量删除权限(软删除);仅校验请求中的权限ID是否合法且存在", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "ids", - "type": "number[]", - "required": true, - "description": "请求的权限ID数组" - }, - { - "name": "deleted_ids", - "type": "number[]", - "required": true, - "description": "本次实际删除(由启用变为停用)的权限ID数组" - }, - { - "name": "already_deleted_ids", - "type": "number[]", - "required": true, - "description": "本就处于删除状态的权限ID数组" - }, - { - "name": "status", - "type": "string", - "required": true, - "description": "固定返回 deleted" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误,ids 非法或包含不存在的权限ID" - }, - { - "code": "404", - "description": "权限不存在" - }, - { - "code": "500", - "description": "删除失败" - } - ] - }, - { - "method": "setting.permission.update", - "description": "更新权限;仅校验请求参数、目标权限及父级权限是否存在,不再校验当前账号是否覆盖该权限", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "permission_id", - "type": "number", - "required": true, - "description": "权限ID" - }, - { - "name": "path", - "type": "string", - "required": true, - "description": "更新后的权限路径" - }, - { - "name": "type", - "type": "string", - "required": true, - "description": "更新后的权限类型" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误、未提供更新项,或目标/父级权限不存在或不可用" - }, - { - "code": "404", - "description": "权限不存在" - }, - { - "code": "500", - "description": "更新失败" - } - ] - } - ] - }, - { - "groupName": "货主管理模块", - "module": "storeWarehouse", - "list": [ - { - "method": "storeWarehouse.store.list", - "description": "查询当前主体下的仓库-货主签约列表;当前主体是仓库时默认查看本仓下货主,当前主体是货主时默认查看本货主下签约仓库,`remask` 表示当前主体给对方设置的通用名/备注", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "list", - "type": "array", - "required": true, - "description": "签约关系数据列表" - }, - { - "name": "total", - "type": "number", - "required": true, - "description": "总条数" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误" - }, - { - "code": "500", - "description": "查询失败" - } - ] - }, - { - "method": "storeWarehouse.store.sign", - "description": "签约接口,支持双阶段流程:1)不传 `temp_code` 时由当前主体发起签约并生成临时码;2)对方主体携带 `temp_code` 预览或确认后,立即写入签约表并生效", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "mode", - "type": "string", - "required": true, - "description": "initiate / preview / confirm" - }, - { - "name": "temp_code", - "type": "string", - "required": false, - "description": "临时码" - }, - { - "name": "contract", - "type": "object", - "required": false, - "description": "确认签约后返回签约关系" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误或确认方不合法" - }, - { - "code": "403", - "description": "当前主体无权使用临时码" - }, - { - "code": "404", - "description": "签约对象不存在或临时码失效" - }, - { - "code": "500", - "description": "签约失败" - } - ] - }, - { - "method": "storeWarehouse.store.unbind", - "description": "解除/恢复仓库-货主签约可用状态;双方均可执行,本接口只变更 `use_status`", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "contract", - "type": "object", - "required": true, - "description": "更新后的关系对象" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误" - }, - { - "code": "404", - "description": "签约关系不存在或无权限操作" - }, - { - "code": "500", - "description": "更新失败" - } - ] - }, - { - "method": "storeWarehouse.store.rename", - "description": "修改当前主体给对方设置的签约显示名称/备注;当前主体为仓库时会更新 `store_remask`,当前主体为货主时会更新 `warehouse_remask`", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "contract", - "type": "object", - "required": true, - "description": "更新后的签约关系" - } - ], - "errors": [ - { - "code": "400", - "description": "参数错误或未提供 `remask`" - }, - { - "code": "404", - "description": "签约关系不存在或无权限操作" - }, - { - "code": "500", - "description": "修改签约名称失败" - } - ] - } - ] - }, - { - "groupName": "商品模块", - "module": "stock", - "list": [ - { - "method": "stock.warehouse.list", - "description": "仓库商品列表查询(支持 where 条件与分页)", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "pagination", - "type": "object", - "required": false, - "source": "body", - "description": "pagination 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.getProhibitedType", - "description": "查询违禁品类型列表(系统预设+仓库自定义)", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.getInfo", - "description": "查询仓库商品详情", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.saveWarehouseStock", - "description": "更新仓库商品资料", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.createWarehouseStock", - "description": "新建仓库商品资料", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.getBarcodes", - "description": "查询商品条码列表", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.saveWarehouseStockBarcode", - "description": "保存商品条码信息", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.getStoreStocks", - "description": "查询仓库商品与货主关联列表", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.bindItem", - "description": "绑定货主商品关系", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.unbindItem", - "description": "解绑货主商品关系", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.checkItemCodeUnique", - "description": "校验商品编码在货主维度唯一性", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "item_code", - "type": "string", - "required": true, - "source": "body", - "description": "item_code 参数" - }, - { - "name": "store_id", - "type": "number", - "required": true, - "source": "body", - "description": "store_id 参数" - }, - { - "name": "id", - "type": "number", - "required": false, - "source": "body", - "description": "id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.queryStockLogs", - "description": "查询库存操作日志", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "warehouseId", - "type": "string", - "required": false, - "source": "body", - "description": "warehouseId 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.handleBatchDelete", - "description": "批量删除仓库商品资料", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.deleteUnit", - "description": "删除库存单位", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.deleteProhibited", - "description": "删除违禁品类型", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.handleBatchChange", - "description": "批量修改仓库商品字段", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.getStockUnits", - "description": "查询可用库存单位(系统+仓库)", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.getUnitList", - "description": "查询当前仓库自定义单位列表", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.createProhibited", - "description": "新增违禁品类型", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "name", - "type": "string", - "required": true, - "source": "body", - "description": "name 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.createUnit", - "description": "新增库存单位", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "name", - "type": "string", - "required": true, - "source": "body", - "description": "name 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "stock.warehouse.search", - "description": "仓库商品关键字搜索", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - } - ] - }, - { - "groupName": "库存模块", - "module": "storage", - "list": [ - { - "method": "storage.receiving.getReceivingList", - "description": "storage.receiving.getReceivingList 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "pagination", - "type": "object", - "required": false, - "source": "body", - "description": "pagination 参数" - }, - { - "name": "sort", - "type": "string", - "required": false, - "source": "body", - "description": "sort 参数" - } - ], - "response": [ - { - "name": "list", - "type": "array", - "required": true, - "description": "收货单列表" - }, - { - "name": "pagination", - "type": "object", - "required": true, - "description": "分页信息(page、pageSize、total、totalPages、hasPrevious、hasNext)" - }, - { - "name": "summary", - "type": "object", - "required": true, - "description": "汇总信息(total_quantity、total_locked、total_available、total_items)" - } - ], - "errors": [ - { - "code": "500", - "description": "查询失败" - } - ] - }, - { - "method": "storage.receiving.getReceivingDetail", - "description": "storage.receiving.getReceivingDetail 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "receiving", - "type": "object", - "required": true, - "description": "收货单详情(含 details、images、pagination)" - } - ], - "errors": [ - { - "code": "0", - "description": "无记录或无权访问" - }, - { - "code": "500", - "description": "服务器错误" - } - ] - }, - { - "method": "storage.receiving.batchCancelReceiving", - "description": "storage.receiving.batchCancelReceiving 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "message", - "type": "string", - "required": true, - "description": "批量作废处理结果" - } - ], - "errors": [ - { - "code": "0", - "description": "部分单据不存在、无权访问或状态不允许作废" - }, - { - "code": "500", - "description": "服务器错误" - } - ] - }, - { - "method": "storage.receiving.create", - "description": "storage.receiving.create 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "id", - "type": "number", - "required": true, - "description": "新建收货单ID" - }, - { - "name": "receiving_number", - "type": "string", - "required": true, - "description": "收货单号" - } - ], - "errors": [ - { - "code": "0", - "description": "创建失败(如字段枚举不合法、数据库约束异常)" - } - ] - }, - { - "method": "storage.receiving.addItem", - "description": "storage.receiving.addItem 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": false, - "source": "body", - "description": "id 参数" - }, - { - "name": "item", - "type": "object", - "required": false, - "source": "body", - "description": "item 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "storage.receiving.removeItem", - "description": "storage.receiving.removeItem 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": false, - "source": "body", - "description": "id 参数" - }, - { - "name": "item_id", - "type": "number", - "required": false, - "source": "body", - "description": "item_id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "storage.receiving.saveReceiving", - "description": "storage.receiving.saveReceiving 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "storage.receiving.get", - "description": "storage.receiving.get 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "storage.receiving.addDetail", - "description": "storage.receiving.addDetail 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "storage.receiving.bindDetailProduct", - "description": "绑定或改绑收货单明细商品,入参为收货单明细ID和商品ID;会更新明细的 `system_product_id` 与 `product_name`。", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "detail_id", - "type": "number", - "required": true, - "source": "body", - "description": "收货单明细ID" - }, - { - "name": "system_product_id", - "type": "number", - "required": true, - "source": "body", - "description": "商品ID,必须属于当前仓库" - } - ], - "response": [ - { - "name": "detail_id", - "type": "number", - "required": true, - "description": "收货单明细ID" - }, - { - "name": "system_product_id", - "type": "number", - "required": true, - "description": "绑定后的商品ID" - }, - { - "name": "product_name", - "type": "string", - "required": true, - "description": "绑定后回填的商品名称" - } - ], - "errors": [ - { - "code": "400", - "description": "参数缺失或收货单状态不允许绑定/改绑商品" - }, - { - "code": "404", - "description": "收货单明细不存在,或商品不存在/不属于当前仓库" - }, - { - "code": "500", - "description": "绑定商品失败" - } - ] - }, - { - "method": "storage.receiving.deleteDetail", - "description": "storage.receiving.deleteDetail 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "storage.receiving.detailChange", - "description": "storage.receiving.detailChange 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "storage.receiving.cancel", - "description": "storage.receiving.cancel 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "storage.receiving.completeReceiving", - "description": "storage.receiving.completeReceiving 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "storage.entry.list", - "description": "入库单列表查询", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "pagination", - "type": "object", - "required": false, - "source": "body", - "description": "pagination 参数" - }, - { - "name": "sort", - "type": "string", - "required": false, - "source": "body", - "description": "sort 参数" - } - ], - "response": [ - { - "name": "list", - "type": "array", - "required": true, - "description": "入库单列表" - }, - { - "name": "pagination", - "type": "object", - "required": true, - "description": "分页信息(page、pageSize、total、totalPages、hasPrevious、hasNext)" - }, - { - "name": "summary", - "type": "object", - "required": true, - "description": "状态汇总(total、pending、creating、created、completed、cancelled)" - } - ], - "errors": [ - { - "code": "400", - "description": "筛选条件格式错误" - }, - { - "code": "500", - "description": "查询失败" - } - ] - }, - { - "method": "storage.entry.get", - "description": "查询入库单详情", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "entryOrder", - "type": "object", - "required": true, - "description": "入库单详情(含 items 明细)" - } - ], - "errors": [ - { - "code": "400", - "description": "id 与 entry_order_code 均未传" - }, - { - "code": "0", - "description": "无记录或无权访问" - } - ] - }, - { - "method": "storage.entry.create", - "description": "创建入库单", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "id", - "type": "number", - "required": true, - "description": "新建入库单ID" - }, - { - "name": "entry_order_code", - "type": "string", - "required": true, - "description": "入库单号" - } - ], - "errors": [ - { - "code": "400", - "description": "参数缺失或业务类型不合法" - }, - { - "code": "409", - "description": "入库单号已存在" - } - ] - }, - { - "method": "storage.entry.addDetail", - "description": "新增入库明细", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "id", - "type": "number", - "required": true, - "description": "新建明细ID" - }, - { - "name": "order_id", - "type": "number", - "required": true, - "description": "所属入库单ID" - } - ], - "errors": [ - { - "code": "400", - "description": "参数不合法或状态不允许新增明细" - }, - { - "code": "404", - "description": "入库单不存在或无权访问" - } - ] - }, - { - "method": "storage.entry.deleteDetail", - "description": "删除入库明细", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "id", - "type": "number", - "required": true, - "description": "删除成功的明细ID" - } - ], - "errors": [ - { - "code": "400", - "description": "参数不合法或明细已有收货数量" - }, - { - "code": "404", - "description": "明细或入库单不存在" - } - ] - }, - { - "method": "storage.entry.detailChange", - "description": "修改入库明细", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "id", - "type": "number", - "required": true, - "description": "修改成功的明细ID" - } - ], - "errors": [ - { - "code": "400", - "description": "参数不合法或没有可更新字段" - }, - { - "code": "404", - "description": "明细或入库单不存在" - } - ] - }, - { - "method": "storage.entry.cancel", - "description": "作废入库单", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "id", - "type": "number", - "required": true, - "description": "作废成功的入库单ID" - } - ], - "errors": [ - { - "code": "400", - "description": "参数不合法或已完成单据不允许作废" - }, - { - "code": "404", - "description": "入库单不存在或无权访问" - } - ] - }, - { - "method": "storage.entry.completeEntry", - "description": "完成入库单", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "id", - "type": "number", - "required": true, - "description": "完成成功的入库单ID" - } - ], - "errors": [ - { - "code": "400", - "description": "参数不合法、已作废或缺少明细" - }, - { - "code": "404", - "description": "入库单不存在或无权访问" - } - ] - } - ] - }, - { - "groupName": "主体模块", - "module": "store", - "list": [ - { - "method": "store.createStore", - "description": "store.createStore 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "store.createWarehouse", - "description": "store.createWarehouse 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "store.joinStore", - "description": "store.joinStore 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "store.joinWarehouse", - "description": "store.joinWarehouse 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "store.getStoreRoles", - "description": "store.getStoreRoles 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "store.auditApply", - "description": "store.auditApply 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - } - ] - }, - { - "groupName": "用户模块", - "module": "user", - "list": [ - { - "method": "user.login", - "description": "用户登录(仅返回 token)", - "isNeedAuth": false, - "isNeedLogin": false, - "headers": [], - "params": [ - { - "name": "password", - "type": "string", - "required": false, - "source": "body", - "description": "password 参数" - }, - { - "name": "username", - "type": "string", - "required": false, - "source": "body", - "description": "username 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "user.loginByCode", - "description": "登录码登录(使用本系统缓存登录码,不依赖 ye4s_user.tmp_code)", - "isNeedAuth": false, - "isNeedLogin": false, - "headers": [], - "params": [ - { - "name": "code", - "type": "string", - "required": true, - "source": "body", - "description": "code 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "user.getLoginWechatCode", - "description": "获取微信扫码登录码:不传客户端编码时生成新的6位客户端编码与登录码;传客户端编码且缓存命中时进入长轮询,优先监听 Redis 登录事件,收到 ye4s_user_id 后立即签发登录 token;未收到事件则刷新登录码返回", - "isNeedAuth": false, - "isNeedLogin": false, - "headers": [], - "params": [], - "response": [ - { - "name": "client_code", - "type": "string", - "required": true, - "description": "客户端编码(6位字母数字混合)" - }, - { - "name": "code", - "type": "string", - "required": false, - "description": "微信扫码登录码(6位字母数字混合)。当 status=authorized 时可能为空" - }, - { - "name": "status", - "type": "string", - "required": true, - "description": "登录状态:pending(等待扫码)或 authorized(已完成登录)" - }, - { - "name": "updated_at", - "type": "string", - "required": false, - "description": "状态更新时间(ISO 时间)" - }, - { - "name": "expires_at", - "type": "number", - "required": false, - "description": "过期时间戳(毫秒)" - }, - { - "name": "expire_after_ms", - "type": "number", - "required": false, - "description": "距离过期剩余毫秒数" - }, - { - "name": "source", - "type": "string", - "required": true, - "description": "数据来源,如 generated/refreshed/cache/event" - }, - { - "name": "ye4s_user_id", - "type": "number", - "required": false, - "description": "当 status=authorized 时返回的 ye4s 用户ID" - }, - { - "name": "loginToken", - "type": "string", - "required": false, - "description": "当 status=authorized 时返回的本地登录 token" - } - ], - "errors": [] - }, - { - "method": "user.getBindWechatCode", - "description": "获取微信绑定状态与绑定码:绑定码为6位字母数字混合且固定60秒有效,默认立即返回;longPoll=true 时最长等待60秒,若无事件则自动刷新新码返回", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [ - { - "name": "account_id", - "type": "number", - "required": true, - "description": "WMS 账号ID" - }, - { - "name": "code", - "type": "string", - "required": true, - "description": "绑定码(已绑定时为空字符串)" - }, - { - "name": "status", - "type": "string", - "required": true, - "description": "绑定状态:pending/scanned/bound" - }, - { - "name": "is_bound", - "type": "boolean", - "required": true, - "description": "是否已绑定微信" - }, - { - "name": "updated_at", - "type": "string", - "required": true, - "description": "状态更新时间(ISO 时间)" - }, - { - "name": "expires_at", - "type": "number", - "required": false, - "description": "过期时间戳(毫秒),bound 状态可为空" - }, - { - "name": "expire_after_ms", - "type": "number", - "required": true, - "description": "距离过期剩余毫秒数" - }, - { - "name": "scanned_at", - "type": "string", - "required": false, - "description": "扫码时间(未扫码可为空)" - }, - { - "name": "source", - "type": "string", - "required": true, - "description": "数据来源,如 cache/generated/refreshed/db" - }, - { - "name": "ye4s_user_id", - "type": "number", - "required": false, - "description": "已绑定的 ye4s 用户ID(未绑定可为空)" - } - ], - "errors": [] - }, - { - "method": "user.unbindWechat", - "description": "解绑微信账号(清理 ye4s 关联账号数据)", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "user.logout", - "description": "用户登出", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "user.info", - "description": "获取当前用户信息", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "user.changeRole", - "description": "user.changeRole 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "user.register", - "description": "user.register 接口", - "isNeedAuth": false, - "isNeedLogin": false, - "headers": [], - "params": [], - "response": [], - "errors": [] - } - ] - }, - { - "groupName": "仓库模块", - "module": "warehouse", - "list": [ - { - "method": "warehouse.getWarehouseZones", - "description": "warehouse.getWarehouseZones 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "warehouse.getWarehouseTree", - "description": "warehouse.getWarehouseTree 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "warehouseId", - "type": "number", - "required": true, - "source": "body", - "description": "warehouseId 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.getChildren", - "description": "warehouse.getChildren 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "zoneId", - "type": "number", - "required": true, - "source": "body", - "description": "zoneId 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.create", - "description": "warehouse.create 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [], - "response": [], - "errors": [] - }, - { - "method": "warehouse.update", - "description": "warehouse.update 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - }, - { - "name": "aisles", - "type": "string", - "required": false, - "source": "body", - "description": "aisles 参数" - }, - { - "name": "cell_height", - "type": "string", - "required": false, - "source": "body", - "description": "cell_height 参数" - }, - { - "name": "cell_length", - "type": "string", - "required": false, - "source": "body", - "description": "cell_length 参数" - }, - { - "name": "cell_width", - "type": "string", - "required": false, - "source": "body", - "description": "cell_width 参数" - }, - { - "name": "direction", - "type": "string", - "required": false, - "source": "body", - "description": "direction 参数" - }, - { - "name": "height", - "type": "number", - "required": false, - "source": "body", - "description": "height 参数" - }, - { - "name": "length", - "type": "number", - "required": false, - "source": "body", - "description": "length 参数" - }, - { - "name": "rack_columns", - "type": "string", - "required": false, - "source": "body", - "description": "rack_columns 参数" - }, - { - "name": "rack_levels", - "type": "string", - "required": false, - "source": "body", - "description": "rack_levels 参数" - }, - { - "name": "rack_rows", - "type": "string", - "required": false, - "source": "body", - "description": "rack_rows 参数" - }, - { - "name": "width", - "type": "number", - "required": false, - "source": "body", - "description": "width 参数" - }, - { - "name": "x", - "type": "number", - "required": false, - "source": "body", - "description": "x 参数" - }, - { - "name": "y", - "type": "number", - "required": false, - "source": "body", - "description": "y 参数" - }, - { - "name": "z", - "type": "number", - "required": false, - "source": "body", - "description": "z 参数" - }, - { - "name": "zone_code", - "type": "string", - "required": false, - "source": "body", - "description": "zone_code 参数" - }, - { - "name": "zone_name", - "type": "string", - "required": false, - "source": "body", - "description": "zone_name 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.delete", - "description": "warehouse.delete 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.detail", - "description": "warehouse.detail 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.checkBarcodeUnique", - "description": "warehouse.checkBarcodeUnique 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "barcode", - "type": "string", - "required": true, - "source": "body", - "description": "barcode 参数" - }, - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.toggleActive", - "description": "warehouse.toggleActive 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - }, - { - "name": "isActive", - "type": "string", - "required": false, - "source": "body", - "description": "isActive 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.getPath", - "description": "warehouse.getPath 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.createRack", - "description": "warehouse.createRack 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "height", - "type": "number", - "required": true, - "source": "body", - "description": "height 参数" - }, - { - "name": "length", - "type": "number", - "required": true, - "source": "body", - "description": "length 参数" - }, - { - "name": "rack_columns", - "type": "number", - "required": true, - "source": "body", - "description": "rack_columns 参数" - }, - { - "name": "rack_levels", - "type": "number", - "required": true, - "source": "body", - "description": "rack_levels 参数" - }, - { - "name": "rack_rows", - "type": "number", - "required": true, - "source": "body", - "description": "rack_rows 参数" - }, - { - "name": "warehouse_id", - "type": "number", - "required": true, - "source": "body", - "description": "warehouse_id 参数" - }, - { - "name": "width", - "type": "number", - "required": true, - "source": "body", - "description": "width 参数" - }, - { - "name": "x", - "type": "number", - "required": true, - "source": "body", - "description": "x 参数" - }, - { - "name": "y", - "type": "number", - "required": true, - "source": "body", - "description": "y 参数" - }, - { - "name": "zone_code", - "type": "string", - "required": true, - "source": "body", - "description": "zone_code 参数" - }, - { - "name": "zone_name", - "type": "string", - "required": true, - "source": "body", - "description": "zone_name 参数" - }, - { - "name": "color", - "type": "string", - "required": false, - "source": "body", - "description": "color 参数" - }, - { - "name": "direction", - "type": "string", - "required": false, - "source": "body", - "description": "direction 参数" - }, - { - "name": "parent_id", - "type": "number", - "required": false, - "source": "body", - "description": "parent_id 参数" - }, - { - "name": "z", - "type": "number", - "required": false, - "source": "body", - "description": "z 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.getPickPath", - "description": "warehouse.getPickPath 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "warehouse_id", - "type": "number", - "required": true, - "source": "query", - "description": "warehouse_id 参数" - }, - { - "name": "include_spaces", - "type": "string", - "required": false, - "source": "query", - "description": "include_spaces 参数" - }, - { - "name": "limit", - "type": "number", - "required": false, - "source": "query", - "description": "limit 参数" - }, - { - "name": "sort_by", - "type": "string", - "required": false, - "source": "query", - "description": "sort_by 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.updateRackPosition", - "description": "warehouse.updateRackPosition 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "x", - "type": "number", - "required": true, - "source": "body", - "description": "x 参数" - }, - { - "name": "y", - "type": "number", - "required": true, - "source": "body", - "description": "y 参数" - }, - { - "name": "rack_id", - "type": "number", - "required": false, - "source": "path", - "description": "rack_id 参数" - }, - { - "name": "z", - "type": "number", - "required": false, - "source": "body", - "description": "z 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.recalculatePickPath", - "description": "warehouse.recalculatePickPath 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "warehouse_id", - "type": "number", - "required": true, - "source": "body", - "description": "warehouse_id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.updateNeighbors", - "description": "warehouse.updateNeighbors 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "warehouse_id", - "type": "number", - "required": true, - "source": "body", - "description": "warehouse_id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.getAreaRacks", - "description": "warehouse.getAreaRacks 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "area_id", - "type": "number", - "required": true, - "source": "query", - "description": "area_id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.getSpacesByRack", - "description": "warehouse.getSpacesByRack 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.createRackWithSpaces", - "description": "warehouse.createRackWithSpaces 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.getSpaceInfo", - "description": "warehouse.getSpaceInfo 接口", - "isNeedAuth": false, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": false, - "source": "body", - "description": "id 参数" - } - ], - "response": [], - "errors": [] - }, - { - "method": "warehouse.updateSpaceInfo", - "description": "warehouse.updateSpaceInfo 接口", - "isNeedAuth": true, - "isNeedLogin": true, - "headers": [ - { - "name": "Authorization", - "type": "string", - "required": true, - "description": "Bearer token" - } - ], - "params": [ - { - "name": "id", - "type": "number", - "required": true, - "source": "body", - "description": "id 参数" - }, - { - "name": "custom_barcode", - "type": "string", - "required": false, - "source": "body", - "description": "custom_barcode 参数" - }, - { - "name": "custom_name", - "type": "string", - "required": false, - "source": "body", - "description": "custom_name 参数" - }, - { - "name": "location_type_id", - "type": "number", - "required": false, - "source": "body", - "description": "location_type_id 参数" - }, - { - "name": "pick_sequence", - "type": "string", - "required": false, - "source": "body", - "description": "pick_sequence 参数" - }, - { - "name": "space_status", - "type": "string", - "required": false, - "source": "body", - "description": "space_status 参数" - } - ], - "response": [], - "errors": [] - } - ] - } - ] - } } diff --git a/script/sync-system-api-permission.cjs b/script/sync-system-api-permission.cjs index c4b3553..aa14fba 100644 --- a/script/sync-system-api-permission.cjs +++ b/script/sync-system-api-permission.cjs @@ -86,6 +86,7 @@ function loadAuthRequiredMethods(methodDocPath) { return [ ...methodSet ].sort(); } +<<<<<<< HEAD function normalizeRolePermissions(rawValue) { if (rawValue === undefined || rawValue === null) { return { allAccess: false, permissionIds: [] }; @@ -145,6 +146,8 @@ function serializeRolePermissions(rawValue) { return state.allAccess ? '*' : JSON.stringify(state.permissionIds); } +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 function buildPermissionDefaults(methodPath, templateRow) { return { path: methodPath, @@ -178,16 +181,24 @@ async function queryExistingPermissions(conn, methodPaths) { const placeholders = methodPaths.map(() => '?').join(','); const [ rows ] = await conn.query( +<<<<<<< HEAD `SELECT id, path, status FROM wms_permission WHERE type = 'api' AND path IN (${placeholders})`, +======= + `SELECT id, path FROM wms_permission WHERE type = 'api' AND path IN (${placeholders})`, +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 methodPaths ); const result = new Map(); for (const row of rows) { +<<<<<<< HEAD result.set(row.path, { id: Number(row.id), status: Number(row.status), }); +======= + result.set(row.path, row.id); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 } return result; } @@ -216,6 +227,7 @@ async function insertPermission(conn, defaults) { return result.insertId; } +<<<<<<< HEAD async function activatePermission(conn, permissionId) { const [ result ] = await conn.query( 'UPDATE wms_permission SET status = 1, update_at = NOW() WHERE id = ? AND status <> 1', @@ -244,6 +256,12 @@ async function bindRolePermission(conn, roleId, permissionId) { const [ result ] = await conn.query( 'UPDATE wms_role SET permissions = ?, updated_at = NOW() WHERE id = ?', [ serializeRolePermissions(nextPermissions), roleId ] +======= +async function bindRolePermission(conn, roleId, permissionId) { + const [ result ] = await conn.query( + 'INSERT IGNORE INTO wms_role_permission (role_id, permission_id, created_at) VALUES (?, ?, NOW())', + [ roleId, permissionId ] +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 ); return result.affectedRows > 0; } @@ -277,6 +295,7 @@ async function main() { const existingMap = await queryExistingPermissions(conn, methodPaths); const missingPaths = methodPaths.filter(item => !existingMap.has(item)); +<<<<<<< HEAD const disabledPaths = methodPaths.filter(item => { const row = existingMap.get(item); return row && Number(row.status) !== 1; @@ -286,6 +305,12 @@ async function main() { const touchedPermissionIds = []; if (!args.dryRun && (missingPaths.length > 0 || disabledPaths.length > 0)) { +======= + const created = []; + const touchedPermissionIds = []; + + if (!args.dryRun && missingPaths.length > 0) { +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 await conn.beginTransaction(); try { for (const methodPath of missingPaths) { @@ -294,6 +319,7 @@ async function main() { created.push({ methodPath, permissionId }); touchedPermissionIds.push(permissionId); } +<<<<<<< HEAD for (const methodPath of disabledPaths) { const permissionRow = existingMap.get(methodPath); @@ -308,6 +334,8 @@ async function main() { touchedPermissionIds.push(permissionRow.id); } +======= +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 await conn.commit(); } catch (error) { await conn.rollback(); @@ -320,8 +348,13 @@ async function main() { : await queryExistingPermissions(conn, methodPaths); for (const methodPath of methodPaths) { +<<<<<<< HEAD const permissionRow = latestMap.get(methodPath); if (permissionRow && permissionRow.id) touchedPermissionIds.push(permissionRow.id); +======= + const permissionId = latestMap.get(methodPath); + if (permissionId) touchedPermissionIds.push(permissionId); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 } const uniquePermissionIds = [ ...new Set(touchedPermissionIds) ]; @@ -340,12 +373,18 @@ async function main() { totalAuthMethods: methodPaths.length, existingPermissionCount: existingMap.size, missingPermissionCount: missingPaths.length, +<<<<<<< HEAD disabledPermissionCount: disabledPaths.length, createdPermissionCount: created.length, reactivatedPermissionCount: reactivated.length, roleBindingCreated, sampleMissing: missingPaths.slice(0, 20), sampleDisabled: disabledPaths.slice(0, 20), +======= + createdPermissionCount: created.length, + roleBindingCreated, + sampleMissing: missingPaths.slice(0, 20), +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 }; console.log('[sync-system-api-permission] summary'); diff --git a/test/app/controller/system.setting.permission.test.js b/test/app/controller/system.setting.permission.test.js index af6053a..4776ac4 100644 --- a/test/app/controller/system.setting.permission.test.js +++ b/test/app/controller/system.setting.permission.test.js @@ -39,6 +39,7 @@ describe('test/app/controller/system.setting.permission.test.js', () => { } }); +<<<<<<< HEAD it('should expose setting.role.permission as alias of setting.permission.list', async () => { const requestData = { type: 'api', @@ -152,12 +153,23 @@ describe('test/app/controller/system.setting.permission.test.js', () => { const updateRes = await invokeSystemMethod('setting.permission.update', { permission_id: 999999999, name: 'not_found_update', +======= + it('should reject out-of-scope permission update', async () => { + const updateRes = await invokeSystemMethod('setting.permission.update', { + permission_id: 999999999, + name: 'out_of_scope_update', +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 }, token, EXTRA_HEADERS); assert.equal(updateRes.status, 200); assert.equal(updateRes.body.flag, 'failure'); +<<<<<<< HEAD assert.equal(Number(updateRes.body.code), 404); assert.match(String(updateRes.body.message || ''), /权限不存在/); +======= + assert.ok([ 400, 404 ].includes(Number(updateRes.body.code)), `unexpected code: ${updateRes.body.code}`); + assert.match(String(updateRes.body.message || ''), /(超出当前登录工号可用权限集|权限不存在)/); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 }); it('should create then update then delete permission successfully', async () => { @@ -289,7 +301,11 @@ describe('test/app/controller/system.setting.permission.test.js', () => { } }); +<<<<<<< HEAD it('should reject mixed delete when ids contain non-existent permission', async () => { +======= + it('should reject mixed delete when ids contain out-of-scope permission', async () => { +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 const suffix = Date.now(); const path = `autotest.permission.mixed.outscope.${suffix}`; let permissionId = 0; @@ -315,8 +331,13 @@ describe('test/app/controller/system.setting.permission.test.js', () => { assert.equal(mixedRes.status, 200); assert.equal(mixedRes.body.flag, 'failure'); +<<<<<<< HEAD assert.equal(Number(mixedRes.body.code), 404); assert.match(String(mixedRes.body.message || ''), /权限不存在/); +======= + assert.ok([ 400, 404 ].includes(Number(mixedRes.body.code)), `unexpected code: ${mixedRes.body.code}`); + assert.match(String(mixedRes.body.message || ''), /(超出当前登录工号可用权限集|权限不存在)/); +>>>>>>> 26af1a7039685344b2ea591cc28e63080c1b8893 // 失败后应保持原子性:合法权限仍可被正常删除(说明前一次未误删) const verifyDeleteRes = await invokeSystemMethod('setting.permission.delete', {