function getAnswerList()
 {
     $tlist = mod_crmmanage::getqtype();
     foreach ($tlist as $key => $value) {
         $newtype[$key + 1] = $value;
     }
     $newtype = genTree($newtype);
     //$answer_id=mod_crmtest::getAnswerId();
     //debug($alist['answer_id']);
     $alist = mod_crmtest::getanswerlist();
     //debug($alist);
     //$a=mb_substr($alist['3']['content'],0,2);
     pm_tpl::assign("ser_tlist", $newtype);
     pm_tpl::assign("alist", $alist);
     pm_tpl::display('crmtest_getanswerlist');
 }
 public function export()
 {
     $where = stripcslashes($_GET['query']);
     $sql = "SELECT * from crm_question WHERE `exists`= '1' {$where} order by create_time desc";
     $list = pm_db::fetch_all_result($sql);
     $plist = mod_product::getcrmproduct();
     $tlist = mod_crmmanage::getqtype();
     $slist = mod_crmmanage::getserverlist();
     foreach ($list as &$value) {
         foreach ($slist as $val) {
             if ($value['server_id'] == $val['id']) {
                 $value['server'] = $val['server_name'];
             }
         }
         foreach ($plist as $val) {
             if ($value['game_id'] == $val['pid']) {
                 $value['game'] = $val['pname'];
             }
         }
         foreach ($tlist as $val) {
             if ($value['qtype_id'] == $val['id']) {
                 $value['qtype'] = $val['name'];
             }
         }
         if ($value['status'] == 'untreated') {
             $value['status_info'] = "未处理";
         } elseif ($value['status'] == 'processed') {
             $value['status_info'] = "已处理";
         } else {
             $value['status_info'] = "已关闭";
         }
         if ($value['operation'] == 1) {
             $value['status_info'] .= "--运营处理中";
         }
         if ($value['operation'] == 2) {
             $value['status_info'] .= "--运营已回复";
         }
     }
     $line = "<tr>";
     foreach ($list as $value) {
         $line .= "<td>" . $value['question_id'] . "</td>";
         $line .= "<td>" . $value['title'] . "</td>";
         $line .= "<td>" . $value['content'] . "</td>";
         $line .= "<td>" . $value['game'] . "</td>";
         $line .= "<td>" . $value['server'] . "</td>";
         $line .= "<td>" . $value['channel'] . "</td>";
         $line .= "<td>" . $value['account'] . "</td>";
         $line .= "<td>" . $value['nick'] . "</td>";
         $line .= "<td>" . $value['role_id'] . "</td>";
         $line .= "<td>" . $value['occurs_time'] . "</td>";
         $line .= "<td>" . $value['qtype'] . "</td>";
         $line .= "<td>" . $value['create_time'] . "</td>";
         $line .= "<td>" . $value['status_info'] . "</td>";
         $line .= "<td>" . $value['qq'] . "</td>";
         $line .= "<td>" . $value['mobile'] . "</td>";
         $line .= "<td>" . $value['email'] . "</td></tr><tr>";
     }
     $content = substr($line, 0, -4);
     $template = file_get_contents("template.html");
     $html = str_replace("[content]", $content, $template);
     echo $html;
 }
 public function serverlist()
 {
     $_GET['game_id'] != -1 && ($gid = $_GET['game_id']);
     $plist = mod_product::getcrmproduct();
     $slist = mod_crmmanage::getserverlist($gid);
     if ($slist) {
         foreach ($plist as $value) {
             foreach ($slist as &$val) {
                 if ($value['pid'] == $val['gid']) {
                     $val['pname'] = $value['pname'];
                 }
             }
         }
         unset($val);
     }
     pm_tpl::assign('gid', $gid);
     pm_tpl::assign('slist', $slist);
     pm_tpl::assign('plist', $plist);
     pm_tpl::assign("ur_here", "区服列表");
     pm_tpl::assign('action_link', array('href' => '?c=crmmanage&a=addserver', 'text' => '添加区服'));
     pm_tpl::display('crmmanage_serverlist');
 }