|
@@ -453,6 +453,18 @@ class Application extends Base
|
|
|
$water_type = self::WATER_TYPE['REDUCE'];
|
|
|
$water_why = self::WATER_WHY['REMOTEPAY'];
|
|
|
try{
|
|
|
+ $remote_order = DB::table('remote_order')
|
|
|
+ ->where('application_id', $application_id)
|
|
|
+ ->where('status', 'neq', self::ORDER_STATUS['CANCEL'])
|
|
|
+ ->field('id')
|
|
|
+ ->find();
|
|
|
+ DB::table('remote_application')->where('id',$application_id)->update(['report_status'=>4]);
|
|
|
+ if($remote_order) {
|
|
|
+ DB::commit();
|
|
|
+ return true;
|
|
|
+ // DB::rollback();
|
|
|
+ // return json_encode(['status'=>'fail','code'=>'2019','已存在订单,请勿重复发起']);
|
|
|
+ }
|
|
|
$hospital = DB::table('institution')
|
|
|
->where('id', $hospital_id)
|
|
|
->field('min_money, current_money')
|
|
@@ -468,19 +480,7 @@ class Application extends Base
|
|
|
return json_encode(['status'=>'fail','code'=>'2017','余额不足请联系医院管理员充值']);
|
|
|
}
|
|
|
DB::table('institution')->where('id',$hospital_id)->update(['current_money'=> $current_money - $order_money]);
|
|
|
- DB::table('remote_application')->where('id',$application_id)->update(['report_status'=>4]);
|
|
|
$order_id = UUIDs::uuid16();
|
|
|
- $remote_order = DB::table('remote_order')
|
|
|
- ->where('application_id', $application_id)
|
|
|
- ->where('status', 'neq', self::ORDER_STATUS['CANCEL'])
|
|
|
- ->field('id')
|
|
|
- ->find();
|
|
|
- if($remote_order) {
|
|
|
- DB::commit();
|
|
|
- return true;
|
|
|
- // DB::rollback();
|
|
|
- // return json_encode(['status'=>'fail','code'=>'2019','已存在订单,请勿重复发起']);
|
|
|
- }
|
|
|
DB::table('remote_order')->insert([
|
|
|
'id' => $order_id,
|
|
|
'hospital_id' => $hospital_id,
|