root 3 سال پیش
والد
کامیت
4cdacaf36e
2فایلهای تغییر یافته به همراه78 افزوده شده و 0 حذف شده
  1. 23 0
      common/helpers/bonus/BonusCalc.php
  2. 55 0
      common/models/GxlimitLog.php

+ 23 - 0
common/helpers/bonus/BonusCalc.php

@@ -44,6 +44,7 @@ use common\models\DeclarationLevel;
 use common\models\DecOrder;
 use common\models\EmployLevel;
 use common\models\FlowBonus;
+use common\models\GxlimitLog;
 use common\models\PerfActiveUser;
 use common\models\ScoreMonth;
 use common\models\User;
@@ -1518,6 +1519,17 @@ class BonusCalc extends BaseObject {
                                 'bonus' => $shareBonusTwo,
                                 'validMinPv' => true,
                             ];
+                            // 增加分享log-----------------------
+                            $gxLimitModel = new GxlimitLog();
+                            $gxLimitModel->NOW_SHARE_TIMES = $shareTimes; // 当前分享得第几次
+                            $gxLimitModel->SHARE_USER_ID = $userId; // 分享奖励者用户ID
+                            $gxLimitModel->WINNER_USER_ID = $parent['PARENT_UID'];// 活得共享奖励者ID
+                            $gxLimitModel->SHARE_TYPE = 1; //得奖类型  1为向下找五次记录  2为得共享奖金记录(过滤掉未满足)
+                            $gxLimitModel->ADD_TIME = date('Y-m-d H:i:s', time());
+                            $gxLimitModel->AMOUNT = $shareBonusTwo;
+                            $gxLimitModel->ORI_AMOUNT = $shareBonusTwo;
+                            $gxLimitModel->save();
+                            // 增加分享log-----------------------
                         }
                         //判断$parent是否有首单团队奖
                         $parentBonus = CalcCache::bonus($parent['PARENT_UID'], $this->_periodNum);
@@ -1562,6 +1574,17 @@ class BonusCalc extends BaseObject {
 
                     //扣除相应的复消积分和管理费
                     $deductData = $this->deduct($bonusUserId, $bonus);
+                    // 增加分享log-----------------------
+                    $gxLimitModel = new GxlimitLog();
+                    $gxLimitModel->NOW_SHARE_TIMES = 0; // 当前分享得第几次
+                    $gxLimitModel->SHARE_USER_ID = $userId; // 分享奖励者用户ID
+                    $gxLimitModel->WINNER_USER_ID = $bonusUserId;// 活得共享奖励者ID
+                    $gxLimitModel->SHARE_TYPE = 2; //得奖类型  1为向下找五次记录  2为得共享奖金记录(过滤掉未满足)
+                    $gxLimitModel->ADD_TIME = date('Y-m-d H:i:s', time());
+                    $gxLimitModel->AMOUNT = $deductData['surplus'];
+                    $gxLimitModel->ORI_AMOUNT = $bonus;
+                    $gxLimitModel->save();
+                    // 增加分享log-----------------------
 
                     CalcCache::bonus($bonusUserId, $this->_periodNum, 'BONUS_GX', $bonus, $deductData);
                     CalcCache::addHasMonthBonusUsers($bonusUserId, $this->_periodNum);

+ 55 - 0
common/models/GxlimitLog.php

@@ -0,0 +1,55 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "{{%GXLIMIT_LOG}}".
+ *
+ * @property string $ID 主键
+ * @property string $NOW_SHARE_TIMES 当前分享得第几次
+ * @property string $SHARE_USER_ID 分享奖励者用户ID
+ * @property string $WINNER_USER_ID 活得共享奖励者ID
+ * @property string $SHARE_TYPE 得奖类型  1为向下找五次记录        2为上和下一起有报单团队奖金得用户
+ * @property string $ADD_TIME 添加时间
+ * @property string $AMOUNT 实得奖金
+ * @property string $ORI_AMOUNT 原奖金
+ */
+class GxlimitLog extends \common\components\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return '{{%GXLIMIT_LOG}}';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'ID' => '主键ID',
+            'NOW_SHARE_TIMES' => '当前分享得第几次',
+            'SHARE_USER_ID' => '分享奖励者用户ID',
+            'WINNER_USER_ID' => '活得共享奖励者ID',
+            'SHARE_TYPE' => '得奖类型  1为向下找五次记录        2为上和下一起有报单团队奖金得用户',
+            'ADD_TIME' => '添加时间',
+            'AMOUNT' => '实得奖金',
+            'ORI_AMOUNT' => '原奖金'
+        ];
+    }
+}