public function editAction() { $tagId = $this->getInput('id', 'Request'); $tagName = $this->getInput('name', 'Request'); $tagType = $this->getInput('type', 'Request'); if ($this->getInput('type', 'post') === 'do') { $tagName = $this->getInput('tagname', 'post'); if (empty($tagName)) { $this->showError('请输入Tag名称'); return; } $hasDuplicate = $this->_getTagDs()->checkDuplicateName($tagName); if ($hasDuplicate) { $this->showError('Tag:' . '"' . $tagName . '"' . '已存在'); return; } $dm = new App_Tag_Dm(); $dm->setTagName($tagName)->setLastUpdateTime(Pw::getTime()); $this->_getTagDs()->update($tagId, $dm); $this->showMessage('更新成功'); } else { $this->setOutput($tagId, 'tagId'); $this->setOutput($tagName, 'tagName'); $this->setOutput($tagType, 'tagType'); } }
public function __construct($uid) { $this->ftype = array('jpg' => 2000, 'png' => 2000, 'jpeg' => 2000); $this->mime = array('image/jpeg', 'image/png', 'image/jpg'); $this->uid = $uid; $this->udir = Pw::getUserDir($this->uid); }
/** * 获取淘宝响应信息 如果oauth2正常流程,可以走curl_init */ public function getResponseInfo() { $result = $this->checkStatus(); if ($result !== true) { return new PwError($result); } $sessionId = Pw::getCookie($this->_getLoginSessionService()->getCookieName()); $sessionInfo = App_Account_LoginSessionBo::getInstance($sessionId)->getSession(); if (!$sessionId || !$sessionInfo) { return new PwError('验证会话失败,请重试'); } list($top_parameters, $top_sign) = array(trim($_REQUEST['top_parameters']), trim($_REQUEST['top_sign'])); if ($this->_checkSign() === false) { return new PwError('与淘宝通信失败,请重试'); } $userInfo = $this->_getUserInfo(); if ($userInfo === false) { return new PwError('获取用户信息失败,请重试'); } list($user_id, $nick) = $userInfo; //更新数据库 $info = $this->_getTaobaoUserInfoDs()->get($user_id); if (!$info) { $dm = new App_Account_TaobaoUserInfoDm(); $dm->setUserId($user_id)->setNick($nick)->setCreateAt(Pw::getTime()); $this->_getTaobaoUserInfoDs()->add($dm); } //更新session $this->updateSession($user_id, $nick, 'taobao'); return true; }
protected function _getActiveUser($fid, $day, $num) { $time = Pw::getTime() - $day * 86400; $array = array(); $thread = Wekit::load('forum.PwThreadExpand')->countUserThreadByFidAndTime($fid, $time, $num); $post = Wekit::load('forum.PwThreadExpand')->countUserPostByFidAndTime($fid, $time, $num); foreach ($thread as $key => $value) { if (!$key) { continue; } $array[$key] = $value['count']; } foreach ($post as $key => $value) { if (!$key) { continue; } if (isset($array[$key])) { $array[$key] += $value['count']; } else { $array[$key] = $value['count']; } } arsort($array); return array_slice($array, 0, $num, true); }
public function afterAction($handlerAdapter) { parent::afterAction($handlerAdapter); $debug = Wekit::C('site', 'debug') || !Wekit::C('site', 'css.compress'); Wekit::setGlobal(array('debug' => $debug ? '/dev' : '/build'), 'theme'); $this->setTheme('site', null); /* @var $resource WindLangResource */ $resource = Wind::getComponent('i18n'); $_error = $this->getForward()->getVars('message'); if ($resource !== null) { foreach ($_error as $key => $value) { if (is_array($value)) { list($value, $var) = $value; } else { $var = array(); } $message = $resource->getMessage($value, $var); $message && ($_error[$key] = $message); } } $this->getForward()->setVars(array('message' => $_error, '__error' => '')); $type = $this->getRequest()->getAcceptTypes(); // 如果是含有上传的递交,不能采用ajax的方式递交,需要以html的方式递交,并且返回的结果需要是json格式,将以json=1传递过来标志 $json = $this->getInput('_json'); $requestJson = $this->getRequest()->getIsAjaxRequest() && strpos(strtolower($type), "application/json") !== false; if ($requestJson || $json == 1) { $this->getResponse()->setHeader('Content-type', 'application/json; charset=' . Wekit::V('charset')); echo Pw::jsonEncode($this->getForward()->getVars()); exit; } }
/** * 发送通知 * @param int $uid * @param string $type * @param int $param * @param array $extendParams * @param $updateUnRead 是否更新未读数 */ public function sendNotice($uid, $type, $param = 0, $extendParams = array(), $updateUnRead = true) { $action = $this->_getAction($type); if (!$action) { return new PwError('MESSAGE::notice.type.undefined'); } $typeId = $this->_getTypeId($type); // 看是否发通知 if ($this->_checkPrivate($uid, $typeId) !== true) { return false; } //aggregated notice Wind::import('SRV:message.dm.PwMessageNoticesDm'); $dm = new PwMessageNoticesDm(); $action->aggregate && ($notice = $this->_getNoticesDs()->getNoticeByUid($uid, $typeId, $param)); $extendParams = $action->formatExtendParams($extendParams, $notice); $noticeTitle = $action->buildTitle($param, $extendParams, $notice); $dm->setToUid($uid)->setRead(0)->setType($typeId)->setParam($param)->setExtendParams($extendParams)->setTitle($noticeTitle); if (!$notice) { $noticeId = $this->_getNoticesDs()->addNotice($dm); } else { $dm->setId($notice['id']); $dm->setModifiedTime(Pw::getTime()); $this->_getNoticesDs()->updateNotice($dm); $noticeId = $notice['id']; } //更新通知未读数 if ($updateUnRead && (!$notice || $notice['is_read'])) { Wind::import('SRV:user.dm.PwUserInfoDm'); $dm = new PwUserInfoDm($uid); $dm->addNotice(1); $this->_getUserDs()->editUser($dm, PwUser::FETCH_DATA); } return true; }
public function afterRegister($userDm) { if ($this->bp->config['type'] != 2) { return false; } /* @var $inviteDs PwInviteCode */ $inviteDs = Wekit::load('invite.PwInviteCode'); if ($this->inviteInfo['created_userid']) { $codeDm = new PwInviteCodeDm(); $codeDm->setInvitedUid($userDm->uid)->setModifiedTime(Pw::getTime())->setIfused(1)->setCode($this->code); //别人赠送的邀请码 $inviteDs->updateCode($codeDm); $creditType = $this->bp->config['invite.reward.credit.type']; $creditNum = $this->bp->config['invite.reward.credit.num']; //邀请人获得加奖励 //[积分日志] 成功邀请好友积分奖励 /* @var $creditBo PwCreditBo */ $creditBo = PwCreditBo::getInstance(); $creditBo->addLog('invite_reward', array($creditType => $creditNum), new PwUserBo($this->inviteInfo['created_userid']), array('friend' => $userDm->getField('username'))); $creditBo->set($this->inviteInfo['created_userid'], $creditType, $creditNum); //邀请成功相互关注 被邀请者关注邀请者 /* @var $attention PwAttentionService */ $attention = Wekit::load('attention.srv.PwAttentionService'); $attention->addFollow($userDm->uid, $this->inviteInfo['created_userid']); // $attention->addFollow($this->inviteInfo['created_userid'], $userDm->uid); } else { $codeDm = new PwInviteCodeDm(); $codeDm->setInvitedUid($userDm->uid)->setIfused(1)->setModifiedTime(Pw::getTime())->setCreateUid($userDm->uid)->setCode($this->code); //自己购买的邀请码 $inviteDs->updateCode($codeDm); } return true; }
public function run() { $page = (int) $this->getInput('page', 'get'); $perpage = 10; $args = array(); $page = $page > 1 ? $page : 1; list($start, $perpage) = Pw::page2limit($page, $perpage); $list = $this->_getPageDs()->getPageList(PwDesignPage::SYSTEM, $start, $perpage); $count = $this->_getPageDs()->countPage(PwDesignPage::SYSTEM); $sysPage = Wekit::load('design.srv.router.PwDesignRouter')->get(); foreach ($list as &$v) { if (isset($sysPage[$v['page_router']])) { list($pagename, $unique) = $sysPage[$v['page_router']]; } list($m, $c, $a, $id) = explode('|', $v['page_router']); if ($unique) { $v['url'] = WindUrlHelper::createUrl($m . '/' . $c . '/' . $a, array($unique => $v['page_unique']), '', 'pw'); } else { $v['url'] = WindUrlHelper::createUrl($m . '/' . $c . '/' . $a, array(), '', 'pw'); } $sep = strpos($v['url'], '?') === false ? '?' : '&'; $v['designurl'] = $v['url'] . $sep . 'design=1'; } $this->setOutput($list, 'list'); $this->setOutput($count, 'count'); $this->setOutput($page, 'page'); $this->setOutput($perpage, 'perpage'); $this->setOutput(ceil($count / $perpage), 'totalpage'); $this->setOutput('design/page/run', 'pageurl'); }
public function run() { list($type, $page) = $this->getInput(array('type', 'page')); $page = intval($page); $page < 1 && ($page = 1); $perpage = 20; list($start, $limit) = Pw::page2limit($page, $perpage); $noticeList = $this->_getNoticeDs()->getNotices($this->loginUser->uid, $type, $start, $limit); $noticeList = $this->_getNoticeService()->formatNoticeList($noticeList); $typeCounts = $this->_getNoticeService()->countNoticesByType($this->loginUser->uid); //类型 $typeid = intval($type); //获取未读通知数 $unreadCount = $this->_getNoticeDs()->getUnreadNoticeCount($this->loginUser->uid); $this->_readNoticeList($unreadCount, $noticeList); //count $count = intval($typeCounts[$typeid]['count']); $this->setOutput($page, 'page'); $this->setOutput($perpage, 'perpage'); $this->setOutput($count, 'count'); $this->setOutput(ceil($count / $perpage), 'totalpage'); $this->setOutput(array('type' => $typeid), 'args'); $this->setOutput($typeid, 'typeid'); $this->setOutput($typeCounts, 'typeCounts'); $this->setOutput($noticeList, 'noticeList'); // seo设置 Wind::import('SRV:seo.bo.PwSeoBo'); $seoBo = PwSeoBo::getInstance(); $lang = Wind::getComponent('i18n'); $seoBo->setCustomSeo($lang->getMessage('SEO:mess.notice.run.title'), '', ''); Wekit::setV('seo', $seoBo); }
protected function getData($field, $order, $limit, $offset) { Wind::import('SRV:tag.vo.PwTagSo'); $so = new PwTagSo(); $field['tag_ids'] && $so->setTagId(explode(' ', $field['tag_ids'])); $field['category_id'] && $so->setCategoryId($field['category_id']); $so->setIflogo($field['islogo']); $so->setIfhot(1); switch ($field['order']) { case 0: $so->orderbyCreatedTime(); break; case 1: $so->orderbyAttentionCount(); break; case 2: $so->orderbyContentCount(); break; } $list = Wekit::load('tag.PwTagSearch')->searchTag($so, $limit, $offset); if (!$list) { return array(); } foreach ($list as $k => $v) { $list[$k]['tagid'] = $v['tag_id']; $list[$k]['tag_name'] = $this->_formatTitle($v['tag_name']); $list[$k]['url'] = WindUrlHelper::createUrl('tag/index/view', array('name' => $v['tag_name']), '', 'pw'); $list[$k]['logo'] = Pw::getPath($v['tag_logo']); $list[$k]['attention_count'] = $v['attention_count']; $list[$k]['content_count'] = $v['content_count']; $list[$k]['excerpt'] = $v['excerpt']; $list[$k]['thumb_attach'] = $v['tag_logo'] ? $v['tag_logo'] : ''; } return $list; }
public function allistAction() { $page = $this->getInput('page'); $schoolId = $this->getCurrentSchoolId(); $schoolName = $this->setAreaFilterWidgetData(); $count = $this->_getCateWeekReportDs()->countCakeWeekBySchoolId($schoolId); if (0 < $count) { $totalPage = ceil($count / $this->pageNumber); $page > $totalPage && ($page = $totalPage); list($start, $limit) = Pw::page2limit($page, $this->pageNumber); if ($page <= 0) { $page = 1; } } $allCateWeekList = $this->_getCateWeekReportDs()->getCakeWeekBySchoolId($schoolId, $start, $limit); foreach ($allCateWeekList as $key => $value) { $date = substr($value['releasedate'], 0, 10); $allCateWeekList[$key]['date'] = $date; $allCateWeekList[$key]['imageurl'] = 'src/extensions/4tschool' . str_replace('\\', '/', $value['breviaryphoto']); } $this->setOutput($allCateWeekList, "allCateWeekList"); $this->setOutput($count, 'count'); $this->setOutput($page, 'page'); $this->setOutput($this->pageNumber, 'perPage'); $this->setOutput($schoolId, 'schoolId'); //SEO Information $SEOTitleKeyword = '美食文章 - ' . $schoolName . '美食外卖'; $this->setOutput($SEOTitleKeyword, 'SEOTitle'); $this->setOutput($SEOTitleKeyword, 'SEOKeyword'); }
/** * 查看投票参与人员 * * @return void */ public function memberAction() { if (!$this->loginUser->getPermission('allow_view_vote')) { $this->showError('VOTE:group.not.allow.view'); } list($pollid, $optionid) = $this->getInput(array('pollid', 'optionid'), 'get'); $poll = $this->_getPollService()->getPoll($pollid); if (!$poll) { $this->showError('VOTE:thread.not.exist'); } //$isVoted = $this->_getPollVoterDs()->isVoted($this->loginUser->uid, $pollid); //$allowView = (!$poll['isafter_view'] || $isVoted); //if (!$allowView) $this->showError('VOTE:not.allow.view'); $page = $this->getInput('page'); $page > 1 && ($this->page = $page); list($start, $limit) = Pw::page2limit($this->page, $this->perpage); $total = $this->_getPollVoterDs()->countUserByOptionid($optionid); $vote = $total ? $this->_getPollVoterDs()->getUserByOptionid($optionid, $limit, $start) : array(); $uids = $userName = array(); foreach ($vote as $value) { $uids[] = $value['uid']; } $userList = $uids ? $this->_getUserDs()->fetchUserByUid($uids) : array(); foreach ($userList as $value) { $userName[$value['uid']] = $value['username']; } $this->_getPollService()->resetOptionVotedNum($optionid); $this->setOutput(array('data' => $userName)); $this->showMessage('success'); }
public function run() { $this->_setNavType('promotionalmanage'); $choosenSchoolId = -1; $promotionalstatus = -1; if ($this->getInput('type', 'post') === 'do') { list($choosenSchoolId, $promotionalstatus) = $this->getInput(array('choosenSchoolId', 'promotionalstatus'), 'post'); } $page = $this->getInput('page'); $searchCondition = array('choosenSchoolId' => $choosenSchoolId, 'promotionalstatus' => $promotionalstatus); $count = $this->_getPromotionalmanageDs()->countPromotional($searchCondition); if (0 < $count) { $totalPage = ceil($count / $this->pageNumber); $page > $totalPage && ($page = $totalPage); list($start, $limit) = Pw::page2limit($page, $this->pageNumber); if ($page <= 0) { $page = 1; } } $shopPromotionalList = $this->_getPromotionalmanageDs()->getAllShopsPromotional($searchCondition, $start, $limit); $shopPromotionalList = array_values($shopPromotionalList); $this->getSchoolList(); $this->setOutput($shopPromotionalList, 'shopPromotionalList'); $this->setOutput($searchCondition, 'searchCondition'); $this->setOutput($count, 'count'); $this->setOutput($page, 'page'); $this->setOutput($this->pageNumber, 'perPage'); }
/** * 为了成长付出的代价 */ 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 run() { $page = (int) $this->getInput('page', 'get'); $flag = $this->getInput('flag'); $compid = (int) $this->getInput('compid'); $compname = $this->getInput('compname'); $perpage = 10; $args = array(); $page = $page > 1 ? $page : 1; list($start, $perpage) = Pw::page2limit($page, $perpage); Wind::import('SRV:design.srv.vo.PwDesignComponentSo'); $vo = new PwDesignComponentSo(); if ($flag) { $vo->setModelFlag($flag); $args['flag'] = $flag; } if ($compid > 0) { $vo->setCompid($compid); $args['compid'] = $compid; } if ($compname) { $vo->setCompname($compname); $args['compname'] = $compname; } $list = $this->_getDesignComponentDs()->searchComponent($vo, $start, $perpage); $count = $this->_getDesignComponentDs()->countComponent($vo); $models = $this->_getDesignService()->getModelList(); $this->setOutput($args, 'args'); $this->setOutput($flag, 'flag'); $this->setOutput($list, 'list'); $this->setOutput($models, 'models'); $this->setOutput($count, 'count'); $this->setOutput($page, 'page'); $this->setOutput($perpage, 'perpage'); }
public function run() { $page = $this->getInput('page'); $this->page = $page < 1 ? 1 : intval($page); list($start, $limit) = Pw::page2limit($this->page, $this->perpage); $timestamp = PW::getTime(); $startTime = $timestamp - 7 * 86400; $endTime = $timestamp; $total = $this->_getPollDs()->countPollByTime($startTime, $endTime); $pollInfo = array(); if ($total) { Wind::import('SRV:poll.srv.dataSource.PwFetchPollByTime'); $pollDisplay = new PwPollDisplay(new PwFetchPollByTime($startTime, $endTime, $limit, $start, array('voter_num' => 0, 'created_time' => 0))); $pollInfo = $this->_buildPoll($pollDisplay->gather()); } $latestPollDisplay = new PwPollDisplay(new PwFetchPollByOrder(10, 0, array('created_time' => '0'))); $latestPoll = $latestPollDisplay->gather(); $this->setOutput($total, 'total'); $this->setOutput($pollInfo, 'pollInfo'); $this->setOutput($latestPoll, 'latestPoll'); $this->setOutput($this->page, 'page'); $this->setOutput($this->perpage, 'perpage'); $this->setOutput(array('allowview' => $this->loginUser->getPermission('allow_view_vote'), 'allowvote' => $this->loginUser->getPermission('allow_participate_vote')), 'pollGroup'); // seo设置 Wind::import('SRV:seo.bo.PwSeoBo'); $seoBo = PwSeoBo::getInstance(); $lang = Wind::getComponent('i18n'); if ($this->page > 1) { $seoBo->setCustomSeo($lang->getMessage('SEO:vote.hot.run.page.title', array($this->page)), $lang->getMessage('vote.hot.run.description'), ''); } else { $seoBo->setCustomSeo($lang->getMessage('SEO:vote.hot.run.title'), '', $lang->getMessage('SEO:vote.hot.run.description')); } Wekit::setV('seo', $seoBo); }
public function run() { $this->_setNavType('cateweekreport'); $allSchool = $this->_get4TSchoolDS()->getOpenedSchools(); $allSchool = array_values($allSchool); $cateTypeClass = $this->setCateTypeCommonClass(); $this->setOutput($allSchool, 'allSchool'); $this->setOutput($cateTypeClass, 'cateTypeClass'); $choosenSchoolId = -1; $typename = -1; $audited = -1; $released = -1; if ($this->getInput('type', 'post') === 'do') { list($choosenSchoolId, $typename, $audited, $released) = $this->getInput(array('choosenSchoolId', 'typename', 'audited', 'released'), 'post'); } $page = $this->getInput('page'); $searchCondition = array('choosenSchoolId' => $choosenSchoolId, 'typename' => $typename, 'audited' => $audited, 'released' => $released); $count = $this->_getCateWeekReportDs()->countCateWeek($searchCondition); if (0 < $count) { $totalPage = ceil($count / $this->pageNumber); $page > $totalPage && ($page = $totalPage); list($start, $limit) = Pw::page2limit($page, $this->pageNumber); if ($page <= 0) { $page = 1; } } $cateWeekReportList = $this->_getCateWeekReportDs()->getSearchCateWeekData($searchCondition, $start, $limit); $cateWeekReportList = array_values($cateWeekReportList); $this->setOutput($searchCondition, 'searchCondition'); $this->setOutput($cateWeekReportList, 'cateWeekReportList'); $this->setOutput($count, 'count'); $this->setOutput($page, 'page'); $this->setOutput($this->pageNumber, 'perPage'); }
public function run() { list($page, $perpage, $username, $starttime, $endtime, $keyword) = $this->getInput(array('page', 'perpage', 'username', 'starttime', 'endtime', 'keyword')); $starttime && ($pwStartTime = Pw::str2time($starttime)); $endtime && ($pwEndTime = Pw::str2time($endtime)); $page = $page ? $page : 1; $perpage = $perpage ? $perpage : $this->perpage; list($start, $limit) = Pw::page2limit($page, $perpage); if ($username) { $userinfo = $this->_getUserDs()->getUserByName($username); $fromUid = $userinfo['uid'] ? $userinfo['uid'] : 0; } Wind::import('WINDID:service.message.srv.vo.WindidMessageSo'); $vo = new WindidMessageSo(); $endtime && $vo->setEndTime($endtime); $fromUid && $vo->setFromUid($fromUid); $keyword && $vo->setKeyword($keyword); $starttime && $vo->setStarttime($starttime); $messages = $this->_getMessageDs()->searchMessage($vo, $start, $limit); $count = $this->_getMessageDs()->countMessage($vo); foreach ($messages as $k => $v) { $uids[] = $v['from_uid']; } $users = $this->_getUserDs()->fetchUserByUid($uids); foreach ($messages as $k => $v) { $messages[$k]['username'] = $users[$v['from_uid']]['username']; } $this->setOutput($count, 'count'); $this->setOutput($page, 'page'); $this->setOutput($perpage, 'perpage'); $this->setOutput(array('keyword' => $keyword, 'username' => $username, 'starttime' => $starttime, 'endtime' => $endtime), 'args'); $this->setOutput($messages, 'messages'); }
/** * 初始化安装程序 */ public function __construct() { $this->_appId = 'L000' . time() . WindUtility::generateRandStr(4); $this->_config = @(include Wind::getRealPath(self::CONF_PATH, true)); $this->tmpPath = Wind::getRealPath($this->getConfig('tmp_dir') . '.' . Pw::getTime(), false); $this->tmpInstallLog = Wind::getRealPath($this->getConfig('log_dir'), false); }
private function _buildSignKey($list) { $_username = array(); $_tids = array(); foreach ($list as $k => $v) { $_tids[] = $v['lastpost_tid']; } $thread = $this->_getThread($_tids); foreach ($list as $k => $v) { $list[$k]['name'] = $this->_filterForumHtml($v['name']); if ($v['type'] == 'category') { $list[$k]['forum_url'] = WindUrlHelper::createUrl('bbs/cate/run', array('fid' => $v['fid']), '', 'pw'); } else { $list[$k]['forum_url'] = WindUrlHelper::createUrl('bbs/thread/run', array('fid' => $v['fid']), '', 'pw'); } $list[$k]['descrip'] = $this->_formatDes($v['descrip']); $list[$k]['logo'] = $v['logo'] ? Pw::getPath($v['logo']) : ''; $lastthread = $thread[$v['lastpost_tid']]; $list[$k]['lastpost_time'] = $this->_formatTime($lastthread['lastpost_time']); $list[$k]['lastpost_smallavatar'] = $lastthread['lastpost_userid'] ? Pw::getAvatar($lastthread['lastpost_userid'], 'small') : ''; $list[$k]['lastpost_middleavatar'] = $lastthread['lastpost_userid'] ? Pw::getAvatar($lastthread['lastpost_userid'], 'middle') : ''; $list[$k]['lastpost_userid'] = $lastthread['lastpost_userid']; $list[$k]['lastpost_username'] = $lastthread['lastpost_username']; $list[$k]['lastpost_space'] = $lastthread['lastpost_userid'] ? WindUrlHelper::createUrl('space/index/run', array('uid' => $lastthread['lastpost_userid']), '', 'pw') : ''; $list[$k]['lastthread_space'] = $lastthread['created_userid'] ? WindUrlHelper::createUrl('space/index/run', array('uid' => $lastthread['created_userid']), '', 'pw') : ''; $list[$k]['lastthread_smallavatar'] = $lastthread['created_userid'] ? Pw::getAvatar($lastthread['created_userid'], 'small') : ''; $list[$k]['lastthread_middleavatar'] = $lastthread['created_userid'] ? Pw::getAvatar($lastthread['created_userid'], 'middle') : ''; $list[$k]['lastthread_username'] = $lastthread['created_username']; $list[$k]['lastthread_time'] = $this->_formatTime($lastthread['created_time']); $list[$k]['lastthread'] = $this->_formatTitle($lastthread['subject']); } return $list; }
/** * 加入版块 * * @param int $uid * @param int $fid * @param int $time * @return bool */ public function join($uid, $fid, $time = 0) { if (!$uid || !$fid) { return false; } return $this->_getDao()->add(array('uid' => $uid, 'fid' => $fid, 'join_time' => $time ? $time : Pw::getTime())); }
public function run() { $this->_setNavType('shopstatusrecord'); if ($this->getInput('type', 'post') === 'do') { list($shopId) = $this->getInput(array('shopId'), 'post'); } $shopId = $this->getInput("shopId"); $this->setOutput($shopId, 'shopId'); $page = $this->getInput('page'); $searchCondition = array('shopId' => $shopId); $count = $this->_getShopstatusrecordDs()->countAllShopStatusRecord($searchCondition); if (0 < $count) { $totalPage = ceil($count / $this->pageNumber); $page > $totalPage && ($page = $totalPage); list($start, $limit) = Pw::page2limit($page, $this->pageNumber); if ($page <= 0) { $page = 1; } } $shopStatusRecordList = $this->_getShopstatusrecordDs()->getAllShopStatusRecord($searchCondition, $start, $limit); $shopStatusRecordList = array_values($shopStatusRecordList); $shopId = $this->getInput('shopId'); $args['shopId'] = $shopId; $this->setOutput($shopStatusRecordList, 'shopStatusRecordList'); $this->setOutput($searchCondition, 'searchCondition'); $this->setOutput($count, 'count'); $this->setOutput($page, 'page'); $this->setOutput($this->pageNumber, 'perPage'); $this->setOutput($args, 'args'); }
/** * 发送动作页面,一般是ajax提交的数据 */ public function sendAction() { $act = $this->getInput('act', 'post'); $uid = $this->getInput('uid', 'post'); if (!$act) { $this->showError('请选择动作'); } if (!$uid) { $this->showError('请选择用户'); } !is_array($uid) && ($uid = array($uid)); Wind::import('EXT:dongta.service.dm.App_Dongta_Dm'); $service = Wekit::load('EXT:dongta.service.App_Dongta'); $users = Wekit::load('user.PwUser')->fetchUserByUid($uid); $actMap = (include Wind::getRealPath('EXT:dongta.conf.dongta.php', true)); $title = '<a href="' . WindUrlHelper::createUrl('space/index/run', array('uid' => $this->loginUser->uid)) . '">' . $this->loginUser->username . '</a> ' . str_replace('{Ta}', '你', $actMap[$act][1]); $content = $title . ' <br>[来自应用 <a href="' . WindUrlHelper::createUrl('app/dongta/index/run') . '">动他一下</a>]'; foreach ($users as $key => $value) { $dm = new App_Dongta_Dm(); $dm->setAct($act)->setTouid($value['uid'])->setCreatedUser($this->loginUser->uid, $this->loginUser->username)->setCreatedTime(Pw::getTime()); $service->add($dm); Wekit::load('message.srv.PwNoticeService')->sendNotice($value['uid'], 'app', 0, array('title' => $title, 'content' => $content)); } $this->showMessage('operate.success'); }
public function check($postDm) { $data = $postDm->getData(); $content = Pw::substrs(Pw::stripWindCode($data['content']), 30) == $data['subject'] ? $data['content'] : $data['subject'] . $data['content']; $banedStrLen = strlen($data['subject']); $wordFilter = Wekit::load('SRV:word.srv.PwWordFilter'); list($type, $words, $isTip) = $wordFilter->filterWord($content); if (!$type) { return true; } $words = array_unique($words); foreach ($words as $k => $v) { if ($k < $banedStrLen) { return new PwError('WORD:content.error.tip', array('{wordstr}' => implode(',', $words))); } } switch ($type) { case 1: return new PwError('WORD:content.error.tip', array('{wordstr}' => implode(',', $words))); case 2: $this->_isVerified = 1; if ($this->_confirm) { return true; } case 3: $this->_word = 1; default: return true; } return true; }
public function run() { $this->setCurrentLeft('avatar'); $isAvatarBan = false; if (Pw::getstatus($this->loginUser->info['status'], PwUser::STATUS_BAN_AVATAR)) { Wind::import('SRV:user.srv.PwBanBp'); $banBp = new PwBanBp($this->loginUser->uid); if (false === $banBp->checkIfBanAvatar()) { $banBp->recoveryBanAvatarError(); } elseif ($banBp->endDateTimeBanAvatar()) { $this->loginUser->info['status'] = $banBp->callEndDateTimeBanAvatar(); } else { $isAvatarBan = true; $info = $banBp->getBanAvatarInfo(); if ($info['created_userid'] == 0) { $info['operator'] = 'system'; } else { $operatorInfo = Wekit::load('user.PwUser')->getUserByUid($info['created_userid']); $info['operator'] = $operatorInfo['username']; } $this->setOutput($info, 'banInfo'); } } $windidApi = $this->_getWindid(); $this->setOutput($windidApi->showFlash($this->loginUser->uid), 'avatarFlash'); $this->setOutput($windidApi->showFlash($this->loginUser->uid, 0), 'avatarArr'); $this->setOutput($isAvatarBan, 'isAvatarBan'); $this->setOutput($this->getInput('type'), 'type'); $this->setLayout(''); $this->setTemplate('profile_avatar'); // seo设置 Wind::import('SRV:seo.bo.PwSeoBo'); $lang = Wind::getComponent('i18n'); PwSeoBo::setCustomSeo($lang->getMessage('SEO:profile.avatar.run.title'), '', ''); }
/** * 做任务 * * 1、查询当前用户是否有正在进行的任务,没有则不执行 * 2、初始化 * 3、获得用户进行的任务详细信息 * 4、过滤任务中已经过期和关闭的任务,这些任务都不能再被继续完成 * 5、执行任务判断:逐个判断注册过来的任务-将任务的条件和已经完成的step传递给任务:任务判断condition和step,如果step还没有完成则更新该step * * @param string $type 任务类别 后台设置中的“会员”/"论坛“类, * @param string $child 任务类别中的小类, 比如”会员“->'求粉丝' * @return boolean */ public function doTask($type, $child) { if (!$this->doTask) { return false; } $myTasks = $this->_getTaskUserDs()->getMyTaskByStatus($this->uid, 1, $this->num, 0); if (!$myTasks) { return true; } $taskList = $this->_getTaskDs()->gets(array_keys($myTasks)); if (!$taskList) { return true; } $time = Pw::getTime(); foreach ($taskList as $id => $task) { if ($task['end_time'] && $task['end_time'] < $time || $task['is_open'] == 0) { continue; } $conditions = unserialize($task['conditions']); if ($conditions['type'] != $type || $conditions['child'] != $child) { continue; } $myStatus = $myTasks[$id]; $step = unserialize($myStatus['step']); if (!is_array($step)) { $step = $myStatus['step']; } $this->_doTask($task, $conditions, $step); } return true; }
public function updateOvertime($tid) { $overtimes = $this->_getOvertimeDs()->getOvertimeByTid($tid); $deltop = 0; $dm = new PwTopicDm($tid); if ($overtimes) { $timestamp = Pw::getTime(); $newOvertime = 0; $ids = array(); foreach ($overtimes as $v) { if ($v['overtime'] > $timestamp) { (!$newOvertime || $newOvertime > $v['overtime']) && ($newOvertime = $v['overtime']); } else { switch ($v['m_type']) { case 'topped': $dm->setTopped(0); $deltop = 1; break; case 'highlight': $dm->setHighlight(''); break; } $ids[] = $v['id']; } } $ids && $this->_getOvertimeDs()->batchDelete($ids); $dm->setOvertime($newOvertime); } else { $dm->setOvertime(0); } $this->_getThreadDs()->updateThread($dm); if ($deltop) { Wekit::load('forum.PwSpecialSort')->deleteSpecialSortByTid($tid); } }
/** * 我关注的人发起的投票 * */ public function createAction() { $page = $this->getInput('page'); $page = $page < 1 ? 1 : intval($page); list($start, $limit) = Pw::page2limit($page, $this->perpage); $followUids = $this->getFollowUids($this->loginUser->uid); $total = $this->_getPwPollDs()->countPollByUids($followUids); $pollInfo = array(); if ($total) { Wind::import('SRV:poll.srv.dataSource.PwFetchPollByUids'); $pollDisplay = new PwPollDisplay(new PwFetchPollByUids($followUids, $limit, $start)); $pollInfo = $this->_buildPoll($pollDisplay->gather()); } $latestPollDisplay = new PwPollDisplay(new PwFetchPollByOrder(10, 0, array('created_time' => '0'))); $latestPoll = $latestPollDisplay->gather(); $this->setOutput($total, 'total'); $this->setOutput($pollInfo, 'pollInfo'); $this->setOutput($latestPoll, 'latestPoll'); $this->setOutput($page, 'page'); $this->setOutput($this->perpage, 'perpage'); $this->setOutput(array('allowview' => $this->loginUser->getPermission('allow_view_vote'), 'allowvote' => $this->loginUser->getPermission('allow_participate_vote')), 'pollGroup'); if (!$total) { $num = 20; $uids = $this->_getRecommendService()->getRecommendAttention($this->loginUser->uid, $num); $recommend = $this->_getRecommendService()->buildUserInfo($this->loginUser->uid, $uids, $num); $this->setOutput($recommend, 'recommend'); } }
/** * 回复列表 */ public function replyAction() { list($page, $perpage) = $this->getInput(array('page', 'perpage')); $page = $page ? $page : 1; $perpage = $perpage ? $perpage : $this->perpage; list($start, $limit) = Pw::page2limit($page, $perpage); $count = $this->_getThreadExpandDs()->countDisabledPostByUid($this->loginUser->uid); if ($count) { $tmpPosts = $this->_getThreadExpandDs()->getDisabledPostByUid($this->loginUser->uid, $limit, $start); $posts = $tids = array(); foreach ($tmpPosts as $v) { $tids[] = $v['tid']; } $threads = $this->_getThreadDs()->fetchThread($tids); foreach ($tmpPosts as $v) { $v['threadSubject'] = Pw::substrs($threads[$v['tid']]['subject'], 30); $v['content'] = Pw::substrs($v['content'], 30); $v['created_time'] = PW::time2str($v['created_time'], 'auto'); $posts[] = $v; } } $this->setOutput($count, 'count'); $this->setOutput($page, 'page'); $this->setOutput($perpage, 'perpage'); $this->setOutput($posts, 'posts'); // seo设置 Wind::import('SRV:seo.bo.PwSeoBo'); $seoBo = PwSeoBo::getInstance(); $lang = Wind::getComponent('i18n'); $seoBo->setCustomSeo($lang->getMessage('SEO:bbs.article.reply.title'), '', ''); Wekit::setV('seo', $seoBo); }
public function doSaveInformationAction() { list($openid, $id, $key) = $this->getInput(array('openid', 'pid', 'key')); $this->setOutput($openid, 'openId'); if (!isset($_SESSION)) { @session_start(); } $_SESSION['exchangekey'] = $key; //user validation $userMoney = $this->getUserMoneyByOpenId($openid); if (empty($userMoney) == false && isset($_SESSION['exchangekey'])) { $prize = $this->_getCommonDs()->getPrizeById($id); //check user money if (empty($prize) == false && $prize['dmoney'] <= $userMoney['money']) { $deductDMoeny = 0 - $prize['dmoney']; $isDeduct = $this->_getMyMoneyDS()->updateMyMoney($userMoney['userid'], $deductDMoeny, 0, $prize['name']); if ($isDeduct > 0) { unset($_SESSION['exchangekey']); $this->setOutput($isDeduct, "isDeduct"); } $myMoney = $this->_getMyMoneyDS()->getMyMoney($userMoney['userid']); $this->setOutput($myMoney[0], 'myMoney'); $this->setOutput($prize, "prize"); list($pid, $receiveContactor, $receivePhone, $receiveQQ, $receiveAddress) = $this->getInput(array('pid', 'receiveContactor', 'receivePhone', 'receiveQQ', 'receiveAddress')); $dm = new App_Giftexchange_Dm(); $dm->setUserId($userMoney['userid'])->setContact($receiveContactor)->setPhoneNumber($receivePhone)->setqq($receiveQQ)->setAddress($receiveAddress)->setProductId($prize['id'])->setCreateTime(Pw::getTime()); $saveInfo = $this->_getGiftexchangeDS()->add($dm); $this->setOutput($saveInfo, 'saveInfo'); } } else { $url = WindUrlHelper::createUrl('app/4tmobile/mobilemymoney/run', array('openid' => $openid)); $this->forwardRedirect($url); } }