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


PHP Base_Common::timeLagToText方法代码示例

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


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

示例1: getQuestionDetail

 public function getQuestionDetail($QuestionId)
 {
     //获取问题的ID和父ID
     $QuestionInfo = $this->getComplain($QuestionId, 'id,author,time,qtype,view,status,description,resolve,photo,call_time,call_type,loginId,receive_time,comment,public,assess,sync,rtime');
     //问题获取到
     $CallTypeList = $this->config->CallTypeList;
     //格式化问题内容
     if ($QuestionInfo['id']) {
         //解包压缩数组
         $Comment = unserialize($QuestionInfo['comment']);
         //如果问题分类已经被转换
         if ($Comment['convert']['to_id'] > 0) {
             $QuestionDetail = array('QuestionId' => $Comment['convert']['to_id'], 'QuestionType' => $Comment['convert']['to_type'], 'Transformed' => 1);
         } else {
             $QuestionDetail = array('QuestionId' => intval($QuestionInfo['id']), 'QuestionContent' => $QuestionInfo['description'], 'QuestionResolve' => $QuestionInfo['resolve'], 'AuthorName' => $QuestionInfo['author'], 'QuestionTime' => date("Y-m-d H:i:s", $QuestionInfo['time']), 'QuestionAttatch' => $QuestionInfo['photo'], 'Views' => $QuestionInfo['view'], 'QtypeId' => $QuestionInfo['qtype'], 'CallType' => $QuestionInfo['call_time'] > 0 ? $CallTypeList[$QuestionInfo['call_type']] : "", 'CallTime' => $QuestionInfo['call_time'] > 0 ? date("Y-m-d H:i:s", $QuestionInfo['call_time']) : 0, 'QuestionStauts' => $this->processStatus($QuestionInfo['status']), 'QuestionStatus' => $this->processStatus($QuestionInfo['status']), 'AcceptTime' => date("Y-m-d H:i:s", $QuestionInfo['receive_time']), 'Hidden' => $QuestionInfo['public'], 'AcceptOperatorName' => $QuestionInfo['loginId'], 'AssessStatus' => $QuestionInfo['assess'], "Sync" => $QuestionInfo['sync'], "RevokeTime" => date("Y-m-d H:i:s", $QuestionInfo['rtime']));
             //获取回答内容
             $AnswerInfo = $this->getAnswer($QuestionDetail['QuestionId']);
             //如果获取到回答
             if ($AnswerInfo['id']) {
                 $QuestionDetail['Answer'] = array('OperatorName' => $AnswerInfo['contact'], 'AnswerTime' => date("Y-m-d H:i:s", $AnswerInfo['time']), 'AnswerContent' => $AnswerInfo['content']);
                 $QuestionDetail['AnswerLag'] = Base_Common::timeLagToText($QuestionInfo['time'], $AnswerInfo['time']);
             }
         }
     } else {
         return false;
     }
     return $QuestionDetail;
 }
开发者ID:eappl,项目名称:prototype,代码行数:28,代码来源:Complain.php

示例2: questionListAction


//.........这里部分代码省略.........
                         //查询当前正在生效的公告列表
                         $oMenCache = new Base_Cache_Memcache("Complaint");
                         $M = $oMenCache->get('NewQuestionNumList_' . $List['StartDate'] . '_' . $List['EndDate'] . '_' . $List['QuestionType'] . '_' . $List['QtypeId'] . '_' . $List['QuestionStatus'] . '_' . $List['Page'] . '_' . $List['PageSize']);
                         if ($M) {
                             $QuestionList = json_decode($M, true);
                         } else {
                             switch ($List['QuestionType']) {
                                 //咨询
                                 case "ask":
                                     $List['Parent'] = 0;
                                     $List['Revocation'] = 0;
                                     $List['hidden'] = 1;
                                     $QuestionList = $this->oQuestion->getQuestionList($List, "id,description,time,atime,status,qtype");
                                     foreach ($QuestionList['QuestionList'] as $key => $QuestionInfo) {
                                         //生成问题链接
                                         $QuestionList['QuestionList'][$key]['QuestionUrl'] = $this->oQuestion->getQuestionLink($QuestionInfo['id'], "question");
                                         //生成问题状态
                                         if ($QuestionInfo['status'] == 1) {
                                             $QuestionList['QuestionList'][$key]['QuestionStatus'] = 1;
                                         } else {
                                             $QuestionList['QuestionList'][$key]['QuestionStatus'] = 2;
                                         }
                                     }
                                     break;
                                     //建议
                                 //建议
                                 case "suggest":
                                     $List['Parent'] = 0;
                                     $List['Revocation'] = 0;
                                     $List['hidden'] = 1;
                                     $QuestionList = $this->oQuestion->getQuestionList($List, "id,description,time,atime,status,qtype");
                                     foreach ($QuestionList['QuestionList'] as $key => $QuestionInfo) {
                                         //生成问题链接
                                         $QuestionList['QuestionList'][$key]['QuestionUrl'] = $this->oQuestion->getQuestionLink($QuestionInfo['id'], "question");
                                         //生成问题状态
                                         if ($QuestionInfo['status'] == 1) {
                                             $QuestionList['QuestionList'][$key]['QuestionStatus'] = 1;
                                         } else {
                                             $QuestionList['QuestionList'][$key]['QuestionStatus'] = 2;
                                         }
                                     }
                                     break;
                                     //投诉
                                 //投诉
                                 case "complain":
                                     $List['Public'] = 0;
                                     $QuestionList = $this->oComplain->getComplainList($List, "id,description,time,atime,status,qtype");
                                     foreach ($QuestionList['QuestionList'] as $key => $QuestionInfo) {
                                         //生成问题链接
                                         $QuestionList['QuestionList'][$key]['QuestionUrl'] = $this->oComplain->getQuestionLink($QuestionInfo['id'], "complain");
                                         //生成问题状态
                                         if (in_array($QuestionInfo['status'], array(0, 4))) {
                                             $QuestionList['QuestionList'][$key]['QuestionStatus'] = 1;
                                         } elseif (in_array($QuestionInfo['status'], array(1, 3))) {
                                             $QuestionList['QuestionList'][$key]['QuestionStatus'] = 2;
                                         }
                                         if ($QuestionInfo['status'] == 2) {
                                             $QuestionList['QuestionList'][$key]['QuestionStatus'] = 3;
                                         }
                                     }
                                     break;
                             }
                             $QtypeList = array();
                             foreach ($QuestionList['QuestionList'] as $key => $QuestionInfo) {
                                 //获取问题分类
                                 $CategoryInfo = $this->oCategory->getCategoryByQuestionType($List['QuestionType'], 'name');
                                 //获取问题主分类
                                 $QuestionList['QuestionList'][$key]['QuestionType'] = $CategoryInfo['name'];
                                 if (!isset($QtypeList[$QuestionInfo['qtype']])) {
                                     $QtypeList[$QuestionInfo['qtype']] = $this->oQtype->getQtypeById($QuestionInfo['qtype']);
                                 }
                                 $QuestionList['QuestionList'][$key]['Qtype'] = $QtypeList[$QuestionInfo['qtype']]['name'];
                                 //格式化提问时间
                                 $QuestionList['QuestionList'][$key]['AddTime'] = date("Y-m-d H:i", $QuestionInfo['time']);
                                 //格式化回答时间
                                 $QuestionList['QuestionList'][$key]['AnswerTimeLag'] = $QuestionInfo['QuestionStatus'] >= 2 && $QuestionInfo['atime'] ? Base_Common::timeLagToText($QuestionInfo['time'], $QuestionInfo['atime']) : "-";
                                 //获取问题状态名称
                                 $QuestionList['QuestionList'][$key]['QuestionStatusName'] = $QuestionStatusList[$QuestionInfo['QuestionStatus']];
                                 //格式化问题内容
                                 $QuestionList['QuestionList'][$key]['Content'] = Base_Common::cutstr($QuestionInfo['description'], 14);
                                 unset($QuestionInfo['description']);
                             }
                             $oMenCache->set('NewQuestionNumList_' . $List['StartDate'] . '_' . $List['EndDate'] . '_' . $List['QuestionType'] . '_' . $List['QtypeId'] . '_' . $List['QuestionStatus'] . '_' . $List['Page'] . '_' . $List['PageSize'], json_encode($QuestionList), 10);
                         }
                         $result = array('return' => 1, 'QuestionList' => $QuestionList);
                     } else {
                         $result = array('return' => 0, 'comment' => "无此问题主分类");
                     }
                 }
             } else {
                 $result = array('return' => 0, 'comment' => "无此问题分类");
             }
         } else {
             $result = array('return' => 0, 'comment' => "时间有误");
         }
     } else {
         $result = array('return' => 0, 'comment' => "验证失败,请检查URL");
     }
     echo json_encode($result);
 }
开发者ID:eappl,项目名称:prototype,代码行数:101,代码来源:ListController.php

示例3: serviceLogUnloggedAction


//.........这里部分代码省略.........
                     if ($M) {
                         $ServiceNum['complain']['New'] = 1;
                     }
                     if (in_array($QuestionInfo['status'], array(0, 4))) {
                         $NewLog[$QuestionInfo['time']][] = array('QuestionId' => $QuestionInfo['QuestionId'], 'QuestionType' => 'complain');
                     }
                 }
                 unset($ServiceNum['complain']['List']);
             } else {
                 $ServiceNum['complain']['Num'] = 0;
             }
             krsort($NewLog);
             $i = 0;
             $NewServiceList = array();
             foreach ($NewLog as $Time => $TimeList) {
                 foreach ($TimeList as $key => $Question) {
                     if ($i < $User['NewCount']) {
                         switch ($Question['QuestionType']) {
                             case "ask":
                                 $QuestionInfo = $this->oQuestion->getQuestion($Question['QuestionId'], "id,description,time,atime,status,qtype");
                                 //生成问题链接
                                 $QuestionInfo['QuestionUrl'] = $this->oQuestion->getQuestionLink($QuestionInfo['id'], "question");
                                 //复制问题分类
                                 $QuestionInfo['QuestionType'] = $Question['QuestionType'];
                                 //生成问题状态
                                 if ($QuestionInfo['status'] == 1) {
                                     $QuestionInfo['QuestionStatus'] = 1;
                                 } else {
                                     $QuestionInfo['QuestionStatus'] = 2;
                                 }
                                 $NewServiceList[] = $QuestionInfo;
                                 break;
                             case "suggest":
                                 $QuestionInfo = $this->oQuestion->getQuestion($Question['QuestionId'], "id,description,time,atime,status,qtype");
                                 //生成问题链接
                                 $QuestionInfo['QuestionUrl'] = $this->oQuestion->getQuestionLink($QuestionInfo['id'], "question");
                                 //复制问题分类
                                 $QuestionInfo['QuestionType'] = $Question['QuestionType'];
                                 //生成问题状态
                                 if ($QuestionInfo['status'] == 1) {
                                     $QuestionInfo['QuestionStatus'] = 1;
                                 } else {
                                     $QuestionInfo['QuestionStatus'] = 2;
                                 }
                                 $NewServiceList[] = $QuestionInfo;
                                 break;
                             case "complain":
                                 $QuestionInfo = $this->oComplain->getComplain($Question['QuestionId'], "id,description,time,atime,status,qtype");
                                 //生成问题链接
                                 $QuestionInfo['QuestionUrl'] = $this->oComplain->getQuestionLink($QuestionInfo['id'], "complain");
                                 //复制问题分类
                                 $QuestionInfo['QuestionType'] = $Question['QuestionType'];
                                 //生成问题状态
                                 if (in_array($QuestionInfo['status'], array(0, 4))) {
                                     $QuestionInfo['QuestionStatus'] = 1;
                                 } elseif (in_array($QuestionInfo['status'], array(1, 3))) {
                                     $QuestionInfo['QuestionStatus'] = 2;
                                 }
                                 if ($QuestionInfo['status'] == 2) {
                                     $QuestionInfo['QuestionStatus'] = 3;
                                 }
                                 $NewServiceList[] = $QuestionInfo;
                                 break;
                         }
                     }
                     $i++;
                 }
             }
             foreach ($NewServiceList as $key => $QuestionInfo) {
                 if (!isset($QtypeList[$QuestionInfo['qtype']])) {
                     $QtypeList[$QuestionInfo['qtype']] = $this->oQtype->getQtypeById($QuestionInfo['qtype']);
                 }
                 $NewServiceList[$key]['Qtype'] = $QtypeList[$QuestionInfo['qtype']]['name'];
                 //格式化提问时间
                 $NewServiceList[$key]['AddTime'] = date("Y-m-d H:i", $QuestionInfo['time']);
                 //格式化回答时间
                 $NewServiceList[$key]['AnswerTimeLag'] = $QuestionInfo['QuestionStatus'] >= 2 && $QuestionInfo['atime'] ? Base_Common::timeLagToText($QuestionInfo['time'], $QuestionInfo['atime']) : "-";
                 //获取问题状态名称
                 $NewServiceList[$key]['QuestionStatusName'] = $QuestionStatusList[$QuestionInfo['QuestionStatus']];
                 //格式化问题内容
                 $NewServiceList[$key]['Content'] = Base_Common::cutstr($QuestionInfo['description'], 14);
                 //获取问题分类
                 $CategoryInfo = $QuestionTypeList[$QuestionInfo['QuestionType']];
                 //获取问题主分类
                 $NewServiceList[$key]['QuestionType'] = $CategoryInfo;
                 unset($NewServiceList[$key]['description']);
             }
             //服务记录详情页面信息
             $ServiceLogDetail = array('Url' => 'http://sc.5173.com/index.php?question/my_ask.html', 'Content' => '查看全部服务记录');
             //入口信息
             $ServiceEntrance = array('Url' => 'http://sc.5173.com/index.php?question/ask_skip.html', 'Content' => '我要提问');
             $result = array('return' => 1, 'ServiceNum' => $ServiceNum, 'ServiceLogDetail' => $ServiceLogDetail, 'ServiceEntrance' => $ServiceEntrance, 'NewServiceList' => $NewServiceList);
         } else {
             $result = array('return' => 0, 'comment' => "时间有误");
         }
     } else {
         $result = array('return' => 0, 'comment' => "验证失败,请检查URL");
     }
     echo json_encode($result);
 }
开发者ID:032404cxd,项目名称:prototype_main,代码行数:101,代码来源:UserController.php

示例4: getQuestionDetail

 public function getQuestionDetail($QuestionId, $History = 0)
 {
     //获取问题的ID和父ID
     $QuestionInfo = $this->getQuestion($QuestionId, 'id,pid', $History);
     //问题获取到
     if ($QuestionInfo['id']) {
         //如果问题父ID大于0,为追问
         if ($QuestionInfo['pid']) {
             $ParentID = $QuestionInfo['pid'];
         } else {
             $ParentID = $QuestionInfo['id'];
         }
         //获取主问内容
         $ParentInfo = $this->getQuestion($ParentID, 'id,author,time,cid,cid1,qtype,attach,views,status,description,is_pj,comment,hidden', $History);
         //解包压缩数组
         $Comment = unserialize($ParentInfo['comment']);
         //如果问题分类已经被转换
         if ($Comment['convert']['to_id'] > 0) {
             $QuestionDetail = array('QuestionId' => $Comment['convert']['to_id'], 'QuestionType' => $Comment['convert']['to_type'], 'Transformed' => 1);
         } else {
             //格式化问题内容
             $QuestionDetail = array('QuestionId' => intval($ParentInfo['id']), 'QuestionContent' => $ParentInfo['description'], 'AuthorName' => $ParentInfo['author'], 'QuestionTime' => date("Y-m-d H:i:s", $ParentInfo['time']), 'QuestionAttatch' => $ParentInfo['attach'], 'Views' => $ParentInfo['views'], 'CatagoryId' => $ParentInfo['cid'], 'QtypeId' => $ParentInfo['qtype'], 'QuestionStauts' => $this->processStatus($ParentInfo['status']), 'QuestionStatus' => $this->processStatus($ParentInfo['status']), 'SubQuestion' => 0, 'AssessStatus' => $ParentInfo['is_pj'], 'AssessCount' => intval($Comment['assess_num']), 'Hidden' => $ParentInfo['hidden'], 'Assess' => $ParentInfo['is_pj'] == 1 ? 0 : 1, 'SubQuestionList' => array());
             //获取回答内容
             $AnswerInfo = $this->getAnswer($QuestionDetail['QuestionId'], "*", $History);
             //如果获取到回答
             if ($AnswerInfo['id']) {
                 //可以继续追问
                 $QuestionDetail['SubQuestion'] = 1;
                 //可以评价
                 $QuestionDetail['Assess'] = $QuestionDetail['Assess'] == 0 ? 0 : 1;
                 //格式化回答内容
                 $QuestionDetail['Answer'] = array('OperatorName' => $AnswerInfo['author'], 'AnswerTime' => date("Y-m-d H:i:s", $AnswerInfo['time']), 'AnswerContent' => $AnswerInfo['content']);
                 $QuestionDetail['AnswerLag'] = Base_Common::timeLagToText($ParentInfo['time'], $AnswerInfo['time']);
             }
             //获取追问信息
             $SubQuestionList = $this->getQuestionList(array('Accepted' => -1, 'Parent' => $ParentID, 'Revocation' => -1, 'Help' => -1, 'History' => $History, 'QuestionType' => "ask,suggest"), 'id,time,cid,cid1,qtype,attach,views,status,description', 'asc');
             $QuestionDetail['SubQuestionList'] = array();
             if (count($SubQuestionList['QuestionNum']) > 0) {
                 foreach ($SubQuestionList['QuestionList'] as $key => $SubQuestion) {
                     //格式化追问内容
                     $QuestionDetail['SubQuestionList'][$key] = array('QuestionId' => intval($SubQuestion['id']), 'QuestionContent' => $SubQuestion['description'], 'QuestionTime' => date("Y-m-d H:i:s", $SubQuestion['time']), 'QuestionStauts' => $this->processStatus($SubQuestion['status']), 'QuestionStatus' => $this->processStatus($SubQuestion['status']));
                     //获取追问回答内容
                     $AnswerInfo = $this->getAnswer($SubQuestion['id'], "*", $History);
                     //如果获取到回答
                     if ($AnswerInfo['id']) {
                         //可以继续追问
                         $QuestionDetail['SubQuestion'] = 1;
                         //格式化追问回答内容
                         $QuestionDetail['SubQuestionList'][$key]['Answer'] = array('OperatorName' => $AnswerInfo['author'], 'AnswerTime' => date("Y-m-d H:i:s", $AnswerInfo['time']), 'AnswerContent' => $AnswerInfo['content']);
                         $QuestionDetail['SubQuestionList'][$key]['AnswerLag'] = Base_Common::timeLagToText($SubQuestion['time'], $AnswerInfo['time']);
                     } else {
                         //不可继续追问
                         $QuestionDetail['SubQuestion'] = 0;
                     }
                 }
             }
         }
         //如果是历史数据
         if ($History > 0) {
             //不可继续追问
             $QuestionDetail['SubQuestion'] = 0;
             //不可评价
             $QuestionDetail['Assess'] = 0;
         }
         return $QuestionDetail;
     } else {
         return false;
     }
 }
开发者ID:eappl,项目名称:prototype,代码行数:69,代码来源:Question.php


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