当前位置: 首页>>代码示例>>PHP>>正文


PHP WebUtils::jsonDecode方法代码示例

本文整理汇总了PHP中WebUtils::jsonDecode方法的典型用法代码示例。如果您正苦于以下问题:PHP WebUtils::jsonDecode方法的具体用法?PHP WebUtils::jsonDecode怎么用?PHP WebUtils::jsonDecode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebUtils的用法示例。


在下文中一共展示了WebUtils::jsonDecode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 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);
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:30,代码来源:TopicActivityAction.php

示例2: _updateUser

 private function _updateUser($res, $gender, $avatar)
 {
     global $_G;
     include_once libfile('function/profile');
     $setarr['gender'] = intval($gender);
     if ($setarr) {
         C::t('common_member_profile')->update($_G['uid'], $setarr);
     }
     manyoulog('user', $uid, 'update');
     $operation = 'gender';
     include_once libfile('function/feed');
     feed_add('profile', 'feed_profile_update_' . $operation, array('hash_data' => 'profile'));
     countprofileprogress();
     // ob_start();
     // $this->getController()->forward('user/uploadavatar', false);
     // $result = ob_get_clean();
     // $picInfo = WebUtils::jsonDecode($result, true);
     // $avatar = $picInfo['pic_path'];
     // $avatar = !empty($_GET['avatar']) ? $_GET['avatar'] : '';
     if (!empty($avatar)) {
         $_GET = array_merge($_GET, array('avatar' => $avatar));
         ob_start();
         $this->getController()->forward('user/saveavatar', false);
         $result = ob_get_clean();
         $result = WebUtils::jsonDecode($result);
         if (WebUtils::checkError($result)) {
             return $this->makeErrorInfo($res, 'user_info_avatar_error');
         }
     }
     return $this->makeErrorInfo($res, lang('message', 'profile_succeed'), array('noError' => 1));
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:31,代码来源:UpdateUserInfoAction.php

示例3: run

 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);
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:29,代码来源:SendAttachmentAction.php

示例4: run

 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);
 }
开发者ID:caidongyun,项目名称:CS,代码行数:9,代码来源:ShareAction.php

示例5: _getForWardInfo

 private function _getForWardInfo($params)
 {
     $_GET = array_merge($_GET, $params);
     ob_start();
     $this->getController()->forward('user/userlist', false);
     $res = ob_get_clean();
     $list = WebUtils::jsonDecode($res);
     return $list['list'];
 }
开发者ID:caidongyun,项目名称:CS,代码行数:9,代码来源:AtUserListAction.php

示例6: run

 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);
 }
开发者ID:caidongyun,项目名称:CS,代码行数:10,代码来源:PMSessionListAction.php

示例7: run

 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);
 }
开发者ID:caidongyun,项目名称:CS,代码行数:11,代码来源:PMListAction.php

示例8: run

 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);
 }
开发者ID:caidongyun,项目名称:CS,代码行数:11,代码来源:NewsViewAction.php

示例9: run

 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);
 }
开发者ID:caidongyun,项目名称:CS,代码行数:12,代码来源:PMAdminAction.php

示例10: run

 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);
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:13,代码来源:SettingAction.php

示例11: _doNewApp

 private function _doNewApp($res, $appKey, $test)
 {
     // $url = 'http://192.168.1.211:9797/mobcentACA/app/wAMkQjefj3HPHsrfCk/profile';
     $url = 'http://www.appbyme.com/mobcentACA/app/' . $appKey . '/profile';
     $temRes = WebUtils::httpRequest($url, 30);
     $temRes = WebUtils::jsonDecode($temRes);
     $appInfo = array('appName' => WebUtils::t($temRes['appName']), 'appAuthor' => WebUtils::t($temRes['appAuthor']), 'appDescribe' => WebUtils::t($temRes['appDescribtion']), 'appVersion' => WebUtils::t($temRes['appVersion']), 'appIcon' => $temRes['appIcon'], 'appImage' => $temRes['appCover'], 'appContentId' => $temRes['contentId'], 'appDownloadUrl' => array('android' => $temRes['apkUrl'], 'apple' => $temRes['ipaUrl'], 'appleMobile' => $temRes['plistUrl']), 'appQRCode' => array('android' => $temRes['qrcode'], 'apple' => $temRes['qrcode']));
     if ($test == 0) {
         AppbymeConfig::saveDownloadOptions($appInfo);
         AppbymeConfig::saveForumkey($temRes['forumKey']);
     }
     return $res;
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:13,代码来源:ServerNotifyAction.php

示例12: _getWeatherConfig

 private function _getWeatherConfig()
 {
     $weather = array('allowUsage' => 1, 'allowCityQuery' => 1);
     $forumKey = isset($_GET['forumKey']) ? $_GET['forumKey'] : '';
     $platType = isset($_GET['platType']) ? $_GET['platType'] : APP_TYPE_ANDROID;
     $url = 'http://sdk.mobcent.com/baikesdk/phpapi/settings';
     // $url = 'http://192.168.1.213/forum/phpapi/settings';
     $url .= sprintf('?forumKey=%s&platType=%s&gzip=false', $forumKey, $platType);
     $res = WebUtils::httpRequest($url, 10);
     $res = WebUtils::jsonDecode($res);
     isset($res['data']['weather']['show_weather']) && ($weather['allowUsage'] = (int) $res['data']['weather']['show_weather']);
     isset($res['data']['weather']['city_query_setting']) && ($weather['allowCityQuery'] = (int) $res['data']['weather']['city_query_setting']);
     return $weather;
 }
开发者ID:caidongyun,项目名称:CS,代码行数:14,代码来源:GetSettingAction.php

示例13: run

 public function run($json)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     // $json = "{'id': 1, 'idType': 'aid', 'page': 1, 'pageSize': 10, }";
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     $res = $this->_checkComment($res, $json);
     if (!WebUtils::checkError($res)) {
         $comments = $this->getCommentList($json);
         $res['body']['list'] = $comments['list'];
         $res = array_merge($res, WebUtils::getWebApiArrayWithPage($res, $json['page'], $json['pageSize'], $comments['count']));
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
开发者ID:caidongyun,项目名称:CS,代码行数:14,代码来源:CommentListAction.php

示例14: run

 public function run($json)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     // $json = "{'action': 'reply', 'idType': 'aid', 'id': 1, 'content': [{'type': 0, 'infor': '呵呵\r\nhaha%25E5%2591%25B5%25E5%2591%25B5%25E2%2580%259C%25E2%2580%259D%2522%2522',}], 'quoteCommentId': 12, }";
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['action']) && ($json['action'] = 'reply');
     !isset($json['idType']) && ($json['idType'] = 'aid');
     switch ($json['action']) {
         case 'reply':
             $res = $this->_commentReply($res, $json);
             break;
         default:
             $res = WebUtils::makeErrorInfo_oldVersion($res, 'mobcent_error_params');
             break;
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:18,代码来源:CommentAdminAction.php

示例15: runWithCache

 protected function runWithCache($key, $params = array())
 {
     $page = $params['page'];
     $fid = $params['fid'];
     $res = array();
     $cache = $this->getCacheInfo();
     if (!$cache['enable'] || ($res = Yii::app()->cache->get($key)) === false) {
         // var_dump('no cache');
         if ($params['sort'] == 'photo') {
             $_GET = array_merge($_GET, $params);
             ob_start();
             $this->getController()->forward('forum/photogallery', false);
             $res = WebUtils::jsonDecode(ob_get_clean());
             $res = WebUtils::outputWebApi($res, 'utf-8', false);
         } else {
             $res = WebUtils::outputWebApi($this->getResult($params), '', false);
         }
         if ($page == 1) {
             if ($fid > 0 && $sort != 'top') {
                 $sql = '
                     SELECT lastpost
                     FROM %t
                     WHERE fid=%d
                     ';
                 $params = array('forum_forum', $fid);
             } else {
                 $sql = '
                     SELECT MAX(dateline)
                     FROM %t
                     ';
                 $params = array('forum_post');
             }
             $dep = new DiscuzDbCacheDependency($sql, $params);
             if ($cache['enable']) {
                 Yii::app()->cache->set($key, $res, $cache['expire'], $dep);
             }
         }
     }
     echo $res;
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:40,代码来源:TopicListAction.php


注:本文中的WebUtils::jsonDecode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。