作者 sgj
1 个管道 的构建 通过 耗费 0 秒

添加时间信息

@@ -210,8 +210,7 @@ class UsersController extends HomeBaseController{ @@ -210,8 +210,7 @@ class UsersController extends HomeBaseController{
210 $price=new OrderController(); 210 $price=new OrderController();
211 $order['price']=$price->getPrice($users_id,$order['start_time'],$order['end_time']); 211 $order['price']=$price->getPrice($users_id,$order['start_time'],$order['end_time']);
212 $time_info=$this->getTimeInfo($order['start_time'],$order['end_time']); 212 $time_info=$this->getTimeInfo($order['start_time'],$order['end_time']);
213 - dump($time_info);  
214 - array_merge($order,$time_info); 213 + $order=array_merge($order,$time_info);
215 $this->apiResponse(200,'success',$order); 214 $this->apiResponse(200,'success',$order);
216 } 215 }
217 216
@@ -243,7 +242,7 @@ class UsersController extends HomeBaseController{ @@ -243,7 +242,7 @@ class UsersController extends HomeBaseController{
243 $this->apiResponse(200,'没有未支付订单'); 242 $this->apiResponse(200,'没有未支付订单');
244 } 243 }
245 $time_info=$this->getTimeInfo($order['start_time'],$order['end_time']); 244 $time_info=$this->getTimeInfo($order['start_time'],$order['end_time']);
246 - array_merge($order,$time_info); 245 + $order=array_merge($order,$time_info);
247 $this->apiResponse(200,'success',$order); 246 $this->apiResponse(200,'success',$order);
248 } 247 }
249 248
@@ -377,6 +376,9 @@ class UsersController extends HomeBaseController{ @@ -377,6 +376,9 @@ class UsersController extends HomeBaseController{
377 376
378 377
379 public function getTimeInfo($start,$end){ 378 public function getTimeInfo($start,$end){
  379 + if(empty($end)){
  380 + $end=time();
  381 + }
380 $time=$end-$start; 382 $time=$end-$start;
381 $return['hour']=floor($time/3600); 383 $return['hour']=floor($time/3600);
382 $return['min']=floor(($time-$return['hour']*3600)/60); 384 $return['min']=floor(($time-$return['hour']*3600)/60);