Beispiel #1
0
 public function view_getAliOrderList_site()
 {
     $keywords = isset($_GET['keywords']) ? trim($_GET['keywords']) : '';
     //关键字
     $keywords = mysql_real_escape_string($keywords);
     $account = isset($_GET['account']) ? intval($_GET['account']) : '';
     //销售账号
     $status = isset($_GET['status']) ? $_GET['status'] : FALSE;
     //回复状态
     $category = isset($_GET['catid']) ? intval($_GET['catid']) : FALSE;
     //分类
     $senderId = isset($_GET['senderid']) ? trim($_GET['senderid']) : FALSE;
     //发送人id
     $orderId = isset($_GET['orderid']) ? trim($_GET['orderid']) : FALSE;
     //订单号
     $prodname = isset($_GET['prodname']) ? trim($_GET['prodname']) : FALSE;
     //差评名称
     $cat_obj = new messagecategoryModel();
     /*----- 获得用户所属文件夹 -----*/
     $Lp_obj = new LocalPowerModel();
     $fieldid = $Lp_obj->getAliPowerlist($_SESSION['userId']);
     //获得当前用户所属的id
     $fieldid = isset($fieldid['field']) ? $fieldid['field'] : array(-1);
     $category = in_array($category, $fieldid) ? $category : -1;
     /*----- 获得用户所属文件夹 -----*/
     if (!empty($fieldid)) {
         $powerlist = $cat_obj->getFieldInfoByIds($fieldid, ' order by category_name');
     } else {
         $powerlist = array();
     }
     $wheresql = '';
     if (!empty($keywords)) {
         //是否指定keywords
         $wheresql .= " and senderid='{$keywords}' ";
     }
     if ($status !== FALSE) {
         //指定状态
         switch ($status) {
             case 1:
                 //回复完成
                 $wheresql .= " and status in (2,3)";
                 break;
             case 2:
                 //未回复
                 $wheresql .= " and status=0 ";
                 break;
             case 3:
                 //回复中
                 $wheresql .= " and status=1 ";
                 break;
             case 4:
                 //回复失败
                 $wheresql .= " and status=4 ";
                 break;
             default:
                 $wheresql .= "";
                 break;
         }
     }
     if ($category !== false) {
         if ($category == -1) {
             $class_sql = implode(', ', $fieldid);
             $wheresql .= " and fieldId in ({$class_sql})";
         } else {
             $wheresql .= " and  ={$category}";
         }
     } else {
         $class_sql = implode(', ', $fieldid);
         $wheresql .= " and fieldId in ({$class_sql}) ";
     }
     $pagesize = 100;
     $msg_obj = new messageModel();
     $mount = $msg_obj->getCountNumberByConditions_aliOrder($wheresql);
     $page_obj = new Page($mount, $pagesize);
     $usercache = new UserCacheModel();
     $msglist = $msg_obj->getMessageListByConditions_aliorder($wheresql . ' order by createtimestr ' . $page_obj->limit);
     $aliAcc_ojb = new AliAccountModel();
     /* --- 格式化数据 ---*/
     foreach ($msglist as &$msgitem) {
         $catinfo = $cat_obj->getCategoryInfoById($msgitem['fieldId']);
         $msgitem['classname'] = $catinfo['category_name'];
         $userinfo = empty($msgitem['replyuser_id']) ? array('userName' => '') : $usercache->getUserInfoBySysId($msgitem['replyuser_id'], 0);
         $msgitem['username'] = $userinfo['userName'];
         $msgitem['retime'] = $msgitem['replytime'] ? date("Y-m-d \n H:i:s", $msgitem['replytime']) : '';
         $msgitem['accname'] = $aliAcc_ojb->accountId2Name();
     }
     if ($mount > $pagesize) {
         //分页
         $pagestr = $page_obj->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $pagestr = $page_obj->fpage(array(0, 2, 3));
     }
     //         print_r($msglist);exit;
     /*----- 获得分类文件夹列表 -----*/
     $categorylist = $cat_obj->getAllCategoryInfoList(' and is_delete=0', 2);
     //         print_r($categorylist);
     $this->smarty->assign('catlist', $categorylist);
     /*----- 获得分类列表 -----*/
     $this->smarty->assign('third_menue', 1);
     $this->smarty->assign('powerlist', $powerlist);
     $this->smarty->assign('from', $from);
     $this->smarty->assign('sec_menue', 4);
     $this->smarty->assign('toplevel', 0);
     $this->smarty->assign('keywords', $keywords);
     $this->smarty->assign('category', $category);
     $this->smarty->assign('status', $status);
     $this->smarty->assign('pagestr', $pagestr);
     $this->smarty->assign('msglist', $msglist);
     $this->smarty->assign('categorylist', $arrlist);
     $this->smarty->assign('toptitle', 'message列表');
     $this->smarty->display('msglistaliorder.htm');
 }