WIN-2308041133\Administrator 4 月之前
父节点
当前提交
1d70c015ec

+ 4 - 2
app/common/repositories/user/UserBillRepository.php

@@ -38,12 +38,14 @@ class UserBillRepository extends BaseRepository
 
     const TYPE_INFO = [
         'brokerage' => [
-            'brokerage/now_money' => '金转入余额',
+            'brokerage/now_money' => '金转入余额',
             'brokerage/extract_award' => '分红积分兑换',
             'brokerage/order_one' => '获得一级推广佣金',
             'brokerage/order_two' => '获得二级推广佣金',
             'brokerage/refund_one' => '退还一级佣金',
             'brokerage/refund_two' => '退还二级佣金',
+            'brokerage/extract' => '奖金提现',
+            'brokerage/extract_return' => '提现退回',
         ],
         'integral' => [
             'integral/cancel' => '退回积分',
@@ -64,7 +66,7 @@ class UserBillRepository extends BaseRepository
         ],
        'now_money' => [
            //'now_money/extract' => '佣金提现余额',
-           'now_money/brokerage' => '金转入余额',
+           'now_money/brokerage' => '金转入余额',
            'now_money/pay_product' => '购买商品',
            'now_money/presell' => '支付预售尾款',
            'now_money/recharge' => '余额充值',

+ 23 - 1
app/common/repositories/user/UserExtractRepository.php

@@ -207,6 +207,16 @@ class UserExtractRepository extends BaseRepository
             if ($data['extract_type'] == self::EXTRACT_TYPE_YUE) {
                 $this->switchStatus($res->extract_id, ['status' => 1]);
             }
+//            bill表创建提现记录
+            $userBillRepository = app()->make(UserBillRepository::class);
+            $userBillRepository->decBill($data['uid'], 'brokerage', 'extract', [
+                'link_id' => $res->extract_id,
+                'status' => 1,
+                'title' => '奖金提现',
+                'number' => $data['extract_price'],
+                'mark' => '用户提现奖金'.$data['extract_price'].'元',
+                'balance' => $brokerage_price
+            ]);
             return $res;
         });
 
@@ -367,11 +377,23 @@ class UserExtractRepository extends BaseRepository
             if ($brokerage_price) {
                 $user->brokerage_price = $brokerage_price;
                 $user->save();
+                if ($data['status']==-1){
+                    //            bill表创建提现退还记录
+                    $userBillRepository = app()->make(UserBillRepository::class);
+                    $userBillRepository->incBill($data['uid'], 'brokerage', 'extract', [
+                        'link_id' => $id,
+                        'status' => 0,
+                        'title' => '提现退还',
+                        'number' => $data['extract_price'],
+                        'mark' => '用户提现审核失败,退回奖金'.$data['extract_price'].'元',
+                        'balance' => $brokerage_price
+                    ]);
+                }
             }
             $data['check_time'] = time();
             // 更新提取记录状态
             $userExtract = $this->dao->update($id, $data);
-            if ($out) $userBillRepository->decBill($user->uid, 'brokerage', $out['type'], $out['data']);
+//            if ($out) $userBillRepository->decBill($user->uid, 'brokerage', $out['type'], $out['data']);
             // 触发状态切换后的事件
             event('user.extractStatus', compact('id', 'userExtract'));
         });