/** * 为了成长付出的代价 */ public function doPay($starttime, $currency) { $tdTime = Pw::getTdtime(); $set_a = array(); Wind::import('EXT:signature.service.dm.App_Signature_dm'); $dm = new App_Signature_dm($this->info['uid']); if (!$starttime) { $set_a = array($tdTime, $this->money); } elseif (!$this->money || strpos($this->groups, ',' . $this->info['groupid'] . ',') === false) { $dm->setStartTime(0); $this->_userDs()->editUser($dm, PwUser::FETCH_DATA); } else { $days = floor(($tdTime - $starttime) / 86400); $cost = $days * $this->money; $cost < 0 && ($cost = 0); if ($currency >= $cost) { $set_a = array($tdTime, $cost); } else { $cost = $currency - $currency % $this->money; $cost < 0 && ($cost = 0); $set_a = array(0, $cost); } } if ($set_a) { /* @var $creditBo PwCreditBo */ $creditBo = PwCreditBo::getInstance(); $creditBo->set($this->info['uid'], $this->moneyType, -$set_a[1]); $dm->setStartTime($set_a[0]); $this->_userDs()->editUser($dm, PwUser::FETCH_DATA); } return true; }
public function welcome(PwUserBo $userBo, $ip) { $config = Wekit::C('site'); $info = $userBo->info; $moneyType = $config['app.signature.moneytype']; $money = $config['app.signature.money']; $in_group = strpos($config['app.signature.groups'], ',' . $info['groupid'] . ',') !== false; $neverPay = !$info['app_signature_starttime'] && $money && $in_group && $info['credit' . $moneyType] > $money; $everPay = $info['app_signature_starttime'] && $info['app_signature_starttime'] != Pw::getTdtime(); if ($neverPay || $everPay) { Wind::import('EXT:signature.service.srv.App_Signature_Pay'); $srv = new App_Signature_Pay($info, $config); $srv->doPay($info['app_signature_starttime'], $info['credit' . $moneyType]); } }
public function bulidUsers($users) { $config = Wekit::C('site'); foreach ($users as $key => $value) { if ($value['bbs_sign']) { $moneyType = $config['app.signature.moneytype']; $money = $config['app.signature.money']; $in_group = strpos($config['app.signature.groups'], ',' . $value['groupid'] . ',') !== false; $payCredit = !$value['app_signature_starttime'] || $value['credit' . $moneyType] < (Pw::getTdtime() - $value['app_signature_starttime']) / 86400 * $money; if ($money && $in_group && $payCredit) { $value['bbs_sign'] = ''; } } $users[$key] = $value; } return $users; }
/** * @see PwUploadAction.check */ public function check() { if (!$this->user->isExists()) { return new PwError('login.not'); } if (!$this->forum->isForum()) { return new PwError('FORUM_IS_NOT_EXISTS'); } if (($result = $this->forum->allowUpload($this->user)) !== true) { return new PwError('BBS:forum.permissions.upload.allow', array('{grouptitle}' => $this->user->getGroupInfo('name'))); } if (!$this->forum->foruminfo['allow_upload'] && !$this->user->getPermission('allow_upload')) { return new PwError('permission.upload.allow', array('{grouptitle}' => $this->user->getGroupInfo('name'))); } if ($uploadPerday = $this->user->getPermission('uploads_perday')) { $count = PwUpload::countUploadedFile() + count($this->flashatt); $todayupload = $this->user->info['lastpost'] < Pw::getTdtime() ? 0 : $this->user->info['todayupload']; if ($count > 0 && $count + $todayupload > $uploadPerday) { return new PwError('permission.upload.nums.perday', array('{nums}' => $uploadPerday)); } } return true; }
public function getOperateCount($uid, $operate) { if (isset($this->_num[$uid][$operate])) { return $this->_num[$uid][$operate]; } isset($this->_ops[$uid]) || ($this->_ops[$uid] = Wekit::load('credit.PwCreditLog')->getOperate($uid)); $ops = $this->_ops[$uid]; if (isset($ops[$operate]) && $ops[$operate]['update_time'] > Pw::getTdtime()) { return $ops[$operate]['num']; } return 0; }
public function checkTodayNum($mobile) { $info = $this->_getDs()->getMobileVerify($mobile); $number = 1; $tdtime = Pw::getTdtime(); if ($info) { $number = $info['number']; if ($info['create_time'] < $tdtime + 86400 && $info['create_time'] > $tdtime) { $number++; } else { $number = 1; } } if ($number > $this->sendNumDay) { return new PwError('USER:mobile.code.send.num.error'); } return $number; }
private function _initVar() { $creditBo = PwCreditBo::getInstance(); $sellCreditRange = $this->loginUser->getPermission('sell_credit_range', false, array()); $allowThreadExtend = $this->loginUser->getPermission('allow_thread_extend', false, array()); $sellConfig = array('ifopen' => $this->post->forum->forumset['allowsell'] && $allowThreadExtend['sell'] ? 1 : 0, 'price' => $sellCreditRange['maxprice'], 'income' => $sellCreditRange['maxincome'], 'credit' => Pw::subArray($creditBo->cType, $this->loginUser->getPermission('sell_credits'))); !$sellConfig['credit'] && ($sellConfig['credit'] = array_slice($creditBo->cType, 0, 1, true)); $enhideConfig = array('ifopen' => $this->post->forum->forumset['allowhide'] && $allowThreadExtend['hide'] ? 1 : 0, 'credit' => Pw::subArray($creditBo->cType, $this->loginUser->getPermission('enhide_credits'))); !$enhideConfig['credit'] && ($enhideConfig['credit'] = array_slice($creditBo->cType, 0, 1, true)); $allowUpload = $this->post->user->isExists() && $this->post->forum->allowUpload($this->post->user) && ($this->post->user->getPermission('allow_upload') || $this->post->forum->foruminfo['allow_upload']) ? 1 : 0; $attachnum = intval(Wekit::C('attachment', 'attachnum')); if ($perday = $this->post->user->getPermission('uploads_perday')) { $count = $this->post->user->info['lastpost'] < Pw::getTdtime() ? 0 : $this->post->user->info['todayupload']; $attachnum = max(min($attachnum, $perday - $count), 0); } $this->setOutput(PwSimpleHook::getInstance('PwEditor_app')->runWithFilters(array()), 'editor_app_config'); $this->setOutput($this->post, 'pwpost'); $this->setOutput($this->post->getDisabled(), 'needcheck'); $this->setOutput($this->post->forum->fid, 'fid'); $this->setOutput($this->post->forum, 'pwforum'); $this->setOutput($sellConfig, 'sellConfig'); $this->setOutput($enhideConfig, 'enhideConfig'); $this->setOutput($allowThreadExtend, 'allowThreadExtend'); $this->setOutput($allowUpload, 'allowUpload'); $this->setOutput($attachnum, 'attachnum'); }
public function updateUser() { $userDm = $this->getUserDm(); $userDm->setLastpost(Pw::getTime()); if ($this->user->info['lastpost'] < Pw::getTdtime()) { $userDm->setTodaypost(0)->setTodayupload(0); } return $userDm; }
public function run() { $page = intval($this->getInput('page', 'get')); $page < 1 && ($page = 1); $perpage = 20; list($start, $limit) = Pw::page2limit($page, $perpage); $gid = $this->getInput('gid'); $url = array(); if ($gid) { $url['gid'] = $gid; $current = $gid; $user = Wekit::load('attention.PwAttentionType')->getUserByType($this->loginUser->uid, $gid, 2000); $uids = array_keys($user); $count = $this->_getService()->countAttentionFreshByUid($this->loginUser->uid, $uids); Wind::import('SRV:attention.srv.dataSource.PwFetchAttentionFreshByUid'); $dataSource = new PwFetchAttentionFreshByUid($this->loginUser->uid, $uids, $limit, $start); } else { $current = 'all'; $count = $this->_getService()->countAttentionFresh($this->loginUser->uid); if ($count > 200) { $count > 250 && Wekit::load('attention.PwFresh')->deleteAttentionFresh($this->loginUser->uid, $count - 200); $count = 200; } Wind::import('SRV:attention.srv.dataSource.PwFetchAttentionFresh'); $dataSource = new PwFetchAttentionFresh($this->loginUser->uid, $limit, $start); } $freshDisplay = new PwFreshDisplay($dataSource); $fresh = $freshDisplay->gather(); $type = Wekit::load('attention.srv.PwAttentionService')->getAllType($this->loginUser->uid); $unpost = ''; !$this->loginUser->info['lastpost'] && ($this->loginUser->info['lastpost'] = $this->loginUser->info['regdate']); $tmp = Pw::getTime() - $this->loginUser->info['lastpost']; if ($tmp > 31536000) { $unpost = floor($tmp / 31536000) . '年多'; } elseif ($tmp > 2592000) { $unpost = floor($tmp / 2592000) . '个多月'; } elseif ($tmp > 172800) { $unpost = floor($tmp / 86400) . '天'; } $type = Wekit::load('attention.srv.PwAttentionService')->getAllType($this->loginUser->uid); $allowUpload = $this->loginUser->getPermission('allow_upload'); if ($imgextsize = Pw::subArray(Wekit::C('attachment', 'extsize'), array('jpg', 'jpeg', 'png', 'gif', 'bmp'))) { $maxSize = max($imgextsize) . ' KB'; $filetypes = '*.' . implode(';*.', array_keys($imgextsize)); $attachnum = intval(Wekit::C('attachment', 'attachnum')); if ($perday = $this->loginUser->getPermission('uploads_perday')) { $todayupload = $this->loginUser->info['lastpost'] < Pw::getTdtime() ? 0 : $this->loginUser->info['todayupload']; $attachnum = max(min($attachnum, $perday - $todayupload), 0); $attachnum == 0 && ($allowUpload = 0); } } else { $allowUpload = $attachnum = $maxSize = 0; $filetypes = ''; } $this->setOutput($allowUpload, 'allowUpload'); $this->setOutput($attachnum, 'attachnum'); $this->setOutput($maxSize, 'maxSize'); $this->setOutput($filetypes, 'filetypes'); $this->setOutput($current, 'currents'); $this->setOutput($type, 'type'); $this->setOutput($unpost, 'unpost'); $this->setOutput($fresh, 'freshdb'); $this->setOutput($this->loginUser->getPermission('fresh_delete'), 'freshDelete'); $this->setOutput($page, 'page'); $this->setOutput($perpage, 'perpage'); $this->setOutput($count, 'count'); $this->setOutput($url, 'url'); // seo设置 Wind::import('SRV:seo.bo.PwSeoBo'); $seoBo = PwSeoBo::getInstance(); $lang = Wind::getComponent('i18n'); $seoBo->setCustomSeo($lang->getMessage('SEO:bbs.fresh.run.title'), '', ''); Wekit::setV('seo', $seoBo); }