天翎MyApps技术社区 - 低代码平台 | 流程管理系统 | BPM软件

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

[微信端] 微信企业号-如何发送微信通知,抄送通知【消息】

[复制链接]
karrman 发表于 2016-6-29 17:32:02 | 显示全部楼层 |阅读模式
A:如何发送微信通知?
Q:可以在表单,配置操作为“无”,在执行脚本上放如下脚本:
  1. (function(){
  2.         var userids=getCurrentDocument().getItemValueAsString("接收人");//表单,获取接收人的值
  3.         var touser="";
  4.         if(userids!=""&&userids!=null){
  5.                userids = userids.split(';');
  6.                     for (var i=0; i < userids.length; i++ ) {
  7.                     var touserid=userids[i];
  8.                         touser+=getUserById(touserid).getLoginno()+"|";
  9.                 }
  10.           touser=touser.substring(0,touser.length-1);
  11.         }
  12.         var formid=getCurrentDocument().getFormid();
  13.         var applicationId=getApplication();
  14.         var domainId=getDomainid();
  15.         var docid=getCurrentDocument().getId();
  16.         var request = $WEB.getParamsTable().getHttpRequest();//获取当前request
  17.         //如果服务器本身就可以访问,就可以通过函数获取
  18.         var url0="http://"+request.getServerName()+":"+request.getServerPort()+getContextPath();
  19.         var url1="http://office.teemlink.com:65533/Z0271IDV"+"/portal/dynaform/document/view.action?_docid="+docid+"&_formid="+formid+"&application="+applicationId;
  20.         //打开的url需要转码
  21.         url1=encodeURIComponent(url1);
  22.         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";

  23.         var title="发送的标题";
  24.         var description="发送的内容";
  25.         var picUrl=url1+"/resource/image/photo.png";
  26.         var flag=sendWeixinRichTextMessage(touser,title,description,url,picUrl,domainId,applicationId);
  27.     println("flag==========="+flag);
  28.         return "";
  29. })()
复制代码


如果在1.4.3版本之后,发送通知的格式有变化调整为
  1. (function(){
  2.         var docid = getId();
  3.         var users = getItemValueAsString("送阅用户");
  4.         var receiver = "";        //|分隔
  5.         var isReply = false;
  6.         var isMass = false;
  7.                 if(users != null && !"".equals(users)){
  8.                         var users1 = splitText(users,";");
  9.                         for(var ii=0;ii<users1.length;ii++){
  10.                                 var userVo = getUserById(users1[ii]);
  11.                                 if(userVo != null){
  12.                                         if("".equals(receiver)){
  13.                                                 receiver += userVo.getLoginno();
  14.                                         }else{
  15.                                                 receiver += "|" + userVo.getLoginno();
  16.                                         }
  17.                                 }
  18.                         }
  19.                 }
  20.         var formid=getCurrentDocument().getFormid();
  21.         var applicationId=getApplication();
  22.         var domainId=getDomainid();
  23.         var docid=getCurrentDocument().getId();
  24.         var request = $WEB.getParamsTable().getHttpRequest();//获取当前request
  25.         //如果服务器本身就可以访问,就可以通过函数获取
  26.         var url0="http://"+request.getServerName()+":"+request.getServerPort()+getContextPath();
  27.         var url1=url0+"/portal/dynaform/document/view.action?_docid="+docid+"&_formid="+formid+"&application="+applicationId;
  28.         //打开的url需要转码
  29.         url1=encodeURIComponent(url1);
  30.                      
  31.                 url1=url0+ "/portal/phone/main.jsp?application="+applicationId+"&jumpToUrl="+url1
  32.          println("urlPC========"+url1);
  33.                  //需要再次转码
  34.                  url1=encodeURIComponent(url1);
  35.                 var url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx5e502f52d41dfb08&redirect_uri="+url1+"&response_type=code&scope=snsapi_base&state="+domainId+"#wechat_redirect";
  36.        println("urlWETCHAT==============="+url);
  37.            var title=getCurrentDocument().getItemValueAsString("标题");
  38.         var description=getCurrentDocument().getItemValueAsString("类别");
  39.         var picUrl="http://www.fxwq365.com/Z01R1"+"/uploads/tzbanner/fxtz.jpg";
  40.         var flag=sendWeixinRichTextMessage(receiver,title,description,url,picUrl,domainId,applicationId);
  41.     println("flag==========="+flag);
  42.         return "";
  43. })()
复制代码

本版积分规则

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

GMT+8, 2026-8-12 02:58

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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