客户端集成
598014

禅道客户端使用怎样二开实现会话机器人已解决 悬赏5积分

提问者 答案数1 阅读数94 发表时间2024-10-31 18:44:07

请问下禅道客户端使用了聊天功能,使用xxd服务端,怎样二开会话机器人定时发送消息

禅道版本:禅道开源版 18.5

安装包类型:Linux安装包

操作系统:CentOS

客户端浏览器:

设置备注
内容
答案列表
2024-11-01 09:10:03

您好,可以结合通知接口文档,经过 api.php 或 x.php 调用通知接口发送推送;

可以参考文档:https://www.zentao.net/book/zentaopms/301.html

此外禅道客户端依赖于喧喧技术,可以参考喧喧二次开发相关文档:https://www.xuanim.com/book/dev/141.html

🌴
2024/11/01
您好,感谢您的回复,不过采用接口文档的方法调用异常,与接口文档不一致(下载的官网18.5开源版Linux一键部署安装),具体情况如下:

访问接口地址为:http://192.168.70.140/zentao/x.php时:接口返回内容一致,如下:

getGroupChats接口返回结果为:
{"status":"success","data":"{\"locate\":\"http:\\\/\\\/192.168.70.140\\\/zentao\\\/x.php?m=user&f=deny&t=json&module=im&method=getgroupchats\"}","md5":"26159f06aa00bf53b6a867a595106d61"}

getChatUsers接口返回结果为:
{"status":"success","data":"{\"locate\":\"http:\\\/\\\/192.168.70.140\\\/zentao\\\/x.php?m=user&f=deny&t=json&module=im&method=getchatusers\"}","md5":"634b53a2c6d4797eed51c7ec60bfdf00"}

sendNotification接口返回结果为:
{"status":"success","data":"{\"locate\":\"http:\\\/\\\/192.168.70.140\\\/zentao\\\/x.php?m=user&f=deny&t=json&module=im&method=sendnotification\"}","md5":"4ab01dc1ad235b2bae12d1f1b2ea12da"}

sendChatMessage接口返回结果为:
{"status":"success","data":"{\"locate\":\"http:\\\/\\\/192.168.70.140\\\/zentao\\\/x.php?m=user&f=deny&t=json&module=im&method=sendchatmessage\"}","md5":"e5102e5821229bd188ce68b44f8f7da3"}

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

访问接口地址为:http://192.168.70.140/zentao/api.php时:接口返回报错,如下:

getGroupChats接口返回结果为:
{"status":"success","data":"{\"locate\":\"http:\\\/\\\/192.168.70.140http:\\\/\\\/192.168.70.140\\\/zentao\\\/index.php?m=user&f=deny&t=json&module=im&method=getgroupchats\"}","md5":"cb4abe895f9ad2c61de0b4211cebf04c"}<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head><body><br />
10:04:34 Uncaught Error: Call to undefined method helper::end() in /opt/zbox/app/zentao/module/common/model.php:413<br />
Stack trace:<br />
#0 /opt/zbox/app/zentao/module/common/model.php(2467): commonModel->deny('im', 'getgroupchats')<br />
#1 /opt/zbox/app/zentao/www/api.php(47): commonModel->checkPriv()<br />
#2 {main}<br />
thrown in <strong>/opt/zbox/app/zentao/module/common/model.php</strong> on line <strong>413</strong> when visiting <strong>/zentao/api.php?m=im&amp;f=getGroupChats&amp;code=xuguTestmanager&amp;token=c4b75207dcb46621d4d1db1b0db90a83</strong><br />
</body></html>

getChatUsers接口返回结果为:
{"status":"success","data":"{\"locate\":\"http:\\\/\\\/192.168.70.140http:\\\/\\\/192.168.70.140\\\/zentao\\\/index.php?m=user&f=deny&t=json&module=im&method=getchatusers\"}","md5":"f31e354b8d86df86cc6c804225814343"}<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head><body><br />
10:05:44 Uncaught Error: Call to undefined method helper::end() in /opt/zbox/app/zentao/module/common/model.php:413<br />
Stack trace:<br />
#0 /opt/zbox/app/zentao/module/common/model.php(2467): commonModel->deny('im', 'getchatusers')<br />
#1 /opt/zbox/app/zentao/www/api.php(47): commonModel->checkPriv()<br />
#2 {main}<br />
thrown in <strong>/opt/zbox/app/zentao/module/common/model.php</strong> on line <strong>413</strong> when visiting <strong>/zentao/api.php?m=im&amp;f=getChatUsers&amp;gid=28d8309c-8c24-4690-bee3-50862941af7d&amp;code=xuguTestmanager&amp;token=2b9e57416ce809973b053780b89001b9</strong><br />
</body></html>

sendNotification接口返回结果为:
{"status":"success","data":"{\"locate\":\"http:\\\/\\\/192.168.70.140http:\\\/\\\/192.168.70.140\\\/zentao\\\/index.php?m=user&f=deny&t=json&module=im&method=sendnotification\"}","md5":"6a2b5684a5608a8bfb4d47625e608fe8"}<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head><body><br />
10:06:22 Uncaught Error: Call to undefined method helper::end() in /opt/zbox/app/zentao/module/common/model.php:413<br />
Stack trace:<br />
#0 /opt/zbox/app/zentao/module/common/model.php(2467): commonModel->deny('im', 'sendnotificatio...')<br />
#1 /opt/zbox/app/zentao/www/api.php(47): commonModel->checkPriv()<br />
#2 {main}<br />
thrown in <strong>/opt/zbox/app/zentao/module/common/model.php</strong> on line <strong>413</strong> when visiting <strong>/zentao/api.php?m=im&amp;f=sendNotification&amp;code=xuguTestmanager&amp;token=a7c15091c2852d84fa5003cdb772c058</strong><br />
</body></html>

sendChatMessage接口返回结果为:
{"status":"success","data":"{\"locate\":\"http:\\\/\\\/192.168.70.140http:\\\/\\\/192.168.70.140\\\/zentao\\\/index.php?m=user&f=deny&t=json&module=im&method=sendchatmessage\"}","md5":"d8781ff94af4fbd57966c762109290b9"}<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /></head><body><br />
10:07:44 Uncaught Error: Call to undefined method helper::end() in /opt/zbox/app/zentao/module/common/model.php:413<br />
Stack trace:<br />
#0 /opt/zbox/app/zentao/module/common/model.php(2467): commonModel->deny('im', 'sendchatmessage')<br />
#1 /opt/zbox/app/zentao/www/api.php(47): commonModel->checkPriv()<br />
#2 {main}<br />
thrown in <strong>/opt/zbox/app/zentao/module/common/model.php</strong> on line <strong>413</strong> when visiting <strong>/zentao/api.php?m=im&amp;f=sendChatMessage&amp;code=xuguTestmanager&amp;token=1f4754a5ee9eebb5b2e5677592f36ce2</strong><br />
</body></html>
🌴
2024/11/02
11月1号的问题目前找到原因了,是后台配置应用时免密必须选择【否】,且账号选择管理员的账号即可;
不过官方提供的4个接口中,im/getGroupChats和im/getChatUsers接口是有效的;
另外两个接口使用报错:
im/sendNotification接口:
请求json为:
notifi_data = {
"users": ["zhangsan", "lisi"],
"title": "发送通知信息展示",
"content": "通知明天需要开会!",
"contentType": "plain"
}
请求返回内容为:{'result': 'fail', 'message': '应当设置接收者用户列表。'}

-------------------------------------------------------------------------------------------------------------------------

im/sendChatMessage接口:
请求json为:
chat_data = {
"gid": "ef794958-94cb-493f-9f3a-464ef4a04907",
"title": "chat聊天消息信息",
"content": "chat聊天消息内容",
"contentType": "plain"
}

请求返回内容为:{'result': 'fail', 'message': '应当设置接收讨论组。'}
🌴
2024/11/03
已解决,失败原因为虽然请求参数是json,但需要指明传输数据类型为json才行,前面未强制指定参数类型为json导致请求失败
联系我们
联系人
刘璐/高级客户经理
电话(微信)
18562550650
QQ号码
2845263372
联系邮箱
liulu@chandao.com
返回顶部
刘璐
高级客户经理
18562550650
2845263372
统一服务热线 4006-8899-23
我要提问提问有任何问题,您都可以在这里提问。 问题反馈反馈点击这里,让我们聆听您的建议与反馈。