Merge branch 'feature-nxdev' of https://gitea.nxsir.cn/code/IM into feature-nxdev

This commit is contained in:
西街长安 2026-03-09 13:16:25 +08:00
commit e38c15ed92
5 changed files with 48 additions and 3 deletions

View File

@ -88,5 +88,13 @@ namespace IM_API.Controllers
var groupinfo = await _groupService.UpdateGroupInfoAsync(int.Parse(useridStr), groupId, dto);
return Ok(new BaseResponse<GroupInfoVo>(groupinfo));
}
[HttpGet]
[ProducesResponseType(typeof(BaseResponse<GroupInfoVo>), StatusCodes.Status200OK)]
public async Task<IActionResult> GetGroupInfo([FromQuery]int groupId)
{
var group = await _groupService.GetGroupInfoAsync(groupId);
return Ok(new BaseResponse<GroupInfoVo>(group));
}
}
}

View File

@ -53,6 +53,8 @@ namespace IM_API.Interface.Services
Task MakeGroupRequestAsync(int userId,int? adminUserId,int groupId);
Task MakeGroupMemberAsync(int userId, int groupId, GroupMemberRole? role);
Task<List<GroupMemberVo>> GetGroupMembers(int userId, int groupId);
Task<GroupInfoVo> UpdateGroupInfoAsync(int userId, int groupId, GroupUpdateDto updateDto);
Task<GroupInfoVo> UpdateGroupInfoAsync(int userId, int groupId, GroupUpdateDto updateDto);
Task<GroupInfoVo> GetGroupInfoAsync(int groupId);
}
}

View File

@ -292,5 +292,15 @@ namespace IM_API.Services
return _mapper.Map<GroupInfoVo>(groupInfo);
}
public async Task<GroupInfoVo> GetGroupInfoAsync(int groupId)
{
var groupInfo = await _context.Groups.FirstOrDefaultAsync(x => x.Id == groupId);
if (groupInfo is null)
throw new BaseException(CodeDefine.GROUP_NOT_FOUND);
return _mapper.Map<GroupInfoVo>(groupInfo);
}
}
}

View File

@ -79,6 +79,10 @@ import { MESSAGE_TYPE } from '../../constants/MessageType';
import feather from 'feather-icons';
import { GROUP_MEMBER_ROLE } from '../../constants/GroupDefine';
import { uploadService } from '../../services/upload/uploadService';
import { groupService } from '../../services/group';
import { SYSTEM_BASE_STATUS } from '../../constants/systemBaseStatus';
import { useMessage } from './useAlert';
import { getFileHash } from '../../utils/uploadTools';
const props = defineProps({
chatType: {
@ -105,6 +109,8 @@ const props = defineProps({
const input = useTemplateRef('input')
const message = useMessage();
defineEmits(['close', 'viewAll']);
const uploadGroupAvatar = () => {
@ -113,7 +119,17 @@ const uploadGroupAvatar = () => {
const fileUploadHandler = async (e) => {
const file = e.target.files[0];
const { data } = await uploadService.uploadSmallFile(file);
const hash = getFileHash(file)
const { data } = await uploadService.uploadSmallFile(file, hash);
const res = await groupService.updateGroupInfo(props.groupData.targetId, {
avatar: data.url
})
if(res.code == SYSTEM_BASE_STATUS.SUCCESS){
message.success('头像更新成功')
}else{
message.error(res.message)
}
}
//

View File

@ -12,5 +12,14 @@ export const groupService = {
* @param {*} groupId
* @returns
*/
getGroupMember: (groupId) => request.get(`/Group/GetGroupMembers?groupId=${groupId}`)
getGroupMember: (groupId) => request.get(`/Group/GetGroupMembers?groupId=${groupId}`),
/**
* 更新群组信息
* @param {*} groupId
* @param {*} params
* @returns
*/
updateGroupInfo: (groupId, params) => request.post(`/Group/UpdateGroup?groupId=${groupId}`, params)
}