wesmiler 3 lat temu
rodzic
commit
bb7d72bf61

+ 3 - 3
source/application/api/service/User.php

@@ -219,13 +219,13 @@ class User
             // 直推平级奖
             $equalScore1 = isset($config['equal_score_1'])? floatval($config['equal_score_1']) : 0;
             if($userLevel==$firstLevel && $equalScore1>0){
-                $model->grantMoney($firstId, $equalScore1, 2, "来自用户[{$userId}]直推[{$firstLevelName}]平级奖");
+                $model->grantMoney($firstId, $equalScore1, 2, "来自用户[{$userId}]直推[{$firstLevelName}]平级奖",0, $userId);
             }
 
             // 间推平级奖
             $equalScore2 = isset($config['equal_score_2'])? floatval($config['equal_score_2']) : 0;
             if($secondInfo && $userLevel==$secondLevel && $equalScore2>0){
-                $model->grantMoney($secondId, $equalScore2, 2, "来自用户[{$userId}]间推[{$secondLevelName}]平级奖");
+                $model->grantMoney($secondId, $equalScore2, 2, "来自用户[{$userId}]间推[{$secondLevelName}]平级奖",0, $userId);
             }
         }
 
@@ -233,7 +233,7 @@ class User
         $reverseScore = isset($config['reverse_score_'.$firstLevel])? floatval($config['reverse_score_'.$firstLevel]) : 0;
         //var_dump($equalScore1.'+++'.$equalScore2.'++'.$reverseScore);
         if($firstLevel>$userLevel && $reverseScore>0){
-            $model->grantMoney($firstId, $reverseScore, 3, "来自用户[{$userId}]反推[{$firstLevelName}]奖");
+            $model->grantMoney($firstId, $reverseScore, 3, "来自用户[{$userId}]反推[{$firstLevelName}]奖",0, $userId);
         }
 
         return true;

+ 2 - 2
source/application/common/model/dealer/Order.php

@@ -182,7 +182,7 @@ class Order extends BaseModel
             $awardScore1 = floatval($payMoney * $awardScoreRate1/100);
             $awardScore2 = floatval($payMoney * $awardScoreRate2/100);
             if($firstId && $firstInfo && $awardScore1>0){
-                User::grantMoney($firstId, $awardScore1,4,'直推订单佣金');
+                User::grantMoney($firstId, $awardScore1,4,'直推订单佣金',$order['order_id'], $order['user_id']);
             }
 
             //二级佣金
@@ -190,7 +190,7 @@ class Order extends BaseModel
                 ->field('user_id,referee_id')
                 ->find();
             if($secondId && $secondInfo && $awardScore2>0){
-                User::grantMoney($secondInfo, $awardScore2,5,'间推订单佣金');
+                User::grantMoney($secondInfo, $awardScore2,5,'间推订单佣金',$order['order_id'], $order['user_id']);
             }
         }
 

+ 3 - 1
source/application/common/model/dealer/User.php

@@ -80,7 +80,7 @@ class User extends BaseModel
      * @throws \think\Exception
      * @throws \think\exception\DbException
      */
-    public static function grantMoney($user_id, $money, $type=4, $remark='')
+    public static function grantMoney($user_id, $money, $type=4, $remark='', $sourceId=0, $sourceUid=0)
     {
         // 分销商详情
         $model = static::detail($user_id);
@@ -95,6 +95,8 @@ class User extends BaseModel
             'type' => $type,
             'flow_type' => 10,
             'money' => $money,
+            'source_id' => $sourceId,
+            'source_uid' => $sourceUid,
             'describe' => $remark? $remark : '订单佣金结算',
             'wxapp_id' => $model['wxapp_id'],
         ]);