dlds/yii2-mlm
Composer 安装命令:
composer require dlds/yii2-mlm
包简介
Yii2 Multi Level Marketing component
关键字:
README 文档
README
Module handles rewards generating from appropriate subjects.
Installation
composer require dlds/yii2-mlm
What is MLM?
MLM is referal marketing system where user get reward for succesfull produc sharing/solding. It is similar to Affiliate marketing but has more then one rewards level. In MLM you build your own structure (own team) of users.
Exmaple:
| –– YOU
| –––– BOB (1st level rewards)
| –––––––– ROBERT (2st level rewards)
| –––– ALICE (1st level rewards)
| –––––––– JIMMY (2st level rewards)
| –––––––– GEORGE (2st level rewards)
| ––––––––––––– MARK (3st level rewards)
In this scenario you will get some reward when any of 6 users in your structure buy a product.
Entities in Module
Folowing naming and entities are used in MLM module.
Subject
Class which is used as source for reward generation. It is usually some sort of ProductOrder or other entity which works with user payments.
Participant
Class which represents user identity among MLM structure.
Reward
Class which represents single rewards entry.
Implementation of module
First of you have to prepare your database. There is MySQL Workbench schema / SQL import script showing simple example of DB structure required for implementation in app/data folder.
There are following tables:
- subject
- participant
- rwd_basic
- rwd_extra
- rwd_custom
As you can see there are 3 types of rewards. There is no need to use all 3 types. Standart rewards are held in table rwd_basic. More about rewards types in secrion Reward Types.
Then you have to implement following interfaces into your application.
MlmSubjectInterface
This interfaces is usually implemented by something like ProductOrder.php
MlmParticipantInterface
This interfaces is usually implemented by something like UsrIdentityModel.php
MlmRewardInterface
This interfaces is usually implemented by something like OrderReward.php
How module works?
After required implementation the rewards generation and verification is processed automatically by cron and console commands.
When Subject is ready to generate rewards module will automatically generate appropiate amount of rewards based on module setup.
During creation each participant is verified if is eligible to take rewards.
After then each of this rewards is verified when reach the end of protection period of time (e.g. 14 days in which the subject order can be cancelled by user)
After that reward is approved and is ready to pay off. Paying off handling is not part of this module yet.
Module Setup
Module provides bunch of setup options which can change the rewards generation.
rules array
Defines procentual amount of subject price will be used for each level of reward.
Example showing 40% of subject price is pushed into rewards and spread among 5 levels:
[
1 => 20,
2 => 10,
3 => 5,
4 => 3,
5 => 2
]
limitRules int
Restriction for rules configuration. Defines maximal procentual sum of all rules. In example above 40 will be suitable.
delayPending int (unix format)
Indicates how long will every single reward be in protection state. During this time the reward will have PENDING state. After this delay the APPROVED/DENY state will be used.
For 1 day the value 86400 must be used. It is unix value for one day: 14 * 24 * 60 * 60 = 86400
roundPrecision int
Number of decimal places for reward value.
roundMode enum (Mlm::MLM_ROUND_UP | Mlm::MLM_ROUND_DOWM)
Indicates if reward value will be rounded up or down.
skipWorthlessRewards boolean
When true the zero reward or rewards which value is 0.0000... after rounding will be ignored.
clsParticipant string
Participant model class name in your application.
clsRewardBasic string
Basic Rewards model class name in your application.
clsSubjects array
Class names of all subjects in your application. You can have 1 to N subjects defined in this array and all will get rewards.
isCreatingActive boolean
Enables / disables reward creation.
isVerifyingActive boolean
Enables / disables reward verification. Verification is processed after protection period.
isLevelRestrictionAllowed
When true the rewards will be created with special verification on participant. As default the participant is verified only if is eligible to take rewards. But when Level Restriction is Allowed the participant will be verified if is eligible to take reward of specific level in structure.
This means that you can restrict some participant to be able to take only 1st and 2nd level of rewards and another participant to be able to take all levels of rewards.
dlds/yii2-mlm 适用场景与选型建议
dlds/yii2-mlm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.78k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2015 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「component」 「yii2」 「mlm」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dlds/yii2-mlm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dlds/yii2-mlm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dlds/yii2-mlm 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
FSi DataSource Component
A custom URL rule class for Yii 2 which allows to create translated URL rules
Priveate for SkeekS CMS
Library for working with mlm matrices
Class Library For the Nubersoft API Service
SCEditor, a lightweight WYSIWYG BBCode & HTML editor extension for Yii 2.0 Framework
统计信息
- 总下载量: 3.78k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2015-04-11