public function view_getProductsCombineSpuList() { $combineSpu = $_GET['combineSpu'] ? post_check(trim($_GET['combineSpu'])) : ''; $webMakerId = $_GET['webMakerId'] ? post_check(trim($_GET['webMakerId'])) : ''; $webMakerId = intval($webMakerId); $tName = 'pc_spu_web_maker a,(select spu,max(id) as id from pc_spu_web_maker group by spu) b'; $select = 'a.id,a.spu,a.webMakerId,a.addTime'; $where = 'where a.spu=b.spu and a.id=b.id AND a.isSingSpu=2 AND a.isAgree=2 AND a.isTake=0 AND a.isComplete=0 '; if (!empty($combineSpu)) { $skuArr = array_filter(explode(',', $combineSpu)); $countSkuArr = count($skuArr); for ($i = 0; $i < $countSkuArr; $i++) { if (preg_match("/^[A-Z0-9]+\$/", $skuArr[$i])) { if ($i == 0) { $where .= " AND (a.spu like'{$skuArr[$i]}%' "; } else { $where .= " OR a.spu like'{$skuArr[$i]}%'"; } if ($i == $countSkuArr - 1) { $where .= ") "; } } } } if ($webMakerId > 0) { $isExsitWebMakerSpuList = getIsExsitWebMakerSpuByIW(2, $webMakerId); //已经分配的spuList $spuArr = array(); foreach ($isExsitWebMakerSpuList as $value) { $spuArr[] = "'" . $value['spu'] . "'"; } $spuStr = implode(',', $spuArr); if (!empty($spuStr)) { $where .= "AND a.spu in({$spuStr}) "; } else { $where .= "AND 1=2 "; } } $total = OmAvailableModel::getTNameCount($tName, $where); $num = 50; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); $where .= "order by a.addTime desc " . $page->limit; $productsComfirmList = OmAvailableModel::getTNameList($tName, $select, $where); if (!empty($productsComfirmList)) { $countProComList = count($productsComfirmList); for ($i = 0; $i < $countProComList; $i++) { $tName = 'pc_auto_create_spu'; $select = 'purchaseId'; $where = "WHERE is_delete=0 AND spu='{$productsComfirmList[$i]['spu']}'"; $autoSpuList = OmAvailableModel::getTNameList($tName, $select, $where); if (!empty($autoSpuList)) { $productsComfirmList[$i]['purchaseId'] = $autoSpuList[0]['purchaseId']; } } } 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=products&act=getProductsComfirmList', 'title' => '产品制作'), array('url' => 'index.php?mod=products&act=getProductsCombineSpuList', 'title' => '1.虚拟SPU指派')); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('onevar', 5); $this->smarty->assign('twovar', 513); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('title', '1.虚拟SPU指派'); $this->smarty->assign('productsCombineSpuList', empty($productsComfirmList) ? array() : $productsComfirmList); $this->smarty->display("productsCombineSpuList.htm"); }
public function view_getAutoCreateSpuList() { //调用action层, 获取列表数据 $status = $_GET['status']; $spu = $_GET['spu'] ? post_check(trim($_GET['spu'])) : ''; $isSingSpu = $_GET['isSingSpu'] ? post_check(trim($_GET['isSingSpu'])) : ''; $autoStatus = $_GET['autoStatus'] ? post_check(trim($_GET['autoStatus'])) : ''; $purchaseId = $_GET['purchaseId'] ? post_check(trim($_GET['purchaseId'])) : ''; $hasToSaler = $_GET['hasToSaler'] ? post_check(trim($_GET['hasToSaler'])) : ''; $isAgree = $_GET['isAgree'] ? post_check(trim($_GET['isAgree'])) : ''; $platformId = $_GET['platformId'] ? post_check(trim($_GET['platformId'])) : ''; $salerId = $_GET['salerId'] ? post_check(trim($_GET['salerId'])) : ''; $isExsitWebMaker = $_GET['isExsitWebMaker'] ? post_check(trim($_GET['isExsitWebMaker'])) : ''; $webMakerId = $_GET['webMakerId'] ? post_check(trim($_GET['webMakerId'])) : ''; $webMakeIsAgree = $_GET['webMakeIsAgree'] ? post_check(trim($_GET['webMakeIsAgree'])) : ''; $productsNewSpu = $_GET['productsNewSpu'] ? post_check(trim($_GET['productsNewSpu'])) : ''; $omAvailableAct = new OmAvailableAct(); $tName = 'pc_auto_create_spu'; $select = '*'; $where = 'WHERE is_delete=0 '; if (!empty($spu)) { $where .= "AND spu='{$spu}' "; } if (intval($isSingSpu) == 1 || intval($isSingSpu) == 2) { $where .= "AND isSingSpu='{$isSingSpu}' "; } if (intval($autoStatus) == 1 || intval($autoStatus) == 2) { $where .= "AND status='{$autoStatus}' "; } if (intval($purchaseId) != 0) { $where .= "AND purchaseId='{$purchaseId}' "; } if (!empty($hasToSaler)) { $hasToSalerSpuList = getHasToSalerSpuByIPS(intval($isSingSpu), $isAgree, $platformId, $salerId); //已经分配的spuList $spuArr = array(); foreach ($hasToSalerSpuList as $value) { $spuArr[] = "'" . $value['spu'] . "'"; } $spuStr = implode(',', $spuArr); if ($hasToSaler == 1) { //已经分配 if (!empty($spuStr)) { $where .= "AND spu in({$spuStr}) "; } else { $where .= "AND 1=2 "; } } elseif ($hasToSaler == 2) { //未分配 if (!empty($spuStr)) { $where .= "AND spu not in({$spuStr}) "; } else { $where .= "AND 1=2 "; } } } if (!empty($isExsitWebMaker)) { $isExsitWebMakerSpuList = getIsExsitWebMakerSpuByIW(intval($isSingSpu), $webMakerId, $webMakeIsAgree); //已经分配的spuList $spuArr = array(); foreach ($isExsitWebMakerSpuList as $value) { $spuArr[] = "'" . $value['spu'] . "'"; } $spuStr = implode(',', $spuArr); if ($isExsitWebMaker == 1) { //有产品制作人 if (!empty($spuStr)) { $where .= "AND spu in({$spuStr}) "; } else { $where .= "AND 1=2 "; } } elseif ($isExsitWebMaker == 2) { //无产品制作人 if (!empty($spuStr)) { $where .= "AND spu not in({$spuStr}) "; } else { $where .= "AND 1=2 "; } } } if ($productsNewSpu == 1) { //新品下单的SPU $productsNewSpuArr = getNotAuditAndNotTakeSpuList(); if (!empty($productsNewSpuArr)) { $spuArr = array(); foreach ($productsNewSpuArr as $value) { $spuArr[] = "'" . $value . "'"; } $spuStr = implode(',', $spuArr); if (!empty($spuStr)) { $where .= "AND spu in({$spuStr}) "; } else { $where .= "AND 1=2 "; } } } $total = $omAvailableAct->act_getTNameCount($tName, $where); $num = 100; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); $where .= 'order by createdTime desc ' . $page->limit; $spuList = $omAvailableAct->act_getTNameList($tName, $select, $where); if (!empty($spuList)) { $countSpuList = count($spuList); for ($i = 0; $i < $countSpuList; $i++) { if ($spuList[$i]['isSingSpu'] == 1) { $tName = 'pc_spu_saler_single'; } else { $tName = 'pc_spu_saler_combine'; } $select = 'platformId,salerId,isAgree'; $where = "WHERE spu='{$spuList[$i]['spu']}'"; $salerList = OmAvailableModel::getTNameList($tName, $select, $where); foreach ($salerList as $value) { $salerName = getPersonNameById($value['salerId']); if ($value['platformId'] == 1) { $spuList[$i]['ebaySalerId'] = $value['salerId']; $spuList[$i]['ebaySaler'] = $salerName; $spuList[$i]['ebayIsAgree'] = $value['isAgree']; } elseif ($value['platformId'] == 2) { $spuList[$i]['aliexpressSalerId'] = $value['salerId']; $spuList[$i]['aliexpressSaler'] = $salerName; $spuList[$i]['aliexpressIsAgree'] = $value['isAgree']; } elseif ($value['platformId'] == 11) { $spuList[$i]['amazonSalerId'] = $value['salerId']; $spuList[$i]['amazonSaler'] = $salerName; $spuList[$i]['amazonIsAgree'] = $value['isAgree']; } elseif ($value['platformId'] == 14) { $spuList[$i]['overseaSalerId'] = $value['salerId']; $spuList[$i]['overseaSaler'] = $salerName; $spuList[$i]['overseaIsAgree'] = $value['isAgree']; } } $tName = 'pc_spu_web_maker'; $select = 'webMakerId,isAgree,isTake,isComplete'; $where = "WHERE is_delete=0 AND spu='{$spuList[$i]['spu']}' order by id desc limit 1"; $spuWebMakerList = OmAvailableModel::getTNameList($tName, $select, $where); $spuList[$i]['webMakerId'] = $spuWebMakerList[0]['webMakerId']; $spuList[$i]['webMaker'] = getPersonNameById($spuWebMakerList[0]['webMakerId']); $spuList[$i]['webMakerIsAgree'] = $spuWebMakerList[0]['isAgree']; $spuList[$i]['webMakerIsTake'] = $spuWebMakerList[0]['isTake']; $spuList[$i]['webMakerIsComplete'] = $spuWebMakerList[0]['isComplete']; } } 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=getAutoCreateSpuList', 'title' => '生成SPU列表管理')); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('onevar', 2); $this->smarty->assign('twovar', 22); $this->smarty->assign('status', $status); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('title', '生成SPU列表管理'); $this->smarty->assign('spuList', empty($spuList) ? array() : $spuList); $this->smarty->display("spuList.htm"); }