/** * 导出 */ public function explodeAction() { $aWhere = array(); $aParam = $this->getParams(); if (!empty($aParam['iType'])) { $aWhere['iType'] = $aParam['iType']; } if (!empty($aParam['iCoIndustry'])) { $aWhere['iCoIndustry'] = $aParam['iCoIndustry']; } if (!empty($aParam['sEmail'])) { $aWhere['sEmail LIKE'] = '%' . $aParam['sEmail'] . '%'; } if (!empty($aParam['sMobile'])) { $aWhere['sMobile LIKE'] = '%' . $aParam['sMobile'] . '%'; } if (!empty($aParam['iStatus'])) { $aWhere['iStatus'] = $aParam['iStatus']; } else { $aWhere['iStatus IN'] = '1,2'; } $aList = Model_User::getAll(array('where' => $aWhere)); header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:filename=用户_" . date('Y-m-d', time()) . ".xls"); $str_explode = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /><title>导出</title><style>td{text-align:center;font-size:12px;font-family:Arial, Helvetica, sans-serif;border:#1C7A80 1px solid;color:#152122;width:100px;}table,tr{border-style:none;}.title{background:#7DDCF0;color:#FFFFFF;font-weight:bold;}</style></head><body>"; $str_explode .= '<table cellspacing="0" cellpadding="3" rules="rows" border="1" id="" style="border-style:None;width:100%;border-collapse:collapse;"> <tr> <th scope="col">帐号类型</th> <th scope="col">登录帐号</th> <th scope="col">手机号</th> <th scope="col">联系人名称</th> <th scope="col">公司名称</th> <th scope="col">所属行业</th> <th scope="col">公司地址</th> <th scope="col">公司网站</th> <th scope="col">公司介绍</th> <th scope="col">微信</th> <th scope="col">QQ</th> <th scope="col">余额</th> <th scope="col">时间</th> </tr>'; foreach ($aList as $key => $val) { $iType = isset($val['iType']) && $val['iType'] == '1' ? '自媒体' : '广告主'; $sEmail = $val['sEmail']; $sMobile = $val['sMobile']; $sRealName = $val['sRealName']; $sCoName = $val['sCoName']; //行业 $sCoIndustry = ''; if ($val['sCoIndustry'] != '') { $rowlevel = Model_Domain::getAll(array('where' => array('iAutoID IN' => $val['sCoIndustry']))); //合作等级 if (isset($rowlevel) && count($rowlevel) > 0) { foreach ($rowlevel as $lrow) { $sCoIndustry .= ' ' . $lrow['sName']; } } } $sCoAddress = $val['sCoAddress']; $sCoWebsite = $val['sCoWebsite']; $sCoDesc = $val['sCoDesc']; $sWeixin = $val['sWeixin']; $sQQ = $val['sQQ']; $iMoney = $val['iMoney']; $iCreateTime = date('Y-m-d H:i:s', $val['iCreateTime']); $str_explode .= '<tr> <td align="left">' . $iType . '</td> <td align="left">' . $sEmail . '</td> <td align="left">' . $sMobile . '</td> <td align="left">' . $sRealName . '</td> <td align="left">' . $sCoName . '</td> <td align="left">' . $sCoIndustry . '</td> <td align="left">' . $sCoAddress . '</td> <td align="left">' . $sCoWebsite . '</td> <td align="left">' . $sCoDesc . '</td> <td align="left">' . $sWeixin . '</td> <td align="left">' . $sQQ . '</td> <td align="left">' . $iMoney . '</td> <td align="left">' . $iCreateTime . '</td> </tr>'; } $str_explode .= '</table>'; $str_explode .= "</body></html>"; echo $str_explode; }
/** * 导出资源数据 */ public function explodeAction() { $iPage = intval($this->getParam('page')); $aWhere = array(); $aParam = $this->getParams(); if (!empty($aParam['iUserID'])) { $aWhere['iUserID'] = $aParam['iUserID']; } if (!empty($aParam['iMediaType'])) { $aWhere['iMediaType'] = $aParam['iMediaType']; } if (!empty($aParam['sMediaName'])) { $aWhere['sMediaName LIKE'] = '%' . $aParam['sMediaName'] . '%'; } if (!empty($aParam['iStatus'])) { $aWhere['iStatus'] = $aParam['iStatus']; } else { $aWhere['iStatus IN'] = '1,2'; } $aList = Model_Media::getAll(array('where' => $aWhere)); header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:filename=资源_" . date('Y-m-d', time()) . ".xls"); $str_explode = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /><title>导出</title><style>td{text-align:center;font-size:12px;font-family:Arial, Helvetica, sans-serif;border:#1C7A80 1px solid;color:#152122;width:100px;}table,tr{border-style:none;}.title{background:#7DDCF0;color:#FFFFFF;font-weight:bold;}</style></head><body>"; $str_explode .= '<table cellspacing="0" cellpadding="3" rules="rows" border="1" id="" style="border-style:None;width:100%;border-collapse:collapse;"> <tr> <th scope="col">归属帐号</th> <th scope="col">媒体类型</th> <th scope="col">帐号名称</th> <th scope="col">公众号名</th> <th scope="col">粉丝数量</th> <th scope="col">粉丝截图</th> <th scope="col">头像</th> <th scope="col">二维码</th> <th scope="col">报价1</th> <th scope="col">报价2</th> <th scope="col">报价3</th> <th scope="col">报价4</th> <th scope="col">阅读量</th> <th scope="col">评分</th> <th scope="col">推荐级别</th> <th scope="col">属性</th> <th scope="col">微信链接地址</th> <th scope="col">认证状态</th> <th scope="col">简介</th> <th scope="col">用户所属类目</th> <th scope="col">合作等级</th> <th scope="col">认证信息介绍</th> <th scope="col">点击量</th> <th scope="col">被选择执行的数量</th> <th scope="col">文章发布数量</th> <th scope="col">文章点赞平均数</th> <th scope="col">分类</th> <th scope="col">城市</th> <th scope="col">圈子</th> <th scope="col">标签</th> </tr>'; foreach ($aList as $key => $val) { $id = $val['iMediaID']; $row = Model_User::getDetail($val['iUserID']); $sRealName = isset($row) && $row['sRealName'] != '' ? $row['sRealName'] : ''; $iMediaType = ''; if ($val['iMediaType'] == '1') { $iMediaType = '微信'; } elseif ($val['iMediaType'] == '2') { $iMediaType = '微博'; } elseif ($val['iMediaType'] == '3') { $iMediaType = '朋友圈'; } elseif ($val['iMediaType'] == '4') { $iMediaType = '新闻'; } $sMediaName = $val['sMediaName']; $sOpenName = $val['sOpenName']; $iFollowerNum = $val['iFollowerNum']; $sFollowerImg = Util_Uri::getDFSViewURL($val['sFollowerImg'], 130, 130); $sAvatar = Util_Uri::getDFSViewURL($val['sAvatar'], 130, 130); $sQRCode = Util_Uri::getDFSViewURL($val['sQRCode'], 130, 130); $iPrice5 = $val['iPrice5']; $iPrice6 = $val['iPrice6']; $iPrice7 = $val['iPrice7']; $iPrice8 = $val['iPrice8']; $iReadNum = $val['iReadNum']; $iScore = $val['iScore']; $iRecommendLevel = $val['iRecommendLevel']; $iPersonCharge = $val['iPersonCharge']; $iAuditperson = $val['iAuditperson']; $rowattr = Model_Domain::getDetail($val['iAttribute']); $iAttribute = isset($rowattr['sName']) ? $rowattr['sName'] : ''; //属性 $sWxLink = $val['sWxLink']; $rowver = Model_Domain::getDetail($val['iVerifyState']); $iVerifyState = isset($rowver['sName']) ? $rowver['sName'] : ''; //认证 $sIntroduction = $val['sIntroduction']; $sTypeInfo = $val['sTypeInfo']; $sCooperateLevelInfo = ''; if ($val['sCooperateLevelInfo'] != '') { $rowlevel = Model_Domain::getAll(array('where' => array('iAutoID IN' => $val['sCooperateLevelInfo']))); //合作等级 if (isset($rowlevel) && count($rowlevel) > 0) { foreach ($rowlevel as $lrow) { $sCooperateLevelInfo .= ' ' . $lrow['sName']; } } } $sCertifiedText = $val['sCertifiedText']; $iClickNumber = $val['iClickNumber']; $iChoiceNumber = $val['iChoiceNumber']; $iArticleNumber = $val['iArticleNumber']; $iZambiaNumber = $val['iZambiaNumber']; //分类 $data_cat = Model_MediaCategory::getAll(array('where' => array('iMediaID' => $val['iMediaID'], 'iStatus' => 1))); $aCategory = ''; if (isset($data_cat) && count($data_cat) > 0) { $iAutoID = array(); foreach ($data_cat as $val_cat) { $iAutoID[] = $val_cat['iCategoryID']; } if (count($iAutoID) > 0) { $rowcat = Model_Domain::getAll(array('where' => array('iAutoID IN' => implode(',', array_unique($iAutoID)), 'iStatus' => '1'))); if (isset($rowcat) && count($rowcat) > 0) { foreach ($rowcat as $vcat) { $aCategory .= ',' . $vcat['sName']; } } } } //城市 $data_city = Model_MediaCity::getAll(array('where' => array('iMediaID' => $val['iMediaID'], 'iStatus' => 1))); $aCity = ''; if (isset($data_city) && count($data_city) > 0) { $iAutoID = array(); foreach ($data_city as $val_City) { $iAutoID[] = $val_City['iCityID']; } if (count($iAutoID) > 0) { $rowCity = Model_Domain::getAll(array('where' => array('iAutoID IN' => implode(',', array_unique($iAutoID)), 'iStatus' => '1'))); if (isset($rowCity) && count($rowCity) > 0) { foreach ($rowCity as $vCity) { $aCity .= ',' . $vCity['sName']; } } } } //圈子 $data_cricle = Model_MediaCricle::getAll(array('where' => array('iMediaID' => $val['iMediaID'], 'iStatus' => 1))); $aCricle = ''; if (isset($data_cricle) && count($data_cricle) > 0) { $iAutoID = array(); foreach ($data_cricle as $val_Cricle) { $iAutoID[] = $val_Cricle['iCricleID']; } if (count($iAutoID) > 0) { $rowCricle = Model_Domain::getAll(array('where' => array('iAutoID IN' => implode(',', array_unique($iAutoID)), 'iStatus' => '1'))); if (isset($rowCricle) && count($rowCricle) > 0) { foreach ($rowCricle as $vCricle) { $aCricle .= ',' . $vCricle['sName']; } } } } //标签 $data_tag = Model_MediaTag::getAll(array('where' => array('iMediaID' => $val['iMediaID'], 'iStatus' => 1))); $aTag = ''; if (isset($data_tag) && count($data_tag) > 0) { $iAutoID = array(); foreach ($data_tag as $val_Tag) { $iAutoID[] = $val_Tag['iTagID']; } if (count($iAutoID) > 0) { $rowTag = Model_Domain::getAll(array('where' => array('iAutoID IN' => implode(',', array_unique($iAutoID)), 'iStatus' => '1'))); if (isset($rowTag) && count($rowTag) > 0) { foreach ($rowTag as $vTag) { $aTag .= ',' . $vTag['sName']; } } } } $iCreateTime = date('Y-m-d H:i:s', $val['iCreateTime']); $str_explode .= '<tr> <td align="left">' . $sRealName . '</td> <td align="left">' . $iMediaType . '</td> <td align="left">' . $sMediaName . '</td> <td align="left">' . $sOpenName . '</td> <td align="left">' . $iFollowerNum . '</td> <td align="left"><img src="' . $sFollowerImg . '" /></td> <td align="left"><img src="' . $sAvatar . '" /></td> <td align="left"><img src="' . $sQRCode . '" /></td> <td align="left">' . $iPrice5 . '</td> <td align="left">' . $iPrice6 . '</td> <td align="left">' . $iPrice7 . '</td> <td align="left">' . $iPrice8 . '</td> <td align="left">' . $iReadNum . '</td> <td align="left">' . $iScore . '</td> <td align="left">' . $iRecommendLevel . '</td> <td align="left">' . $iAttribute . '</td> <td align="left">' . $sWxLink . '</td> <td align="left">' . $iVerifyState . '</td> <td align="left">' . $sIntroduction . '</td> <td align="left">' . $sTypeInfo . '</td> <td align="left">' . $sCooperateLevelInfo . '</td> <td align="left">' . $sCertifiedText . '</td> <td align="left">' . $iClickNumber . '</td> <td align="left">' . $iChoiceNumber . '</td> <td align="left">' . $iArticleNumber . '</td> <td align="left">' . $iZambiaNumber . '</td> <td align="left">' . $aCategory . '</td> <td align="left">' . $aCity . '</td> <td align="left">' . $aCricle . '</td> <td align="left">' . $aTag . '</td> </tr>'; } $str_explode .= '</table>'; $str_explode .= "</body></html>"; echo $str_explode; }
/** * 导出 */ public function explodeAction() { $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; } if (!empty($aParam['sAdName']) && $aParam['sAdName'] != '') { $aWhere['sAdName LIKE'] = '%' . $aParam['sAdName'] . '%'; } if (!empty($aParam['iMediaType']) && $aParam['iMediaType'] != '') { $aWhere['iMediaType'] = $aParam['iMediaType']; } if (!empty($aParam['iAdType']) && $aParam['iAdType'] != '') { $aWhere['iAdType'] = $aParam['iAdType']; } if (!empty($aParam['iPayStatus']) && $aParam['iPayStatus'] != '') { $aWhere['iPayStatus'] = $aParam['iPayStatus']; } if (!empty($aParam['iStatus']) && $aParam['iStatus'] != '') { $aWhere['iStatus'] = $aParam['iStatus']; } else { $aWhere['iStatus IN'] = '1,2,3,4,5'; } $aList = Model_Ad::getAll(array('where', $aWhere)); foreach ($aList['aList'] as $key => $val) { //媒体类型 if ($val['iMediaType'] == '1') { $aList['aList'][$key]['iMediaType'] = '公众号'; } elseif ($val['iMediaType'] == '2') { $aList['aList'][$key]['iMediaType'] = '朋友圈'; } elseif ($val['iMediaType'] == '3') { $aList['aList'][$key]['iMediaType'] = '新浪微博'; } elseif ($val['iMediaType'] == '4') { $aList['aList'][$key]['iMediaType'] = '新闻论坛'; } //广告类型 if ($val['iAdType'] == '1') { $aList['aList'][$key]['iAdType'] = '硬广'; } elseif ($val['iAdType'] == '2') { $aList['aList'][$key]['iAdType'] = '软广'; } elseif ($val['iAdType'] == '3') { $aList['aList'][$key]['iAdType'] = '全部'; } //支付状态 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'] = '全未填写完成'; } //城市 if ($val['sCityID'] != '') { $data_City = Model_City::getAll(array('where' => array('iCityID IN' => $val['sCityID']))); $sCityID = ''; if (count($data_City) > 0) { foreach ($data_City as $val_City) { $sCityID .= ',' . $val_City['sCityName']; } } $aList['aList'][$key]['sCityID'] = $sCityID; } //媒体分类 if ($val['sCatID'] != '') { $data_Cat = Model_Domain::getAll(array('where' => array('iAutoID IN' => $val['sCatID']))); $sCatID = ''; if (count($data_Cat) > 0) { foreach ($data_Cat as $val_City) { $sCatID .= ',' . $val_City['sName']; } } $aList['aList'][$key]['sCatID'] = $sCatID; } //资源广告内容 $rowAd = array(); if ($val['iMediaType'] == Model_Media::TYPE_WEIXIN) { $rowAd = Model_AdWeixin::getDetail($val['iAdID']); $iPosID = $rowAd['iAdPos']; } elseif ($val['iMediaType'] == Model_Media::TYPE_FRIEND) { $rowAd = Model_AdFriend::getDetail($val['iAdID']); $iPosID = $rowAd['iAdPos']; } elseif ($val['iMediaType'] == Model_Media::TYPE_WEIBO) { $rowAd = Model_AdWeibo::getDetail($val['iAdID']); $iPosID = $rowAd['iAdPos']; } elseif ($val['iMediaType'] == Model_Media::TYPE_NEWS) { $rowAd = Model_AdNews::getDetail($val['iAdID']); $iPosID = $rowAd['iAdPos']; } $aList['aList'][$key]['Media'] = $rowAd; //广告位 $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 ($val['iMediaType'] != '') { $iPos = $aTitle[$val['iMediaType']][$iPosID]; $aList['aList'][$key]['sPos'] = $iPos; } } header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:filename=广告_" . date('Y-m-d', time()) . ".xls"); $str_explode = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /><title>导出</title><style>td{text-align:center;font-size:12px;font-family:Arial, Helvetica, sans-serif;border:#1C7A80 1px solid;color:#152122;width:100px;}table,tr{border-style:none;}.title{background:#7DDCF0;color:#FFFFFF;font-weight:bold;}</style></head><body>"; $str_explode .= '<table cellspacing="0" cellpadding="3" rules="rows" border="1" id="" style="border-style:None;width:100%;border-collapse:collapse;"> <tr> <th scope="col">用户名称/th> <th scope="col">广告名称</th> <th scope="col">最小投放预算</th> <th scope="col">最大投放预算</th> <th scope="col">投放时间</th> <th scope="col">媒体类型</th> <th scope="col">广告类型</th> <th scope="col">媒体分类</th> <th scope="col">所在城市</th> <th scope="col">总价</th> <th scope="col">支付状态</th> <th scope="col">状态</th> <th scope="col">时间</th> </tr>'; foreach ($aList as $key => $val) { $row = Model_User::getDetail($val['iUserID']); $sUserRealName = isset($row) && $row['sRealName'] != '' ? $row['sRealName'] : ''; $iCreateTime = date('Y-m-d H:i:s', $val['iCreateTime']); $iPlanTime = isset($val['iPlanTime']) && $val['iPlanTime'] != '' ? date('Y-m-d H:i:s', $val['iPlanTime']) : ''; $str_explode .= '<tr> <td align="left">' . $sUserRealName . '</td> <td align="left">' . $val['sAdName'] . '</td> <td align="left">' . $val['iPlanMinMoney'] . '</td> <td align="left">' . $val['iPlanMaxMoney'] . '</td> <td align="left">' . $val['iPlanTime'] . '</td> <td align="left">' . $val['iMediaType'] . '</td> <td align="left">' . $val['iAdType'] . '</td> <td align="left">' . $val['sCatID'] . '</td> <td align="left">' . $val['sCityID'] . '</td> <td align="left">' . $val['iTotalMoney'] . '</td> <td align="left">' . $val['iPayStatus'] . '</td> <td align="left">' . $val['iStatus'] . '</td> <td align="left">' . $iCreateTime . '</td> </tr>'; } $str_explode .= '</table>'; $str_explode .= "</body></html>"; echo $str_explode; }