fuyu 5 năm trước cách đây
mục cha
commit
d9d22fdea8
1 tập tin đã thay đổi với 26 bổ sung7 xóa
  1. 26 7
      application/inter/controller/Writereport.php

+ 26 - 7
application/inter/controller/Writereport.php

@@ -561,14 +561,33 @@ class Writereport extends Base
                 // todo 微信消息推送
                 return true;
             }
-            DB::table('institution')->where('id', $remote_order['super_hospital_id'])->update(['current_money' => $hospital['current_money'] + $remote_order['order_money']]);
+            $brfore_money =  $hospital['current_money'];
+            $order_money = $remote_order['order_money'];
+            $after_money = $brfore_money + $order_money;
+            DB::table('institution')->where('id', $remote_order['super_hospital_id'])->update(['current_money' => $after_money]);
             DB::table('remote_order')->where('id', $remote_order['id'])->update(['status' => Application::ORDER_STATUS['CONFIRM']]);
-            DB::table('remote_water')->insert([
-                'hospital_id' => $remote_order['super_hospital_id'],
-                'order_id' => $remote_order['id'],
-                'money' =>$remote_order['order_money'],
-                'type' => Application::WATER_TYPE['ADD'],
-                'why' =>  Application::WATER_WHY['REMOTEINCOME'],
+            $hospital_id = $remote_order['super_hospital_id'];
+            $order_id = $remote_order['id'];
+            
+            $type = Application::WATER_TYPE['ADD'];
+            $why = Application::WATER_WHY['REMOTEINCOME'];
+            $water_id = DB::table('remote_water')->insertGetId([
+                'hospital_id' => $hospital_id,
+                'order_id' => $order_id,
+                'money' => $order_money,
+                'type' => $type,
+                'why' =>  $why,
+                'timestamp' => time(),
+            ]);
+            DB::table('remote_water_log')->insert([
+                'hospital_id' => $hospital_id,
+                'order_id' => $order_id,
+                'water_id' => $water_id,
+                'order_money' => $order_money,
+                'brfore_money' => $brfore_money,
+                'after_money' => $after_money,
+                'type' => $type,
+                'why' =>  $why,
                 'timestamp' => time(),
             ]);
             // 提交事务