gogs 2 miesięcy temu
rodzic
commit
a82166597f
1 zmienionych plików z 5 dodań i 5 usunięć
  1. 5 5
      app/Service/AuxiliaryAccountService.php

+ 5 - 5
app/Service/AuxiliaryAccountService.php

@@ -209,18 +209,18 @@ class AuxiliaryAccountService extends Service
             $model->crt_id = $user['id'];
             $model->crt_id = $user['id'];
             $model->top_depart_id = $user['top_depart_id'];
             $model->top_depart_id = $user['top_depart_id'];
             $model->save();
             $model->save();
-            $this->saveDetail($model->id, time(), $data,$user['id']);
+            $this->saveDetail($model->id, time(), $data,$user['id'],$user['top_depart_id']);
 
 
             DB::commit();
             DB::commit();
         }catch (\Exception $exception){
         }catch (\Exception $exception){
             DB::rollBack();
             DB::rollBack();
-            return [false,$exception->getMessage()];
+            return [false,$exception->getLine().':'.$exception->getMessage()];
         }
         }
 
 
         return [true, ''];
         return [true, ''];
     }
     }
 
 
-    private function saveDetail($id, $time, $data,$crt_id){
+    private function saveDetail($id, $time, $data,$crt_id,$user){
         if(! empty($data['details'])){
         if(! empty($data['details'])){
             $unit = [];
             $unit = [];
             foreach ($data['details'] as $value){
             foreach ($data['details'] as $value){
@@ -239,7 +239,7 @@ class AuxiliaryAccountService extends Service
                     'entrust2_amount' => $value['entrust2_amount']??0,
                     'entrust2_amount' => $value['entrust2_amount']??0,
                     'aggregation_amount' => $value['aggregation_amount']??00,
                     'aggregation_amount' => $value['aggregation_amount']??00,
                     'total_amount' => $value['total_amount'],
                     'total_amount' => $value['total_amount'],
-                    'top_depart_id' => $data['top_depart_id'],
+                    'top_depart_id' => $user['top_depart_id'],
                     'item_id' => $value['item_id'],
                     'item_id' => $value['item_id'],
                     'crt_time' => $time,
                     'crt_time' => $time,
                     'crt_id' => $crt_id,
                     'crt_id' => $crt_id,
@@ -286,7 +286,7 @@ class AuxiliaryAccountService extends Service
             if ($claimTime < $monthStart || $claimTime > $monthEnd) return [false, "第" . ($index + 1) . "凭证日期必须早于当前结算月份(" . date("Y-m", $data['month']) . ")"];
             if ($claimTime < $monthStart || $claimTime > $monthEnd) return [false, "第" . ($index + 1) . "凭证日期必须早于当前结算月份(" . date("Y-m", $data['month']) . ")"];
         }
         }
 
 
-        $query = AuxiliaryAccount::where('top_depart_id', $data['top_depart_id'])
+        $query = AuxiliaryAccount::where('top_depart_id', $user['top_depart_id'])
             ->where('month', $monthStart)
             ->where('month', $monthStart)
             ->where('del_time', 0);
             ->where('del_time', 0);