public function run()
 {
     header("Content-type: text/html; charset=" . Wekit::V('charset'));
     //$pwServer['HTTP_USER_AGENT'] = 'Shockwave Flash';
     $swfhash = 1;
     Pw::echoJson(array('uid' => $this->loginUser->uid, 'a' => 'dorun', 'verify' => $swfhash));
     $this->setTemplate('');
 }
 /**
  * 发帖页我的草稿
  *
  * @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;
     }
     Pw::echoJson(array('state' => 'success', 'data' => $data));
     exit;
 }
 /** 
  * 获取用户关注数据,ajax输出
  *
  */
 public function getfollowAction()
 {
     list($type, $page, $perpage) = $this->getInput(array('type', 'page', 'perpage'));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $typeCounts = $this->_getAttentionTypeDs()->countUserType($this->loginUser->uid);
     if ($type) {
         $tmp = $this->_getAttentionTypeDs()->getUserByType($this->loginUser->uid, $type, $limit, $start);
         $follows = $this->_getAttentionDs()->fetchFollows($this->loginUser->uid, array_keys($tmp));
         $count = $typeCounts[$type] ? $typeCounts[$type]['count'] : 0;
     } else {
         $follows = $this->_getAttentionDs()->getFollows($this->loginUser->uid, $limit, $start);
         $count = $this->loginUser->info['follows'];
     }
     $uids = array_keys($follows);
     Pw::echoJson(array('state' => 'success', 'data' => $this->_buildRemindUsers($uids), 'page' => $page));
     exit;
 }
Exemple #4
0
	/**
	 * 获取热门话题
	 *
	 * @return void
	 */
	public function getHotTagsAction(){
		$hotTags = $this->_getTagService()->getHotTags('',$this->hotTagList);
		Pw::echoJson($hotTags);exit;
	}
 /**
  * 获取我关注的人
  *
  * @return void
  */
 public function followsAction()
 {
     list($page, $perpage, $type) = $this->getInput(array('page', 'perpage', 'type'));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $attentionDs = Wekit::load('attention.PwAttention');
     $type = $type ? $type : 'follows';
     if ($type == 'follows') {
         $count = $this->loginUser->info['follows'];
         $count && ($attentions = $attentionDs->getFollows($this->loginUser->uid, $limit, $start));
     } else {
         $count = $this->loginUser->info['fans'];
         $count && ($attentions = $attentionDs->getFans($this->loginUser->uid, $limit, $start));
     }
     if (!$attentions) {
         Pw::echoJson(array('state' => 'fail'));
         exit;
     }
     Pw::echoJson(array('state' => 'success', 'data' => $this->_buildUsers($attentions)));
     exit;
 }
 /**
  * 主题分类
  */
 public function topictypesAction()
 {
     $fid = (int) $this->getInput('fid', 'post');
     if ($fid < 1) {
         $this->showError('data.error');
     }
     $topicTypes = Wekit::load('forum.srv.PwTopicTypeService')->getTopictypes($fid);
     $topicTypes = $topicTypes ? $topicTypes : '';
     Pw::echoJson(array('state' => 'success', 'data' => $topicTypes));
     exit;
 }
 /** 
  * 请求获取tip
  *
  */
 public function punchtipAction()
 {
     $punchData = $this->loginUser->info['punch'];
     $punchData = $punchData ? unserialize($punchData) : array();
     $reward = $this->config['punch.reward'];
     if (!$punchData) {
         $data = array('cUnit' => $this->_creditBo->cUnit[$reward['type']], 'cType' => $this->_creditBo->cType[$reward['type']], 'todaycNum' => $reward['min'], 'tomorrowcNum' => $reward['min'] + $reward['step'], 'step' => $reward['step'], 'max' => $reward['max']);
         Pw::echoJson(array('state' => 'success', 'data' => $data));
         exit;
     }
     $havePunch = $this->_getPunchService()->isPunch($punchData);
     if ($punchData['username'] == $this->loginUser->username && $havePunch) {
         Pw::echoJson(array('state' => 'fail'));
         exit;
     }
     $behavior = $this->_getUserBehaviorDs()->getBehavior($this->loginUser->uid, 'punch_day');
     $steps = $behavior['number'] > 0 ? $behavior['number'] : 0;
     $awardNum = $reward['min'] + $steps * $reward['step'] > $reward['max'] ? $reward['max'] : $reward['min'] + $steps * $reward['step'];
     $tomorrowcNum = $awardNum + $reward['step'];
     $data = array('cUnit' => $this->_creditBo->cUnit[$reward['type']], 'cType' => $this->_creditBo->cType[$reward['type']], 'todaycNum' => $awardNum, 'tomorrowcNum' => $tomorrowcNum > $reward['max'] ? $reward['max'] : $tomorrowcNum, 'step' => $reward['step'], 'max' => $reward['max']);
     Pw::echoJson(array('state' => 'success', 'data' => $data));
     exit;
 }
 /**
  * do群发消息
  *
  * @return void
  */
 public function doSendAction()
 {
     list($type, $content, $title, $step, $countStep) = $this->getInput(array('type', 'content', 'title', 'step', 'countStep'));
     !$content && $this->showError('Message:content.empty');
     if ($step > $countStep) {
         $this->showMessage("ADMIN:success");
     }
     $step = $step ? $step : 1;
     switch ($type) {
         case 1:
             // 根据用户组
             list($user_groups, $grouptype) = $this->getInput(array('user_groups', 'grouptype'));
             Wind::import('SRV:user.vo.PwUserSo');
             $vo = new PwUserSo();
             $searchDs = Wekit::load('SRV:user.PwUserSearch');
             if (!$user_groups) {
                 $this->showError('Message:user.groups.empty');
             }
             if ($grouptype == 'memberid') {
                 $vo->setMemberid($user_groups);
             } else {
                 $vo->setGid($user_groups);
             }
             $count = $searchDs->countSearchUser($vo);
             $countStep = ceil($count / $this->perstep);
             if ($step <= $countStep) {
                 list($start, $limit) = Pw::page2limit($step, $this->perstep);
                 $userInfos = $searchDs->searchUser($vo, $limit, $start);
             }
             break;
         case 2:
             // 根据用户名
             $touser = $this->getInput('touser');
             !$touser && $this->showError('Message:receive.user.empty');
             $touser = explode(' ', $touser);
             $count = count($touser);
             $countStep = ceil($count / $this->perstep);
             if ($step <= $countStep) {
                 $userDs = Wekit::load('user.PwUser');
                 list($start, $limit) = Pw::page2limit($step, $this->perstep);
                 $userInfos = $userDs->fetchUserByName(array_slice($touser, $start, $limit));
             }
             break;
         case 3:
             // 根据在线用户(精确在线)
             $onlineService = Wekit::load('online.srv.PwOnlineCountService');
             list($count, $userInfos) = $onlineService->getVisitorList('', $step, $this->perstep, true);
             $countStep = ceil($count / $this->perstep);
             break;
     }
     $result = $this->sendNoticeByUsers((array) $userInfos, $content, strip_tags($title));
     if ($result instanceof PwError) {
         $this->showError($result->getError());
     }
     $haveBuild = $step * $this->perstep;
     $haveBuild = $haveBuild > $count ? $count : $haveBuild;
     $step++;
     usleep(500);
     $data = array('step' => $step, 'countStep' => $countStep, 'count' => $count, 'haveBuild' => $haveBuild);
     Pw::echoJson(array('data' => $data));
     exit;
 }
 public function __echo($issuccess, $statement, $from)
 {
     if ($issuccess == true || $issuccess == "true") {
         $e['issuccess'] = "true";
     } elseif ($issuccess == false || $issuccess == "false") {
         $e['issuccess'] = "false";
     } else {
         $e['issuccess'] = "false";
     }
     $e['data'] = array();
     $e['statement'] = $statement;
     Pw::echoJson($e);
     // $e['issuccess']=""
 }