Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

设置用户资料接口中自定义字段设置未生效问题(有时候生效) #145

Closed
heangping opened this issue Oct 28, 2022 · 11 comments

Comments

@heangping
Copy link

heangping commented Oct 28, 2022

设置用户资料接口现在情况是设置昵称,头像,自定义字段等数据时调用接口返回成功,然后调用拉取资料查询,昵称,头像是更新成功的,但是自定义字段更新未成功,自定义字段是正确的key,因为有时候自定义字段是更新成功的,查看了入参都没发现啥问题
okhttp request:

Request{method=POST, url=https://console.tim.qq.com/v4/profile/portrait_set?sdkappid=xxxxx&identifier=administrator&usersig=xxxxx&random=2136887377&contenttype=json, headers=[User-Agent:qcloud-im-server-sdk-java/null(Mac OS X/13.0/aarch64;11.0.14.1)]}

okhttp requestString: {"From_Account":"xxxxxx","ProfileItem":[{"Tag":"Tag_Profile_IM_Nick","Value":"对对对"},{"Tag":"Tag_Profile_IM_Image","Value":"https:/xxxx.oss-cn-shanghai.aliyuncs.com/dams/47ed6184c7ee4ffeb9b6cabd7.png"},{"Tag":"Tag_Profile_Custom_Data","Value":"{"mobileNo":"13311111111","roleNameList":["SA"]}"}]}

okhttp response:

Response{protocol=http/1.1, code=200, message=OK, url=https://console.tim.qq.com/v4/profile/portrait_set?sdkappid=dddd&identifier=administrator&usersig=ddddd*&random=2136887377&contenttype=json}

多次调用接口都是返回成功的,自定义字段实际未生效, 查看入参都没问题,费解 是有什么要注意的吗 im后台设置的用户自定义字段key是 : Tag_Profile_Custom_Data 大小写是注意到了 没啥问题

@yanglbme
Copy link
Member

你可以用 rest api 在线工具试试,看看有没有设置成功

https://tcc.tencentcs.com/im-api-tool/index.html#/v4/profile/portrait_get

@heangping
Copy link
Author

同样的参数 用在线工具试了是成功的 所以搞不懂了

@heangping
Copy link
Author

大佬 这个httpUtil 里面的详细的日志可以加下么 不然看真实的参数有点麻烦

@yanglbme
Copy link
Member

我本地试了,没自定义字段,是会报错的。

http 请求的数据 {"From_Account":"test1","ProfileItem":[{"Tag":"Tag_Profile_IM_Nick","Value":"MyNickName"},{"Tag":"Tag_Profile_Custom_Data","Value":"123"}]}

PortraitSetResult{errorDisplay='', actionStatus='FAIL', errorInfo='Invalid field: Tag_Profile_Custom_Data. You may not configure custom fields in the console or use the wrong fields.', errorCode=40009}

@yanglbme
Copy link
Member

yanglbme commented Oct 28, 2022

我配置之后,重新调用 portraitSet 是成功的。

然后 portraitGet 拉取数据,响应结果如下:

PortraitGetResult{errorDisplay='', userProfileItemList=[UserProfileItem{toAccount='test1', profileItemList=[ProfileItem{tag='Tag_Profile_IM_Nick', value='MyNickName'}, ProfileItem{tag='Tag_Profile_Custom_Data', value='123'}], resultCode=0, resultInfo=''}], failAccount=null, actionStatus='OK', errorInfo='', errorCode=0}

@yanglbme
Copy link
Member

可以看到结果返回了自定义的 tag 数据

@yanglbme
Copy link
Member

没啥问题吧,你自查一下?

@yanglbme
Copy link
Member

项目里提供了 JsonUtil.obj2Str(),你可以把请求对象打印一下看看。

@heangping
Copy link
Author

好的 多谢 我在看看

@yanglbme
Copy link
Member

嗯好,有问题随时反馈

@heangping
Copy link
Author

按照步骤试了下 ok了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants