Exemplo n.º 1
0
 public function validate_checkIfDomainIdExists($field, $input, $param = null)
 {
     if (!isset($input[$field]) || empty($input[$field])) {
         return;
     }
     $model = new Model_Domain();
     $results = $model->getByQuery('id = ?', $input[$field]);
     if (count($results) == 0) {
         return array('field' => $field, 'value' => $input[$field], 'rule' => __FUNCTION__, 'param' => $param);
     }
 }
Exemplo n.º 2
0
 public function deleteAction()
 {
     $params = Request::getParams();
     $validator = new Validator();
     $params = $validator->sanitize($params);
     $validator->validation_rules(array("id" => "required|numeric|checkIfDomainIdExists"));
     $validated_data = $validator->run($params);
     if ($validated_data === false) {
         Response::setStatus(404);
         $returnArray = array("error" => "Invalid data was sent", "messages" => $validator->get_readable_errors());
     } else {
         $model = new Model_Domain();
         $model->delete($params['id']);
         Response::setStatus(204);
         $returnArray = array();
     }
     return $returnArray;
 }
Exemplo n.º 3
0
 function init()
 {
     parent::init();
 }
Exemplo n.º 4
0
    /**
     * 导出资源数据
     */
    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;
    }
Exemplo n.º 5
0
 /**
  * 请求数据检测
  *
  * @return mixed
  */
 public function _checkData($sType = 'add')
 {
     $iType = $this->getParam('iType');
     $sEmail = $this->getParam('sEmail');
     $sMobile = $this->getParam('sMobile');
     $sRealName = $this->getParam('sRealName');
     $sPassword = $this->getParam('sPassword');
     $sCoName = $this->getParam('sCoName');
     $iCoIndustry = $this->getParam('iCoIndustry');
     $sCoAddress = $this->getParam('sCoAddress');
     $sCoWebSite = $this->getParam('sCoWebSite');
     $sCoDesc = $this->getParam('sCoDesc');
     $sWeixin = $this->getParam('sWeixin');
     $sQQ = $this->getParam('sQQ');
     $iIncome = $this->getParam('iIncome');
     $iMoney = $this->getParam('iMoney');
     $iStatus = $this->getParam('iStatus');
     $iRate = $this->getParam('iRate');
     $iUpdateTime = time();
     if (!Util_Validate::isEmail($sEmail)) {
         return $this->showMsg('输入的邮箱地址不合法!', false);
     }
     if (($sType == 'add' || !empty($sPassword)) && !Util_Validate::isLength($sPassword, 6, 20)) {
         return $this->showMsg('登录密码长度范围为6到20字符!', false);
     }
     if (!Util_Validate::isMobile($sMobile)) {
         return $this->showMsg('输入的手机号码不合法!', false);
     }
     if (!Util_Validate::isLength($sRealName, 2, 20)) {
         return $this->showMsg('真实姓名长度范围为2到20字符!', false);
     }
     $aDomain = Model_Domain::getPairDomain(Model_Domain::TYPE_CO_INDUSTRY);
     if (!isset($aDomain[$iCoIndustry])) {
         return $this->showMsg('选择的行业不存在!', false);
     }
     $aRow = array('iType' => $iType, 'sEmail' => $sEmail, 'sMobile' => $sMobile, 'sRealName' => $sRealName, 'sCoName' => $sCoName, 'iCoIndustry' => $iCoIndustry, 'sCoAddress' => $sCoAddress, 'sCoWebSite' => $sCoWebSite, 'sCoDesc' => $sCoDesc, 'sWeixin' => $sWeixin, 'sQQ' => $sQQ, 'iIncome' => $iIncome, 'iMoney' => $iMoney, 'iStatus' => $iStatus, 'iUpdateTime' => $iUpdateTime, 'iRate' => $iRate);
     if (!empty($sPassword)) {
         $aRow['sPassword'] = md5(Yaf_G::getConf('cryptkey', 'cookie') . $sPassword);
     }
     return $aRow;
 }
Exemplo n.º 6
0
Arquivo: Adsh.php Projeto: pancke/yyaf
    /**
     * 导出
     */
    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;
    }
Exemplo n.º 7
0
Arquivo: Ad.php Projeto: pancke/yyaf
 /**
  * 添加推广
  */
 public function addAction()
 {
     if ($this->isPost()) {
         $iAdID = (int) $this->getParam('id');
         $aAd = null;
         if ($iAdID > 0) {
             $aAd = Model_Ad::getDetail($iAdID);
             if ($aAd['iUserID'] != $this->aCurrUser['iUserID']) {
                 return $this->showMsg('不要乱改别人的数据', false);
             }
         }
         $aData = array();
         $aData['iUserID'] = $this->aCurrUser['iUserID'];
         $aData['iMediaType'] = (int) $this->getParam('iMediaType');
         $aData['iAdType'] = (int) $this->getParam('iAdType');
         $aData['sAdName'] = $this->getParam('sAdName');
         $aData['iPlanMinMoney'] = (int) $this->getParam('iPlanMinMoney');
         $aData['iPlanMaxMoney'] = (int) $this->getParam('iPlanMaxMoney');
         $aData['sCatID'] = (int) $this->getParam('sCatID');
         $aAdType = $this->getParam('aAdType');
         $aCityID = $this->getParam('aCityID');
         $aErr = array();
         if (!Util_Validate::isLength($aData['sAdName'], 2, 50)) {
             $aErr['sAdName'] = '请输入推广名称';
         }
         if ($aData['iPlanMinMoney'] > $aData['iPlanMaxMoney']) {
             $aErr['iPlanMoney'] = '后者数字必须大于前者数字';
         }
         /*
          * if (empty($aAdType)) { $aErr['aAdType'] = '请选择广告类型'; } if (empty($aCatID)) { $aErr['aCatID'] = '请选择媒体类别'; }
          */
         /*
          * if (empty($aCityID)) { $aErr['aCityID'] = '请选择城市/地区'; }
          */
         if (!empty($aCityID) && count($aCityID) > 3) {
             $aErr['aCityID'] = '最多选择3个城市/地区';
         }
         // 判断该自媒是否已经存在
         if (!empty($aData['sAdName'])) {
             $aOtherAd = Model_Ad::getAdByName($aData['iUserID'], $aData['sAdName'], $iAdID);
             if (!empty($aOtherAd) && $aOtherAd['iStatus'] != Model_Ad::STATUS_DELETE) {
                 $aErr['sAdName'] = '该推广计划已经存在!';
             }
         }
         if (!empty($aErr)) {
             return $this->showMsg($aErr, false);
         }
         /*
          * if (count($aAdType) == 2) { $aData['iAdType'] = 3; } else { $aData['iAdType'] = array_pop($aAdType); }
          */
         $aData['sCityID'] = empty($aCityID) ? '' : join(',', $aCityID);
         $aData['iStatus'] = Model_Ad::STATUS_WRITING;
         if (empty($aAd)) {
             $iAdID = Model_Ad::addData($aData);
         } else {
             $aData['iAdID'] = $aAd['iAdID'];
             Model_Ad::updData($aData);
         }
         Model_User::updData(array('iUserID' => $this->aCurrUser['iUserID'], 'iFirst' => 'iFirst + 1'));
         if ($iAdID > 0) {
             return $this->showMsg($iAdID, true);
         } else {
             $aErr['sAdName'] = '添加失败,请稍后再试';
             return $this->showMsg($aErr, false);
         }
     } else {
         $iAdID = intval($this->getParam('id'));
         $aAd = null;
         if ($iAdID > 0) {
             $aAd = Model_Ad::getDetail($iAdID);
         }
         if (empty($aAd)) {
             $iType = intval($this->getParam('type', Model_Media::TYPE_WEIXIN));
         } else {
             $iType = $aAd['iMediaType'];
             $aAd['aCityID'] = explode(',', $aAd['sCityID']);
             $aAd['aCatID'] = explode(',', $aAd['sCatID']);
         }
         $aData = array();
         switch ($iType) {
             case Model_Media::TYPE_WEIXIN:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIXIN_CATEGORY);
                 // $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIXIN_TAG);
                 break;
             case Model_Media::TYPE_FRIEND:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_FRIEND_CATEGORY);
                 // $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_FRIEND_TAG);
                 break;
             case Model_Media::TYPE_WEIBO:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIBO_CATEGORY);
                 // $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIBO_TAG);
                 break;
             case Model_Media::TYPE_NEWS:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_NEWS_CATEGORY);
                 // $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_NEWS_TAG);
                 break;
         }
         $aData['aAdType'] = array(1 => '软广', 2 => '硬广');
         $aData['aCity'] = Model_City::getPairCitys(Model_City::TYPE_FRONT);
         $aType = Model_Media::$aType;
         unset($aType[Model_Media::TYPE_NEWS]);
         $this->assign('iType', $iType);
         $this->assign('aType', $aType);
         $this->assign('aData', $aData);
         $this->assign('aAd', $aAd);
         $this->assign('aUser', Model_User::getDetail($this->aCurrUser['iUserID']));
         $this->assign('sTopMenu', 'aadd');
         $this->setMeta('ad_add', array('sTitle' => '添加推广计划'));
     }
 }
Exemplo n.º 8
0
 /**
  * 企业资料
  */
 public function coinfoAction()
 {
     if ($this->isPost()) {
         $aParam = $this->getParams();
         $aParam['iUserID'] = $this->aCurrUser['iUserID'];
         $aUser = Model_User::getDetail($aParam['iUserID']);
         $aErr = array();
         if (!Util_Validate::isCLength($aParam['sCoName'], 2, 50)) {
             $aErr['sCoName'] = '公司名称长度为2-50个汉字';
         }
         if (empty($aParam['aCoIndustry']) || count($aParam['aCoIndustry']) > 3) {
             $aErr['sCoIndustry'] = '请选择1~3个行业';
         }
         if (!Util_Validate::isCLength($aParam['sCoAddress'], 5, 100)) {
             $aErr['sCoAddress'] = '公司地址长度为5-50个汉字';
         }
         if (!Util_Validate::isAbsoluteUrl($aParam['sCoWebsite'])) {
             $aErr['sCoWebsite'] = '公司网址格式不正确';
         }
         if (!Util_Validate::isCLength($aParam['sCoDesc'], 2, 200)) {
             $aErr['sCoDesc'] = '公司介绍长度为2-500个汉字';
         }
         if (!empty($aErr)) {
             return $this->showMsg($aErr, false);
         }
         $aParam['sCoIndustry'] = join(',', $aParam['aCoIndustry']);
         Model_User::updData($aParam);
         return $this->showMsg('企业资料修改成功!', true);
     } else {
         $aUser = Model_user::getDetail($this->aCurrUser['iUserID']);
         $aUser['aCoIndustry'] = explode(',', $aUser['sCoIndustry']);
         $aIndustry = Model_Domain::getOption(Model_Domain::TYPE_CO_INDUSTRY);
         $this->assign('aUser', $aUser);
         $this->assign('aIndustry', $aIndustry);
         $this->assign('iTabID', 1);
         $this->setMeta('mcenter_page', array('sTitle' => '自媒体中心 - 企业资料'));
     }
 }
Exemplo n.º 9
0
 /**
  * 添加自媒体
  */
 public function addAction()
 {
     if ($this->isPost()) {
         $aUser = $this->getCurrUser(Model_User::TYPE_MEDIA);
         if (empty($aUser)) {
             return $this->showMsg('请先登录!', false);
         }
         $iMediaID = (int) $this->getParam('iMediaID');
         $aMedia = null;
         if ($iMediaID > 0) {
             $aMedia = Model_Media::getDetail($iMediaID);
             if ($aMedia['iUserID'] != $aUser['iUserID']) {
                 return $this->showMsg('不要乱改别人的数据', false);
             }
         }
         $aData = array();
         $aData['iUserID'] = $aUser['iUserID'];
         $aData['iMediaType'] = (int) $this->getParam('iMediaType');
         $aData['sMediaName'] = $this->getParam('sMediaName');
         $aData['sOpenName'] = $this->getParam('sOpenName');
         $aData['iFollowerNum'] = (int) $this->getParam('iFollowerNum');
         $aData['sFollowerImg'] = $this->getParam('sFollowerImg');
         $aData['sAvatar'] = $this->getParam('sAvatar');
         $aData['sQRCode'] = $this->getParam('sQRCode');
         $aErr = array();
         switch ($aData['iMediaType']) {
             case Model_Media::TYPE_WEIXIN:
                 if ($aData['iFollowerNum'] == 0) {
                     $aErr['iFollowerNum'] = '请输入丝粉数量';
                 }
                 if (!Util_Validate::isLength($aData['sMediaName'], 2, 50)) {
                     $aErr['sMediaName'] = '请输入微信名称';
                 }
                 if (!preg_match('/[a-z][0-9a-z_\\-]{5,19}/i', $aData['sOpenName'])) {
                     $aErr['sOpenName'] = '请输入正确的微信帐号';
                 }
                 if (empty($aData['sFollowerImg'])) {
                     $aErr['sFollowerImg'] = '请上传粉丝数截图';
                 }
                 if (empty($aData['sAvatar'])) {
                     $aErr['sAvatar'] = '请上传微信头像';
                 }
                 if (empty($aData['sQRCode'])) {
                     $aErr['sQRCode'] = '请上传二维码';
                 }
                 $aOtherMedia = Model_Media::getMediaByOpenName($aData['iMediaType'], $aData['sOpenName'], $iMediaID);
                 if (!empty($aOtherMedia)) {
                     $aErr['sOpenName'] = '该自媒体已经存在!';
                 }
                 break;
             case Model_Media::TYPE_FRIEND:
                 if (empty($aData['sMediaName'])) {
                     $aErr['sMediaName'] = '请输入账号名称';
                 }
                 if ($aData['iFollowerNum'] == 0) {
                     $aErr['iFollowerNum'] = '请输入好友数量';
                 }
                 if (empty($aData['sFollowerImg'])) {
                     $aErr['sFollowerImg'] = '请上传好友数截图';
                 }
                 if (empty($aData['sAvatar'])) {
                     $aErr['sAvatar'] = '请上传你微信头像';
                 }
                 // 判断该自媒是否已经存在
                 $aOtherMedia = Model_Media::getMediaByName($aData['iMediaType'], $aData['sMediaName'], $iMediaID);
                 if (!empty($aOtherMedia)) {
                     $aErr['sMediaName'] = '该微信帐号已经存在!';
                 }
                 break;
             case Model_Media::TYPE_WEIBO:
                 if (empty($aData['sMediaName'])) {
                     $aErr['sMediaName'] = '请输入账号名称';
                 }
                 if ($aData['iFollowerNum'] == 0) {
                     $aErr['iFollowerNum'] = '请输入好友数量';
                 }
                 if (empty($aData['sFollowerImg'])) {
                     $aErr['sFollowerImg'] = '请上传好友数截图';
                 }
                 if (empty($aData['sAvatar'])) {
                     $aErr['sAvatar'] = '请上传你微博头像';
                 }
                 $aData['sUrl'] = $this->getParam('sUrl');
                 if (!Util_Validate::isAbsoluteUrl($aData['sUrl'])) {
                     $aErr['sUrl'] = '请输入正确的微博地址';
                 }
                 // 判断该自媒是否已经存在
                 $aOtherMedia = Model_Media::getMediaByName($aData['iMediaType'], $aData['sMediaName'], $iMediaID);
                 if (!empty($aOtherMedia)) {
                     $aErr['sMediaName'] = '该微博帐号已经存在!';
                 }
                 break;
         }
         $aCatID = $this->getParam('aCatID');
         $aCityID = $this->getParam('aCityID');
         $aTagID = $this->getParam('aTagID');
         //             if (empty($aCatID)) {
         //                 $aErr['aCatID'] = '请选择媒体类别';
         //             }
         //             if (! empty($aCatID) && count($aCatID) > 3) {
         //                 $aErr['aCatID'] = '最多选择3个媒体类别';
         //             }
         if (empty($aTagID)) {
             $aErr['aTagID'] = '请选择媒体标签';
         }
         if (!empty($aTagID) && count($aTagID) > 6) {
             $aErr['aTagID'] = '最多选择6个媒体标签';
         }
         if (empty($aCityID)) {
             $aErr['aCityID'] = '请选择城市/地区';
         }
         if (!empty($aCityID) && count($aCityID) > 3) {
             $aErr['aCityID'] = '最多选择3个城市/地区';
         }
         if (!empty($aErr)) {
             return $this->showMsg($aErr, false);
         }
         if (empty($aMedia)) {
             $aData['iStatus'] = 3;
             $aData['sVerifyCode'] = strtoupper(Util_Tools::passwdGen(32));
             $iMediaID = Model_Media::addData($aData);
         } else {
             $aData['iStatus'] = 2;
             $aData['iMediaID'] = $aMedia['iMediaID'];
             Model_Media::updData($aData);
         }
         Model_User::updData(array('iUserID' => $this->aCurrUser['iUserID'], 'iFirst' => 'iFirst + 1'));
         if ($iMediaID > 0) {
             //Model_Media::updCategory($iMediaID, $aCatID);
             Model_Media::updCity($iMediaID, $aCityID);
             Model_Media::updTag($iMediaID, $aTagID);
             return $this->showMsg($iMediaID, true);
         } else {
             $aErr['sMediaName'] = '添加失败,请稍后再试';
             return $this->showMsg($aErr, false);
         }
     } else {
         $aUser = $this->getCurrUser(Model_User::TYPE_MEDIA);
         if (empty($aUser)) {
             return $this->redirect('/user/login/type/' . Model_User::TYPE_MEDIA . '.html?ret=' . Util_Uri::getCurrUrl());
         }
         $iMediaID = intval($this->getParam('id'));
         $aMedia = null;
         if ($iMediaID > 0) {
             $aMedia = Model_Media::getFullDetail($iMediaID);
         }
         if (empty($aMedia)) {
             $iType = intval($this->getParam('type', Model_Media::TYPE_WEIXIN));
         } else {
             $iType = $aMedia['iMediaType'];
         }
         $aData = array();
         switch ($iType) {
             case Model_Media::TYPE_WEIXIN:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIXIN_CATEGORY);
                 $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIXIN_TAG);
                 break;
             case Model_Media::TYPE_FRIEND:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_FRIEND_CATEGORY);
                 $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_FRIEND_TAG);
                 break;
             case Model_Media::TYPE_WEIBO:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIBO_CATEGORY);
                 $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIBO_TAG);
                 break;
             case Model_Media::TYPE_NEWS:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_NEWS_CATEGORY);
                 $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_NEWS_TAG);
                 break;
         }
         $aData['aCity'] = Model_City::getPairCitys(Model_City::TYPE_FRONT);
         // array_unshift($aData['aCategory'], '不限');
         // array_unshift($aData['aCity'], '不限');
         // array_unshift($aData['aTag'], '不限');
         $aType = Model_Media::$aType;
         unset($aType[Model_Media::TYPE_NEWS]);
         $this->assign('iType', $iType);
         $this->assign('aType', $aType);
         $this->assign('aData', $aData);
         $this->assign('aMedia', $aMedia);
         $this->assign('aUser', Model_User::getDetail($this->aCurrUser['iUserID']));
         $this->assign('sTopMenu', 'madd');
         $sRandCode = Util_Tools::passwdGen(8, Util_Tools::FLAG_ALPHANUMERIC);
         Util_Cookie::set('media_verify_code', $sRandCode);
         $this->assign('sRandCode', $sRandCode);
         $this->setMeta('media_add', array('sTitle' => '添加媒体'));
     }
 }
Exemplo n.º 10
0
 /**
  * 增加基础配置
  */
 public function addAction()
 {
     if ($this->_request->isPost()) {
         $aDomain = $this->_checkData('add');
         if (empty($aDomain)) {
             return null;
         }
         if (Model_Domain::getRow(array('where' => array('sName' => $aDomain['sName'], 'iType' => $aDomain['iType'], 'iStatus' => 1)))) {
             return $this->showMsg('基础配置已经存在!', false);
         }
         if (Model_Domain::addData($aDomain) > 0) {
             return $this->showMsg('基础配置增加成功!', true);
         } else {
             return $this->showMsg('基础配置增加失败!', false);
         }
     }
     $this->assign('iType', Model_Domain::$iType);
 }
Exemplo n.º 11
0
Arquivo: User.php Projeto: pancke/yyaf
 /**
  * 修改用户信息
  */
 public function chginfoAction()
 {
     if ($this->isPost()) {
         $aParam = $this->getParams();
         $aUser = Model_User::getDetail($aParam['iUserID']);
         $aErr = array();
         if (empty($aParam['sEmail']) || !Util_Validate::isEmail($aParam['sEmail'])) {
             $aErr['sEmail'] = '登录邮箱格式不正确!';
         }
         if (empty($aParam['sMobile']) || !Util_Validate::isMobile($aParam['sMobile'])) {
             $aErr['sMobile'] = '手机号码格式不正确!';
         }
         if ($aUser['sEmail'] != $aParam['sEmail'] && Model_User::getUserByEmail($aParam['sEmail'], $aParam['iType'], $aParam['iUserID'])) {
             $aErr['sEmail'] = '该邮箱已经被注册了!';
         }
         if ($aUser['sMobile'] != $aParam['sMobile'] && Model_User::getUserByMobile($aParam['sMobile'], $aParam['iType'], $aParam['iUserID'])) {
             $aErr['sMobile'] = '该手机号码已经被注册了!';
         }
         if (!Util_Validate::isCLength($aParam['sCoName'], 1, 50)) {
             $aErr['sCoName'] = '企业名称长度为1-50个汉字!';
         }
         if (!Util_Validate::isCLength($aParam['sRealName'], 2, 5)) {
             $aErr['sRealName'] = '联系人名称长度为2-5个汉字!';
         }
         if (!Util_Validate::isAbsoluteUrl($aParam['sCoWebsite'])) {
             $aErr['sCoWebsite'] = '网址格式不正确!';
         }
         if (!Util_Validate::isCLength($aParam['sCoDesc'], 2, 200)) {
             $aErr['sCoDesc'] = '公司介绍长度为2-500个汉字!';
         }
         if (empty($aParam['sWeixin'])) {
             $aErr['sWeixin'] = '请输入你的微信号!';
         }
         if (!Util_Validate::isQQ($aParam['sQQ'])) {
             $aErr['sQQ'] = 'QQ号码输入不正确!';
         }
         if (!empty($aErr)) {
             return $this->showMsg($aErr, false);
         }
         Model_User::updData($aParam);
         return $this->showMsg('个人信息修改成功!', true);
     } else {
         $iType = $this->getParam('type');
         $aUser = $this->getCurrUser($iType);
         if (empty($aUser)) {
             return $this->show404();
         }
         $aUser = Model_user::getDetail($aUser['iUserID']);
         $aIndustry = Model_Domain::getOption(Model_Domain::TYPE_CO_INDUSTRY);
         $this->assign('aUser', $aUser);
         $this->assign('aIndustry', $aIndustry);
     }
 }