原创| 开发动态| 2019-11-24| 阅读 138 次 | 1赞同 0反对
概述:现在微信公众号吸粉是越来越难,主要在于网友已经玩坏了各种花样,而且企业能拿出来的花样也越来越少,今天我将分享一下我是怎么样用30元获得3000粉丝的实战经验。
我们首先来确认一遍为什么网友会喜欢口令红包的游戏思路:
1. 娱乐性质
2. 利益诱惑
关于娱乐的性质,把公众号吸粉如投票、转发这种体力活变成找茬、寻宝等娱乐活动,自然会降低一点网友的排斥心理;而利益诱惑,简单来说就是尝试30秒获得一个现金红包,不用邀约1000好友帮忙拼夕夕,也不用建群盖楼,回复口令即有机会立即获得一个大于1块钱的现金红包,这也是为什么吸粉很快。
当然,这个功能吸纳的关注可能不是你的精准用户,这里推荐一篇卢松松博客《你这一辈子,有没有为五毛钱拼过命?》,会打开你对利益营销的思想大门!
接下来切入正题,口令红包需要在服务号的基础上体验最完善,订阅号只能做“文字口令”。原理直接上代码!
$server = $this->wxapp()->server;
$server->push(function ($message) {
$wxid = $message['ToUserName'];
$openid = $message['FromUserName'];
switch ($message['MsgType']) {
case 'text':
$text = new ServiceProcess();
return $text->processPutTxt($wxid, $openid, $message['Content']);
break;
case 'voice':
if ($message['Recognition']) {
$regstr = '/[[:punct:]]|[[:lower:]]|。|,|,/i';
$word = preg_replace($regstr, '', $message['Recognition']);
$one = Db::name('wx_luckcode')->where('code', $word)
->where('gh_id', $wxid)
->find(); // 还剩余多少现金红包
if ($one != null && $one['leftnum'] > 0) {
$group = new ServiceLuckmoney();
return $group->ProcessCode($wxid, $word, $openid);
}
if (strstr($word, '天王盖地虎') || strstr($word, '口令')) {
$word = str_replace('天王盖地虎', '', $word);
$word = str_replace('口令', '', $word);
$word = str_replace(' ', '', $word);
$group = new ServiceLuckmoney();
return $group->ProcessCode($wxid, $word, $openid);
} else {
$text = new ServiceProcess();
return $text->processPutTxt($wxid, $openid, $word);
}
} else {
return '亲,我只是个机器人啊,听不懂你说什么啊!';
}
break;
以上代码示例讲述了一个利用语音做口令红包的基础配置:语音转化成为文字,文字去触发获得红包的机会。
当然,如果你希望每一个参与者都获得红包的机会,那么你的成本可能会很高,所以在触发获得红包的机会的时候,希望你能够用随机概率或者稳定的红包兑现规律。
以下为我如何利用随机数拒绝口令和利用规律发放红包的实现,该方法为可行的直接实现方式,你可以通过各项判断条件揣摩出具体的模块设计思路:
if (rand(1, 10) == 8) {
return new Text('现在抽奖人数太多,请稍后再试!');
}
$tao = '/太阳/太阳/太阳 铜梁视窗合伙人计划招募中<a href="https://mp.weixin.qq.com/s/seuptyomIZYaHZ35j6dlsA">#点击了解详情#</a>';
$one = $this->where('code', $code)
->where('gh_id', $gh_id)
->find(); // 还剩余多少现金红包
if ($one == null) {
return new Text('您的口令错误【' . $code . '】!请在本公众号文章中找寻正确口令');
}
if ($one['starttime'] > time() || $one['endtime'] < time()) {
return new Text('口令使用时间为' . date('Y-m-d H:i:s', $one['starttime']) . '至' . date('Y-m-d H:i:s', $one['endtime']));
}
if ($one['totalnum'] == 0 && $one['leftnum'] == 0) {
return new Text('现在的口令是:' . $one['othercode']);
}
if ($one['leftnum'] <= 0) {
$othercode = $tao;
if (strlen($one['othercode']) > 1) {
$othercode = '
今天的红包早早被领完,要不咱们再加一个?
试试 ' . $one['othercode'];
}
return new Text('今日口令"' . $code . '"红包' . $one['totalnum'] . '个已领完。
请关注明日微信公众号推文,寻找当天口令!
您也可以点击=><a href="' . $one['jumpurl'] . '">#这里#</a>了解他们的活动详情
加客服daneas2014详询活动日程和诸多好物推荐!' . $othercode);
}
$db = Db::name('wx_luckcodelog');
$logs = $db->where('code', $code)
->where('openid', $openid)
->where('gh_id', $gh_id)
->count();
if ($logs >= $one['maxnum']) {
return new Text('您今天的口令次数已耗尽(共' . $one['maxnum'] . '次),还剩余' . $one['leftnum'] . '个现金红包哟,赶紧邀约你的好友参与吧' . $tao);
}
$log = $db->where('code', $code)
->where('openid', $openid)
->where('gh_id', $gh_id)
->where('money', 1)
->find();
// 生成现金红包
if ($log == null) {
if ($one != null && $one['leftnum'] > 0 && ($db->where('code', $code)->count()) % $one['rate'] == 0) {
$type = $one['leftnum'] > 3 ? rand(1, 2) : 1;
if ($type == 2 && rand(1, 4) == 4) {
$type = 2;
} else {
$type = 1;
}
if ($type == 1) {
$this->where('code', $code)->setDec('leftnum', 1);
} else {
$this->where('code', $code)->setDec('leftnum', 3);
}
$db->insert([
'openid' => $openid,
'code' => $code,
'gh_id' => $gh_id,
'money' => 1,
'createtime' => time()
]);
return new Text(self::CreateLuckM($gh_id, $openid, $type));
}
}
// 生成券包
$db->insert([
'openid' => $openid,
'code' => $code,
'gh_id' => $gh_id,
'money' => 0,
'createtime' => time()
]);
$random = rand(0, 1);
if ($random == 0) {
return new Text('(⊙o⊙)… 这次你啥也没中,继续关注本活动总会有搞着的' . $one['jumpurl']);
}
return new Text(self::CreateLuckC($gh_id, $openid, $one['jumpurl'], $one['jumpword']));
最后关于“CreateLuckC”,这个方法是具体的如何发放红包功能,可以通过配置微信支付链接,用户点击即可获得,例如下方效果,感兴趣的朋友们可以复制代码体验一下,备注Easywechat请使用最新版本哟。
本频道需要登陆后才能评论,请登录