Example #1
0
 public function view_categoryListAli()
 {
     /* -----  获取全部的分类列表  -----*/
     $msgcat_obj = new messagecategoryModel();
     $lp_ojb = new LocalPowerModel();
     $powerlist = $lp_ojb->getAliPowerlist($_SESSION['userId']);
     // print_r($powerlist);exit;
     if (empty($powerlist['field'])) {
         $filsql = '0';
     } else {
         $filsql = implode(', ', $powerlist['field']);
     }
     //echo $filsql;exit;
     $arrlist = $msgcat_obj->getAllCategoryInfoList(' and id in (' . $filsql . ') and platform=2 order by category_name');
     $msg_obj = new AliOderMessageModel();
     foreach ($arrlist as &$listval) {
         /* ---- 计算某个分类下已经读取的数量 <订单留言>  ---- */
         $replyed_num_order = $msg_obj->culculateNumberOrder(" and fieldId={$listval['id']} and hasread=1");
         $listval['replyed_order'] = $replyed_num_order;
         /* ---- 计算某个分类下未读的数量  <订单留言>---- */
         $noreply_num_order = $msg_obj->culculateNumberOrder(" and fieldId={$listval['id']} and hasread=0");
         $listval['noreply_order'] = $noreply_num_order;
         /* ---- 计算某个分类下已读的数量 <站内信>  ---- */
         $replyed_num_site = $msg_obj->culculateNumberSite(" and fieldId={$listval['id']} and hasread=1");
         $listval['replyed_site'] = $replyed_num_site;
         /* ---- 计算某个分类下未读的数量  <站内信>---- */
         $noreply_num_site = $msg_obj->culculateNumberSite(" and fieldId={$listval['id']} and hasread=0");
         $listval['noreply_site'] = $noreply_num_site;
     }
     $this->smarty->assign('sec_menue', 2);
     $this->smarty->assign('toplevel', 1);
     $this->smarty->assign('categorylist', $arrlist);
     $this->smarty->assign('toptitle', 'message类别列表-速卖通');
     $this->smarty->display('msgcategorylistAli.htm');
 }
Example #2
0
 public function view_replyMessageFormAliSite()
 {
     $msgids = isset($_GET['msgids']) ? trim($_GET['msgids']) : '';
     if ($msgids === '') {
         //没指定id
         $msgdata = array('data' => array('请指定要回复的message'), 'link' => 'index.php?mod=messagefilter&act=getAliSiteList');
         goErrMsgPage($msgdata);
         exit;
     }
     /*----- 获得message信息 -----*/
     $idar = explode(',', $msgids);
     //数组
     $idar = array_map('intval', $idar);
     //转换成
     $msg_obj = new messageModel();
     $msg_list = $msg_obj->getMessageInfoAliSite($idar);
     foreach ($msg_list as &$value) {
         $value['createtime'] = trunToLosangeles('Y-m-d H:i:s', $value['createtimestamp']);
         //echo $value['relationId'];
         $value['commnuni'] = $msg_obj->getRlatedSiteMessage($value['relationId']);
         $value['orderids'] = array();
         $temparr = array();
         $bigestid = 0;
         $idregion = array();
         foreach ($value['commnuni'] as &$cval) {
             $cval['createtimestamp'] = trunToLosangeles('Y:m:d H:i:s', $cval['createtimestamp']);
             if (1 == $cval['role'] && !empty($cval['orderUrl']) && !empty($cval['orderId'])) {
                 if (!in_array($cval['orderId'], $temparr)) {
                     $value['orderids'][] = array('account' => $cval['receiverid'], 'orderid' => $cval['orderId']);
                     $temparr[] = $cval['orderId'];
                 }
             }
             if ($bigestid < $cval['message_id']) {
                 $bigestid = $cval['message_id'];
             }
             if ($cval['role'] == 1) {
                 $idar[] = $cval['id'];
                 if ($cval['hasread'] == 0) {
                     $idregion[] = $cval['message_id'];
                 }
             }
             $cval['content'] = str_replace("\n", '</br>', $cval['content']);
         }
         //             print_r($idregion);
         sort($idregion);
         if (count($idregion) > 0) {
             $refirst = $idregion[0];
             $reend = $idregion[count($idregion) - 1];
             $msg_obj->markAsReadByMsgId_site($idregion);
             //标记为已读状态
             $msg_obj->markUser_site($idregion, $_SESSION['globaluserid']);
             //标记回复人id
         } else {
             $refirst = 0;
             $reend = 0;
         }
         $value['idregion_h'] = $refirst;
         $value['idregion_e'] = $reend;
         $value['bigestid'] = $bigestid;
     }
     //print_r($msg_list);exit;
     /*----- 获得message信息 -----*/
     /*----- 获得模板信息 -----*/
     $tpl_obj = new MessageTemplateModel();
     $tpl_list = $tpl_obj->getTplList($_SESSION['globaluserid'], array('id', 'name', 'iscommon', 'incommonuse', 'content'), 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);
     /*----- 获得文件夹分类列表 -----*/
     //         print_r($msg_list);exit;
     $this->smarty->assign('msglist', $msg_list);
     $this->smarty->assign('sec_menue', 4);
     $this->smarty->assign('toplevel', 0);
     $this->smarty->assign('toptitle', 'message回复');
     $this->smarty->display('msgreplyalisite.htm');
 }
Example #3
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');
 }
Example #4
0
 public function handleSubmitData($platform)
 {
     extract($this->generateInfo($platform));
     $cids = isset($_POST['catids']) ? $_POST['catids'] : array();
     $userid = isset($_POST['userid']) ? $_POST['userid'] : FALSE;
     if ($userid === FALSE) {
         $msgdata = array('data' => array('没指定用户!'), 'link' => $gobackurl);
         goErrMsgPage($msgdata);
         exit;
     }
     $msgcat_obj = new messagecategoryModel();
     $catidlist = $msgcat_obj->getAllCategoryInfoList('', $platformid, 'id');
     $original = array();
     foreach ($catidlist as $value) {
         $original[] = $value['id'];
     }
     $original[] = -1;
     //增加额外文件夹 迷途文件夹 -1
     $finalids = array_intersect($original, $cids);
     //保证提交的分类id都是在正确范围内的
     $power = array('field' => $finalids);
     $power_ser = serialize($power);
     $lp_obj = new LocalPowerModel();
     $upresult = $lp_obj->{$updatefunc}($userid, $power_ser);
     if ($upresult) {
         $msgdata = array('data' => array('成功!'), 'link' => $gobackurl);
         goOkMsgPage($msgdata);
         exit;
     } else {
         $msgdata = array('data' => array('失败!'), 'link' => $gobackurl);
         goErrMsgPage($msgdata);
         exit;
     }
 }
Example #5
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');
 }