洛杉矶MC机房 高速低价18元起

DIYVM

**大佬帮我加个IF判断

提示:如果官网是英文页面,建议使用谷歌浏览器能同步翻译页面。点击下载【谷歌浏览器最新绿色便携版】
注意:部分文章发布时间较长,可能存在未知因素,购买时建议在本站搜索商家名称,先充分了解商家动态。
交流:唯一投稿邮箱:hostvps@88.com。

网友 a*inhai 说:

*帖最后由 a*inhai 于 2022-7-25 11:23 编辑

实现 IF 短信内容包含“快递” 则转发短信 不包含则不发
**要怎么写

现在这个代码是 什么短信都转发

//定义post方法
function posthttp(**l, data) {
    var xhr = new XMLHttpRe*uest();
    xhr.addEventListener(&*uot;readystatechange&*uot;, function () {
        if (this.readyState === 4) {
            flash(this.responseText); //显示返回**,可删除*行
        }
    });
    xhr.open(&*uot;POST&*uot;, **l, false);
    xhr.send(data);
    ret**n xhr.responseText;
}

//定义get方法
function gethttp(**l) {
    var xhr = new XMLHttpRe*uest();
    xhr.addEventListener(&*uot;readystatechange&*uot;, function () {
        if (this.readyState === 4) {
            flash(this.responseText); //显示返回**,可删除*行
        }
    });
    xhr.open(&*uot;GET&*uot;, **l, false);
    xhr.send();
    ret**n xhr.responseText;
}

//获取token
var gettoken = &*uot;https://*yapi.weixin.**.com/cgi-bin/gettoken?corpid=&*uot; + ID + &*uot;&corpsecret=&*uot; + SECRET;
var ACCESS_TOKEN = **ON.parse(gethttp(gettoken)).acce**_token;
if(SNSRD)
//发送**(文*)
var **SRF = global(‘**SRF’);
var **SRB = global(‘**SRB’);
var **SRT = global(‘**SRT’);
var **SRD = global(‘**SRD’);
var CONTENT = &*uot;发件人: &*uot; + **SRF + &*uot;\n时间: &*uot; + **SRT + &*uot;,  日期: &*uot; + **SRD + &*uot;\n短信内容: &*uot; + **SRB;
var me**age = **ON.st**ngify({
    &*uot;touser&*uot;: &*uot;@all&*uot;,
    &*uot;msgtype&*uot;: &*uot;text&*uot;,
    &*uot;agentid&*uot;: AGENTID,
    &*uot;text&*uot;: {
        &*uot;content&*uot;: CONTENT
    },
    &*uot;safe&*uot;: 0
});
var send = &*uot;https://*yapi.weixin.**.com/cgi-bin/me**age/send?acce**_token=&*uot; + ACCESS_TOKEN;
posthttp(send, me**age);
网友 HOH 说:

https://*yapi.weixin.**.com/cgi-bin/me**age/send


网友 *lwz 说:

//定义post方法
function posthttp(**l, data) {
    var xhr = new XMLHttpRe*uest();
    xhr.addEventListener(&*uot;readystatechange&*uot;, function () {
        if (this.readyState === 4) {
            flash(this.responseText); //显示返回**,可删除*行
        }
    });
    xhr.open(&*uot;POST&*uot;, **l, false);
    xhr.send(data);
    ret**n xhr.responseText;
}

//定义get方法
function gethttp(**l) {
    var xhr = new XMLHttpRe*uest();
    xhr.addEventListener(&*uot;readystatechange&*uot;, function () {
        if (this.readyState === 4) {
            flash(this.responseText); //显示返回**,可删除*行
        }
    });
    xhr.open(&*uot;GET&*uot;, **l, false);
    xhr.send();
    ret**n xhr.responseText;
}

//获取token
var gettoken = &*uot;https://*yapi.weixin.**.com/cgi-bin/gettoken?corpid=&*uot; + ID + &*uot;&corpsecret=&*uot; + SECRET;
var ACCESS_TOKEN = **ON.parse(gethttp(gettoken)).acce**_token;
if(SNSRD)
//发送**(文*)
var **SRF = global(‘**SRF’);
var **SRB = global(‘**SRB’);
// **SRB是短信内容? 判断是否包含快递两字
if(**SRB.indexOf(&*uot;快递&*uot; > -1) {
//终止后续 不发短信
ret**n
}
var **SRT = global(‘**SRT’);
var **SRD = global(‘**SRD’);
var CONTENT = &*uot;发件人: &*uot; + **SRF + &*uot;\n时间: &*uot; + **SRT + &*uot;,  日期: &*uot; + **SRD + &*uot;\n短信内容: &*uot; + **SRB;
var me**age = **ON.st**ngify({
    &*uot;touser&*uot;: &*uot;@all&*uot;,
    &*uot;msgtype&*uot;: &*uot;text&*uot;,
    &*uot;agentid&*uot;: AGENTID,
    &*uot;text&*uot;: {
        &*uot;content&*uot;: CONTENT
    },
    &*uot;safe&*uot;: 0
});

var send = &*uot;https://*yapi.weixin.**.com/cgi-bin/me**age/send?acce**_token=&*uot; + ACCESS_TOKEN;
posthttp(send, me**age);
网友 tear****s 说:

*帖最后由 tear****s 于 2022-7-25 12:39 编辑

³#是对的


网友 Faxlok 说:

47行整行换成

if(me**age.match(&*uot;快递&*uot;))posthttp(send, me**age);


网友 a*inhai 说:

*lwz 发表于 2022-7-25 11:33
网友 *lwz 说:

a*inhai 发表于 2022-7-25 11:51
Unc**ght SyntaxEr**r: Invalid or unexpected token

About 贝壳

【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。

 收藏 (0) 打赏

您可以选择一种方式赞助本站

支付宝扫一扫赞助

微信钱包扫描赞助

本文链接:贝壳主机网 » **大佬帮我加个IF判断

分享到: 生成海报
香港/美国/国内高速VPS
切换注册

登录

忘记密码 ?

切换登录

注册

我们将发送一封验证邮件至你的邮箱, 请正确填写以完成账号注册和激活