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

添加时间信息

... ... @@ -209,6 +209,8 @@ class UsersController extends HomeBaseController{
$order['time']=ceil(($order['end_time']-$order['start_time'])/3600);
$price=new OrderController();
$order['price']=$price->getPrice($users_id,$order['start_time'],$order['end_time']);
$time_info=$this->getTimeInfo($order['start_time'],$order['end_time']);
array_merge($order,$time_info);
$this->apiResponse(200,'success',$order);
}
... ... @@ -235,9 +237,12 @@ class UsersController extends HomeBaseController{
public function getOrderById2(){
$users_id=$this->request->param('users_id');
$order= Db::name('order')->where(['users_id'=>$users_id,'state'=>2])->find();
if (empty($order)){
$this->apiResponse(200,'没有未支付订单');
}
$time_info=$this->getTimeInfo($order['start_time'],$order['end_time']);
array_merge($order,$time_info);
$this->apiResponse(200,'success',$order);
}
... ... @@ -370,12 +375,10 @@ class UsersController extends HomeBaseController{
}
public function getTimeInfo(){
$start='1543812320';
$end='1543812407';
public function getTimeInfo($start,$end){
$time=$end-$start;
$return['hour']=floor($time/3600);
$return['min']=floor(($time-$return['hour']*3600)/60);
dump($return);
$return;
}
}
\ No newline at end of file
... ...