zoukankan      html  css  js  c++  java
  • 如何设计一套积分系统(附django开源模块)

    调研发现任何一款有背景的app都离不开积分系统,甚至有的app本身就是积分系统!本文将重点介绍开源积分框架vcoin,以及使用方式

    价值体系

    作为个人开发者或者公司运营的产品,都离不开价值体系,更直接一点的就是微信支付宝支付功能,还有积分兑换礼品,主要为了裂变和营销,如果你的产品中没有价值体系,只能靠广告变现了,所以价值体系很重要

    vcoin是个什么鬼

    vcoin是最近刚开源的django模块,开发语言是python;直接使用pip install就可以完成安装使用!整个积分系统与业务完全隔离,上层业务逻辑在需要积分的增删改查冻结回退等操作的时候,直接调用积分系统静态方法即可!如果你有很多app或者产品,这一套是可以无限复用的!

    使用方式

    =====
    django-vcoin

    =====

    django-vcoin project is coin application for hehuoya.com

    virtual coin for app

    Quick start

    1. Add "vcoin" to your INSTALLED_APPS setting like this::

      INSTALLED_APPS = [
      ...
      'vcoin',
      ]

    2. Include the class in your project views.py like this::
      from vcoin.Checker import HHYAES
      from vcoin.views import VCoinManager

    and then pass your user token for vcoin

    aes_encrypt_data = HHYAES.aes_encrypt(utoken.decode(encoding='utf-8'))
    utoken = base64.b64encode(aes_encrypt_data.encode('utf-8'))
    VCoinManager.freezeCoin(utoken, 50, 1)

    1. Run python3 manage.py makemigrations vcoin to create the vcoin models.

    2. Run python3 manage.py migrate to create the vcoin models.

    3. Start the development server and visit http://127.0.0.1:8000/admin/
      to create a models if needed (you'll need the Admin app enabled).

    demo:

    from vcoin.Checker import HHYAES
    from vcoin.views import VCoinManager
    
    def index(request):
        current_milli_time = int(round(time.time() * 1000))
        utoken = ('AABBB>' + str(current_milli_time)).encode("utf-8")
        aes_encrypt_data = HHYAES.aes_encrypt(utoken.decode(encoding='utf-8'))
        utoken = base64.b64encode(aes_encrypt_data.encode('utf-8'))
        # 对base64的tokenAES加密
        VCoinManager.provideCoin(user_token=utoken, coin_count=10, coin_type=1)
        return HttpResponse(utoken)
    
    

    欢迎关注 www.hehuoya.com

    个人网站地址:https://hehuoya.com 专 业:计算机科学与技术 先后入职 360、新氧、自如
  • 相关阅读:
    Could A New Linux Base For Tablets/Smartphones Succeed In 2017?
    使用libhybris,glibc和bionic共存时的TLS冲突的问题
    6 Open Source Mobile OS Alternatives To Android in 2018
    Using MultiROM
    GPU drivers are written by the GPU IP vendors and they only provide Android drivers
    Jolla Brings Wayland Atop Android GPU Drivers
    How to Use Libhybris and Android GPU Libraries with Mer (Linux) on the Cubieboard
    闲聊Libhybris
    【ARM-Linux开发】wayland和weston的介绍
    Wayland and X.org problem : Why not following the Android Solution ?
  • 原文地址:https://www.cnblogs.com/huntaiji/p/15780602.html
Copyright © 2011-2022 走看看