本文整理汇总了PHP中Pw::getTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Pw::getTime方法的具体用法?PHP Pw::getTime怎么用?PHP Pw::getTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pw
的用法示例。
在下文中一共展示了Pw::getTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: bulidThread
public function bulidThread($thread)
{
if ($thread['issort'] && $thread['topped']) {
$thread['icon'] = 'headtopic_' . $thread['topped'];
} elseif ($thread['digest']) {
$thread['icon'] = 'digest';
} elseif (Pw::getstatus($thread['tpcstatus'], PwThread::STATUS_LOCKED)) {
$thread['icon'] = 'lock';
} elseif ($thread['special'] && isset($this->specialIcon[$thread['special']])) {
$thread['icon'] = $this->specialIcon[$thread['special']];
} elseif ($thread['replies'] > $this->_iconHot) {
$thread['icon'] = 'topichot';
} elseif (Pw::getTime() - $thread['created_time'] < $this->_iconNew) {
$thread['icon'] = 'topicnew';
} else {
$thread['icon'] = 'topic';
}
if ($thread['overtime'] && $thread['overtime'] < Pw::getTime()) {
$overtimeService = Wekit::load("SRV:forum.srv.PwOvertimeService");
$overtimeService->updateOvertime($thread['tid']);
}
if ($thread['highlight']) {
$highlight = Wekit::load("Lib:utility.PwHighlight");
$thread['highlight_style'] = $highlight->getStyle($thread['highlight']);
}
if ($thread['inspect']) {
$thread['inspect'] = explode("\t", $thread['inspect']);
}
if ($thread['ifshield']) {
$thread['highlight_style'] = 'text-decoration: line-through';
$thread['subject'] = '此帖已被屏蔽';
}
return $this->runWithFilters('bulidThread', $thread);
}
示例3: updateOvertime
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);
}
}
示例4: signToVisitor
/**
* 更新我的脚印
*
* @param int $spaceUid
* @param int $visitUid
*/
public function signToVisitor($spaceUid, $visitUid)
{
if ($spaceUid < 1 || $visitUid < 1) {
return false;
}
if ($spaceUid == $visitUid) {
return false;
}
$time = Pw::getTime();
$space = $this->_getSpaceDs()->getSpace($visitUid);
$tovisitors = unserialize($space['tovisitors']);
$tovisitors = is_array($tovisitors) ? $tovisitors : array();
if (array_key_exists($spaceUid, $tovisitors)) {
$keys = array_keys($tovisitors);
if (array_shift($keys) == $spaceUid) {
return false;
}
//如果是第一个不需要更新
unset($tovisitors[$spaceUid]);
}
$tovisitors = array($spaceUid => $time) + $tovisitors;
if (count($tovisitors) > 20) {
$tovisitors = array_slice($tovisitors, 0, 20, true);
}
Wekit::load('space.dm.PwSpaceDm');
$dm = new PwSpaceDm($visitUid);
$dm->setTovisitors($tovisitors);
return $this->_getSpaceDs()->updateInfo($dm);
}
示例5: sendAction
/**
* 发送动作页面,一般是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');
}
示例6: 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;
}
示例7: doTask
/**
* 做任务
*
* 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;
}
示例8: 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;
}
示例9: __construct
/**
* 初始化安装程序
*/
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);
}
示例10: _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);
}
示例11: gainReward
public function gainReward($uid, $reward, $taskname)
{
$userBo = Wekit::getLoginUser();
list($id) = explode('-', $reward['value'], 2);
$time = abs(intval($reward['time']));
/* @var $userBelongDs PwUserBelong */
$userBelongDs = Wekit::load('user.PwUserBelong');
$info = $userBelongDs->getUserBelongs($uid);
$_groups = array();
foreach ($info as $_item) {
$_groups[$_item['gid']] = $_item['endtime'];
}
$_groups[$id] = $time ? Pw::getTime() + 24 * 3600 * $time : 0;
/* @var $userService PwUserService */
$userService = Wekit::load('user.srv.PwUserService');
list($gid, $groups) = $userService->caculateUserGroupid($userBo->gid, $_groups);
$dm = new PwUserInfoDm($uid);
$dm->setGroupid($gid)->setGroups($groups);
/* @var $userDs PwUser */
$userDs = Wekit::load('user.PwUser');
$result = $userDs->editUser($dm, PwUser::FETCH_MAIN);
if ($result instanceof PwError) {
return $result;
}
return true;
}
示例12: join
/**
* 加入版块
*
* @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()));
}
示例13: 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');
}
}
示例14: doSaveInformationAction
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);
}
}
示例15: isAllowVote
public function isAllowVote()
{
if ((!$this->info['poll']['expired_time'] || $this->info['poll']['expired_time'] && $this->info['poll']['expired_time'] > Pw::getTime()) && $this->user->getPermission('allow_participate_vote')) {
return true;
}
return false;
}