Coder Social home page Coder Social logo

lottery-jx3box's Introduction

抽奖

该抽奖程序 每次可以抽取多个不同奖品。

效果: TODO 补充B站地址

直接使用

下载本项目的release, 然后 参考 配置文件说明 进行配置

window

直接双击运行 双击 app.exe.

linuxmac

终端执行 ./app

然后用 chrome 打开 http://localhost:14422/ 即可。 windowlinux下 按F11全屏, mac好像是 cmd + shift + f全屏

操作说明

在浏览器查看使用说明即可

二次开发

LinuxMac 执行:

go run main.go
# 新开终端
cd web-src
yarn install # npm install
yarn start # npm start

window 下建议使用WSL进行二次开发和部署

编译

运行脚本build.sh

该脚本不提供 maclinux的跨平台编译。

由于本程序使用了 sqlite3 如果需要跨系统编译需要gcc,那么进行下面软件安装。

【或者 通过修改 database/init.go第9行第22行替换成mysql来避免使用gcc编译】

macubuntu下编译window版本

需要安装:

mac: brew install mingw-w64

ubuntu: sudo apt-get install gcc-mingw-w64

maclinux的相互编译

mac下编译 linux版本,或者 linux下编译mac版本 都不推荐使用跨平台编译。 推荐在部署机上克隆代码后进行本机build

动画配置

参数定义在: web-src/lib/game.tsIAnimationIEndingAnimation 参数配置在: web-src/Lottery.tsxcomponentDidMountnew GameScreen

使用IDE搜索即可找到具体代码

配置文件说明

demo数据

启动浏览器后 在 数据配置 点击 生成测试配置,然后点击读取配置生成数据 即可生成demo数据

生产环境

按照下文配置好配置文件后 ,在浏览器后数据配置 点击读取配置生成数据 即可生成配置好的数据

用户池 配置

修改文件 lottery/conf/user.json

[
    {
        "name": "用户名",
        "avatar":"头像",
        "uuid":"用户唯一标识",
        "pool": "用户池" // 抽奖时 有多个用户池,可选,默认为
    },
    // ...
]

奖品列表 配置

修改文件 lottery/conf/award.json

[
    {
        "id": 1 , // 奖品id,不重复
        "name": "奖品名称",
        "avatar":"奖品图片",
    },
    {
        "id": 2 , 
        "name": "...",
        "avatar":"...",
    }
    // ...
]

抽奖配置

文件 setting.json 放在lottery/conf/setting.json

抽奖将按配置依次进行。

[
    // 第一条配置表示,第一轮 从用户池1 抽取 奖品1 10个,奖品2 5个
    {
        "pool":"用户池1", //可选
        "rule":[{
            "award_id": 1, // 奖品id, 请用 奖品配置 award.json 里面的id,
            "count": 10, // 抽多少个奖品,如果每轮抽奖有多个奖品,数组里面填多个奖品的抽奖数量,
        },
        {
            "award_id": 2, // 奖品id, 请用 奖品配置 award.json 里面的id, 如果每轮抽奖有多个奖品,数组里面填多个id
            "count": 5, // 抽多少个奖品,如果每轮抽奖有多个奖品,数组里面填多个奖品的抽奖数量, 
        }]
    },
    // 第二条配置表示,第二轮 从用户池2 抽取 奖品3 20个
    {
        "pool":"用户池2",
        "rule":[{
            "award_id": 3, 
            "count": 20,
        }]
    }
]

License

MIT

打赏

如果对你有帮助,可以请喝咖啡。【请备注github帐户】

lottery-jx3box's People

Contributors

huyinghuan avatar iruxu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.