gorden 2 ヶ月 前
コミット
0dfbd89ee2

+ 4 - 3
app/admin/controller/order/PayDetailController.php

@@ -293,14 +293,15 @@ class PayDetailController extends Curd
             $data = $this->insertGiveInput($request);
             $data['pay_prepayid'] = $data['join_pay_member_id'] . '-CASH';
 
-            $this->doInsert($data);
 
             // 金额累加到福利账户
-            $memberAccount = MemberAccount::where('join_account_member_id', $data['join_pay_member_id'])->where('member_account_classify', 'WELFARE')->first();
+            $memberAccount = MemberAccount::where('join_account_member_id', $data['join_pay_member_id'])->where('member_account_classify', 'CASH')->first();
             $memberAccount->member_account_income = $memberAccount->member_account_income + $data['pay_amount'];
             $memberAccount->member_account_surplus = $memberAccount->member_account_surplus + $data['pay_amount'];
             $memberAccount->save();
 
+            $data['pay_amount'] = 0;
+            $this->doInsert($data);
             Db::commit();
         } catch (BusinessException $customException) {
             Db::rollBack();
@@ -520,7 +521,7 @@ class PayDetailController extends Curd
         $data['join_pay_object_json'] = json_encode(['order_id' => 'SYSTEM']);
 
         $rate = 0;
-        $extendJson['added_amount'] = number_format($data['pay_amount'] * $rate, 2, '.', '');
+        $extendJson['added_amount'] = $data['pay_amount'];
         $extendJson['added_rate'] = $rate;
         $data['pay_extend_json'] = json_encode($extendJson);
         $data['pay_paytimes'] = date('Y-m-d H:i:s', strtotime($data['pay_paytimes']));

+ 9 - 4
app/admin/service/member/MemberService.php

@@ -731,7 +731,7 @@ class MemberService
                             'join_pay_member_id' => $item['join_pay_member_id'],
                             'pay_addtimes' => $item['pay_addtimes'],
                             'pay_amount' => $extendJson['added_amount'],
-                            'pay_category' => 'ADDED',
+                            'pay_category' => $item['pay_category'] == 'GIVE' ? 'GIVE' : 'ADDED',
                             'balance' => number_format($balance, 2, '.', ''),
                             'balance_type' => 'add',
                         ];
@@ -741,7 +741,10 @@ class MemberService
 
                 $item['balance'] = number_format($balance, 2, '.', '');
                 $balance = $balance - $item['pay_amount'];
-                $data[] = $item;
+                if ($item['pay_category'] != 'GIVE'){
+                    $data[] = $item;
+                }
+
                 continue;
             }
 
@@ -753,7 +756,7 @@ class MemberService
                             'join_pay_member_id' => $item['join_pay_member_id'],
                             'pay_addtimes' => $item['pay_addtimes'],
                             'pay_amount' => $extendJson['added_amount'],
-                            'pay_category' => 'ADDED',
+                            'pay_category' => $item['pay_category'] == 'GIVE' ? 'GIVE' : 'ADDED',
                             'balance' => number_format($balance, 2, '.', ''),
                             'balance_type' => 'add',
                         ];
@@ -767,7 +770,9 @@ class MemberService
                 $balance = $balance + $item['pay_amount'];
             }
 
-            $data[] = $item;
+            if ($item['pay_category'] != 'GIVE') {
+                $data[] = $item;
+            }
         }
 
         $total = count($data);