/** * 上传视频 * * @param * $aConfig * @return array */ public function uploadimg($aConfig) { $aReturn = array('state' => 'SUCCESS', 'url' => '', 'title' => '', 'original' => '', 'type' => '', 'size' => ''); do { $sFileField = $aConfig['imageFieldName']; if (!isset($_FILES[$sFileField])) { $aReturn['state'] = '上传文件为空'; break; } $sFromURL = $this->getRequest()->getHttpReferer(); $oStorage = new File_Storage(); $mResult = $oStorage->isAllowedDomain($sFromURL); if (!$mResult) { // 当前站点不允许上传到图片服务器 $aReturn['state'] = '当前站点不允许上传到服务器'; break; } $sIP = $this->getRequest()->getClientIP(); $sDomain = Util_Uri::getDomain($sFromURL); $aFile = $_FILES[$sFileField]; list($iError, $mResult) = $oStorage->saveFile($aFile['name'], $aFile['tmp_name'], $aFile['error'], $aFile['size'], $sIP, $sDomain); if ($iError !== 0) { $aReturn['state'] = $mResult; break; } $sCDNDomain = Yaf_G::getConf('file', 'domain'); $aReturn['url'] = 'http://' . $sCDNDomain . '/view/' . $mResult['sKey'] . '.' . $mResult['sExt']; $aReturn['title'] = basename($aFile['name']); $aReturn['original'] = basename($aFile['name']); $aReturn['type'] = $mResult['sExt']; $aReturn['size'] = $mResult['iSize']; } while (false); return $aReturn; }
/** * banner文件上传 * * @return bool */ public function banneruploadAction() { header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With'); $sFromURL = $this->getRequest()->getHttpReferer(); $oStorage = new File_Storage(); $mResult = $oStorage->isAllowedDomain($sFromURL); $iRetError = 0; if (true === $mResult) { $aFiles = $this->getUploadFiles(); $sIP = $this->getRequest()->getClientIP(); $sDomain = Util_Uri::getDomain($sFromURL); $aUpdFiles = array(); // 批量上传图片 @todo 待优化 foreach ($aFiles as $aFile) { list($iError, $mResult) = $oStorage->saveFile($aFile['name'], $aFile['tmp_name'], $aFile['error'], $aFile['size'], $sIP, $sDomain, Model_FileMeta::BID_BANNER); if ($iError == 0) { $iRetError = 0; $mResult['iError'] = $iError; $aUpdFiles[$aFile['key']] = $mResult; } else { $aUpdFiles[$aFile['key']] = array('iError' => $iError, 'sMsg' => $mResult); } } $mResult = $aUpdFiles; } else { $iRetError = 1; $mResult = array('sMsg' => 'The upload domain is forbidden.'); } $this->getResponse()->setHeader('Content-Type', 'application/json'); $aRet = array_merge(array('iError' => $iRetError), $mResult); $this->getResponse()->setBody(json_encode($aRet)); return false; }
/** * 检测是否登录 */ public function checkLogin($iType) { $this->getCurrUser($iType); if (empty($this->aCurrUser)) { return $this->redirect('/user/login/type/' . $iType . '.html?ret=' . Util_Uri::getCurrUrl()); } return true; }
public function dispatchLoopShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) { $aADUSQL = Db_Orm::getADUSQL(); if (!empty($aADUSQL)) { $aLog = array('sIP' => $request->getClientIP(), 'sParam' => json_encode($request->getParams()), 'sSQL' => join("\n", $aADUSQL), 'sUserName' => Model_ActionLog::getUser(), 'iType' => Model_ActionLog::getType(), 'sUrl' => Util_Uri::getCurrUrl()); Model_ActionLog::addData($aLog); } }
public function actionBefore() { parent::actionBefore(); // 判断广告主是否已登录 $this->aCurrUser = $this->getCurrUser(Model_User::TYPE_AD); if (empty($this->aCurrUser)) { return $this->redirect('/user/login/type/' . Model_User::TYPE_AD . '.html?ret=' . Util_Uri::getCurrUrl()); } }
/** * 检查使用方是否是允许的域名 * * @param string $p_sReferer * @return true/string */ public function isAllowedDomain($p_sReferer) { $sDomain = Util_Uri::getDomain($p_sReferer); $aAllowedDomain = Yaf_G::getConf('aAllowedDomain', 'file', 'file'); foreach ($aAllowedDomain as $sDomainPattern) { if (1 === preg_match($sDomainPattern, $sDomain)) { return true; break; } } return false; }
/** * 导出资源数据 */ 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 adexplodeAction() { $iAdID = intval($this->getParam('id')); $aAd = Model_Ad::getDetail($iAdID); //类别 $aCat = ''; if ($aAd['sCatID'] != '') { $rowCat = Model_Domain::getAll(array('where' => array('iAutoID IN' => $aAd['sCatID']))); if (count($rowCat) > 0) { foreach ($rowCat as $val) { if ($val['sName'] != '') { $aCat .= ',' . $val['sName']; } } } } $this->assign('aCat', $aCat); //城市 $aCityName = ''; if ($aAd['sCityID'] != '') { $rowCity = Model_City::getAll(array('where' => array('iCityID IN' => $aAd['sCityID']))); if (count($rowCity) > 0) { foreach ($rowCity as $val) { if ($val['sName'] != '') { $aCityName .= ',' . $val['sCityName']; } } } } $this->assign('aCityName', $aCityName); $iType = $aAd['iMediaType']; $iTypeName = Model_Media::$aType[$aAd['iMediaType']]; $this->assign('iTypeName', $iTypeName); if ($aAd['iAdType'] == '1') { $this->assign('iAdType', '软广'); } elseif ($aAd['iAdType'] == '2') { $this->assign('iAdType', '硬广'); } elseif ($aAd['iAdType'] == '3') { $this->assign('iAdType', '全部'); } if ($aAd['iStatus'] == '1') { $this->assign('iStatus', '待审核'); } elseif ($aAd['iStatus'] == '2') { $this->assign('iStatus', '审核通过'); } elseif ($aAd['iStatus'] == '3') { $this->assign('iStatus', '审核未通过'); } elseif ($aAd['iStatus'] == '4') { $this->assign('iStatus', '完成'); } elseif ($aAd['iStatus'] == '5') { $this->assign('iStatus', '未填写完成'); } $aUser = Model_User::getDetail($aAd['iUserID']); $this->assign('aUser', $aUser); $this->assign('aAd', $aAd); //资源广告内容 if ($aAd['iMediaType'] == Model_Media::TYPE_WEIXIN) { $rowAd = Model_AdWeixin::getDetail($aAd['iAdID']); $this->assign('type_weixin', Model_Media::TYPE_WEIXIN); $iPosID = $rowAd['iAdPos']; } elseif ($aAd['iMediaType'] == Model_Media::TYPE_FRIEND) { $rowAd = Model_AdFriend::getDetail($aAd['iAdID']); $this->assign('type_friend', Model_Media::TYPE_FRIEND); $iPosID = $rowAd['iAdPos']; } elseif ($aAd['iMediaType'] == Model_Media::TYPE_WEIBO) { $rowAd = Model_AdWeibo::getDetail($aAd['iAdID']); $this->assign('type_weibo', Model_Media::TYPE_WEIBO); $iPosID = $rowAd['iAdPos']; } elseif ($aAd['iMediaType'] == Model_Media::TYPE_NEWS) { $rowAd = Model_AdNews::getDetail($aAd['iAdID']); $this->assign('type_news', Model_Media::TYPE_NEWS); $iPosID = $rowAd['iAdPos']; } //广告位 $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 ($aAd['iMediaType'] != '') { $iPos = $aTitle[$aAd['iMediaType']][$iPosID]; $this->assign('aPos', $iPos); } $this->assign('rowAd', $rowAd); $aAdMedia = Model_AdMedia::getAll(array('where' => array('iAdID' => $aAd['iAdID']))); foreach ($aAdMedia as $key => $val) { //资源 $aMedia = Model_Media::getDetail($val['iMediaID']); $aAdMedia[$key]['sMediaName'] = $aMedia['sMediaName']; //用户 $aUser = Model_User::getDetail($val['iUserID']); $aAdMedia[$key]['sEmail'] = $aUser['sEmail']; //广告位 $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 ($aAd['iMediaType'] != '') { $iPos = $aTitle[$aAd['iMediaType']][$val['iPos']]; $aAdMedia[$key]['iPosName'] = $iPos; } //支付状态 if ($val['iPayStatus'] == '0') { $aAdMedia[$key]['iPayStatusName'] = '未支付'; } elseif ($val['iPayStatus'] == '1') { $aAdMedia[$key]['iPayStatusName'] = '已支付'; } //状态 if ($val['iStatus'] == '1') { $aAdMedia[$key]['iStatusName'] = '等待接单'; } elseif ($val['iStatus'] == '2') { $aAdMedia[$key]['iStatusName'] = '等待执行'; } elseif ($val['iStatus'] == '3') { $aAdMedia[$key]['iStatusName'] = '执行中'; } elseif ($val['iStatus'] == '4') { $aAdMedia[$key]['iStatusName'] = '已完成'; } elseif ($val['iStatus'] == '5') { $aAdMedia[$key]['iStatusName'] = '拒绝接单'; } } $this->assign('aAdMedia', $aAdMedia); 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> <td>用户名称</td> <td>' . $aUser['sRealName'] . '</td> </tr> <tr> <td>广告名称</td> <td>' . (isset($aAd['sAdName']) ? $aAd['sAdName'] : '') . '</td> </tr> <tr> <td>最小投放预算</td> <td>' . (isset($aAd['iPlanMinMoney']) ? $aAd['iPlanMinMoney'] : '') . '</td> </tr> <tr> <td>最大投放预算</td> <td>' . (isset($aAd['iPlanMaxMoney']) ? $aAd['iPlanMaxMoney'] : '') . '</td> </tr> <tr> <td>投放时间</td> <td>' . (isset($aAd['iPlanTime']) ? $aAd['iPlanTime'] : '') . '</td> </tr> <tr> <td>媒体类型</td> <td>' . $iTypeName . '</td> </tr> <tr> <td>广告类型</td> <td>' . $iAdType . '</td> </tr> <tr> <td>媒体分类</td> <td>' . $aCat . '</td> </tr> <tr> <td>所在城市</td> <td>' . $aCityName . '</td> </tr> <tr> <td>总价</td> <td>' . (isset($aAd['iTotalMoney']) ? $aAd['iTotalMoney'] : '') . '</td> </tr> <tr> <td>支付类型</td> <td>' . (isset($aAd['iPayStatus']) && $aAd['iPayStatus'] == '0' ? '未付款' : '已付款') . '</td> </tr>'; if ($aAd['iMediaType'] == Model_Media::TYPE_WEIXIN) { $str_explode .= '<tr> <td>广告位</td> <td>' . $aPos . '</td> </tr> <tr> <td>显示时间</td> <td>' . date('Y-m-d H:i:s', $rowAd['iShowTime']) . '</td> </tr> <tr> <td>导入URL</td> <td>' . $rowAd['sImportUrl'] . '</td> </tr> <tr> <td>上传Word</td> <td>' . $rowAd['sWordFile'] . '</td> </tr> <tr> <td>标题</td> <td>' . $rowAd['sTitle'] . '</td> </tr> <tr> <td>作者</td> <td>' . $rowAd['sAuthor'] . '</td> </tr> <tr> <td>封面图片</td> <td>' . (isset($rowAd['sCoverImg']) ? Util_Uri::getDFSViewURL($rowAd['sCoverImg'], 130, 130) : '') . '</td> </tr> <tr> <td>摘要</td> <td>' . $rowAd['sAbstract'] . '</td> </tr> <tr> <td>内容</td> <td>' . $rowAd['sContent'] . '</td> </tr> <tr> <td>原链接</td> <td>' . $rowAd['sOriginalUrl'] . '</td> </tr>'; } elseif ($aAd['iMediaType'] == Model_Media::TYPE_FRIEND) { $str_explode .= '<tr> <td>投放形式</td> <td>' . $aPos . '</td> </tr> <tr> <td>转发链接</td> <td>' . $rowAd['sForwardUrl'] . '</td> </tr> <tr> <td>转发文字</td> <td>' . $rowAd['sForwardText'] . '</td> </tr> <tr> <td>转发配图</td> <td>'; if ($rowAd['sForwardImg'] != '') { $arr = explode(',', $rowAd['sForwardImg']); if (count($arr) > 0) { foreach ($arr as $v) { $str_explode .= '<img src="' . Util_Uri::getDFSViewURL($v, 130, 130) . '" width="130" />'; } } else { $str_explode .= '<img src="' . Util_Uri::getDFSViewURL($rowAd['sOriginalUrl'], 130, 130) . '" width="130" />'; } } $str_explode .= '</td> </tr>'; } elseif ($aAd['iMediaType'] == Model_Media::TYPE_WEIBO) { $str_explode .= '<tr> <td>投放形式</td> <td>' . $aPos . '</td> </tr> <tr> <td>转发链接</td> <td>' . $rowAd['sForwardUrl'] . '</td> </tr> <tr> <td>转发文字</td> <td>' . $rowAd['sForwardText'] . '</td> </tr> <tr> <td>转发配图</td> <td>'; if ($rowAd['sForwardImg'] != '') { $arr = explode(',', $rowAd['sForwardImg']); if (count($arr) > 0) { foreach ($arr as $v) { $str_explode .= '<img src="' . Util_Uri::getDFSViewURL($v, 130, 130) . '" width="130" />'; } } else { $str_explode .= '<img src="' . Util_Uri::getDFSViewURL($rowAd['sForwardImg'], 130, 130) . '" width="130" />'; } } $str_explode .= '</td> </tr>'; } elseif ($aAd['iMediaType'] == Model_Media::TYPE_NEWS) { $str_explode .= '<tr> <td>投放形式</td> <td>' . $aPos . '</td> </tr> <tr> <td>标题</td> <td>' . $rowAd['sTitle'] . '</td> </tr> <tr> <td>内容</td> <td>' . $rowAd['sContent'] . '</td> </tr>'; } $str_explode .= '<tr> <td>状态</td> <td>' . $iStatus . '</td> </tr> <tr> <td>资源列表</td> <td> <table cellspacing="0" cellpadding="3" rules="rows" border="1" id="" style="border-style:None;width:100%;border-collapse:collapse;"> <tr> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">#</td> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">用户名称</td> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">媒体名称</td> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">广告位</td> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">价格</td> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">执行时间</td> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">支付状态</td> <td style="border-bottom: 1px solid #000000;">状态</td> </tr>'; foreach ($aAdMedia as $keyAdMedia => $valAdMedia) { $iAutoID = $valAdMedia['iAutoID']; $sEmail = $valAdMedia['sEmail']; $sMediaName = $valAdMedia['sMediaName']; $iPosName = $valAdMedia['iPosName']; $iMoney = $valAdMedia['iMoney']; $iPlanTime = ''; if ($valAdMedia['iPlanTime'] != '' && $valAdMedia['iPlanTime'] > 0) { $iPlanTime = date('Y-m-d', $valAdMedia['iPlanTime']); } $iPayStatusName = $valAdMedia['iPayStatusName']; $iStatusName = $valAdMedia['iStatusName']; $str_explode .= '<tr> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">' . $iAutoID . '</td> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">' . $sEmail . '</td> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">' . $sMediaName . '</td> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">' . $iPosName . '</td> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">' . $iMoney . '</td> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">' . $iPlanTime . '</td> <td style="border-right: 1px solid #000000;border-bottom: 1px solid #000000;">' . $iPayStatusName . '</td> <td style="border-bottom: 1px solid #000000;">' . $iStatusName . '</td> </tr>'; } $str_explode .= '</table> </td> </tr> <tr> <td>更新时间</td> <td>' . date('Y-m-d H:i:s', $aAd['iUpdateTime']) . '</td> </tr> <tr> <td>创建时间</td> <td>' . date('Y-m-d H:i:s', $aAd['iCreateTime']) . '</td> </tr>'; $str_explode .= '</table>'; $str_explode .= "</body></html>"; echo $str_explode; }
/** * 提现申请 */ public function cashoutAction() { if ($this->isPost()) { $aUser = Model_User::getDetail($this->aCurrUser['iUserID']); $aParam = $this->getParams(); $aParam['iPayMoney'] = (int) $this->getParam('iPayMoney'); $aParam['iPayType'] = (int) $this->getParam('iPayType'); $aErr = array(); if (empty($aParam['sRealName'])) { $aErr['sRealName'] = '请输入申请人'; } if (empty($aParam['iPayMoney']) || intval($aParam['iPayMoney']) < 1) { $aErr['iPayMoney'] = '请输入正确的提现金额'; } if (empty($aParam['sPayPassword']) || $aUser['sPayPass'] != Model_User::makePassword($aParam['sPayPassword'])) { $aErr['sPayPass'] = '******'; } if ($aParam['iPayMoney'] > $aUser['iMoney']) { $aErr['iPayMoney'] = '可提现的余额不足'; } if ($aParam['iPayType'] == 1) { if (empty($aParam['sPayAccount']) || strlen($aParam['sPayAccount']) < 5) { $aErr['sPayAccount'] = '请输入正确的支付账号'; } $aParam['sOpenName'] = $aParam['sOpenName1']; if (empty($aParam['sOpenName']) || !Util_Validate::isCLength($aParam['sOpenName'], 2, 20)) { $aErr['sOpenName'] = '请输入正确的支付宝姓名'; } } else { if (empty($aParam['sOpenName']) || !Util_Validate::isCLength($aParam['sOpenName'], 2, 20)) { $aErr['sOpenName'] = '请输入正确的开户姓名'; } if (empty($aParam['sBankName']) || !Util_Validate::isCLength($aParam['sBankName'], 4, 50)) { $aErr['sBankName'] = '请输入正确的开户银行'; } if (empty($aParam['sBankAccount']) || !Util_Validate::isLength($aParam['sBankAccount'], 10, 30)) { $aErr['sBankAccount'] = '请输入正确的开户银行'; } } if (!empty($aErr)) { return $this->showMsg($aErr, false); } $aRow = array('iUserID' => $aUser['iUserID'], 'iPayment' => Model_Finance::PAYMENT_OUT, 'iSource' => Model_Finance::SOURCE_CASH_OUT, 'sRealName' => $aParam['sRealName'], 'iPayType' => (int) $aParam['iPayType'], 'iPayMoney' => $aParam['iPayMoney'], 'iUserMoney' => $aUser['iMoney'] - $aParam['iPayMoney'], 'sOpenName' => $aParam['iPayType'] == 1 ? '' : $aParam['sOpenName'], 'sBankName' => $aParam['iPayType'] == 1 ? '' : $aParam['sBankName'], 'sPayAccount' => $aParam['iPayType'] == 1 ? $aParam['sPayAccount'] : $aParam['sBankAccount'], 'iPayStatus' => 0, 'sPayOrder' => '', 'sRemark' => ''); Model_User::begin(); Model_Finance::addData($aRow); Model_User::updData(array('iUserID' => $aUser['iUserID'], 'iMoney' => 'iMoney - ' . $aParam['iPayMoney'])); Model_User::commit(); $sTitle = Model_Kv::getValue('user_tixian_email_title'); $sContent = Model_Kv::getValue('user_tixian_email_content'); $email = '*****@*****.**'; Util_Mail::send($email, $sTitle, $sContent, array($aUser['sEmail'], $aParam['iPayMoney'])); return $this->showMsg('提现申请成功', true); } else { $aType = Model_Domain::getOption(Model_Domain::TYPE_USER_CASTOUT); $aUser = Model_User::getDetail($this->aCurrUser['iUserID']); if (empty($aUser['sPayPass'])) { return $this->redirect('/mcenter/chgpaypwd.html?ret=' . Util_Uri::getCurrUrl()); } $this->assign('aType', $aType); $this->assign('aUser', $aUser); $this->setMeta('mcenter_page', array('sTitle' => '自媒体中心 - 申请提现')); } }
/** * 填写报价 */ public function add2Action() { if ($this->isPost()) { $aUser = $this->getCurrUser(Model_User::TYPE_MEDIA); if (empty($aUser)) { return $this->showMsg('请先登录!', false); } $iMediaID = (int) $this->getParam('iMediaID'); $aMedia = Model_Media::getDetail($iMediaID); if (empty($aMedia)) { return $this->showMsg('数据导常', false); } if ($aMedia['iUserID'] != $aUser['iUserID']) { return $this->showMsg('不要乱改别人的数据', false); } $aData = array('iMediaID' => $iMediaID, 'iPrice1' => intval($this->getParam('iPrice1', 0)), 'iPrice2' => intval($this->getParam('iPrice2', 0)), 'iPrice3' => intval($this->getParam('iPrice3', 0)), 'iPrice4' => intval($this->getParam('iPrice4', 0)), 'iPrice5' => intval($this->getParam('iPrice1', 0)), 'iPrice6' => intval($this->getParam('iPrice2', 0)), 'iPrice7' => intval($this->getParam('iPrice3', 0)), 'iPrice8' => intval($this->getParam('iPrice4', 0))); $aErr = array(); if (!Util_Validate::isUnsignedInt($aData['iPrice1'])) { $aErr['iPrice1'] = '请输入正确的报价'; } if (!Util_Validate::isUnsignedInt($aData['iPrice2'])) { $aErr['iPrice2'] = '请输入正确的报价'; } if (!Util_Validate::isUnsignedInt($aData['iPrice3'])) { $aErr['iPrice3'] = '请输入正确的报价'; } if (!Util_Validate::isUnsignedInt($aData['iPrice4'])) { $aErr['iPrice4'] = '请输入正确的报价'; } if ($aData['iPrice1'] + $aData['iPrice2'] + $aData['iPrice3'] + $aData['iPrice4'] == 0) { $aErr['iPrice1'] = '请至少输入一个报价'; } if (!empty($aErr)) { return $this->showMsg($aErr, false); } $aData['iStatus'] = 2; Model_Media::updData($aData); return $this->showMsg($iMediaID, true); } else { $aUser = $this->getCurrUser(Model_User::TYPE_MEDIA); if (empty($aUser)) { return $this->redirect('/user/login/type/' . Model_User::TYPE_MEDIA . '?ret=' . Util_Uri::getCurrUrl()); } $iMediaID = (int) $this->getParam('id'); if (empty($iMediaID)) { return $this->show404(); } $aMedia = Model_Media::getDetail($iMediaID); if (empty($aMedia) || $aMedia['iUserID'] != $aUser['iUserID']) { return $this->show404(); } $aTitle = array(Model_Media::TYPE_WEIXIN => array('iPrice1' => '单图文报价', 'iPrice2' => '多图文第一条报价', 'iPrice3' => '多图文第二条报价', 'iPrice4' => '多图文第三条报价'), Model_Media::TYPE_FRIEND => array('iPrice1' => '转发报价', 'iPrice2' => '直发报价'), Model_Media::TYPE_WEIBO => array('iPrice1' => '转发报价', 'iPrice2' => '直发报价')); $this->assign('aTitle', $aTitle); $this->assign('aMedia', $aMedia); $this->assign('sTopMenu', 'madd'); $this->setMeta('media_add', array('sTitle' => '添加媒体 - 填写报价')); } }