Пример #1
0
 /**
  * 检测是否登录
  */
 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;
 }
Пример #2
0
 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);
     }
 }
Пример #3
0
Файл: Ad.php Проект: pancke/yyaf
 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());
     }
 }
Пример #4
0
 /**
  * 提现申请
  */
 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' => '自媒体中心 - 申请提现'));
     }
 }
Пример #5
0
 /**
  * 填写报价
  */
 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' => '添加媒体 - 填写报价'));
     }
 }