本文整理汇总了PHP中Pw::time2str方法的典型用法代码示例。如果您正苦于以下问题:PHP Pw::time2str方法的具体用法?PHP Pw::time2str怎么用?PHP Pw::time2str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pw
的用法示例。
在下文中一共展示了Pw::time2str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _formatTime
/**
* 格式化时间
* @param int $time
*/
protected final function _formatTime($time)
{
if (!$time) {
return '';
}
return $this->_viewSet['timefmt'] ? Pw::time2str($time, $this->_viewSet['timefmt']) : Pw::time2str($time, 'auto');
}
示例2: sendAutoTask
/**
* 根据用户的行为数据分析并发送自动任务
*
* @param array $behavior
* @return boolean
*/
public function sendAutoTask($behavior)
{
if (!Wekit::C('site', 'task.isOpen')) {
return false;
}
$whitBehavior = array('login_days', 'post_days', 'thread_count');
if (!in_array($behavior['behavior'], $whitBehavior)) {
return false;
}
$tody = Pw::time2str(Pw::getTime(), 'Y-m-d');
$isSend = false;
switch ($behavior['behavior']) {
case 'login_days':
$isSend = $behavior['number'] % 3 == 0;
break;
case 'post_days':
$is_tody = $tody == Pw::time2str($behavior['extend_info'], 'Y-m-d');
$isSend = $is_tody && $behavior['number'] % 2 == 0;
break;
case 'thread_count':
$isSend = $behavior['number'] == 1 || $behavior['number'] % 50 == 0;
break;
}
if (!$isSend) {
return false;
}
Wind::import('SRV:task.srv.PwTaskApply');
$userTask = new PwTaskApply($behavior['uid']);
$userTask->autoApplies($this->getAutoApplicableTaskList($behavior['uid'], 1));
return true;
}
示例3: getMyAnnounceBySchoolIdAction
public function getMyAnnounceBySchoolIdAction()
{
$schoolid = $this->getInput('schoolid', 'get');
if (empty($schoolid)) {
$this->output(-1);
return;
}
$result = $this->_getPwAnnounceDs()->getAnnounceBySchoolId($schoolid, Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')), 9, 0);
$this->output($result);
}
示例4: checkEducationYear
/**
* 检查教育时间是否非法
*
* @param int $year
* @return int
*/
public static function checkEducationYear($year)
{
$endYear = Pw::time2str(Pw::getTime(), 'Y');
if ($year > $endYear) {
$year = $endYear;
} elseif ($year < $endYear - 100) {
$year = $endYear - 100;
}
return $year;
}
示例5: getAnnounceForBbsScroll
/**
* 通过公告记录组装前台显示效果
* 帖子列表滚动展示标题用
*
* @return array
*/
public function getAnnounceForBbsScroll()
{
$announces = array();
$announceInfos = $this->_getPwAnnounceDs()->getAnnounceByTimeOrderByVieworder(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')), 9, 0);
foreach ($announceInfos as $value) {
$announces[$value['aid']] = $value;
$announces[$value['aid']]['start_date'] = Pw::time2str($value['start_date'], 'Y-m-d');
if (Pw::strlen($value['subject']) > 18) {
$announces[$value['aid']]['subject'] = Pw::substrs($value['subject'], 18);
}
}
return $announces;
}
示例6: myDraftsAction
/**
* 发帖页我的草稿
*
* @return void
*/
public function myDraftsAction()
{
$drafts = $this->_getDraftDs()->getByUid($this->loginUser->uid, $this->maxNum);
$data = array();
foreach ($drafts as $v) {
$_tmp['id'] = $v['id'];
$_tmp['title'] = $v['title'];
$_tmp['content'] = $v['content'];
$_tmp['created_time'] = Pw::time2str($v['created_time'], 'auto');
$data[] = $_tmp;
}
echo Pw::jsonEncode(array('state' => 'success', 'data' => $data));
exit;
}
示例7: run
public function run()
{
$aid = $this->getInput('aid', 'get');
$page = $this->getInput('page');
$this->page = $page < 1 ? 1 : intval($page);
list($start, $limit) = Pw::page2limit($this->page, $this->perpage);
$total = $this->_getPwAnnounceDs()->countAnnounceByTime(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')));
$list = $total ? $this->_getPwAnnounceService()->formatAnnouncesUsername($this->_getPwAnnounceDs()->getAnnounceByTimeOrderByVieworder(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')), $limit, $start)) : array();
$this->setOutput($total, 'total');
$this->setOutput($list, 'list');
$this->setOutput($aid, 'aid');
$this->setOutput($this->page, 'page');
$this->setOutput($this->perpage, 'perpage');
}
示例8: run
/**
* 空间首页列出审核过的贴子
*
* @access public
* @return void
*/
public function run()
{
$spaceUid = $this->getInput('uid', 'get');
$page = $this->getInput('page', 'get');
//
$space = new PwSpaceModel($spaceUid);
$space->setTome($spaceUid, $this->uid);
//
$tids = $this->_getPwNativeThreadDs()->getThreadListByUid($spaceUid, $page, $this->uid == $spaceUid ? 'my' : 'space');
$myThreadList = $this->_getPwNativeThreadDs()->getThreadContent($tids);
//pids 默认是0;
$attList = $this->_getPwNativeThreadDs()->getThreadAttach($tids, array(0));
$threadList = $this->_getPwNativeThreadDs()->gather($myThreadList, $attList);
//
$prev_val = '';
$_tids = $_threadList = array();
foreach ($threadList as $k => $v) {
$_created_time = Pw::time2str($v['created_time'], 'auto');
list($_key, $_time) = explode(' ', $_created_time);
if (!preg_match('/-/', $_created_time)) {
$_key = '今天';
}
if ($prev_val != $_key) {
$threadList[$k]['barName'] = $_key;
$prev_val = $_key;
} else {
$threadList[$k]['barName'] = '';
}
$_threadList[] = $threadList[$k];
$_tids[] = $v['tid'];
}
//获得登陆用户是否喜欢过帖子|回复
$threadLikeData = array();
if ($this->uid && $_tids) {
$_threadLikeData = $this->_getLikeReplyService()->getAllLikeUserids(PwLikeContent::THREAD, $_tids);
foreach ($_tids as $v) {
if (isset($_threadLikeData[$v])) {
$threadLikeData[$v] = array_search($this->uid, $_threadLikeData[$v]) === false ? 0 : 1;
}
}
}
//帖子发布来源
$threadFromtypeList = $this->_getThreadsPlaceService()->getThreadFormTypeByTids($_tids);
$location_text = Wekit::loadDao('native.dao.PwNativeThreadsDao')->getCityByUid($spaceUid);
$location_text || ($location_text = Wekit::loadDao('native.dao.PwPostsPlaceDao')->getCityByUid($spaceUid));
$location_text || ($location_text = $space->spaceUser['location_text']);
$data = array('uid' => $this->uid, 'userInfo' => isset($space->spaceUser) ? array('username' => $space->spaceUser['username'], 'gender' => $space->spaceUser['gender'], 'location_text' => $location_text, 'avatar' => Pw::getAvatar($spaceUid), 'attentionNum' => $space->spaceUser['follows'], 'fansNum' => $space->spaceUser['fans']) : array('username' => '', 'gender' => 0, 'location_text' => '', 'avatar' => '', 'attentionNum' => 0, 'fansNum' => 0), 'tome' => isset($space->tome) ? $space->tome : 0, 'pageCount' => $this->_getPwNativeThreadDs()->getThreadPageCount(), 'threadList' => $_threadList, 'threadFromtypeList' => $threadFromtypeList);
$this->setOutput($data, 'data');
$this->showMessage('success');
}
示例9: getUrl
public function getUrl(PwPayVo $vo)
{
strlen($this->bill) == 11 && ($this->bill .= '01');
$param = array('inputCharset' => $this->charset == 'gbk' ? 2 : 1, 'pageUrl' => $this->baseurl, 'version' => 'v2.0', 'language' => 1, 'signType' => 1, 'merchantAcctId' => $this->bill, 'payerName' => 'admin', 'orderId' => $vo->getOrderNo(), 'orderAmount' => $vo->getFee() * 100, 'orderTime' => Pw::time2str(Pw::getTime(), 'YmdHis'), 'productName' => $vo->getBody(), 'productNum' => 1, 'payType' => '00', 'redoFlag' => 1);
$url = $this->bill_url;
$arg = '';
foreach ($param as $key => $value) {
$value = trim($value);
if (strlen($value) > 0) {
$arg .= "{$key}={$value}&";
$url .= "{$key}=" . urlencode($value) . "&";
//$inputMsg .= "<input type=\"hidden\" name=\"$key\" value=\"$value\" />";
}
}
$url .= 'signMsg=' . strtoupper(md5($arg . 'key=' . $this->bill_key));
return $url;
}
示例10: editAction
/**
* 编辑用户信息
*
* @return void
*/
public function editAction()
{
$uid = (int) $this->getInput('uid', 'get');
$user = Windid::load('user.WindidUser');
$_info = $user->getUserByUid($uid, WindidUser::FETCH_ALL);
if (!$_info) {
$this->showError('WINDID:fail');
}
$tYear = Pw::time2str(Pw::getTime(), 'Y');
$birMin = $tYear - 100;
$birMax = $tYear + 100;
$this->setOutput($this->_buildArea($_info['location']), 'location');
$this->setOutput($this->_buildArea($_info['hometown']), 'hometown');
$this->setOutput($birMin . '-01-01', 'bmin');
$this->setOutput($birMax . '-12-31', 'bmax');
$this->setOutput($_info, 'info');
$this->setOutput($_info['online'] / 3600, 'online');
}
示例11: welcome
public function welcome(PwUserBo $userBo, $ip)
{
if (!Wekit::C('site', 'task.isOpen')) {
return true;
}
/* @var $behaviorDs PwUserBehavior */
$behaviorDs = Wekit::load('user.PwUserBehavior');
$info = $behaviorDs->getBehavior($userBo->uid, 'login_days');
$time = $info['extend_info'] ? $info['extend_info'] : 0;
if (!$time || Pw::time2str($time, 'Y-m-d') < Pw::time2str(Pw::getTime(), 'Y-m-d')) {
/* @var $taskService PwTaskService */
$taskService = Wekit::load('SRV:task.srv.PwTaskService');
$userTask = new PwTaskApply($userBo->uid);
$autoTaskIds = $taskService->getAutoApplicableTaskList($userBo->uid, 5);
$userTask->autoApplies($autoTaskIds);
}
return true;
}
示例12: run
public function run()
{
$aid = $this->getInput('id', 'get');
$this->setOutput($aid, 'id');
$pagetag = $this->getInput('pagetag', 'get');
$this->setOutput($pagetag, 'pagetag');
$schoolid = $this->getCurrentSchoolId();
if (empty($pagetag)) {
$info = $this->_getPwAnnounceDs()->getAnnounce($aid);
} else {
$info = $this->_getPwAnnounceDs()->getAnnouncePageTurn($schoolid, $aid, $pagetag);
}
$currentime = time();
$this->setOutput($currentime, 'currentime');
$this->setOutput(Pw::time2str($info['start_date'], 'Y-m-d'), 'startdate');
$this->setOutput(Pw::time2str($info['end_date'], 'Y-m-d'), 'enddate');
$this->setOutput($info, 'schoolAnnounceInfo');
}
示例13: clearAction
/**
* 清除三个月前操作
*/
public function clearAction()
{
if (!$this->isFounder($this->adminUser->getUsername())) {
$this->showError('fail');
}
$step = $this->getInput('step', 'post');
if ($step != 2) {
$this->showError('fail');
}
list($year, $month) = explode('-', Pw::time2str(Pw::getTime(), 'Y-n'));
if ($month > 3) {
$month = $month - 3;
} else {
$month = 9 - $month;
$year = $year - 1;
}
Wekit::load('log.PwLoginLog')->clearLogBeforeDatetime(Pw::str2time($year . '-' . $month . '-1'));
$this->showMessage('success');
}
示例14: run
public function run()
{
if ($this->regist['type'] != 2) {
$this->forwardRedirect(WindUrlHelper::createUrl('my/invite/inviteFriend'));
// $this->showError('USER:invite.close');
}
Wind::import('SRV:credit.bo.PwCreditBo');
/* @var $pwCreditBo PwCreditBo */
$pwCreditBo = PwCreditBo::getInstance();
$startTime = Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d'));
$readyBuy = $this->_getDs()->countByUidAndTime($this->loginUser->uid, $startTime);
$gidLimit = abs(ceil($this->loginUser->getPermission('invite_limit_24h')));
$price = abs(ceil($this->loginUser->getPermission('invite_buy_credit_num')));
$_tmpId = $this->regist['invite.credit.type'];
$_credit = array('id' => $_tmpId, 'name' => $pwCreditBo->cType[$_tmpId], 'unit' => $pwCreditBo->cUnit[$_tmpId]);
$this->setOutput($_credit, 'creditWithBuy');
//用于购买的积分信息
$_tmpId = $this->regist['invite.reward.credit.type'];
$_credit = array('id' => $_tmpId, 'name' => $pwCreditBo->cType[$_tmpId], 'unit' => $pwCreditBo->cUnit[$_tmpId]);
$this->setOutput($_credit, 'rewardCredit');
//奖励的积分信息
$this->setOutput($readyBuy > $gidLimit ? 0 : $gidLimit - $readyBuy, 'canBuyNum');
//还能购买的邀请数
$this->setOutput($price, 'pricePerCode');
//每个邀请码需要积分的单价
$this->setOutput($this->loginUser->info['credit' . $this->regist['invite.credit.type']], 'myCredit');
//我拥有的积分
$this->setOutput($this->regist['invite.reward.credit.num'], 'rewardNum');
//奖励积分数
$this->setOutput($this->regist['invite.expired'], 'codeExpired');
//邀请码有效期
$this->setOutput($this->loginUser->getPermission('invite_allow_buy'), 'canInvite');
//该用户组是否可以购买邀请码
$this->setOutput($this->regist['invite.pay.money'], 'money');
$this->setOutput(false, 'canBuyWithMoney');
$this->listCode();
// seo设置
Wind::import('SRV:seo.bo.PwSeoBo');
$seoBo = PwSeoBo::getInstance();
$lang = Wind::getComponent('i18n');
$seoBo->setCustomSeo($lang->getMessage('SEO:bbs.invite.run.title'), '', '');
Wekit::setV('seo', $seoBo);
}
示例15: gather
/**
* 整理合并贴子内容
*
* @param mixed $tids
* @param mixed $pids
* @access public
* @return void
*/
public function gather($threadList, $attList)
{
if (!is_array($threadList) || !is_array($attList)) {
return array();
}
foreach ($threadList as $key => $thread) {
$pic_key = $thread['tid'] . '_0';
$threadList[$key]['pic'] = isset($attList[$pic_key]) ? $attList[$pic_key] : array();
//列表数据,过滤掉图片及附件url等标签
$_shareData = Pw::formatContent($threadList[$key]['content']);
$threadList[$key]['share'] = $_shareData['share'];
$threadList[$key]['content'] = preg_replace('/(\\[)[^\\]]*$/i', '', mb_substr($_shareData['content'], 0, 90));
//截字并修正表情标签
//
$threadList[$key]['created_user_avatar'] = Pw::getAvatar($threadList[$key]['created_userid'], '');
//
$threadList[$key]['lastpost_time'] = Pw::time2str($threadList[$key]['lastpost_time'], 'auto');
}
krsort($threadList, SORT_NUMERIC);
return $threadList;
}