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


PHP BaseController::sendResponse方法代码示例

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


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

示例1: signAction

 public function signAction()
 {
     $request_data = $this->view->request_data;
     if (isset($request_data['data']['campaign_id']) && $request_data['data']['campaign_id'] > 0 && isset($request_data['data']['uid']) && isset($request_data['data']['comment']) && isset($request_data['data']['fb_share']) && isset($request_data['data']['show_name'])) {
         $db_static = Zend_Registry::get('db_static');
         $db_share = Zend_Registry::get('db_share');
         $me = Zend_Registry::get('me');
         // ALEADY SIGN?
         if ($row = $me->_db_channel->fetchRow('SELECT id FROM signatures WHERE campaign_id=? AND uid=? LIMIT 1', array($request_data['data']['campaign_id'], $request_data['data']['uid']))) {
             $data = array("data" => null, "status" => ReturnStatus::ALREADY_SIGN_TO_SUPPORT, "status_msg" => "Already Sign to support campaign");
             parent::sendResponse($data);
         } else {
             $campaign_codename = $db_static->fetchOne('SELECT codename FROM db_campaign WHERE campaign_id=? LIMIT 1', array($request_data['data']['campaign_id']));
             try {
                 $insert_full = array('campaign_id' => $request_data['data']['campaign_id'], 'campaign_codename' => $campaign_codename, 'uid' => $me->_data['uid'], 'username' => $me->_data['username'], 'first_name' => $me->_data['first_name'], 'last_name' => $me->_data['last_name'], 'display_name' => $request_data['data']['show_name'] == 'yes' ? $me->_data['first_name'] . ' ' . $me->_data['last_name'] : '', 'display_comment' => $request_data['data']['comment'], 'date' => date('Y-m-d'), 'time' => date('H:i:s'), 'country_code' => $me->_data['country'], 'fb_share' => $request_data['data']['fb_share'], 'show_name' => $request_data['data']['show_name']);
                 $me->_db_channel->insert('signatures', $insert_full);
                 // ++signatures
                 $db_static->query('UPDATE db_campaign SET signatures=signatures+1 WHERE campaign_id=?', array($request_data['data']['campaign_id']));
                 // Send email
                 $this->view->dict = Utils::getDictSet($me, 'index', 'campaign');
                 $this->sendEmail($me->_data['username'], Utils::resolveTag($this->view->dict['THANKS_FOR_SUPPORT.SUBJECT'], array('[TITLE]' => $this->view->dict[$campaign_codename . '.TITLE'])), Utils::resolveTag($this->view->dict['THANKS_FOR_SUPPORT.CONTENT'], array('[NAME]' => $me->_data['first_name'], '[IMAGE]' => '<img src="http://www.5000s.org/views/images/campaign/' . $request_data['data']['campaign_id'] . '/1.jpg" width="200">', '[BRIEF]' => $this->view->dict[$campaign_codename . '.BRIEF'], '[FB_SHARE_BUTTON]' => '<img src="http://www.5000s.org/views/images/fb-share-button.png" width="210">')));
             } catch (Exception $e) {
                 $data = array("data" => null, "status" => ReturnStatus::FAILED_SIGN_TO_SUPPORT, "status_msg" => $e->getMessage());
                 parent::sendResponse($data);
             }
             if ($request_data['data']['show_name'] == 'yes') {
                 $insert_signatures = array('campaign_id' => $request_data['data']['campaign_id'], 'campaign_codename' => $campaign_codename, 'uid' => $me->_data['uid'], 'username' => $me->_data['username'], 'first_name' => $me->_data['first_name'], 'last_name' => $me->_data['last_name'], 'date' => date('Y-m-d'), 'time' => date('H:i:s'));
                 try {
                     $db_share->insert('signatures', $insert_signatures);
                 } catch (Exception $e) {
                 }
             }
             if ($request_data['data']['comment']) {
                 $insert_comment = array('campaign_id' => $request_data['data']['campaign_id'], 'campaign_codename' => $campaign_codename, 'uid' => $me->_data['uid'], 'username' => $me->_data['username'], 'first_name' => $me->_data['first_name'], 'last_name' => $me->_data['last_name'], 'display_name' => $me->_data['first_name'] . ' ' . $me->_data['last_name'], 'display_comment' => $request_data['data']['comment'], 'date' => date('Y-m-d'), 'time' => date('H:i:s'));
                 try {
                     $db_share->insert('comments', $insert_comment);
                 } catch (Exception $e) {
                 }
                 $last_insert_id = $db_share->lastInsertId();
                 if ($request_data['data']['show_name'] == 'no') {
                     $db_share->update('comments', array('display_name' => 'Anonymous'), 'id=' . $last_insert_id);
                 }
             }
             $data = array("data" => null, "status" => 200, "status_msg" => 'Success');
             parent::sendResponse($data);
         }
     } else {
         $data = array("data" => null, "status" => 305, "status_msg" => "Input Wrong Format[?]");
         parent::sendResponse($data);
     }
 }
开发者ID:KBO-Techo-Dev,项目名称:5000sCampaignAPI,代码行数:51,代码来源:SignatureController.php

示例2: queryAction

 public function queryAction()
 {
     $request_data = $this->view->request_data;
     if (isset($request_data['data']['mode']) && isset($request_data['data']['date'])) {
         try {
             $result = $this->getInfo($request_data['data']['mode'], $request_data['data']['date']);
             if (isset($result[0])) {
                 $info = $this->extractInfo($result);
                 $data = array("data" => $info, "status" => 200, "status_msg" => "Success");
                 parent::sendResponse($data);
             } else {
                 $data = array("data" => null, "status" => ReturnStatus::DATA_NOT_FOUND, "status_msg" => "Data not found.");
                 parent::sendResponse($data);
             }
         } catch (Exception $e) {
             $data = array("data" => null, "status" => $e->getCode(), "status_msg" => $e->getMessage());
             parent::sendResponse($data);
         }
     } else {
         $data = array("data" => null, "status" => 305, "status_msg" => "Input Wrong Format[Language]");
         parent::sendResponse($data);
     }
 }
开发者ID:KBO-Techo-Dev,项目名称:5000sCampaignAPI,代码行数:23,代码来源:StatController.php

示例3: infoAction

 public function infoAction()
 {
     $request_data = $this->view->request_data["data"];
     $token = isset($request_data['token']) ? $request_data['token'] : "";
     try {
         $uid = GameManager::getUidByToken($token);
         $me = GameManager::getUserObject($uid);
         $response = array("data" => $me->_data, "status" => ReturnStatus::SUCCESS, "status_msg" => "Success");
         parent::sendResponse($response);
     } catch (Exception $e) {
         $data = array("data" => null, "status" => ReturnStatus::INTERNAL_SERVER_ERROR, "status_msg" => "Internal Server Error:" . $e);
         parent::sendResponse($data);
     }
 }
开发者ID:KBO-Techo-Dev,项目名称:5000sCampaignAPI,代码行数:14,代码来源:AccountController.php


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