我看文档里面说创建群时不设置头像不会自动生成微信样式的头像

莫语 6月前 298

我看文档里面说创建群组时不填写群头像,当客户端发现群头像为空时,自动在本地自动拼接群头像并显示,但是实际上会显示成这种默认的图片,是需要设置哪里吗?

服务端代码

/**
     * 新增群聊
     *
     * @param appGroup 群聊
     * @return 结果
     */
    @Transactional
    @Override
    public int insertAppGroup(AppGroup appGroup) {
        try {
            Properties properties = new Properties();
            File configFile = new File("config/app_config.properties");
            properties.load(new FileInputStream(configFile));
            String[] groupManagerList = properties.getProperty("group_manager").split(",");

            //创建群聊
            //判断该群聊是否已创建
            PojoGroupInfo pojoGroupInfo = new PojoGroupInfo();
            pojoGroupInfo.setName(appGroup.getGroupName());
            pojoGroupInfo.setOwner(groupManagerList[0]);
            //设置只有群主和管理才能有相关权限
            pojoGroupInfo.setType(GroupType_Restricted);
            //设置禁止成员私聊
            pojoGroupInfo.setPrivate_chat(1);

            ArrayList<PojoGroupMember> pojoGroupMembers = new ArrayList<>();
            for (String s : groupManagerList) {
                PojoGroupMember pojoGroupMember = new PojoGroupMember();
                pojoGroupMember.setMember_id(s);
                pojoGroupMembers.add(pojoGroupMember);
            }

            IMResult<OutputCreateGroupResult> group = GroupAdmin.createGroup(groupManagerList[0], pojoGroupInfo, pojoGroupMembers, null, null);
            if (group.getCode() != 0) {
                throw new RuntimeException("创建群组失败");
            }
            //更新群组信息
            appGroup.setGroupId(group.getResult().getGroup_id());
            appGroup.setCreateTime(DateUtils.getNowDate());
            int i = appGroupMapper.insertAppGroup(appGroup);
            if (i == 0) {
                throw new RuntimeException("创建群组失败");
            }
            return i;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }

最新回复 (1)
返回