找回密码
 注册成为天翎用户
查看: 289|回复: 1

[已解决] 怎么给指定的微信用户发送图文消息?

[复制链接]
Merida 发表于 2021-7-1 16:04:01 | 显示全部楼层 |阅读模式
【myApps/OBPM版本号】:v4.4- sp XX
【浏览器类型】:Chrome/其他
【联系方式-QQ】:
【联系电话】:   
【问题描述】:

怎么给指定的微信用户发送图文消息?






 楼主| Merida 发表于 2021-7-1 16:05:55 | 显示全部楼层
请参考以下脚本代码

// 实现sendWeixinRichTextMessage(touser,title,description,url,picUrl)函数的应用,发送微信信息给指定用户


var userids=getCurrentDocument().getItemValueAsString("接收人");//表单,获取接收人的值
var touser="";
if(userids!=""&&userids!=null){
userids = userids.split(';');
for (var i=0; i < userids.length; i++ ) {
    var user = getUserById(userids[i]);
    if(user!=null && user.isUseWEI() == true){  //user.isUseWEI() == true后台设置该用户是否发送微信
        touser+= user.getLoginno()+"|";
    }
}
touser=touser.substring(0,touser.length-1);
}
var formid=getCurrentDocument().getFormid();
var agentid="1";
var docid=getCurrentDocument().getId();
var request = $WEB.getParamsTable().getHttpRequest();//获取当前request
//如果服务器本身就可以访问,就可以通过函数获取
var url0="http://"+request.getServerName()+":"+request.getServerPort()+getConte
xtPath();
var url1="http://ws.jhkj.com/jhkj/portal/dynaform/document/view.action?_docid="+docid+"&_formid="+formid+"&application="+applicationId;
//打开的url需要转码
url1=encodeURIComponent(url1);
var url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxe36ce2ae5ff0a86c&redirect_uri="+url1+"&response_type=code&scope=snsapi_base&state="+domainId+"#wechat_redirect";
var title="发送的标题";
var description="发送的内容";
var picUrl=url1+"/resource/image/photo.png";
var flag=sendWeixinRichTextMessage(agentid,touser,title,description,url,picUrl);
println("flag==========="+flag);
回复

使用道具 举报

本版积分规则

手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-14 00:11

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表