微信小程序抽奖平台源码(4套)

一,https://github.com/tuoxie15/LuckDrawProgram

    页面

├── home                   首页 奖品列表页
├── luckDraw               奖品详情页 抽奖页
├── personalCenter         个人中心 我参加的抽奖、中奖纪录、收货地址
├── past                   我参与过的抽奖页 待开奖、已结束
├── prize                  中/未中奖展示页、分享页、通过通知点进去展示页
├── record                 中过奖的记录页
├── portraitList           头像列表
├── FLBRecord              福利分领取记录
├── exchangeDetails        兑换商品详情
├── exchangeRecord         兑换商品记录
├── rankingList            排行榜
├── strategy               赚币攻略
|—— getMoreFLC             福利分页面 获得更多福利分
|—— historyDraw            历史抽奖
|—— sponsor                成为赞助商
|—— feedBack               意见反馈

二,https://github.com/ezshine/mp_luckydraw

一套微信小程序抽奖平台(包含全部前后端源码)

功能介绍

1、口令抽奖: 大家都知道小程序的限制颇多,不能引导回公众号,即使关联跳转小程序,也有数量限制。口令抽奖一来可以限制参与抽奖的人,二来可以通过口令提示引导回公众号下发口令,带动关注。

2、限定地点: 我希望这个小程序未来也可以帮助线下的商户发起抽奖活动,那么做一个参与的位置电子围栏是很有必要的。

3、限定性别: 不多解释

4、条码解锁: 这个的思路也很好玩,让抽奖活动需要触发扫描特定的条形码方可参与。那么自然特别适合快速消费品品牌来玩。

5、RP币

三,https://github.com/ifanrx/hydrogen-lottery-miniprogram

知晓云抽奖小程序

四,https://github.com/wang-binbin/smallAppsLottery

golang交叉编译

Windows主机编译Linux,MAC客户端

Windows主机编译Windows客户端

SET CGO_ENABLED=0
SET GOOS=windows
SET GOARCH=amd64
go build -o client-windows.exe main.go

Windows主机编译LINUX客户端

SET CGO_ENABLED=0
SET GOOS=linux
SET GOARCH=amd64
go build -o client-linux main.go

Windows主机编译MAC客户端

SET CGO_ENABLED=0
SET GOOS=darwin
SET GOARCH=amd64
go build -o client-mac main.go

Linux主机编译Widows,MAC客户端

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o client-linux main.go
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o client-mac main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o client-windows.exe main.go

MAC主机编译Widows,linux客户端

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o client-linux main.go
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o client-mac main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o client-windows.exe main.go

PHP7.3 zts(线程安全)编译以及多线程(pthreads)使用

下载PHP

下载地址:https://www.php.net/downloads.php,开始下载:

su root
mkdir tmp
cd tmp
wget https://www.php.net/distributions/php-7.3.7.tar.bz2

编译安装PHP开启线程安全

tar -jxvf php-7.3.7.tar.bz2
cd php-7.3.7
yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libicu-devel

编译

./configure \
--prefix=/usr/local/php-7.3.7-ts \
--enable-maintainer-zts \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-bcmath \
--enable-exif \
--enable-intl \
--enable-mbstring \
--enable-pcntl \
--with-pdo-mysql \
--enable-sockets \
--enable-mysqlnd \
--with-gd

然后:

make && make install

更新autoconf

Autoconf version 2.68 or higher is required错误是才需要此步骤

wget http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
tar -zxvf autoconf-latest.tar.gz 
cd autoconf-2.69/
.configure
make
make install
autoconf --version 

安装pthreads

git clone https://github.com/krakjoe/pthreads.git
cd pthreads
/usr/local/php-7.3.7-ts/bin/phpize
./configure --with-php-config=/usr/local/php-7.3.7-ts/bin/php-config
make
make install

修改 /usr/local/php-7.3.7-ts/lib/php.ini,增加 extension=pthreads

测试pthreads

/usr/local/php-7.3.7-ts/bin/php worker.php

<?php

class MyWorker extends Worker
{
    public $id;
    public $time;

    public function __construct($id, $time)
    {
        $this->id = $id;
        $this->time = $time;
    }

    public function run()
    {
        while (true) {
            echo sprintf(worker %s is running, %s\n, $this->id, date('Y-m-d H:i:s'));
            sleep($this->time);
        }
    }
}

class MyManager
{
    /**
     * @var MyWorker[]
     */
    protected $workers;

    public function add(MyWorker $work)
    {
        $this->workers[$work->id] = $work;
        echo 'add worker' . $work->id . \n;
    }

    public function run()
    {
        foreach ($this->workers as $id => $work) {
            echo 'run worker' . $work->id . \n;
            $work->start();
        }
    }
}

$manager = new MyManager();
$manager->add(new MyWorker('1', 1));
$manager->add(new MyWorker('2', 3));
$manager->run();

nginx access log 记录cgi执行时间

log_format combined_with_time '$remote_addr - $remote_user [$time_local]  '
                     '$request $status $body_bytes_sent '
                     '$http_referer $http_user_agent '
                     '$request_time $upstream_response_time';

access_log  /data/wwwroot/xxxx/vagrant/nginx/log/frontend-access.log combined_with_time;

firebase替代

Google的firebase只能在国外用,且不开源,国内的有野狗、leancloud都是小厂。

参考

PouchDB

PouchDB is an open-source JavaScript database inspired by Apache CouchDB that is designed to run well within the browser.

PouchDB was created to help web developers build applications that work as well offline as they do online.

It enables applications to store data locally while offline, then synchronize it with CouchDB and compatible servers when the application is back online, keeping the user\'s data in sync no matter where they next login.

var db = new PouchDB('dbname');

db.put({
  _id: 'dave@gmail.com',
  name: 'David',
  age: 69
});

db.changes().on('change', function() {
  console.log('Ch-Ch-Changes');
});

db.replicate.to('http://example.com/mydb');

CouchDB

Apache CouchDB™ lets you access your data where you need it. The Couch Replication Protocol is implemented in a variety of projects and products that span every imaginable computing environment from globally distributed server-clusters, over mobile phones to web browsers.

Store your data safely, on your own servers, or with any leading cloud provider. Your web- and native applications love CouchDB, because it speaks JSON natively and supports binary data for all your data storage needs.

The Couch Replication Protocol lets your data flow seamlessly between server clusters to mobile phones and web browsers, enabling a compelling offline-first user-experience while maintaining high performance and strong reliability. CouchDB comes with a developer-friendly query language, and optionally MapReduce for simple, efficient, and comprehensive data retrieval.

$ curl -X PUT http://127.0.0.1:5984/my_database/001 -d
'{  Name  :  Raju  ,  age  : 23  ,  Designation  :  Designer  }'

{ok:true,id:001,rev:1-1c2fae390fa5475d9b809301bbf3f25e}

gunDB

A realtime, decentralized, offline-first, mutable graph protocol to sync the web. https://gun.eco/docs

<script src=https://cdn.jsdelivr.net/npm/gun/gun.js></script>
<script>
// var Gun = require('gun'); // in NodeJS
// var Gun = require('gun/gun'); // in React
var gun = Gun();

gun.get('mark').put({
  name: Mark,
  email: mark@gunDB.io,
});

gun.get('mark').on(function(data, key){
  console.log(update:, data);
});
</script>

gun官网

RxDB

⛁ A realtime Database for JavaScript Applications https://rxdb.info/

myCollection.insert({
  name: 'foo',
  lastname: 'bar'
});
const query = myCollection
    .find()
    .where('age')
    .gt(18);

Meteor

Meteor is a full-stack JavaScript platform for developing modern web and mobile applications. Meteor includes a key set of technologies for building connected-client reactive applications, a build tool, and a curated set of packages from the Node.js and general JavaScript community.

  • Meteor allows you to develop in one language, JavaScript, in all environments: application server, web browser, and mobile device.
  • Meteor uses data on the wire, meaning the server sends data, not HTML, and the client renders it.
  • Meteor embraces the ecosystem, bringing the best parts of the extremely active JavaScript community to you in a careful and considered way.
  • Meteor provides full stack reactivity, allowing your UI to seamlessly reflect the true state of the world with minimal development effort.

Meteor 官网

import { Mongo } from 'meteor/mongo'; 
export const Tasks = new Mongo.Collection('tasks'); 
import { Tasks } from '../api/tasks.js'; 
db.tasks.insert({ text: Hello world!, createdAt: new Date() });

Kinto

Kinto is a minimalist JSON storage service with synchronisation and sharing abilities. It is meant to be easy to use and easy to self-host.

Kinto is used at Mozilla and released under the Apache v2 licence.

http GET https://kinto.dev.mozaws.net/v1/buckets/default/collections/tasks/records \
       -v --auth 'bob:s3cr3t'

Kinto文档

Kinto官网

Hoodie

Hoodie is a free and Open Source Software for building applications for the web and iOS. It is a complete backend for your apps, ready for you to get creative. It works immediately out-of-the-box: develop your frontend code, plug it into Hoodie’s frontend-friendly API and your app is ready.

When you develop it, your app runs locally first, you can then deploy and host it wherever you want to. And if you want to extend Hoodie’s core features, you can check our list of currently available plugins or build plugins yourself.

Hoodie is a noBackend technology — it\'s there for making the lives of frontend developers easier by abstracting away the backend and keeping you from worrying about backends. It gives you Dreamcode: a simple, easy-to-learn-and-implement frontend API built into it. Hoodie is also Offline First, which means that your app users’ data is stored locally by default so your Hoodie-based apps are accessible and usable anytime, independent from your users’ internet connection.

hoodie.store.add({
    type: 'todo-item',
    content: 'Try out hoodie!',
    done: false
})

letsencrypt https证书自动更新和续期(支持泛域名)

https://github.com/tengattack/certbot-dns-aliyun

获取证书

certbot certonly -a certbot-dns-aliyun:dns-aliyun \
    --certbot-dns-aliyun:dns-aliyun-credentials aliyun.ini \
    -d c4ys.com \
    -d *.c4ys.com

更新证书

certbot renew

自动重新加载nginx(需要更新成功后,所以等前一个任务进行几分钟之后再执行)

nginx -s reload

基于微信的一些开源工具

Android -Xposed

项目地址:https://github.com/weechatfly/wtoolsdkrobot

项目简介:有趣的微信机器人,基于Xposed

开发语言:Java

项目地址:https://github.com/weechatfly/wtoolsdkroomlive/

项目简介:有趣的微信转发程序,用于微信群直播

开发语言:Java

项目地址:https://github.com/chaojimiaomiao/colorful_wechat

项目简介:微信美化插件,开发者是个大美女

项目地址:https://github.com/geeeeeeeeek/WeChatLuckyMoney

项目简介:微信抢红包外挂插件

开发语言:Java

WEB

项目地址:https://github.com/lu4kyd0y/WeChat-Cloud-Robot

项目简介:基于网页版的微信机器人

开发语言/框架:python

项目地址:https://github.com/sjdy521/Mojo-Weixin

项目简介:基于网页版的微信WEB版协议框架,可用于IRC转发

开发语言:Python

IOS-TWEAK

项目地址:https://github.com/cocos543/WeChatTimeLineRobot

项目简介:朋友圈自动点赞评论机器人

开发语言:C++

MacOSX-Tweak

项目地址:https://github.com/Sunnyyoung/WeChatTweak-macOS

项目简介:Mac微信多开及防撤回插件

开发语言:Objective-C

协议

Tencent/mars

Mars is a cross-platform network component developed by WeChat.

https://github.com/Tencent/mars

WeChatXY

微信ipad协议源码,可实现微信80%功能。支持62数据登录、扫码登录、收发朋友圈、查看朋友圈、微信建群、微信拉人进群、微信公众号阅读、微信消息收发、微信附近的人定位、微信添加好友、微信红包接收、微信防撤回、分享小程序、微信加粉、微信收藏、微信标签等。请联系qq:929918989

https://github.com/weixinbao/WeChatXY

PadChat-SDK

永久免费 微信ipad、微信mac协议,可实现微信80%功能;支持62数据登录、扫码登录、收发朋友圈、查看朋友圈、微信建群、微信拉人进群、微信公众号阅读、微信消息收发、微信附近的人定位、微信添加好友、微信红包接收、微信防撤回、分享小程序、微信加粉、微信收藏、微信标签等

https://github.com/AvengersWeChat/PadChat-SDK

PyMicroChat

https://github.com/fatesinger/PyMicroChat

MicroChat

使用腾讯微信Mars跨平台通信库实现模拟微信App通信

https://github.com/FlyingGlass/MicroChat

WeChatProtocolStudy

微信协议研究,实现基于Android/MAC/IPAD协议的PC客户端

https://github.com/214175590/WeChatProtocolStudy

SDK

Chatie/wechaty

wechaty-puppet-puppeteer - Angular Hook for Web Wechat <- This is the DEFAULT
wechaty-puppet-wechat4u - HTTP API for Web Wechat
wechaty-puppet-padchat - iPad App Protocol
wechaty-puppet-ioscat - iPhone App Hook
wechaty-puppet-mock - Mock for Testing

https://github.com/Chatie/wechaty

Python进入交互模式4种方法

使用python -i参数

添加-i参数

python -i myapp.py

使用code.interact()

    import code
    # before
    code.interact()
    # after

使用pdb lib

for thing in set_of_things:
    import pdb;
    pdb.set_trace()
    do_stuff_to(thing)

使用IPython embed

from IPython import embed

for thing in set_of_things:
  embed()
  do_stuff_to(thing)

忘读读书法

有没有一种(功利的)读书法,读得快但是效果又最好?

进过不懈的努力,这个读书法被我发现了,就是“忘读读书法”。

这个方法类似张三丰教张无忌的太极神功,强调一个“忘”字。

方法原理:为什么是“忘”?我们相信:

  • 记住几个关键词,比记住整本书要容易得多
  • 记住当前最有效的部分并行动,比按照整本书去行动可行性更高
  • 书本的价值在于你利用多少,而不在于你知道多少

方法步骤:

  • 找到一步本书进行阅读,阅读的时候思考当前阅读的内容是否有新的观点,这个观点是否能够作为自己未来的人生信条和行为纲领,如果不是则忘掉,如果是则标记,这样读完;(因为一本书能够作为信条和纲领的比较少,所以能很快读完)
  • 重新阅读标记部分,提炼成几个关键字,根据关键字形成自己的关键字理解笔记(理解归纳,便于形成自己观点)
  • 将关键字作为自己未来的人生信条和行为纲领(学以致用)

《马云:未来已来》读后感 – 担当、乐观与坚持

担当

有担当才有未来,担当是个人和企业的对人类未来的价值和意义,担当能保证方向正确

  • 一家伟大的公司,必须解决社会问题
  • 企业家要思考十年之后的事
  • 如果地球病了,没有人会健康
  • 公益的本质是唤醒善良
  • 我相信,要改变世界,先改变自己,改变自己比改变世界更重要,也更简单。然后,我想改善世界。

乐观

机会就在被抱怨的地方,人类只要还存在不满,就不会停止进步,我们就还有机会

  • 机会就在被抱怨的地方
  • 所谓改革就是改革自己

坚持

三十年后不忘初心,就是成功

  • 少一些抱怨,多一些坚持
  • 三十年后不忘初心,就是成功
  • 一家企业没有经历过残酷时代,经不起风浪
  • 在阳光灿烂的日子修屋顶,年轻力壮的的时候生孩子
  • 晚上想想千条路,早上醒来走原路