public function view_getSpuArchiveList() { $omAvailableAct = new OmAvailableAct(); $status = isset($_GET['status']) ? post_check($_GET['status']) : ''; $spu = isset($_GET['spu']) ? post_check($_GET['spu']) : ''; $auditStatus = isset($_GET['auditStatus']) ? $_GET['auditStatus'] : ''; $spuStatus = isset($_GET['spuStatus']) ? $_GET['spuStatus'] : ''; $purchaseId = isset($_GET['purchaseId']) ? $_GET['purchaseId'] : ''; $isPPVRecord = isset($_GET['isPPVRecord']) ? $_GET['isPPVRecord'] : ''; //有无属性记录搜索 $haveSizePPV = isset($_GET['haveSizePPV']) ? $_GET['haveSizePPV'] : ''; //是否有尺码属性值记录 $isMeasureRecord = isset($_GET['isMeasureRecord']) ? $_GET['isMeasureRecord'] : ''; //有无尺寸测量记录搜索 $pid = isset($_GET['pid']) ? $_GET['pid'] : ''; $dept = isset($_GET['dept']) ? $_GET['dept'] : ''; $startdate = isset($_GET['startdate']) ? $_GET['startdate'] : ''; $enddate = isset($_GET['enddate']) ? $_GET['enddate'] : ''; $tName = 'pc_spu_archive'; $select = '*'; $where = 'WHERE is_delete=0 '; if (!empty($spu)) { $where .= "AND spu='{$spu}' "; } if (!empty($auditStatus)) { $where .= "AND auditStatus='{$auditStatus}' "; } if (!empty($spuStatus)) { if (isAccessAll('autoCreateSpu', 'auditSpuArchive')) { //如果有审核权限的人,则可以看到所有状态的人员的记录 $where .= "AND spuStatus='{$spuStatus}' "; } else { //如果没有审核权限的人,只能看到自己对应所在状态的记录 $where .= "AND spuStatus='{$spuStatus}' AND purchaseId='{$_SESSION['userId']}' "; } } if (!empty($pid)) { $where .= "AND categoryPath REGEXP '^{$pid}(-[0-9]+)*\$' "; } if (intval($purchaseId) != 0) { $where .= "AND purchaseId='{$purchaseId}' "; } if (intval($isPPVRecord) != 0) { $spuList = getSpuPPV(); if (!empty($spuList)) { $tmpArr = array(); foreach ($spuList as $value) { $tmpArr[] = "'" . $value['spu'] . "'"; } $tmpStr = implode(',', $tmpArr); if ($isPPVRecord == 1) { //无记录 $where .= "AND spu not in({$tmpStr}) "; } elseif ($isPPVRecord == 2) { //有记录 $where .= "AND spu in({$tmpStr}) "; } } } if (intval($haveSizePPV) != 0) { $spuList = getSpuListByPropertyName('尺码'); //获取具有尺码属性关联的spuList if (!empty($spuList)) { $tmpArr = array(); foreach ($spuList as $value) { $tmpArr[] = "'" . $value['spu'] . "'"; } $tmpStr = implode(',', $tmpArr); if ($haveSizePPV == 1) { //无记录 $where .= "AND spu not in({$tmpStr}) "; } elseif ($haveSizePPV == 2) { //有记录 $where .= "AND spu in({$tmpStr}) "; } } } if (intval($isMeasureRecord) != 0) { $spuList = OmAvailableModel::getTNameList('pc_archive_spu_input_size_measure', 'spu', 'group by spu'); if (!empty($spuList)) { $tmpArr = array(); foreach ($spuList as $value) { $tmpArr[] = "'" . $value['spu'] . "'"; } $tmpStr = implode(',', $tmpArr); if ($isMeasureRecord == 1) { //无记录 $where .= "AND spu not in({$tmpStr}) "; } elseif ($isMeasureRecord == 2) { //有记录 $where .= "AND spu in({$tmpStr}) "; } } } $dept = intval($dept); $spuArchiveDepArr = getSpuArchiveDetArr(); if (array_key_exists($dept, $spuArchiveDepArr)) { //检查要所搜的部门是否包含在定义内 $personIdArr = OmAvailableModel::getAllPersonIdByDeptId($dept); //每个销售部下面的人员id的arr $personStr = implode(',', array_filter($personIdArr)); if (!empty($personStr)) { $where .= "AND purchaseId in({$personStr}) "; } } if ($startdate != '') { $start = strtotime($startdate . ' 00:00:00'); $where .= "AND spuCreatedTime>='{$start}' "; } if ($enddate != '') { $end = strtotime($enddate . ' 23:59:59'); $where .= "AND spuCreatedTime<='{$end}' "; } $total = $omAvailableAct->act_getTNameCount($tName, $where); $num = 100; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); $where .= "ORDER BY auditTime DESC,spuCreatedTime DESC " . $page->limit; $spuArchiveList = $omAvailableAct->act_getTNameList($tName, $select, $where); if (!empty($_GET['page'])) { if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) { $n = 1; } else { $n = (intval($_GET['page']) - 1) * $num + 1; } } else { $n = 1; } if ($total > $num) { //输出分页显示 $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $show_page = $page->fpage(array(0, 2, 3)); } $navlist = array(array('url' => 'index.php?mod=autoCreateSpu&act=getAutoCreatePrefixList', 'title' => 'SPU管理'), array('url' => 'index.php?mod=autoCreateSpu&act=getSpuArchiveList', 'title' => 'SPU档案管理')); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('onevar', 2); $this->smarty->assign('twovar', 23); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('title', 'SPU档案管理'); //取得搜索类别的记录 $pidArr = explode('-', $pid); $this->smarty->assign('pidArr', $pidArr); $this->smarty->assign('status', $status); if (!empty($spuArchiveList)) { $countSpuArchiveList = count($spuArchiveList); $allSpuStatusName = displayAllSpuStatus(); for ($i = 0; $i < $countSpuArchiveList; $i++) { $spuArchiveList[$i]['spuStatusName'] = $allSpuStatusName[$spuArchiveList[$i]['spuStatus']]['statusName']; } } $this->smarty->assign('spuArchiveList', empty($spuArchiveList) ? null : $spuArchiveList); $this->smarty->display("spuArchiveList.htm"); }