网络技术

[javascript代码]竞价页多微信轮流值守切换防封号

竞价页多微信轮流值守切换防封号

一个项目做百度360搜狗竞价推广,开了很多户有很多网站流量很大加微信的转化也不低。那就要用到很多不同的微信号,如果是少量的微信号,短时间内加很多会被封号的。想必被封号的痛苦各位看官也都多少经历过。封号是小事情,几十块钱找人解开就好,关键会影响到业务。就需要一个合理的解决方案。本片从技术角度入手,零成本消除隐患。

废话不多说,开始整。

这里给两份代码,一份是手写的,一份是借鉴的。

每隔一段时间更换一次微信。

借鉴的代码开始:

//js部分开始

var wxNumber = ['微信号1','微信号2','微信号3','微信号4'];
var firstOpenTime = localStorage.getItem('firstOpenTime'); // 第一次打开时,写入缓存的微信号

// 将时间戳转换成日期格式
var date = new Date();
Y = date.getFullYear() + '-';
M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
D = date.getDate() + ' ';
h = date.getHours() + ':';
m = date.getMinutes() + ':';
s = date.getSeconds();
console.log(Y+M+D+h+m+s);

// 思路:↓↓↓↓↓↓↓

// 1440 一天有1440分钟
// 1440/15 = 96 一天要轮换96次

// 获取当天的凌晨时间
// 获取打开时间

// 打开时间 - 凌晨时间 过了多少分钟
// 过了多少分钟 / 15 = 轮换了多少次

// 凌晨时间:将日期格式转换成时间戳
var zeroTime = Y+M+D+' 00:00:00:000'; // 当天的凌晨时间
var zeroTime_t = new Date(zeroTime.replace(/-/g, '/')); // 格式化凌晨时间
var zeroTime_timestamp = zeroTime_t.getTime(); // 将 Y+M+D+h+m+s 格式转换成时间戳格式
console.log('零'+zeroTime_timestamp);

// 获取打开时间的时间戳 单位毫秒
// var nowTime = new Date();
var nowTime = new Date().getTime();
console.log('现'+nowTime);

// 时间差:打开时间 减去 凌晨时间
var difference = nowTime - zeroTime_timestamp;
console.log(difference);

// 15分钟有多少毫秒
var fift = 15*60*1000;
var count = Math.floor(difference/fift); // 在这个时间差内,轮换了多少次
console.log(count);

// 一共有多少个微信号
var wxNumber_count = wxNumber.length;
console.log(wxNumber_count);

// 打开时间 改轮换到了哪一个
var wx_index = count % wxNumber_count;
console.log(wx_index);
console.log(wxNumber[wx_index]);

if(typeof(Storage)!==undefined && firstOpenTime==null){ // setp 1. 第一次打开页面的情况
// 浏览器支持,且本地缓存的‘firstOpenTime’为空

localStorage.setItem('firstOpenTime',wxNumber[wx_index]); // 将第一次打开页面时随机的微信号缓存进本地
$('.wxcopy').html(wxNumber[wx_index]);
console.log('第一次打开页面,设置操作'+firstOpenTime);

}else if(typeof(Storage)!==undefined && firstOpenTime!=null){ // setp 2. 之前打开过页面的情况
// 浏览器支持,且本地缓存的‘firstOpenTime’不为空

$('.wxcopy').html(firstOpenTime);
console.log('之前打开过页面,读取操作+'+firstOpenTime);

}else { // setp 3. 不支持web storage的情况,默认选择第一个
console.log('sorry, you browser does not support Web storage...')
$('.wxcopy').html(wxNumber[0]);
}
//js部分结束
<!--html部分开始-->
<a><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cscript%3EwxNumber()%3C%2Fscript%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="&lt;script&gt;" title="&lt;script&gt;" /></a>
<!--html部分结束-->

借鉴的代码结束。
这样可以实现多个微信号,每隔十五分钟切换一个。但是存在弊端,如果有图片二维码要同步切换就麻烦了。

手写的代码开始:

//js部分开始
function weiXinHao() {
    today=new Date();
    var day; 
    var date; 
    var weiXinHao;
    hour=new Date().getHours()
    if(hour < 8)weiXinHao='微信号1'
    else if(hour < 16)weiXinHao='微信号2'
    else {weiXinHao='微信号3'}
    var webUrl = webUrl;
    document.write(' '+weiXinHao);
}

function erWeiMa() {
today=new Date();
var day; 
var date; 
var erWeiMa;
hour=new Date().getHours()
if(hour < 8)erWeiMa='<img src="二维码图片地址" style="属性:值;">'
else if(hour < 16)erWeiMa='<img src="二维码图片地址" style="属性:值;">'
else {erWeiMa='<img src="二维码图片地址" style="属性:值;">'}
var webUrl = webUrl;
document.write(' '+erWeiMa);
}
//js部分结束
<!--html部分开始-->
<script>weiXinHao()</script>
<script>erWeiMa()</script>
<!--html部分结束-->

手写的代码结束。
控制时间,在00:00-08:00是一个号,08:00-16:00是一个号,16:00到24:00是一个号。这样一来也可以达到分散流量均到不同的接入微信账号上的目的。还可以嵌套更多的if else。调用也是非常简单。
而且可控多处,代码简单易于维护,比如erWeiMaTop和erWeiMaBottom(因为可能有不同的样式或风格吧)。

34 thoughts on “[javascript代码]竞价页多微信轮流值守切换防封号

  1. I do agree with all the ideas you have offered on your post.
    They’re very convincing and will certainly work.
    Nonetheless, the posts are too short for starters.

    May you please lengthen them a little from subsequent time?
    Thanks for the post.

  2. We absolutely love your blog and find nearly all of your post’s
    to be what precisely I’m looking for. Do you offer guest writers to
    write content for you? I wouldn’t mind publishing a post or
    elaborating on a few of the subjects you write with regards to here.
    Again, awesome weblog!

  3. Do you mind if I quote a couple of your articles as long as I provide credit and sources back to
    your website? My website is in the exact same
    area of interest as yours and my visitors would truly benefit
    from some of the information you present here. Please let me know if this alright with you.
    Many thanks!

  4. I was curious if you ever considered changing the page layout of
    your website? Its very well written; I love what youve got
    to say. But maybe you could a little more in the way of content so
    people could connect with it better. Youve got
    an awful lot of text for only having 1 or two pictures.

    Maybe you could space it out better?

  5. Have you ever considered about including a little bit more than just
    your articles? I mean, what you say is fundamental and everything.

    But just imagine if you added some great photos or videos to give
    your posts more, “pop”! Your content is excellent but with
    images and clips, this site could undeniably be one of the most beneficial in its niche.
    Wonderful blog!

  6. Nice post. I was checking constantly this blog and I’m impressed!
    Very useful info specifically the last part 🙂 I care
    for such info a lot. I was looking for this particular information for
    a long time. Thank you and best of luck.

  7. When I originally left a comment I appear to have clicked on the -Notify me when new
    comments are added- checkbox and from now on every time a comment is added
    I recieve four emails with the exact same comment.
    Perhaps there is an easy method you can remove me from that service?
    Many thanks!

  8. Hmm is anyone else encountering problems with the images on this blog loading?
    I’m trying to find out if its a problem on my end or if it’s the blog.
    Any feed-back would be greatly appreciated.

  9. 你好!请问能否将贵站友情链接“陈沩亮博客”,修改为这个关键词“网络营销” ?

    如果可以,我会给朋友贵站,他们可能会跟你交换友情链接。

  10. 你好!你的网站内容不错,对用户有帮助。

    我的网站定期更新原创文章,Alexa排名15万之内左右,希望和你交换友情链接。

    我暂先给你添加链接了 ^_^

    URL:https://www.chenweiliang.com/
    链接文字:网络营销

    如能交换友情链接,请回复

发表评论

电子邮件地址不会被公开。 必填项已用*标注

答案 : *
16 + 26 =


返回顶部