当前位置: 首页>>代码示例>>PHP>>正文


PHP XDateTime::HourDiff方法代码示例

本文整理汇总了PHP中XDateTime::HourDiff方法的典型用法代码示例。如果您正苦于以下问题:PHP XDateTime::HourDiff方法的具体用法?PHP XDateTime::HourDiff怎么用?PHP XDateTime::HourDiff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XDateTime的用法示例。


在下文中一共展示了XDateTime::HourDiff方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showOrderList

    public function showOrderList($request, $response)
    {/*{{{*/
        $orderId = $request->orderid;
        $status = $request->type;
        $beginDate = $request->beginDate;
        $endDate = $request->endDate ? $request->endDate : XDateTime::now()->today()->toShortString();
        $page = $request->page?$request->page : 1;
        $pageSize = 20;
        $telOwner = DAL::get()->find_by_relatedObject('telowner', $this->_newSpace->user);
        $options = array();
        $options['orderId'] = $orderId;
        if($status != TelOrder::SEARCH_FINISHED_CLOSE) 
        {
            $options['desc'] = 'asc';
        }
        $res = TelOrderClient::getInstance()->getList($status, $page, $pageSize, $telOwner->id, $options);
        $pagelink = PageNav::getNavLink(PageNav::getPageNavTemplate("showorderlist?type=$status&orderId=$orderId&actionclass=$request->actionclass&page="),$res['pageInfo']['nowpage'],$res['pageInfo']['pagesize'],$res['pageInfo']['total']);
        $waittimearray = array();
        $waittimeall = 0;
        $visitordersarray = array();
        $now = XDateTime::now();
        foreach($res['list'] as $telOrder)
        {
            $confirmtime = $telOrder->confirmStartTime;
            if(($telOrder->status != TelOrder::STATUS_FINISHED && $telOrder->status != TelOrder::STATUS_CLOSED) || $confirmtime > $now)
            {
                $confirmtime = $now;
            }
            $paytime = $telOrder->payTime;
            if(XDateTime::valueOf($telOrder->payTime)->isZero() == true)
            {
                $paytime = $telOrder->ctime;
            }
            $visitOrder = DAL::get()->find_by_orderid('TelVisit', $telOrder->id);    
            $flow = DAL::get()->find_by_patientid_and_spaceid('DoctorPatientRef', 
                    $telOrder->patient->id, $telOrder->executer->relatedObject->id);
            if($visitOrder->isNull() == false && $flow->isNull() == false && $visitOrder->rank != TelVisit::RANK_ZERO && $visitOrder->content != '')
            {
                $visitordersarray[$telOrder->id] = true;
            }
            if($telOrder->status == TelOrder::STATUS_FINISHED || $telOrder->status == TelOrder::STATUS_CLOSED || $telOrder->status == TelOrder::STATUS_CONFIRM)
            {
                $waittimearray[$telOrder->id] = XDateTime::monthDiff($paytime,$confirmtime)."月";
                if($waittimearray[$telOrder->id] <= 0)
                {
                    $waittimearray[$telOrder->id] = XDateTime::dayDiff($paytime,$confirmtime)."天";
                    if($waittimearray[$telOrder->id] <= 0)
                    {
                        $waittimearray[$telOrder->id] = XDateTime::HourDiff($paytime,$confirmtime)."小时";
                        if($waittimearray[$telOrder->id] <= 0)
                        {
                            $waittimearray[$telOrder->id] = XDateTime::minuteDiff($paytime,$confirmtime)."分";
                            if($waittimearray[$telOrder->id] <= 0)
                            {
                                $waittimearray[$telOrder->id] = XDateTime::minuteDiff($paytime,$confirmtime)."秒"; 
                                if($waittimearray[$telOrder->id] <= 0)
                                {
                                    $waittimearray[$telOrder->id] = 0;
                                }
                            }
                        }
                    }
                }
            }
            if(XDateTime::secondDiff($paytime,$confirmtime) > 0)
            {
                $waittimeall += XDateTime::secondDiff($paytime,$confirmtime);
            }
        }
        $avgtime = "0天";
        if(count($res['list']) > 0)
        {
            $avgtimeall = $waittimeall/count($res['list']);
            $avgtime = floor($avgtimeall/2592000)."月";

            if(($avgtimeall/2592000) < 1)
            {
                $avgtime = floor($avgtimeall/86400)."天";
            }
            if($avgtimeall/86400 < 1)
            {
                $avgtime = floor($avgtimeall/3600)."小时";
            }
            if($avgtimeall/3600 < 1)
            {
                $avgtime = floor($avgtimeall/60)."分";
            }
        }
        $response->waittimearray = $waittimearray;
        $response->avgtime = $avgtime;
        $response->orderid = $orderId;
        $response->visitordersarray = $visitordersarray;
        $response->telOrderList = $res['list'];
        $response->space = $this->_newSpace;
        $response->beginDate = $beginDate;
        $response->endDate = $endDate;
        $response->pagelink = $pagelink;
        $response->type = $status;
        $response->telOwner = $telOwner;
        $response->actionClass = $request->actionclass;
//.........这里部分代码省略.........
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:101,代码来源:adminpaymentcontroller.php


注:本文中的XDateTime::HourDiff方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。