调研发现任何一款有背景的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 HHYAESfrom vcoin.views import VCoinManagerdef 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