public function run()
 {
     $res = $this->initWebApiArray();
     $uid = $this->getController()->uid;
     $res = $this->_runAction($res, $uid);
     echo WebUtils::outputWebApi($res, '', false);
 }
 public function run($attachment)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $this->getController()->uid;
     // $attachment ="{'head': {'errCode': 0, 'errInfo': ''}, 'body': {'attachment': {'name': 'test', 'isPost': 1, 'data': 'ss', 'type': 'image', 'module':'forum'}, 'externInfo': {}}}";
     $attachment = rawurldecode($attachment);
     $attachment = WebUtils::jsonDecode($attachment);
     $attachment = isset($attachment['body']['attachment']) ? $attachment['body']['attachment'] : array();
     !isset($attachment['module']) && ($attachment['module'] = 'forum');
     $resAttachment = false;
     if (!empty($attachment)) {
         if ($attachment['isPost'] == 1) {
             if (($data = file_get_contents('php://input')) === false) {
                 $attachment['data'] = $GLOBALS['HTTP_RAW_POST_DATA'];
             } else {
                 $attachment['data'] = $data;
             }
         }
         // $attachment['data'] = WebUtils::httpRequest('http://bbs.appbyme.com/static/image/common/logo.png');// test
         $resAttachment = $this->_saveAttachment($uid, $attachment);
     }
     if ($resAttachment === false) {
         $attachmentTypes = array('audio' => WebUtils::t('语音'), 'image' => WebUtils::t('图片'));
         $res = WebUtils::makeErrorInfo_oldVersion($res, 'UPLOAD_ATTACHMENT_ERROR', array('{attachment}' => $attachmentTypes[$attachment['type']]));
     } else {
         $res['body']['attachment'] = $resAttachment;
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 3
0
 public function run($keyword, $page = 1, $pageSize = 10, $searchid = 0)
 {
     $keyword = rawurldecode($keyword);
     $res = WebUtils::initWebApiArray_oldVersion();
     $res = $this->_getForumData($res, $keyword, $page, $pageSize, $searchid);
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 4
0
 public function run($getSetting, $longitude = 0, $latitude = 0, $location = '')
 {
     $res = $this->initWebApiArray();
     // $longitude='116.3093650';$latitude='40.0611250';$location='北京市海淀区上地东路';
     $location = WebUtils::t(rawurldecode($location));
     global $_G;
     ($uid = $_G['uid']) && $this->_saveUserLocation($uid, $longitude, $latitude, $location);
     // $getSetting ="{'body': {'postInfo': {'forumIds': '0'}}}";
     $settings = rawurldecode($getSetting);
     $settings = WebUtils::jsonDecode($settings);
     $postInfo = isset($settings['body']['postInfo']) ? $settings['body']['postInfo'] : array();
     if (!empty($postInfo)) {
         $res['body']['postInfo'] = $this->_getPostInfo($postInfo);
     }
     $res['body']['serverTime'] = time() . '000';
     $res['body']['misc'] = $this->_getMiscSetting();
     $res['body']['plugin'] = $this->_getPluginSetting();
     $res['body']['forum'] = $this->_getForumSetting();
     $res['body']['portal'] = $this->_getPortalSetting();
     $res['body']['user'] = $this->_getUserSetting();
     $res['body']['message'] = $this->_getMessageSetting();
     $res['body']['moduleList'] = PortalUtils::getModuleList(6);
     // 2014/11/4 门户资讯分类模块列表
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 5
0
 public function run($type = 'follow', $page = 1, $pageSize = 10, $orderBy = 'dateline', $longitude = '', $latitude = '', $radius = 100000)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     switch ($orderBy) {
         case 'register':
             $sortType = 'regdate';
             break;
         case 'login':
             $sortType = 'lastvisit';
             break;
         case 'followed':
             $sortType = 'follower';
             break;
         case 'distance':
             $sortType = 'range';
             break;
         case 'dateline':
             $sortType = 'default';
             break;
         case 'at':
             $sortType = 'at';
             break;
         default:
             break;
     }
     global $_G;
     $uid = $_G['uid'];
     $viewUid = isset($_GET['uid']) ? $_GET['uid'] : $uid;
     $res = $this->_getUserInfoList($res, $type, $uid, $viewUid, $page, $pageSize, $sortType, $longitude, $latitude, $radius);
     echo WebUtils::outputWebApi($res, '', false);
 }
 public function run($tid, $act = 'apply')
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $this->getController()->uid;
     // $_REQUEST['json'] = "{'payment':1,'payvalue':100, 'realname': '请求参数11', 'qq': '8', 'message': '请求参数'}";
     $json = isset($_REQUEST['json']) ? $_REQUEST['json'] : '';
     $json = rawurldecode($json);
     $data = WebUtils::jsonDecode($json);
     if (!empty($data)) {
         foreach ($data as $key => $value) {
             if (is_string($value)) {
                 $data[$key] = WebUtils::t($value);
             }
         }
         switch ($act) {
             case 'apply':
                 $res = $this->_applyActivityTopic($res, $tid, $uid, $data);
                 break;
             case 'cancel':
                 $res = $this->_cancelActivityTopic($res, $tid, $uid, $data);
                 break;
             default:
                 $res = $this->_makeErrorInfo($res, 'activity_apply_params_error');
                 break;
         }
     } else {
         $res = $this->_makeErrorInfo($res, 'activity_apply_params_error');
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 7
0
 public function run($custom = 0)
 {
     $res = $this->initWebApiArray();
     $res['body'] = $this->_getUIconfig($custom);
     $res['head']['errInfo'] = '';
     echo WebUtils::outputWebApi($res, 'utf-8', false);
 }
Exemplo n.º 8
0
 public function run($uid, $albumId, $page = 1, $pageSize = 10)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $landUid = $this->getController()->uid;
     $res = $this->_getImageInfoList($res, $landUid, $uid, $page, $pageSize, $albumId);
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 9
0
 public function run($ids, $picDesc, $albumId = -1)
 {
     $albumId = $albumId == 0 ? -1 : $albumId;
     $res = $this->initWebApiArray();
     $res = $this->_saveAlbum($ids, $picDesc, $albumId);
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 10
0
 public function run($avatar)
 {
     $res = $this->initWebApiArray();
     $uid = $this->getController()->uid;
     $res = $this->_runAction(array('res' => $res, 'uid' => $uid, 'avatar' => $avatar));
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 11
0
 public static function endAppWithErrorInfo($res, $message, $params = array())
 {
     $tmpRes = WebUtils::initWebApiArray_oldVersion();
     $tmpRes = WebUtils::makeErrorInfo_oldVersion($tmpRes, $message, $params);
     $tmpRes = array_merge($tmpRes, $res);
     WebUtils::outputWebApi($tmpRes);
 }
Exemplo n.º 12
0
 public function run($openId, $oauthToken, $platformId = 20)
 {
     $this->password .= FileUtils::getRandomFileName('', 3);
     $res = $this->initWebApiArray();
     $openId = rawurldecode($openId);
     $res = $this->getBindInfo($res, $openId, $oauthToken, $platformId);
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 13
0
 public function run($longitude, $latitude, $location)
 {
     $res = $res = $this->initWebApiArray();
     // $longitude='116.3093650';$latitude='40.0611250';$location='北京市海淀区上地东路xxx';
     $location = WebUtils::t(rawurldecode($location));
     $this->_getSaveUserLocation($longitude, $latitude, $location);
     echo WebUtils::outputWebApi($res, '', false);
 }
 public function run($username, $oauthToken, $password, $openId, $email = '', $gender = 0, $act = 'register', $platformId = 20)
 {
     $username = WebUtils::t(rawurldecode($username));
     $email = WebUtils::t(rawurldecode($email));
     $res = $this->initWebApiArray();
     $res = $this->getPlatFormInfo($res, $username, $oauthToken, $password, $openId, $email, $gender, $act, $platformId);
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 15
0
 public function run($share)
 {
     $res = $this->initWebApiArray();
     // $share = "{'body': {'shareInfo': {'shareId':8,'shareType': 'news'}}}";
     $share = rawurldecode($share);
     $shareInfo = WebUtils::jsonDecode($share);
     $res['body']['shareData'] = $this->_getShareData($shareInfo);
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 16
0
 public function run($username, $password, $email)
 {
     $username = WebUtils::t(rawurldecode($username));
     $password = rawurldecode($password);
     $email = rawurldecode($email);
     $res = $this->initWebApiArray();
     $res = $this->_register($res, $username, $password, $email);
     echo WebUtils::outputWebApi($res, '', false);
 }
 public function run($type, $gender = '', $avatar = '', $oldPassword = '', $newPassword = '')
 {
     $res = $this->initWebApiArray();
     if ($type == 'info') {
         $res = $this->_updateUser($res, $gender, $avatar);
     } elseif ($type == 'password') {
         $res = $this->_updatePass($res, $oldPassword, $newPassword);
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 18
0
 public function run($fid = 0, $type = '')
 {
     global $_G;
     if ($type == 'rec') {
         $res = $this->getResult(array('fid' => $fid, 'type' => $type));
         echo WebUtils::outputWebApi($res, '', true);
     }
     $key = CacheUtils::getForumListKey(array($fid, $_G['groupid'], $type));
     $this->runWithCache($key, array('fid' => $fid));
 }
Exemplo n.º 19
0
 public function run($type = 'login', $username = '', $password = '')
 {
     $res = $this->initWebApiArray();
     if ($type == 'login') {
         $res = $this->_login($res, $username, $password);
     } elseif ($type == 'logout') {
         $res = $this->_logout($res);
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 20
0
 public function run($json)
 {
     $res = $this->initWebApiArray();
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['page']) && ($json['page'] = 1);
     !isset($json['pageSize']) && ($json['pageSize'] = 10);
     $res = $this->_getResult($res, $json);
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 21
0
 public function run($act = 'init', $accessToken = '', $accessSecret = '', $device = '', $activityId = 1)
 {
     $res = $this->initWebApiArray();
     if ($act == 'init') {
         $res = $this->_inviteActiv($res, $accessToken, $accessSecret, $device, $activityId);
     } elseif ($act == 'user') {
         $res = $this->_userReward($res, $activityId, $accessToken, $accessSecret);
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 22
0
 public function run()
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     global $_G;
     $uid = $_G['uid'];
     $puid = isset($_GET['userId']) ? $_GET['userId'] : $uid;
     $res = $this->_getUserInfo($res, $uid, $puid);
     $res['info'] = array();
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 23
0
 public function run($json)
 {
     $res = $this->initWebApiArray();
     // $json = '{"aid": 10, "page": 1}';
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['aid']) && ($json['aid'] = 0);
     !isset($json['page']) && ($json['page'] = 1);
     $res = $this->_getResult($res, (int) $json['aid'], (int) $json['page']);
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 24
0
 public function run($page = 1, $pageSize = 10)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $this->getController()->uid;
     $params = array('type' => 'friend', 'orderBy' => 'at', 'page' => 0, 'uid' => $uid);
     $friend = $this->_getForWardInfo($params);
     $params = array('type' => 'follow', 'orderBy' => 'dateline', 'page ' => 0, 'uid' => $uid);
     $follow = $this->_getForWardInfo($params);
     $res = $this->_getUserPostFriendPagingListInfo($res, $friend, $follow, $page, $pageSize);
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 25
0
 public function run()
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $_GET['uid'];
     $page = $_GET['page'] ? $_GET['page'] : 1;
     $pageSize = $_GET['pageSize'] ? $_GET['pageSize'] : 10;
     $type = $_GET['type'];
     $idType = $_GET['idType'] ? $_GET['idType'] : 'tid';
     $res = $this->_getTopicList($res, $type, $idType, $uid, $page, $pageSize, $idtype);
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 26
0
 public function run($pmlist)
 {
     $res = $this->initWebApiArray();
     $uid = $this->getController()->uid;
     // $pmlist ='{"body": {"pmInfos": [{"fromUid": 4, "startTime": "0", "stopTime": "0", "cacheCount": 0, "pmLimit": 10, }], "externInfo": {"onlyFromUid":0} } }';
     $pmlist = rawurldecode($pmlist);
     $pmInfos = WebUtils::jsonDecode($pmlist);
     $res['body']['userInfo'] = $this->_getUserInfo($uid);
     $res['body']['pmList'] = $this->_getPMList($uid, $pmInfos);
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 27
0
 public function run()
 {
     $json = $_REQUEST['json'];
     $json = rawurldecode($json);
     $info = WebUtils::jsonDecode($json);
     $jsonInfo = !empty($info['body']['json']) ? $info['body']['json'] : array();
     $act = $_GET['act'];
     $res = $this->_sendPostResult($jsonInfo, $act);
     echo WebUtils::outputWebApi($res, '', false);
     $this->_doPostStatistics($act);
 }
Exemplo n.º 28
0
 public function run($json)
 {
     $res = $this->initWebApiArray();
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['action']) && ($json['action'] = 'send');
     !isset($json['toUid']) && ($json['toUid'] = 0);
     !isset($json['plid']) && ($json['plid'] = 0);
     !isset($json['pmid']) && ($json['pmid'] = 0);
     $res = $this->_pmAdmin($res, $json);
     echo WebUtils::outputWebApi($res, '', false);
 }
Exemplo n.º 29
0
 /**
  * runWithCache
  * 
  * @param string $key
  * @param array $params
  */
 protected function runWithCache($key, $params = array())
 {
     $cache = $this->getCacheInfo();
     $res = array();
     if (!$cache['enable'] || ($res = Yii::app()->cache->get($key)) === false) {
         $res = WebUtils::outputWebApi($this->getResult($params), '', false);
         if ($cache['enable']) {
             Yii::app()->cache->set($key, $res, $cache['expire']);
         }
     }
     echo $res;
 }
Exemplo n.º 30
0
 public function run($setting)
 {
     $res = $this->initWebApiArray();
     $uid = $this->getController()->uid;
     // test
     // $setting ='{"head": {"errCode": 0, "errInfo": ""}, "body": {"settingInfo": {"hidden": 0}, "externInfo": {}}}';
     $settings = rawurldecode($setting);
     $settings = WebUtils::jsonDecode($settings);
     $settings = !empty($settings) ? $settings['body']['settingInfo'] : array();
     // insert or update new settings
     AppbymeUserSetting::saveNewSettings($uid, $settings);
     echo WebUtils::outputWebApi($res, '', false);
 }