本文整理汇总了PHP中Pw类的典型用法代码示例。如果您正苦于以下问题:PHP Pw类的具体用法?PHP Pw怎么用?PHP Pw使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pw类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editAction
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');
}
}
示例2: __construct
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);
}
示例3: getResponseInfo
/**
* 获取淘宝响应信息 如果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;
}
示例4: _getActiveUser
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);
}
示例5: afterAction
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;
}
}
示例6: sendNotice
/**
* 发送通知
* @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;
}
示例7: afterRegister
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;
}
示例8: run
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');
}
示例9: run
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);
}
示例10: getData
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;
}
示例11: allistAction
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');
}
示例12: memberAction
/**
* 查看投票参与人员
*
* @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');
}
示例13: run
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');
}
示例14: doPay
/**
* 为了成长付出的代价
*/
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;
}
示例15: run
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');
}