예제 #1
0
 private function editMsgCategoryDataSubmit()
 {
     $data['name'] = isset($_POST['catname']) ? trim($_POST['catname']) : '';
     //名称
     $data['rules'] = isset($_POST['alphabet']) ? $_POST['alphabet'] : array();
     $data['account'] = isset($_POST['account']) ? trim($_POST['account']) : '';
     //账号
     $data['site'] = isset($_POST['site']) ? trim($_POST['site']) : '';
     $data['gmail'] = isset($_POST['gmail']) ? trim($_POST['gmail']) : '';
     $data['notes'] = isset($_POST['notes']) ? trim($_POST['notes']) : '';
     //备注
     extract($this->platformRelate($type));
     //特定平台相关信息
     $data['rules'] = array_intersect($data['rules'], generate_alphabet());
     //计算交集      以确保规则正确
     $data['rules'] = implode(',', $data['rules']);
     $data = array_map('mysql_real_escape_string', $data);
     $msgcat_obj = new amazonmessagecategoryModel();
     $lpower_obj = new LocalPowerAmazonModel();
     $global_obj = new GetLoacalUserModel();
     //print_r($_SESSION);
     $creater = $global_obj->getRealNameByGlobalId($_SESSION['globaluserid']);
     $data['creater'] = $creater['global_user_name'];
     $data['createtime'] = time();
     if ($data['account'] == -1) {
         //未分配账号
         $promptdata = array('data' => array('请分配账号!'), 'link' => $gobackurl);
         goErrMsgPage($promptdata);
     }
     $cid = isset($_POST['cid']) ? trim($_POST['cid']) : 0;
     //这下面是判断是新增分类还是编辑分类,然后执行相应操作
     if ($cid === 0) {
         //新增加分类
         try {
             $result = $msgcat_obj->addNewCategory($data);
         } catch (Exception $e) {
             $promptdata = array('data' => array('新增分类失败!'), 'link' => $gobackurl);
             goErrMsgPage($promptdata);
             exit;
         }
         if (empty($result)) {
             //不存在的id
             $promptdata = array('data' => array('不合法的id!'), 'link' => $gobackurl);
             goErrMsgPage($promptdata);
             exit;
         } else {
             /*----- 将新增的分类的权限给创建者 -----*/
             try {
                 $new_cid = $msgcat_obj->getCategoryInfoByCatname($data['name']);
                 $lpower_obj->updatePowerByAddClass($_SESSION['userId'], $new_cid['id']);
             } catch (Exception $e) {
                 print_r($new_cid);
                 /* $promptdata = array('data'=>array('权限更新失败!'), 'link'=>$gobackurl);
                   	goErrMsgPage($promptdata); */
                 exit;
             }
         }
     } else {
         //更新分类
         /*----- 如果是更新 则需确保数据分类是否和操作的向对应 -----*/
         $catinfo = $msgcat_obj->getCategoryInfoById($cid);
         if (empty($catinfo)) {
             //不存在的id
             $promptdata = array('data' => array('不合法的id!'), 'link' => $gobackurl);
             goErrMsgPage($promptdata);
             exit;
         }
         $result = $msgcat_obj->updateCategoryInfo($cid, $data);
     }
     if ($result) {
         $promptdata = array('data' => array('操作成功!'), 'link' => $gobackurl);
         goOkMsgPage($promptdata);
         exit;
     } else {
         $promptdata = array('data' => array('操作失败!'), 'link' => $gobackurl);
         goErrMsgPage($promptdata);
         exit;
     }
 }
예제 #2
0
 public function view_messageStatisticsAli()
 {
     $starttime = isset($_GET['starttime']) ? trim($_GET['starttime']) : '';
     $endtime = isset($_GET['endtime']) ? trim($_GET['endtime']) : '';
     $type = isset($_GET['type']) ? trim($_GET['type']) : 'order';
     $wheresql = '';
     date_default_timezone_set('America/Los_Angeles');
     //转换成洛杉矶时间
     $start_stamp = strtotime($starttime);
     $end_stamp = strtotime($endtime) + 84600;
     date_default_timezone_set('Asia/Shanghai');
     if (!empty($starttime)) {
         $wheresql .= ' and createtimestamp > ' . $start_stamp;
     }
     if (!empty($endtime)) {
         $wheresql .= ' and createtimestamp < ' . $end_stamp;
     }
     $localuser = new GetLoacalUserModel();
     $mysql_obj = new MysqlModel();
     $cat_obj = new messagecategoryModel();
     $list = $cat_obj->getAllCategoryInfoList('', 2);
     //         print_r($list);
     $userGroup = array();
     foreach ($list as $lival) {
         $cat_name = trim($lival['category_name']);
         $nameBreak = explode("--", $cat_name);
         $userName = array_pop($nameBreak);
         if (array_key_exists($userName, $userGroup)) {
             $userGroup[$userName][] = $lival['id'];
         } else {
             $userGroup[$userName] = array($lival['id']);
         }
     }
     $userName2loginName = array('韩庆新' => '*****@*****.**', '王丽娟' => '*****@*****.**', '王玲' => '*****@*****.**', '王铭' => '*****@*****.**', '喻情' => '*****@*****.**', '黄海娣' => '*****@*****.**', '袁岸' => '*****@*****.**', '潘小红' => '*****@*****.**', '陈小燕' => '*****@*****.**', '肖奇生' => '*****@*****.**', '戴霞' => '*****@*****.**', '温健玲' => '*****@*****.**', '肖庚莲' => '*****@*****.**');
     $name2id = $localuser->getUserId($userName2loginName);
     //中文名称到系统用户id的映射关系
     //         print_r($name2id);
     if ($type == 'order') {
         //处理订单留言
         $sql = "select fieldId , hasread,count(*) as num from msg_aliordermessage where role=1 and hasread in (0,1)\n                       {$wheresql} group by fieldId, hasread\n                    ";
         //             echo $sql;exit;
         $resultList = $mysql_obj->getQueryResult($sql);
         $statistics = array();
         //统计数据
         foreach ($userGroup as $username => $ids) {
             if (!array_key_exists($username, $statistics)) {
                 $statistics[$username] = array(0 => 0, 1 => 0);
             }
             foreach ($resultList as $row) {
                 if (in_array($row['fieldId'], $ids)) {
                     if ($row['hasread'] == 0) {
                         //累加未回复留言
                         $statistics[$username][0] += $row['num'];
                     } elseif ($row['hasread'] == 1) {
                         //累加已读留言
                         $statistics[$username][1] += $row['num'];
                     }
                 }
             }
         }
         foreach ($statistics as $key => $item) {
             $total = array_sum($item);
             $statistics[$key]['total'] = $total;
         }
         //             print_r($statistics);
         $replyedStatistics = array();
         //已回复留言统计
         $userIdSql = implode(', ', $name2id);
         $sqlre = "select replyer, count(*) as num from msg_aliordermessage where role=1 and replyer in ({$userIdSql}) \n                                    and hasread=2 {$wheresql}  group by replyer";
         //             echo $sqlre;exit;
         $replyResult = $mysql_obj->getQueryResult($sqlre);
         $replyList = array();
         foreach ($replyResult as $reRow) {
             $replyList[$reRow['replyer']] = $reRow['num'];
         }
         $totalNohandle = 0;
         //未处理的留言总数
         $totalRead = 0;
         //已读留言总数
         $totalReply = 0;
         //已回复留言总数
         foreach ($statistics as $r) {
             $totalNohandle += $r[0];
             $totalRead += $r[1];
             $totalReply += $r[2];
         }
         global $dbConn;
         $accountGroup = $this->getAliAccountGroup();
         $gropAmount = array();
         foreach ($accountGroup as $key => $group) {
             $sql_str = implode("', '", $group);
             $sql = "select count(1) as num from msg_aliordermessage where receiverid in ('{$sql_str}') {$wheresql}";
             $row = $dbConn->fetch_first($sql);
             $gropAmount[$key] = $row['num'];
         }
         $filpNameId = array_flip($name2id);
         foreach ($statistics as $user => $rows) {
             $userId = isset($name2id[$user]) ? $name2id[$user] : -1;
             if (isset($replyList[$userId])) {
                 $statistics[$user][2] = $replyList[$userId];
             } else {
                 $statistics[$user][2] = 0;
             }
         }
         $thirdmenue = 1;
     } else {
         //处理站内信
         $sql = "select fieldId , hasread, count(*) as num from msg_alisitemessage where role=1 and hasread in (0,1)\n                      {$wheresql}  group by fieldId, hasread\n                    ";
         $resultList = $mysql_obj->getQueryResult($sql);
         $statistics = array();
         // 统计数据
         foreach ($userGroup as $username => $ids) {
             if (!array_key_exists($username, $statistics)) {
                 $statistics[$username] = array(0 => 0, 1 => 0);
             }
             foreach ($resultList as $row) {
                 if (in_array($row['fieldId'], $ids)) {
                     if ($row['hasread'] == 0) {
                         // 累加未回复留言
                         $statistics[$username][0] += $row['num'];
                     } elseif ($row['hasread'] == 1) {
                         // 累加已读留言
                         $statistics[$username][1] += $row['num'];
                     }
                 }
             }
         }
         foreach ($statistics as $key => $item) {
             $total = array_sum($item);
             $statistics[$key]['total'] = $total;
         }
         //             print_r($statistics);
         $replyedStatistics = array();
         // 已回复留言统计
         $userIdSql = implode(', ', $name2id);
         $sqlre = "select replyer, count(*) as num from msg_alisitemessage where role=1 and replyer in ({$userIdSql}) \n                                  and hasread=2 {$wheresql} group by replyer";
         //             echo $sqlre;exit;
         $replyResult = $mysql_obj->getQueryResult($sqlre);
         $replyList = array();
         foreach ($replyResult as $reRow) {
             $replyList[$reRow['replyer']] = $reRow['num'];
         }
         $totalNohandle = 0;
         // 未处理的留言总数
         $totalRead = 0;
         // 已读留言总数
         $totalReply = 0;
         // 已回复留言总数
         foreach ($statistics as $r) {
             $totalNohandle += $r[0];
             $totalRead += $r[1];
             $totalReply += $r[2];
         }
         global $dbConn;
         $accountGroup = $this->getAliAccountGroup();
         $gropAmount = array();
         foreach ($accountGroup as $key => $group) {
             $sql_str = implode("', '", $group);
             $sql = "select count(1) as num from msg_alisitemessage where receiverid in ('{$sql_str}') {$wheresql}";
             $row = $dbConn->fetch_first($sql);
             $gropAmount[$key] = $row['num'];
         }
         //             print_r($gropAmount);exit;
         $filpNameId = array_flip($name2id);
         //             print_r($filpNameId);
         foreach ($statistics as $user => $rows) {
             $userId = isset($name2id[$user]) ? $name2id[$user] : -1;
             if (isset($replyList[$userId])) {
                 $statistics[$user][2] = $replyList[$userId];
             } else {
                 $statistics[$user][2] = 0;
             }
         }
         //             print_r($statistics);exit;
         $thirdmenue = 2;
     }
     //         exit;
     //         print_r($data);exit;
     $this->smarty->assign('third_menue', $thirdmenue);
     $this->smarty->assign('starttime', $starttime);
     $this->smarty->assign('endtime', $endtime);
     $this->smarty->assign('totalNhandle', $totalNohandle);
     $this->smarty->assign('totalread', $totalRead);
     $this->smarty->assign('totalreply', $totalReply);
     $this->smarty->assign('type', $type);
     $this->smarty->assign('toplevel', 3);
     //         $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('statistics', $statistics);
     $this->smarty->assign('statistics_2', $gropAmount);
     $this->smarty->assign('sec_menue', 2);
     $this->smarty->display('msgstatisticsAliorder.htm');
 }
예제 #3
0
 private function allocateFieled()
 {
     extract($this->generateInfo());
     $userid = isset($_GET['uid']) ? $_GET['uid'] : FALSE;
     if (!is_numeric($userid) || $userid === FALSE) {
         $msgdata = array('data' => array('用户id不合法!'), 'link' => $gobackurl);
         goErrMsgPage($msgdata);
         exit;
     }
     $use_obj = new GetLoacalUserModel();
     $userinfo = $use_obj->getUserInfoById($userid);
     if (empty($userinfo)) {
         $msgdata = array('data' => array('用户信息不存在!'), 'link' => $gobackurl);
         goErrMsgPage($msgdata);
         exit;
     }
     //获得相应平台 文件夹信息
     $cat_obj = new amazonmessagecategoryModel();
     $catlist = $cat_obj->getAllCategoryInfoList(' order by category_name');
     //         print_r($catlist);exit;
     //print_r($catlist);exit;
     //获得用户权限
     $lp_obj = new LocalPowerAmazonModel();
     $userpower = $lp_obj->getUserInfo($userinfo['user_id'])['power'];
     // print_r($userpower);exit;
     $this->smarty->assign('userpower', explode(',', $userpower));
     $this->smarty->assign('gobackurl', $gobackurl);
     $this->smarty->assign('catlist', $catlist);
     $this->smarty->assign('submiturl', $submiturl);
     $this->smarty->assign('userinfo', $userinfo);
     $this->smarty->assign('sec_menue', $sec_menue);
     $this->smarty->assign('toplevel', 4);
     $this->smarty->assign('toptitle', 'Amazon message类别列表');
     $this->smarty->display('fieldAllocationAmazon.htm');
 }
예제 #4
0
 public function getUserInfoBySysId($userId, $way = 1)
 {
     $returnar = array('userName' => NULL);
     if ($way === 1) {
         $info = $this->getUsernameById($userId);
         if (!empty($info)) {
             $decode = json_decode($info, TRUE);
             if (is_array($decode)) {
                 $returnar['userName'] = $decode[0]['userName'];
             } else {
                 $returnar['userName'] = '';
             }
         }
     } else {
         $glu_ojb = new GetLoacalUserModel();
         $user = $glu_ojb->getUserInfoBySysId($userId);
         if (!empty($user)) {
             $returnar['userName'] = $user['global_user_name'];
         }
     }
     return $returnar;
 }
예제 #5
0
function process_message($msg)
{
    $dbalive = mysql_ping();
    if ($dbalive !== TRUE) {
        //数据库连接失效 重连
        echo "reconnecting DB ! \n";
    }
    global $remsg_obj, $msg_obj, $rm_obj, $remsgque_obj, $dbConn;
    $message_body = json_decode($msg->body, TRUE);
    if ($message_body == FALSE || !is_array($message_body) || !isset($message_body['id'])) {
        echo 'invalid message ! --- ' . $msg->body . "\n";
        return;
    }
    $id = $message_body['id'];
    $sql = "select * from msg_replyqueue where id={$id}  limit 1";
    $row = $dbConn->fetch_first($sql);
    if (empty($row)) {
        //没找到信息 直接return
        $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
        //删除队列信息
        return;
    }
    $infor = unserialize($row['parameter']);
    // 反序列化其他扩展信息
    /*----- 根据账号来加载账号信息 -----*/
    $ebayaccount = $row['account'];
    //所属账号
    $token_file = WEB_PATH . "lib/ebaylibrary/keys/keys_" . $ebayaccount . ".php";
    if (!file_exists($token_file)) {
        echo formatetime() . '---' . $token_file . " does not exists!!! at code line--" . __LINE__ . "\n";
        // 密码文件不存在
        $remsgque_obj->delAQueueRecords($row['id']);
        //数据不对直接删除
        $msg_obj->updateMessageStatus(array($row['messageid']), 0);
        //重置message为0的状态
        $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
        //删除队列信息
        return;
        // 退出
    }
    include '' . $token_file;
    /*----- 导出为全局变量 ugly code -----*/
    $GLOBALS['siteID'] = $siteID;
    $GLOBALS['production'] = $production;
    $GLOBALS['compatabilityLevel'] = $compatabilityLevel;
    $GLOBALS['devID'] = $devID;
    $GLOBALS['appID'] = $appID;
    $GLOBALS['certID'] = $certID;
    $GLOBALS['serverUrl'] = $serverUrl;
    $GLOBALS['userToken'] = $userToken;
    /*----- 根据账号来加载账号信息 -----*/
    $msgid = $row['messageid'];
    //对应的message表的主键id
    if ($row['replytype'] == 1) {
        //带有回复内容的message回复
        $content = $row['retext'];
        //回复内容
        $copytosender = $infor['iscopy'];
        // 是否抄送 改值只能为0、1
        /*----- 推送回复到线上 -----*/
        $result = $rm_obj->replyMessage($msgid, $content, $copytosender);
        //回复 并返回结果
        if ($result == TRUE) {
            //执行成功则标记为已经读取
            $result = $rm_obj->markAsRead($msgid, 'Read');
            if (!$result) {
                echo ReplyMessageModel::$errMsg . " --- 回邮件发送成功, 标记已读失败!\n";
            }
        }
    } else {
        //只标及为回复状态 没有回复内容的
        /*----- 发送请求 -----*/
        $result = $rm_obj->markAsRead($msgid, 'Read');
    }
    if ($result == TRUE) {
        // 发送成功 删除该回复队列记录
        $remsgque_obj->delAQueueRecords($row['id']);
        $status = 2;
        // 默认为正常回复
        if ($row['replytype'] == 2) {
            //为标记回复
            $status = 3;
        }
        $msg_obj->updateMessageStatus(array($msgid), $status);
        //将message状态改为回复成功
        echo 'success!  ' . date('Y:m:d H:i:s', time()) . "\n";
    } else {
        // 发送失败
        echo date('Y-m-d H:i:s', time()) . '---' . __LINE__ . '---' . __FILE__ . '---' . ReplyMessageModel::$errMsg . "\n";
        $errcontent = ReplyMessageModel::$sendMsg;
        if (ReplyMessageModel::$sender != NULL) {
            $usrmod_obj = new GetLoacalUserModel();
            $userinfo = $usrmod_obj->getUserInfoBySysId(ReplyMessageModel::$sender);
            if (!empty($userinfo)) {
                /*发送邮件*/
                $result_sys = getOpenSysApi('notice.send.message', array('content' => $errcontent, 'from' => 'tuxinglong', 'to' => $userinfo['global_user_login_name'], 'type' => 'email'));
            }
        }
        $remsgque_obj->plusCountById($row['id']);
        // 将失败次数加一
    }
    //确认收到
    $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
    //确认收到
    // Send a message with the string "quit" to cancel the consumer.
    if ($msg->body === 'quit') {
        $msg->delivery_info['channel']->basic_cancel($msg->delivery_info['consumer_tag']);
    }
}
 public function view_messageStatistics()
 {
     $starttime = isset($_GET['starttime']) ? trim($_GET['starttime']) : '';
     $endtime = isset($_GET['endtime']) ? trim($_GET['endtime']) : '';
     $this->smarty->assign('starttime', $starttime);
     $this->smarty->assign('endtime', $endtime);
     $wheresql = '';
     if (!empty($starttime)) {
         $start_stamp = strtotime($starttime);
     } else {
         $start_stamp = strtotime(date('Y-m-d'));
         //没有开始时间就默认为当前日期
     }
     if (!empty($endtime)) {
         $end_stamp = strtotime($endtime);
     } else {
         $end_stamp = $start_stamp + 86399;
         //没有结束时间就默认为开始时间加到这天的最后一秒
     }
     if ($starttime == $endtime) {
         $end_stamp = $start_stamp + 86399;
     }
     $wheresql .= '(replytime between ' . $start_stamp . ' and ' . $end_stamp . ')';
     /*获得文件夹列表*/
     $cat_obj = new amazonmessagecategoryModel();
     $list = $cat_obj->getAllCategoryInfoList('');
     $catgroup = array();
     $finalcatgroup = array();
     //print_r($list);exit;
     /*----- 生成数组形式的客服及其所属分类id -----*/
     foreach ($list as $v) {
         $catname = $v['category_name'];
         $breakar = explode('-', $catname);
         if (isset($breakar[1])) {
             if (array_key_exists($breakar[1], $catgroup)) {
                 $catgroup[$breakar[1]][] = $v['id'];
             } else {
                 $catgroup[$breakar[1]] = array($v['id']);
             }
         }
     }
     //  print_r($catgroup);
     $localUser_obj = new GetLoacalUserModel();
     $userlist = array();
     $userlist = $localUser_obj->getUserInfo(74);
     //获得所有的74部门的成员
     $name2id = $localUser_obj->getUserId($userlist);
     $userlist_tmp = array_flip($name2id);
     //print_r($userlist_tmp);
     //这是防止创建人不是74部的
     foreach ($catgroup as $name => $cid) {
         if (in_array($name, $userlist_tmp)) {
             $finalcatgroup[$name] = $cid;
         }
     }
     // print_r($finalcatgroup);
     $idsql = implode(',', $name2id);
     //根据上边的全局id查询某个id回复了的邮件数
     $sql_user = "******";
     //echo $sql_user;
     $query_re = mysql_query($sql_user);
     $userReply = array();
     //为对应的全局id和回复的邮件数
     while ($urow = mysql_fetch_assoc($query_re)) {
         $userReply[$urow['replyuser_id']] = $urow['num'];
     }
     //print_r($userReply);
     /*----- 生成统计信息 -----*/
     /*----- 以下是先获取所有的邮件回复状况 -----*/
     $sql = "select classid, status, count(status) as num from msg_amazonmessage where ( {$wheresql} ) or replytime is null  group by classid , status";
     // echo $sql;
     $result = array();
     // result结构:array(分类id=>array(邮件状态值=>邮件数量))
     $finalresult = array();
     $final = array();
     //echo $sql;
     $qre = mysql_query($sql);
     while ($row = mysql_fetch_assoc($qre)) {
         if (array_key_exists($row['classid'], $result)) {
             if (!array_key_exists($row['status'], $result[$row['classid']])) {
                 $result[$row['classid']][$row['status']] = $row['num'];
             }
         } else {
             $result[$row['classid']] = array($row['status'] => $row['num']);
         }
     }
     // print_r($result);
     foreach ($finalcatgroup as $name => $cids) {
         foreach ($result as $classid => $status) {
             if (in_array($classid, $cids)) {
                 $finalresult[$name][] = $status;
             } else {
                 $finalresult[$name][] = array(0, 0, 0, 0);
             }
         }
     }
     //print_r($finalresult);
     //这里统计的是某个客服邮件的未回复,回复中,标记回复数
     foreach ($finalresult as $name => $status) {
         $final[$name] = array(0, 0, 0, 0);
         foreach ($status as $state) {
             $final[$name][0] += isset($state[0]) ? $state[0] : 0;
             $final[$name][1] += isset($state[1]) ? $state[1] : 0;
             $final[$name][2] += isset($state[2]) ? $state[2] : 0;
             $final[$name][3] += isset($state[3]) ? $state[3] : 0;
         }
         //名字必须在该部门,其回复的数量才会被记录,不然会被置为0
         $final[$name][2] = array_key_exists($name, $userlist) ? $final[$name][2] : 0;
         $final[$name][4] = $final[$name][0] + $final[$name][2];
         $final[$name]['name'] = $name;
     }
     //print_r($final);
     /*----- 处理排序 -----*/
     $noreply = array();
     //未回复
     $replyed = array();
     //已回复
     $replying = array();
     //回复中
     $markreply = array();
     //标记回复
     $total = array();
     //总数
     foreach ($final as $name => $item) {
         $noreply[$name] = $item[0];
         $replyed[$name] = $item[2];
         $replying[$name] = $item[1];
         $markreply[$name] = $item[3];
         $total[$name] = $item[4];
     }
     //print_r($total);exit;
     $total_noreply = array_sum($noreply);
     $total_replyed = array_sum($replyed);
     $total_replying = array_sum($replying);
     $total_markreply = array_sum($markreply);
     $total_total = array_sum($total);
     $this->smarty->assign('total_noreply', $total_noreply);
     $this->smarty->assign('total_replyed', $total_replyed);
     $this->smarty->assign('total_markreply', $total_markreply);
     $this->smarty->assign('total_replying', $total_replying);
     $this->smarty->assign('total_total', $total_total);
     $sort_no = isset($_GET['srtn']) ? $_GET['srtn'] == 'asc' ? $sortype = 'asc' : ($sortype = 'desc') : FALSE;
     //未回复
     $sort_h = isset($_GET['srth']) ? $_GET['srth'] == 'asc' ? $sortype = 'asc' : ($sortype = 'desc') : FALSE;
     //已回复
     $sort_i = isset($_GET['srti']) ? $_GET['srti'] == 'asc' ? $sortype = 'asc' : ($sortype = 'desc') : FALSE;
     //回复中
     $sort_m = isset($_GET['srtm']) ? $_GET['srtm'] == 'asc' ? $sortype = 'asc' : ($sortype = 'desc') : FALSE;
     //标记回复
     $sort_t = isset($_GET['srtt']) ? $_GET['srtt'] == 'asc' ? $sortype = 'asc' : ($sortype = 'desc') : FALSE;
     //总数
     if ($sort_no !== FALSE) {
         //未回复排序
         if ($sort_no == 'asc') {
             //升序
             asort($noreply);
         } else {
             //降序
             arsort($noreply);
         }
         $this->smarty->assign('condition', 'sort_no');
         $this->smarty->assign('sortindex', $noreply);
     } elseif ($sort_h !== FALSE) {
         //已回复
         if ($sort_h == 'asc') {
             asort($replyed);
         } else {
             arsort($replyed);
         }
         $this->smarty->assign('condition', 'sort_h');
         $this->smarty->assign('sortindex', $replyed);
     } elseif ($sort_i !== FALSE) {
         //回复中
         if ($sort_i == 'asc') {
             asort($replying);
         } else {
             arsort($replying);
         }
         $this->smarty->assign('condition', 'sort_i');
         $this->smarty->assign('sortindex', $replying);
     } elseif ($sort_m !== FALSE) {
         //标记回复
         if ($sort_m == 'asc') {
             asort($markreply);
         } else {
             arsort($markreply);
         }
         $this->smarty->assign('condition', 'sort_m');
         $this->smarty->assign('sortindex', $markreply);
     } elseif ($sort_t !== FALSE) {
         //总数量
         if ($sort_t == 'asc') {
             asort($total);
         } else {
             arsort($total);
         }
         $this->smarty->assign('condition', 'sort_t');
         $this->smarty->assign('sortindex', $total);
     } else {
         //默认按未回复数量降序排列
         if ($sort_no == 'asc') {
             //升序
             asort($noreply);
         } else {
             //降序
             arsort($noreply);
         }
         $this->smarty->assign('condition', 'sort_no');
         $this->smarty->assign('sortindex', $noreply);
     }
     //print_r($noreply);exit;
     $this->smarty->assign('sorttype', $sortype);
     /*----- 处理排序 -----*/
     $this->smarty->assign('sec_menue', 7);
     $navlist = array(array('url' => 'index.php?mod=msgCategoryAmazon&act=categoryList', 'title' => 'Amazon message系统'), array('url' => '', 'title' => 'Amazon message统计'));
     $isExport = isset($_GET['export']) ? TRUE : FALSE;
     if ($isExport) {
         $final[] = array($total_noreply, 0, $total_replyed, 0, $total_total, 'name' => '统计');
         $this->exportExcell($starttime, $endtime, $final);
         exit;
     }
     $this->smarty->assign('starttime', date('Y-m-d', $start_stamp));
     $this->smarty->assign('endtime', date('Y-m-d', $end_stamp));
     $this->smarty->assign('toplevel', 3);
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('statistics', $final);
     $this->smarty->assign('sec_menue', 3);
     $this->smarty->display('msgstatisticsAmazon.htm');
 }
예제 #7
0
 public function view_mailPushSettingList()
 {
     include_once WEB_PATH . 'lib/global_ebay_accounts.php';
     //导入ebay平台账号
     $bindObj = new UserAccountBindModel();
     $relatio = array();
     $userObj = new GetLoacalUserModel();
     foreach ($GLOBAL_EBAY_ACCOUNT as $account) {
         $users = $bindObj->getBindInfo($account);
         foreach ($users as &$u) {
             $userInfo = $userObj->getUserInfoBySysId($u['userID']);
             $u['name'] = isset($userInfo['global_user_name']) ? $userInfo['global_user_name'] : '';
         }
         $relation[$account] = $users;
     }
     $allowedList = $bindObj->getAllowedAccount($_SESSION['globaluserid']);
     $GLOBAL_EBAY_ACCOUNT = array_intersect($allowedList, $GLOBAL_EBAY_ACCOUNT);
     //         print_r($relation);exit;
     $this->smarty->assign('accountList', $GLOBAL_EBAY_ACCOUNT);
     $this->smarty->assign('sec_menue', 4);
     $this->smarty->assign('toplevel', 4);
     $this->smarty->assign('powerList', $relation);
     $this->smarty->assign('toptitle', 'message类别列表');
     $this->smarty->display('mailPushSettingList.htm');
 }