/** * 订单中心 */ public function indexAction() { $iStatus = max(2, intval($this->getParam('type'))); $iPage = max(1, intval($this->getParam('page'))); $aData = Model_AdMedia::getList(array('iMUserID' => $this->aCurrUser['iUserID'], 'iChoose' => 1, 'iStatus' => $iStatus), $iPage, 'iUpdateTime DESC'); foreach ($aData['aList'] as $k => &$aRow) { $aRow['aAd'] = Model_Ad::getDetail($aRow['iAdID']); $aRow['aMedia'] = Model_Media::getDetail($aRow['iMediaID']); } $aUser = Model_User::getDetail($this->aCurrUser['iUserID']); $this->assign('aUser', $aUser); $this->assign('aData', $aData); $this->assign('aType', Model_Media::$aType); $this->assign('aOrderStatus', Model_Ad::$aOrderStatus); $this->assign('iType', $iStatus); $this->assign('aStatus', Model_AdMedia::$aStatus); $this->setMeta('mcenter_page', array('sTitle' => '自媒体中心 - 订单中心')); }
/** * 资源订单列表 */ public function listAction() { $iPage = intval($this->getParam('page')); $uWhere = array(); $aParam = $this->getParams(); $userid = ''; if (!empty($aParam['sUserRealName'])) { $uWhere['sRealName LIKE'] = '%' . $aParam['sUserRealName'] . '%'; $data_user = Model_User::getAll(array('where' => $uWhere)); $useridArr = array(); foreach ($data_user as $val) { if ($val['iUserID'] != '') { $useridArr[] = $val['iUserID']; } } if (count($useridArr) > 0) { $userid = implode(',', array_unique($useridArr)); } } $aWhere = array(); if (!empty($aParam['iUserID'])) { $aWhere['iUserID'] = $aParam['iUserID']; } if ($userid != '') { $aWhere['iUserID IN'] = $userid; } $iAdID = ''; if (!empty($aParam['sAdName'])) { $uWhere['sAdName LIKE'] = '%' . $aParam['sAdName'] . '%'; $data_Ad = Model_Ad::getAll(array('where' => $uWhere)); $iAdIDArr = array(); foreach ($data_Ad as $val) { if ($val['iAdID'] != '') { $iAdIDArr[] = $val['iAdID']; } } if (count($iAdIDArr) > 0) { $iAdID = implode(',', array_unique($iAdIDArr)); } } if (!empty($aParam['iAdID'])) { $aWhere['iAdID'] = $aParam['iAdID']; } if ($iAdID != '') { $aWhere['iAdID IN'] = $iAdID; } if (!empty($aParam['iPayStatus']) && $aParam['iPayStatus'] != '') { $aWhere['iPayStatus'] = $aParam['iPayStatus']; } if (!empty($aParam['iStatus']) && $aParam['iStatus'] != '') { $aWhere['iStatus'] = $aParam['iStatus']; } $aList = Model_AdMedia::getList($aWhere, $iPage); $iAdIDArr = $useridArr = array(); foreach ($aList['aList'] as $val) { if ($val['iUserID'] != '') { $useridArr[] = $val['iUserID']; } if ($val['iAdID'] != '') { $iAdIDArr[] = $val['iAdID']; } } if (count($useridArr) > 0) { $whereU = array(); $whereU['iUserID IN'] = implode(',', array_unique($useridArr)); $userData = Model_User::getAll(array('where' => $whereU)); if (count($userData) > 0) { $data = array(); foreach ($userData as $val) { $row = array(); $row['iUserID'] = $val['iUserID']; $row['sRealName'] = $val['sRealName']; $data[$val['iUserID']] = $row; } $this->assign('aData', $data); } } $data = array(); if (count($iAdIDArr) > 0) { $whereAd = array(); $whereAd['iAdID IN'] = implode(',', array_unique($iAdIDArr)); $AdData = Model_Ad::getAll(array('where' => $whereAd)); if (count($AdData) > 0) { foreach ($AdData as $val) { $row = array(); $row['iAdID'] = $val['iAdID']; $row['sAdName'] = $val['sAdName']; $row['iMediaType'] = $val['iMediaType']; $data[$val['iAdID']] = $row; } $this->assign('AdData', $data); } } foreach ($aList['aList'] as $key => $val) { $iMediaType = ''; if (count($data) > 0 && isset($data[$val['iAdID']]['iMediaType']) && $data[$val['iAdID']]['iMediaType'] != '') { $iMediaType = $data[$val['iAdID']]['iMediaType']; } $aTitle = array(Model_Media::TYPE_WEIXIN => array('1' => '单图文报价', '2' => '第一条报价', '3' => '第二条报价', '4' => '其它位置价'), Model_Media::TYPE_FRIEND => array('1' => '转发报价', '2' => '直发报价'), Model_Media::TYPE_WEIBO => array('1' => '转发报价', '2' => '直发报价')); if ($iMediaType != '') { $aList['aList'][$key]['iPos'] = $aTitle[$iMediaType][$val['iPos']]; } $sMediaName = ''; $row_Media = Model_Media::getDetail($val['iMediaID']); if (isset($row_Media)) { $sMediaName = $row_Media['sMediaName']; } $aList['aList'][$key]['iMediaID'] = $sMediaName; if ($val['iPayStatus'] == '0') { $aList['aList'][$key]['iPayStatus'] = '未支付'; } elseif ($val['iPayStatus'] == '1') { $aList['aList'][$key]['iPayStatus'] = '已支付'; } if ($val['iStatus'] == '1') { $aList['aList'][$key]['iStatus'] = '等待接单'; } elseif ($val['iStatus'] == '2') { $aList['aList'][$key]['iStatus'] = '等待执行'; } elseif ($val['iStatus'] == '3') { $aList['aList'][$key]['iStatus'] = '执行中'; } elseif ($val['iStatus'] == '4') { $aList['aList'][$key]['iStatus'] = '已完成'; } elseif ($val['iStatus'] == '5') { $aList['aList'][$key]['iStatus'] = '拒绝接单'; } } $this->assign('aList', $aList); $this->assign('aParam', $aParam); }