Browse Source

福利账户清零功能

gorden 1 tháng trước cách đây
mục cha
commit
37746bc6f1
1 tập tin đã thay đổi với 7 bổ sung2 xóa
  1. 7 2
      app/admin/controller/order/PayDetailController.php

+ 7 - 2
app/admin/controller/order/PayDetailController.php

@@ -333,12 +333,17 @@ class PayDetailController extends Curd
         try {
             $data = $this->insertRechargeInput($request, 'WELFARE');
             $data['pay_prepayid'] = $data['join_pay_member_id'] . '-WELFARE';
+            $memberAccount = MemberAccount::where('join_account_member_id', $data['join_pay_member_id'])
+                ->where('member_account_classify', 'WELFARE')
+                ->first();
+            if ($memberAccount->member_account_status != 'ACTIVED'){
+                throw new BusinessException('账户状态异常');
+            }
 
             $this->doInsert($data);
 
             // 金额累加到福利账户
-            $memberAccount = MemberAccount::where('join_account_member_id', $data['join_pay_member_id'])->where('member_account_classify', 'WELFARE')->first();
-            $memberAccount->member_account_income = $memberAccount->member_account_income + $data['pay_amount'];
+           $memberAccount->member_account_income = $memberAccount->member_account_income + $data['pay_amount'];
             $memberAccount->member_account_surplus = $memberAccount->member_account_surplus + $data['pay_amount'];
             $memberAccount->save();