Exemplo n.º 1
0
 public function postHandle()
 {
     //门户管理模式 编译目录切换
     if ($this->getRequest()->getPost('design')) {
         $loginUser = Wekit::getLoginUser();
         $designPermission = $loginUser->getPermission('design_allow_manage.push');
         if ($designPermission > 0) {
             $dir = Wind::getRealDir('DATA:design.template');
             if (is_dir($dir)) {
                 WindFolder::rm($dir, true);
             }
             $this->forward->getWindView()->compileDir = 'DATA:design.template';
         }
     }
     // SEO settings
     Wind::import('SRV:seo.bo.PwSeoBo');
     $sitename = Wekit::C('site', 'info.name');
     PwSeoBo::set('{sitename}', $sitename);
     Wekit::setGlobal(NEXT_VERSION . ' ' . NEXT_RELEASE, 'version');
     Wekit::setGlobal(PwSeoBo::getData(), 'seo');
     $this->setOutput($this->getRequest()->getIsAjaxRequest() ? '1' : '0', '_ajax_');
     /*[设置给PwGlobalFilters需要的变量]*/
     $_var = array('current' => $this->forward->getWindView()->templateName, 'a' => $this->router->getAction(), 'c' => $this->router->getController(), 'm' => $this->router->getModule());
     $this->getResponse()->setData($_var, '_aCloud_');
     Wekit::load('APPS:appcenter.service.srv.PwDebugApplication')->compile();
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 public function __construct($fid, PwUserBo $user = null)
 {
     $this->forum = new PwForumBo($fid);
     $this->user = $user ? $user : Wekit::getLoginUser();
     $this->isBM = $this->forum->isBM($this->user->username);
     parent::__construct();
 }
Exemplo n.º 4
0
 public function headerInfo1()
 {
     $showuserinfo = Wekit::C('site', 'app.torrent.showuserinfo');
     if (is_array($showuserinfo) && !in_array('headerinfo', $showuserinfo)) {
         return;
     }
     $user = Wekit::getLoginUser();
     if ($user) {
         $peers = Wekit::load('EXT:torrent.service.PwTorrentPeer')->fetchTorrentPeerByUid($user->uid);
         $histories = Wekit::load('EXT:torrent.service.PwTorrentHistory')->fetchTorrentHistoryByUid($user->uid);
         $seeding = $leeching = 0;
         if (is_array($peers)) {
             foreach ($peers as $peer) {
                 if ($peer['seeder'] == 'yes') {
                     $seeding++;
                 } else {
                     $leeching++;
                 }
             }
         }
         if (is_array($histories)) {
             foreach ($histories as $history) {
                 $downloaded_total += $history['downloaded'];
                 $uploaded_total += $history['uploaded'];
             }
         }
         if ($downloaded_total != 0) {
             $rotio = round($uploaded_total / $downloaded_total, 2);
         } else {
             $rotio = 'Inf.';
         }
         echo '<a href="' . WindUrlHelper::createUrl('space/profile/run?uid=' . $user->uid) . '">下载:' . $leeching . ' 做种:' . $seeding . ' 分享率:' . $rotio . '</a>';
     }
 }
Exemplo n.º 5
0
 /**
  * (non-PHPdoc)
  * @see PwTagAction::getContents()
  */
 public function getContents($ids)
 {
     $threads = $this->_getThreadDs()->fetchThread($ids, PwThread::FETCH_ALL);
     $array = array();
     if ($threads) {
         $fids = array();
         foreach ($threads as $v) {
             $fids[] = $v['fid'];
         }
         $user = Wekit::getLoginUser();
         $forums = $this->_getForumDs()->fetchForum($fids);
         $forbidFids = $this->getForbidVisitForum($user, $forums);
         $lang = Wind::getComponent('i18n');
         foreach ($threads as $k => $v) {
             if ($v['disabled'] > 0) {
                 $content = $lang->getMessage('BBS:forum.thread.disabled');
                 $v['subject'] = $content;
                 $v['content'] = $content;
             } elseif (in_array($v['fid'], $forbidFids)) {
                 $content = $lang->getMessage('BBS:forum.thread.right.error');
                 $v['subject'] = $content;
                 $v['content'] = $content;
             }
             $v['forum_name'] = $forums[$v['fid']]['name'];
             $v['created_time_auto'] = pw::time2str($v['created_time'], 'auto');
             $v['type_id'] = $forums[$v['fid']]['name'];
             $array[$k] = $v;
         }
     }
     return $array;
 }
Exemplo n.º 6
0
 /** 
  * 退出系统
  * 
  * @return boolean
  */
 public function logout()
 {
     $loginUser = Wekit::getLoginUser();
     PwSimpleHook::getInstance('PwUserService_logout')->runDo($loginUser);
     $loginUser->reset();
     return Pw::setCookie('winduser', '', -1);
 }
Exemplo n.º 7
0
 public function addThread($tid)
 {
     $userBo = Wekit::getLoginUser();
     $ds = Wekit::load('user.PwUserBehavior');
     $time = Pw::getTime();
     $ds->replaceBehavior($userBo->uid, 'thread_days', $time);
     $ds->replaceBehavior($userBo->uid, 'thread_count');
 }
 public function displayFootHtml()
 {
     $left = $this->getInput('_tab', 'get');
     $left = $left ? $left : 'profile';
     $user = Wekit::getLoginUser();
     $bp = new PwUserProfileExtends($user);
     return new App_Verify_Profile($bp, $left);
 }
Exemplo n.º 9
0
 public function gainReward($uid, $reward, $taskname)
 {
     $num = $reward['num'];
     list($id) = explode('-', $reward['value'], 2);
     /* @var $creditBo PwCreditBo */
     $creditBo = PwCreditBo::getInstance();
     $creditBo->addLog('task_reward', array($id => $reward['num']), Wekit::getLoginUser(), array('taskname' => $taskname));
     return $creditBo->sets($uid, array($id => $reward['num']));
 }
 public function beforeAction($handlerAdapter)
 {
     $this->_m = $handlerAdapter->getModule();
     $this->_c = $handlerAdapter->getController();
     $this->_a = $handlerAdapter->getAction();
     $this->_mc = $this->_m . '/' . $this->_c;
     $this->_mca = $this->_mc . '/' . $this->_a;
     $this->loginUser = Wekit::getLoginUser();
     $this->setTheme('site', null);
 }
Exemplo n.º 11
0
 public function addPost($pid, $tid)
 {
     $userBo = Wekit::getLoginUser();
     $ds = Wekit::load('user.PwUserBehavior');
     $time = Pw::getTime();
     $ds->replaceBehavior($userBo->uid, 'post_days', $time);
     $posts = Wekit::load('forum.PwThread')->getPostByTid($tid, 1, 0, true);
     if (array_key_exists($pid, $posts)) {
         $ds->replaceBehavior($userBo->uid, 'safa_times');
     }
 }
Exemplo n.º 12
0
 public function preHandle()
 {
     $url = array();
     $var = Wekit::url();
     $url['base'] = $var->base;
     $url['res'] = $var->res;
     $url['css'] = $var->css;
     $url['images'] = $var->images;
     $url['js'] = $var->js;
     $url['attach'] = $var->attach;
     $url['themes'] = $var->themes;
     $url['extres'] = $var->extres;
     Wekit::setGlobal($url, 'url');
     $request = array('m' => $this->router->getModule(), 'c' => $this->router->getController(), 'a' => $this->router->getAction());
     $request['mc'] = $request['m'] . '/' . $request['c'];
     $request['mca'] = $request['mc'] . '/' . $request['a'];
     Wekit::setGlobal($request, 'request');
     if (in_array($request['mca'], array('default/index/login', 'default/index/showVerify', 'appcenter/app/upload'))) {
         return;
     }
     /* @var $userService AdminUserService */
     $userService = Wekit::load('ADMIN:service.srv.AdminUserService');
     /* @var $safeService AdminSafeService */
     $safeService = Wekit::load('ADMIN:service.srv.AdminSafeService');
     /* @var $founderService AdminFounderService */
     $founderService = Wekit::load('ADMIN:service.srv.AdminFounderService');
     /* @var $loginUser AdminUserBo */
     $loginUser = Wekit::getLoginUser();
     if (!$loginUser->isExists() || !$founderService->isFounder($loginUser->username) && !$safeService->ipLegal(Wind::getComponent('request')->getClientIp())) {
         if (!$this->getRequest()->getIsAjaxRequest()) {
             $this->forward->forwardAction('default/index/login');
         } else {
             $this->errorMessage->addError('logout', 'state');
             $this->errorMessage->sendError('ADMIN:login.fail.not.login');
         }
     }
     $_unVerifyTable = array('home', 'index', 'find');
     if (!in_array(strtolower($request['c']), $_unVerifyTable)) {
         if ($request['c'] != 'adminlog') {
             $logService = Wekit::load('ADMIN:service.srv.AdminLogService');
             $logService->log($this->getRequest(), $loginUser->username, $request['m'], $request['c'], $request['a']);
         }
         $_result = $userService->verifyUserMenuAuth($loginUser, $request['m'], $request['c'], $request['a']);
         if ($_result instanceof PwError) {
             $this->errorMessage->sendError($_result->getError());
         }
     }
 }
 /**
  * 获取单个帖子信息
  *
  * @param int $tid 帖子id
  * return array
  */
 public function getByTid($tid)
 {
     $tid = intval($tid);
     if ($tid < 1) {
         return $this->buildResponse(THREAD_INVALID_PARAMS, "参数不存在");
     }
     //TODO 权限
     $thread = new PwThreadBo($tid);
     $thread = $thread->info;
     if ($thread instanceof PwError) {
         return $this->buildResponse(-1, $thread->getError());
     }
     $result = array();
     $user = Wekit::getLoginUser();
     $result['tid'] = $thread['tid'];
     $result['fid'] = $thread['fid'];
     $result['icon'] = Pw::getAvatar($thread['created_userid']);
     $result['titlefont'] = '';
     //TODO 标题字体
     $result['author'] = $thread['created_username'];
     $result['authorid'] = $thread['created_userid'];
     $result['subject'] = $thread['subject'];
     $result['type'] = $thread['topic_type'];
     $result['postdate'] = $thread['create_time'];
     $result['lastpost'] = $thread['lastpost_time'];
     $result['lastposter'] = $thread['lastpost_username'];
     $result['hits'] = $thread['hits'];
     $result['replies'] = $thread['replies'];
     $result['topped'] = $thread['topped'];
     $result['locked'] = $thread['locked'];
     $result['digest'] = $thread['digest'];
     $result['special'] = $thread['special'];
     $result['state'] = $thread['thread_status'];
     //帖子状态
     $result['tpcstatus'] = $thread['thread_status'];
     $result['specialsort'] = $thread['special_sort'];
     $result['uid'] = $user->uid;
     $result['groupid'] = $user->gid;
     $result['userip'] = $user->ip;
     $result['ifsign'] = $user->bbs_sign;
     $result['ipfrom'] = $thread['created_ip'];
     $result['content'] = $thread['content'];
     $result['attachlist'] = $thread['attach'];
     return $this->buildResponse(0, $result);
 }
Exemplo n.º 14
0
 /**
  * @param PwUserInfoDm $dm
  */
 public function doPunch($dm)
 {
     if (!Wekit::C('site', 'task.isOpen')) {
         return true;
     }
     $punchData = @unserialize($dm->getField('punch'));
     if (!$punchData || !is_array($punchData)) {
         return false;
     }
     /* @var $bo PwUserBo */
     $bo = Wekit::getLoginUser();
     //帮别人打卡不算完成任务
     if ($dm->uid != $bo->uid) {
         return false;
     }
     $bp = new PwTaskComplete($bo->uid, $this);
     $bp->doTask('member', 'punch');
 }
Exemplo n.º 15
0
 public function addMessage($uid, $fromUid, $content)
 {
     if (!Wekit::C('site', 'task.isOpen')) {
         return true;
     }
     /* @var $dm PwMessageMessagesDm */
     $bo = Wekit::getLoginUser();
     if ($fromUid != $bo->uid) {
         return false;
     }
     $user = Wekit::load('user.PwUser')->getUserByUid($uid);
     if (!$user) {
         return false;
     }
     $this->name = $user['username'];
     $bp = new PwTaskComplete($bo->uid, $this);
     $bp->doTask('member', 'msg');
 }
Exemplo n.º 16
0
 /**
  * 获取首页打卡状态
  * 
  * @param PwUserBo $user
  * return array
  */
 public function getPunch($user = null)
 {
     !$user && ($user = Wekit::getLoginUser());
     $punchData = unserialize($user->info['punch']);
     $havePunch = $this->isPunch($punchData);
     if (!$havePunch) {
         $unPunchDays = $punchData['time'] > 0 ? ceil((Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')) - Pw::str2time(Pw::time2str($punchData['time'], 'Y-m-d'))) / 86400) : 1;
         $punchText = $unPunchDays > 1 ? "{$unPunchDays}天未打卡" : "每日打卡";
         return array(true, $punchText, array());
     }
     $behaviorDays = $this->_getBehavior($punchData['time'], $punchData['days']);
     if ($punchData['username'] == $user->username && $havePunch) {
         $behaviorDays or $behaviorDays = 1;
         $punchText = "连续{$behaviorDays}天打卡";
         return array(false, $punchText, array());
     }
     return array(true, '继续打卡', $punchData);
 }
Exemplo n.º 17
0
 /**
  * 发送举报
  * 
  * @param string $type
  * @param int $type_id
  * @param string $reason
  * @return bool
  */
 public function sendReport($type, $type_id, $reason)
 {
     $action = $this->_getReportAction($type);
     if (!$action) {
         return new PwError('REPORT:type.undefined');
     }
     $typeId = $this->_getTypeId($type);
     $loginUser = Wekit::getLoginUser();
     $dm = $action->buildDm($type_id);
     if (!$dm) {
         return new PwError('REPORT:data.error');
     }
     $dm->setType($typeId)->setTypeId($type_id)->setCreatedUserid($loginUser->uid)->setCreatedTime(Pw::getTime())->setReason($reason);
     $result = $this->_getReportDs()->addReport($dm);
     if ($result instanceof PwError) {
         return $result;
     }
     // 发通知
     return $this->sendNotice($dm->getData());
 }
Exemplo n.º 18
0
 public function createAction()
 {
     $page = $this->getInput('page');
     $this->page = $page < 1 ? 1 : intval($page);
     list($start, $limit) = Pw::page2limit($this->page, $this->perpage);
     $total = $this->_getPollDs()->countPollByUid($this->loginUser->uid);
     $pollInfo = array();
     if ($total) {
         $pollDisplay = new PwPollDisplay(new PwFetchPollByUid(Wekit::getLoginUser()->uid, $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($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');
     $this->setOutput(false, 'isPostPollGuide');
 }
Exemplo n.º 19
0
 /**
  * 获取版块列表
  * 
  * @return array
  */
 public function getAllForum()
 {
     $forumDs = $this->_getPwForum();
     $forumResult = $forumDs->getForumList(PwForum::FETCH_MAIN | PwForum::FETCH_STATISTICS);
     if ($forumResult instanceof PwError) {
         return $this->buildResponse(-1, $forumResult->getError());
     }
     $forumDomain = $this->_getDomainDs()->getByType('forum');
     $key = Pw::collectByKey($forumDomain, 'id');
     $forumDomain = array_combine($key, $forumDomain);
     $cates = $forums = $subForums = $secondSubForums = array();
     $count = 0;
     foreach ($forumResult as $k => $v) {
         $v['domain'] = '';
         if (isset($forumDomain[$k])) {
             $v['domain'] = $forumDomain[$k]['domain'];
         }
         if ($v['type'] == 'category') {
             $cates[$v['fid']] = array('fid' => $v['fid'], 'forumname' => strip_tags($v['name']), 'type' => $v['type'], 'todaypost' => '', 'domain' => $v['domain']);
         } elseif ($v['type'] == 'forum') {
             Wind::import('SRV:forum.bo.PwForumBo');
             $pwforum = new PwForumBo($v['fid'], true);
             if ($pwforum->allowVisit(Wekit::getLoginUser()) !== true) {
                 continue;
             }
             $forums[$v['parentid']][$v['fid']] = array('fid' => $v['fid'], 'forumname' => strip_tags($v['name']), 'type' => $v['type'], 'todaypost' => $v['todayposts'], 'domain' => $v['domain']);
         } elseif ($v['type'] == 'sub') {
             $subForums[$v['parentid']][$v['fid']] = array('fid' => $v['fid'], 'forumname' => strip_tags($v['name']), 'type' => $v['type'], 'todaypost' => $v['todayposts'], 'domain' => $v['domain']);
         } elseif ($v['type'] == 'sub2') {
             $secondSubForums[$v['parentid']][$v['fid']] = array('fid' => $v['fid'], 'forumname' => strip_tags($v['name']), 'type' => $v['type'], 'todaypost' => $v['todayposts'], 'domain' => $v['domain']);
         }
         $count++;
     }
     $result = array();
     foreach ($cates as $k => $v) {
         $v['child'] = isset($forums[$k]) ? $this->_buildForums($forums[$k], $subForums, $secondSubForums) : array();
         $result[] = $v;
     }
     return $this->buildResponse(0, array('count' => $count, 'forums' => $result));
 }
Exemplo n.º 20
0
 public function beforeAction($handlerAdapter)
 {
     $this->_m = $handlerAdapter->getModule();
     $this->_c = $handlerAdapter->getController();
     $this->_a = $handlerAdapter->getAction();
     $this->_mc = $this->_m . '/' . $this->_c;
     $this->_mca = $this->_mc . '/' . $this->_a;
     $this->_setPreCache($this->_m, $this->_mc, $this->_mca);
     $this->loginUser = Wekit::getLoginUser();
     $this->_setPreHook($this->_m, $this->_mc, $this->_mca);
     $config = Wekit::C('site');
     if ($config['visit.state'] > 0) {
         $service = Wekit::load('site.srv.PwSiteStatusService');
         $resource = $service->siteStatus($this->loginUser, $config);
         if ($resource instanceof PwError) {
             if (!($config['visit.state'] == 1 && $this->_mc == 'u/login')) {
                 $this->showError($resource->getError());
             }
         }
     }
     if (!in_array($this->_mc, array('u/login', 'u/register', 'u/findPwd')) && !$this->loginUser->getPermission('allow_visit')) {
         if ($this->loginUser->isExists()) {
             if ($this->_mca != 'u/login/logout') {
                 $this->showError(array('permission.visit.allow', array('{grouptitle}' => $this->loginUser->getGroupInfo('name'))));
             }
         } else {
             $this->forwardAction('u/login/run');
         }
     }
     if ($config['refreshtime'] > 0 && Wind::getApp()->getRequest()->isGet() && !Wind::getApp()->getRequest()->getIsAjaxRequest()) {
         if (Wekit::app()->lastRequestUri == Wekit::app()->requestUri && Wekit::app()->lastvisit + $config['refreshtime'] > Pw::getTime()) {
             $this->showError('SITE:refresh.fast');
         }
     }
     $debug = $config['debug'] || !$config['css.compress'];
     Wekit::setGlobal(array('debug' => $debug ? '/dev' : '/build'), 'theme');
     $this->setTheme('site', null);
 }
Exemplo n.º 21
0
 public function preHandle()
 {
     /* @var $userBo PwUserBo */
     $userBo = Wekit::getLoginUser();
     if ($userBo->isExists() && !in_array($this->router->getAction(), array('welcome', 'guide'))) {
         //TODO 好友邀请链接
         $inviteCode = $this->getInput('invite');
         if ($inviteCode) {
             $user = Wekit::load('SRV:invite.srv.PwInviteFriendService')->invite($inviteCode, $userBo->uid);
             if ($user instanceof PwError) {
                 $this->showError($user->getError());
             }
         }
         if (strtolower($this->router->getAction()) == strtolower('activeEmail')) {
             $referer = Wekit::C('site', 'info.url');
         } else {
             $referer = $this->getRequest()->getServer('HTTP_REFERER');
         }
         $this->errorMessage->addError($referer ? $referer : WindUrlHelper::createUrl(''), 'referer');
         $this->errorMessage->addError(2, 'refresh');
         $this->errorMessage->sendError('USER:register.dumplicate');
     }
 }
Exemplo n.º 22
0
 public function preHandle()
 {
     $module = $this->router->getModule();
     $controller = $this->router->getController();
     $action = $this->router->getAction();
     if (in_array("{$module}/{$controller}/{$action}", array('default/index/login', 'default/index/showVerify'))) {
         return;
     }
     /* @var $userService AdminUserService */
     $userService = Wekit::load('ADMIN:service.srv.AdminUserService');
     /* @var $safeService AdminSafeService */
     $safeService = Wekit::load('ADMIN:service.srv.AdminSafeService');
     /* @var $founderService AdminFounderService */
     $founderService = Wekit::load('ADMIN:service.srv.AdminFounderService');
     /* @var $loginUser AdminUserBo */
     $loginUser = Wekit::getLoginUser();
     if (!$loginUser->isExists() || !$founderService->isFounder($loginUser->getUsername()) && !$safeService->ipLegal(Wekit::app()->clientIp)) {
         if (!$this->getRequest()->getIsAjaxRequest()) {
             $this->forward->forwardAction('default/index/login');
         } else {
             $this->errorMessage->addError('logout', 'state');
             $this->errorMessage->sendError('ADMIN:login.fail.not.login');
         }
     }
     $_unVerifyTable = array('home', 'index', 'find');
     if (!in_array(strtolower($controller), $_unVerifyTable)) {
         if ($controller != 'adminlog') {
             $logService = Wekit::load('ADMIN:service.srv.AdminLogService');
             $logService->log($this->getRequest(), $loginUser->username, $module, $controller, $action);
         }
         $_result = $userService->verifyUserMenuAuth($loginUser, $module, $controller, $action);
         if ($_result instanceof PwError) {
             $this->errorMessage->sendError($_result->getError());
         }
     }
 }
Exemplo n.º 23
0
 public function onResponse()
 {
     if (Wind::getApp()->getRequest()->getIsAjaxRequest()) {
         return;
     }
     $_var = Wind::getApp()->getResponse()->getData('_aCloud_');
     if (!is_array($_var) || in_array($_var['m'], array('design', 'cron', 'windid'))) {
         return;
     }
     require_once Wind::getRealPath('ACLOUD:aCloud');
     $dataMapper = new PwAcloudDataMapper();
     if (null !== ($collect = $this->getCollect($_var['c']))) {
         if (!$collect->isCollect($_var['a'])) {
             return;
         }
         $vars = Wind::getApp()->getResponse()->getData($_var['current']);
         $collect->collect($dataMapper, $vars);
     }
     $dataMapper->setSrc($_var['c']);
     $dataMapper->setUid(Wekit::getLoginUser()->uid);
     $dataMapper->setUsername(Wekit::getLoginUser()->username);
     $dataMapper->setCharset(Wind::getApp()->getResponse()->getCharset());
     Wind::getApp()->getResponse()->setBody(ACloudAppGuiding::getApp($dataMapper), 'acloud');
 }
Exemplo n.º 24
0
 /**
  * 检测是否有评分权限
  */
 protected function _checkMarkCreditsRight($credits)
 {
     $loginUser = Wekit::getLoginUser();
     Wind::import('SRV:credit.bo.PwCreditBo');
     $creditBo = PwCreditBo::getInstance();
     $app_mark_credits = $loginUser->getPermission('app_mark_credits');
     $behaviors = $this->_getService()->getMarkBehavior($loginUser->uid, $app_mark_credits);
     foreach ($credits as $k => $v) {
         if (!$v) {
             continue;
         }
         if (!$app_mark_credits[$k]['isopen']) {
             return new PwError(sprintf('%s积分类型未开启', $creditBo->cType[$k]));
         }
         if ($v < $app_mark_credits[$k]['min'] || $v > $app_mark_credits[$k]['max']) {
             return new PwError(sprintf('每次评分限制最小%s,最大%s', $app_mark_credits[$k]['min'] . $creditBo->cType[$k], $app_mark_credits[$k]['max'] . $creditBo->cType[$k]));
         }
         $absValue = abs($v);
         if ($behaviors[$k] + $absValue > $app_mark_credits[$k]['dayMax']) {
             return new PwError(sprintf('您已达每日评分上限%s', $app_mark_credits[$k]['dayMax'] . $creditBo->cType[$k]));
         }
         $mycredit = $loginUser->info['credit' . $k];
         if ($loginUser->info['credit' . $k] < $absValue) {
             return new PwError(sprintf('您只有:%s,积分不足,', $mycredit . $creditBo->cType[$k]));
         }
         $this->_getUserBehaviorDs()->replaceDayNumBehavior($loginUser->uid, sprintf('app_mark_%d', $k), Pw::getTime(), $absValue);
     }
     return true;
 }
Exemplo n.º 25
0
 public function __construct()
 {
     $this->loginUser = Wekit::getLoginUser();
 }
Exemplo n.º 26
0
 public function createHtml()
 {
     $user = Wekit::getLoginUser();
     $bp = new PwUserProfileExtends($user);
     return new App_Account_ProfileDo($bp);
 }
Exemplo n.º 27
0
 public function afterDesign()
 {
     $ds = Wekit::load('design.PwDesignPage');
     Wind::import('SRV:design.dm.PwDesignPageDm');
     $dm = new PwDesignPageDm($this->pageid);
     $dm->setModuleIds(array_unique($this->moduleIds))->setStrucNames($this->structNames)->setSegments($this->segments);
     $resource = $ds->updatePage($dm);
     Wekit::load('design.PwDesignModule')->batchUpdateIsUsed($this->moduleIds);
     if ($this->isDesign) {
         $loginUser = Wekit::getLoginUser();
         $dm = new PwDesignPageDm($this->pageid);
         $dm->setDesignLock($loginUser->uid, Pw::getTime());
         $ds->updatePage($dm);
         Wekit::load('design.srv.PwPageBakService')->doSnap($this->pageid);
     }
 }
Exemplo n.º 28
0
 private function _getLoginUserId()
 {
     $loginUser = Wekit::getLoginUser();
     return $loginUser->uid;
 }
Exemplo n.º 29
0
 public function createOrderNo()
 {
     return '3' . str_pad(Wekit::getLoginUser()->uid, 10, "0", STR_PAD_LEFT) . Pw::time2str(Pw::getTime(), 'YmdHis') . WindUtility::generateRandStr(5);
 }
Exemplo n.º 30
0
 public function getLock()
 {
     list($uid, $time) = explode('|', $this->_pageInfo['design_lock']);
     if (Pw::getTime() - (int) $time < 60) {
         $user = Wekit::getLoginUser();
         if ($user->uid != $uid) {
             return true;
         }
     }
     return false;
 }