作者 潘浩文
1 个管道 的构建 通过 耗费 2 秒

XIAOPAN

@@ -73,9 +73,9 @@ class OrderController extends HomeBaseController{ @@ -73,9 +73,9 @@ class OrderController extends HomeBaseController{
73 // */ 73 // */
74 public function order($users_id,$name){ 74 public function order($users_id,$name){
75 $order= Db::name('order')->where(['users_id'=>$users_id,'state'=>1])->find(); 75 $order= Db::name('order')->where(['users_id'=>$users_id,'state'=>1])->find();
76 - 76 + $hospital=Db::name('equipment')->where('name',$order['eq_name'])->find()['hospital'];
77 $end_time=time(); 77 $end_time=time();
78 - $price=$this->getPrice($users_id,$order['start_time'],$end_time); 78 + $price=$this->getPrice($users_id,$order['start_time'],$end_time,$hospital);
79 $time=ceil(($end_time-$order['start_time'])/3600); 79 $time=ceil(($end_time-$order['start_time'])/3600);
80 $data=[ 80 $data=[
81 'end_time'=>$end_time, 81 'end_time'=>$end_time,
@@ -458,7 +458,7 @@ class OrderController extends HomeBaseController{ @@ -458,7 +458,7 @@ class OrderController extends HomeBaseController{
458 458
459 459
460 460
461 - public function getPrice($users_id,$start_time,$end_time){ 461 + public function getPrice($users_id,$start_time,$end_time,$hospital){
462 /*先获取跨越天数*/ 462 /*先获取跨越天数*/
463 463
464 464
@@ -468,8 +468,8 @@ class OrderController extends HomeBaseController{ @@ -468,8 +468,8 @@ class OrderController extends HomeBaseController{
468 if ($spend['min']!=0||$spend['sec']!=0){ 468 if ($spend['min']!=0||$spend['sec']!=0){
469 $spend['hour']++; 469 $spend['hour']++;
470 } 470 }
471 - $interval = Db::name('interval')->where('id',1)->find();  
472 - $cost=Db::name('cost')->where('id',1)->find(); 471 + $interval = Db::name('interval')->where('hospital',$hospital)->find();
  472 + $cost=Db::name('cost')->where('hospital',$hospital)->find();
473 $is_free=Db::name('users')->where('id',$users_id)->find()['is_free']; 473 $is_free=Db::name('users')->where('id',$users_id)->find()['is_free'];
474 $price=0; 474 $price=0;
475 $time=$start_time; 475 $time=$start_time;