网络技术

[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(因为可能有不同的样式或风格吧)。

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

  1. I really love your website.. Very nice colors & theme.
    Did you make this website yourself? Please reply back as I’m looking to create my own personal site and want to learn where you got this from or just what the theme is
    called. Thanks!

  2. This design is spectacular! You obviously know how to keep a reader amused.
    Between your wit and your videos, I was almost moved to start my own blog
    (well, almost…HaHa!) Excellent job. I really enjoyed what you had to say, and more than that, how you presented it.

    Too cool!

  3. I loved as much as you will receive carried out right here.
    The sketch is attractive, your authored material stylish.
    nonetheless, you command get bought an shakiness over that you wish be delivering the following.
    unwell unquestionably come further formerly again as exactly the same nearly very often inside case you shield this hike.

  4. I really love your blog.. Great colors & theme. Did you create this amazing site yourself?
    Please reply back as I’m trying to create my own blog and
    would like to find out where you got this from or just what the theme is
    called. Many thanks!

  5. Superb website you have here but I was curious if you knew of any community forums that cover
    the same topics discussed in this article? I’d really love to be a part of community where I can get comments from other experienced individuals
    that share the same interest. If you have any suggestions, please let me know.
    Thanks a lot!

  6. Today, while I was at work, my cousin stole my iphone and tested to see if it
    can survive a 30 foot drop, just so she can be a youtube sensation. My iPad is now destroyed
    and she has 83 views. I know this is totally off topic but
    I had to share it with someone!

  7. of course like your web-site but you need to check the spelling on quite a few of your posts.
    Many of them are rife with spelling problems and I in finding it very troublesome to tell the reality on the other hand I’ll definitely come
    back again.

  8. 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?

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

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

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

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

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

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

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

发表评论

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

返回顶部