|
|
@@ -33,6 +33,7 @@ use common\models\CalcBonusXF;
|
|
|
use common\models\CalcBonusYC;
|
|
|
use common\models\CalcBonusYJ;
|
|
|
use common\models\CalcMonthBonusUser;
|
|
|
+use common\models\Config;
|
|
|
use common\models\FlowDeductZR;
|
|
|
use common\models\PerfCompany;
|
|
|
use common\models\PerfMonth;
|
|
|
@@ -86,6 +87,8 @@ class BonusCalc extends BaseObject {
|
|
|
|
|
|
const LOOP_FINISH = 1;
|
|
|
const LOOP_CONTINUE = 2;
|
|
|
+ const GX_FLOOR_LIMIT = 5; // 共享奖向上找的最大层级
|
|
|
+ const GX_LIMIT_SWITCH = true; // 是否开启共享奖向上找的最大限制 true 为开启 false 关闭
|
|
|
|
|
|
const ORDER_TYPE_TO_FW_COEFFICIENT = [
|
|
|
'ZC' => 'fwCoefficientFromZc',
|
|
|
@@ -1453,6 +1456,12 @@ class BonusCalc extends BaseObject {
|
|
|
if ($allData) {
|
|
|
echo sprintf("时间:[%s]共享奖,当前offset为:【%s】" . PHP_EOL, date('Y-m-d H:i:s', time()) , $offset);
|
|
|
$insertBonusData = [];
|
|
|
+ // 获取线上找几层和是否开启找几层的限制
|
|
|
+ $configsGx = Config::find()->where(
|
|
|
+ 'CONFIG_NAME="gxNoPvFindLimitSwitch" OR CONFIG_NAME="gxNoPvFindLimitTimes"'
|
|
|
+ )->orderBy('SORT ASC')->indexBy('CONFIG_NAME')->asArray()->all();
|
|
|
+ $openFindLimit = isset($configsGx['gxNoPvFindLimitSwitch']) ? $configsGx['gxNoPvFindLimitSwitch']['VALUE'] : 1; // 是否开放了 得奖人不满足980就找一个满足980的人来得这个奖 的最大向上循环次数
|
|
|
+ $findLimitTimes = isset($configsGx['gxNoPvFindLimitTimes']) ? $configsGx['gxNoPvFindLimitTimes']['VALUE'] : 5 ; // 开放的限制层数
|
|
|
foreach ($allData as $userId) {
|
|
|
$bonusUserData = [];
|
|
|
$bonusPercentOne = $this->_sysConfig['shareRecPercent']['VALUE'] / 100;
|
|
|
@@ -1513,7 +1522,7 @@ class BonusCalc extends BaseObject {
|
|
|
// unset($bonusUserDataEvery, $bonusUserId);
|
|
|
// continue;
|
|
|
//得奖人不满足980就找一个满足980的人来得这个奖
|
|
|
- $bonusUserId = $this->getMinBdPvNetworkParent($bonusUserId);
|
|
|
+ $bonusUserId = $this->getMinBdPvNetworkParent($bonusUserId, $openFindLimit, $findLimitTimes);
|
|
|
if ( !$bonusUserId ) {
|
|
|
unset($bonusUserDataEvery, $bonusUserId);
|
|
|
continue;
|
|
|
@@ -2772,14 +2781,22 @@ class BonusCalc extends BaseObject {
|
|
|
* @param $userId
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function getMinBdPvNetworkParent($userId) {
|
|
|
+ public function getMinBdPvNetworkParent($userId, $openFindLimit = 1, $findLimitTimes = 5) {
|
|
|
$validParentId = '';
|
|
|
- $this->loopNetworkParentDo($userId, function ($parent) use(&$validParentId) {
|
|
|
+ $validDeep = 1;
|
|
|
+ $this->loopNetworkParentDo($userId, function ($parent) use(&$validParentId,&$validDeep,$openFindLimit,$findLimitTimes) {
|
|
|
if ( $this->checkSmallMarketPerf($parent['PARENT_UID']) ) {
|
|
|
$validParentId = $parent['PARENT_UID'];
|
|
|
unset($parent);
|
|
|
return self::LOOP_FINISH;
|
|
|
}
|
|
|
+ // 只找5层
|
|
|
+ if ( $openFindLimit && $validDeep >= $findLimitTimes ) {
|
|
|
+ unset($parent);
|
|
|
+ return self::LOOP_FINISH;
|
|
|
+ }
|
|
|
+
|
|
|
+ $validDeep += 1;
|
|
|
unset($parent);
|
|
|
});
|
|
|
|