Exemplo n.º 1
0
 public function view_replyMessageFormAliOrder()
 {
     $msgids = isset($_GET['msgids']) ? trim($_GET['msgids']) : '';
     if ($msgids === '') {
         //没指定id
         $msgdata = array('data' => array('请指定要回复的message'), 'link' => 'index.php?mod=messagefilter&act=getAliOrderList');
         goErrMsgPage($msgdata);
         exit;
     }
     /*----- 获得message信息 -----*/
     $idar = explode(',', $msgids);
     //数组
     $idar = array_map('intval', $idar);
     //转换成
     $msg_obj = new messageModel();
     $msg_list = $msg_obj->getMessageInfoAliOrder($idar);
     $localuser = new GetLoacalUserModel();
     foreach ($msg_list as &$value) {
         $value['createtime'] = trunToLosangeles('Y-m-d H:i:s', $value['createtimestamp']);
         $value['communi'] = $msg_obj->getCommunicationList($value['orderid']);
         $bigestid = 0;
         //最大messageid
         $idregion = array();
         foreach ($value['communi'] as &$val) {
             $val['responsetime'] = date('Y-m-d H:i:s', $val['responsetime']);
             $val['createtimestamp'] = trunToLosangeles('Y-m-d H:i:s', $val['createtimestamp']);
             if ($bigestid < $val['message_id']) {
                 $bigestid = $val['message_id'];
             }
             if ($val['role'] == 1) {
                 $idar[] = $val['id'];
                 if ($val['hasread'] == 0) {
                     $idregion[] = $val['message_id'];
                 }
             }
             $val['content'] = str_replace("\n", '<br>', $val['content']);
         }
         sort($idregion);
         if (count($idregion) > 0) {
             $refirst = $idregion[0];
             $reend = $idregion[count($idregion) - 1];
             $msg_obj->markAsReadByMsgId($idregion);
             //标记为已读状态
             $msg_obj->markUser($idregion, $_SESSION['globaluserid']);
             //标记回复人id
         } else {
             $refirst = 0;
             $reend = 0;
         }
         $value['idregion_h'] = $refirst;
         $value['idregion_e'] = $reend;
         $value['bigestid'] = $bigestid;
     }
     //print_r($idregion);exit;
     /*----- 获得message信息 -----*/
     /*----- 获得模板信息 -----*/
     $tpl_obj = new MessageTemplateModel();
     $tpl_list = $tpl_obj->getTplList($_SESSION['globaluserid'], array('id', 'name', 'iscommon', 'content', 'incommonuse'), 2);
     $this->smarty->assign('tpllist', $tpl_list);
     /*----- 获得模板信息  -----*/
     /*----- 获得文件夹分类列表 -----*/
     $categorylist = new messagecategoryModel();
     $cat_list = $categorylist->getAllCategoryInfoList(' and is_delete=0', 2);
     $this->smarty->assign('catlist', $cat_list);
     /*----- 获得文件夹分类列表 -----*/
     $this->smarty->assign('msglist', $msg_list);
     $this->smarty->assign('bigpriidList', $bigpriidList);
     $this->smarty->assign('sec_menue', 4);
     $this->smarty->assign('toplevel', 0);
     $this->smarty->assign('toptitle', 'message回复');
     $this->smarty->display('msgreplyaliorder.htm');
 }