|  |  | @ -44,10 +44,10 @@ async function editUser (ctx) { | 
			
		
	
		
			
				
					|  |  |  |          // 存在且传递id 或者 不传id也存在
 | 
			
		
	
		
			
				
					|  |  |  |          // 修改 update
 | 
			
		
	
		
			
				
					|  |  |  |          storageData.deleted = false | 
			
		
	
		
			
				
					|  |  |  |          storageData.role = [...new Set([...existUserRes.role, ...role])] | 
			
		
	
		
			
				
					|  |  |  |          if ( | 
			
		
	
		
			
				
					|  |  |  |             role.includes('admin') | 
			
		
	
		
			
				
					|  |  |  |             storageData.role.includes('admin') | 
			
		
	
		
			
				
					|  |  |  |          ) { | 
			
		
	
		
			
				
					|  |  |  |             storageData.role = [...new Set([...existUserRes.role, ...role])] | 
			
		
	
		
			
				
					|  |  |  |             storageData.disabled = false | 
			
		
	
		
			
				
					|  |  |  |          } | 
			
		
	
		
			
				
					|  |  |  |          await models.User.update(storageData, { | 
			
		
	
	
		
			
				
					|  |  | @ -75,6 +75,16 @@ async function putUser (ctx) { | 
			
		
	
		
			
				
					|  |  |  |       const models = ctx.fs.dc.models; | 
			
		
	
		
			
				
					|  |  |  |       const { pomsUserId } = ctx.params | 
			
		
	
		
			
				
					|  |  |  |       const { disabled = undefined, deleted = undefined } = ctx.request.body | 
			
		
	
		
			
				
					|  |  |  |       const existUserRes = await models.User.findOne({ | 
			
		
	
		
			
				
					|  |  |  |          where: { | 
			
		
	
		
			
				
					|  |  |  |             id: pomsUserId | 
			
		
	
		
			
				
					|  |  |  |          } | 
			
		
	
		
			
				
					|  |  |  |       }) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |       if (existUserRes && existUserRes.role.includes('admin')) { | 
			
		
	
		
			
				
					|  |  |  |          throw '已是管理员,请先解除管理员权限' | 
			
		
	
		
			
				
					|  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |       const updateData = { | 
			
		
	
		
			
				
					|  |  |  |          disabled, | 
			
		
	
		
			
				
					|  |  |  |          deleted, | 
			
		
	
	
		
			
				
					|  |  | @ -84,6 +94,7 @@ async function putUser (ctx) { | 
			
		
	
		
			
				
					|  |  |  |             delete updateData[k] | 
			
		
	
		
			
				
					|  |  |  |          } | 
			
		
	
		
			
				
					|  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |       await models.User.update(updateData, { | 
			
		
	
		
			
				
					|  |  |  |          where: { | 
			
		
	
		
			
				
					|  |  |  |             id: pomsUserId | 
			
		
	
	
		
			
				
					|  |  | @ -94,7 +105,7 @@ async function putUser (ctx) { | 
			
		
	
		
			
				
					|  |  |  |       ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
			
		
	
		
			
				
					|  |  |  |       ctx.status = 400; | 
			
		
	
		
			
				
					|  |  |  |       ctx.body = { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |          message: typeof error == 'string' ? error : undefined | 
			
		
	
		
			
				
					|  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  |    } | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |