public function invoke() { $filter = new MUserFilter(); $filter->oauth2Judge(); //check user auth $user = MUserManager::getInstance()->getCurrentUser(); $userId = $user["id"]; $user = MiniUser::getInstance()->getUser($userId); if ($user["is_admin"] !== true) { throw new MiniException(1200); } parent::invoke(); }
<div class="row-fluid"> <div class="col-lg-12 col-md-12 col-sm-12"> <?php if ($form->isSubmitted() && $form->validate()) { try { $data = $form->getValue(); AnonymousController::register($data); foreach ($form->getElements() as $element) { if ($element instanceof HTML_QuickForm2_Element_Captcha) { $element->clearCaptchaSession(); } } AnonymousController::sendConfirmationEmail($data["mail"]); // echo ViewHelper::redirect(BASE_URL); } catch (PDOException $exc) { AnonymousController::register(); } } else { echo $form; } ?> </div> </div> </div> </div> </div> </div> </div> </div> </div> </body>
* 迷你云匿名接口访问入口. * * @author app <*****@*****.**> * @link http://www.miniyun.cn * @copyright 2014 Chengdu MiniYun Technology Co. Ltd. * @license http://www.miniyun.cn/license.html * @since 1.6 */ date_default_timezone_set("PRC"); defined('YII_DEBUG') or define('YII_DEBUG', false); @ini_set('display_errors', '1'); error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); // change the following paths if necessary $config = dirname(__FILE__) . '/protected/config/main.php'; $yii = dirname(__FILE__) . '/yii/framework/yii.php'; // specify how many levels of call stack should be shown in each log message defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 8); // 客户端请求 defined('CLIENT_REQUEST_API') or define('CLIENT_REQUEST_API', TRUE); require_once $yii; Yii::createWebApplication($config); header('Access-Control-Allow-Origin: http://static.miniyun.cn'); header('Access-Control-Allow-Methods: POST'); header('Access-Control-Allow-Methods: GET'); MiniAppParam::getInstance()->load(); //初始化APP静态数据 MiniPlugin::getInstance()->load(); //加载插件 $meta = new AnonymousController(); //通过meta的控制器进行跳转处理逻辑 $meta->invoke();
}, "customer/login" => function () { if (isset($_SESSION["active"]) && $_SESSION["role"] == "customer") { ViewHelper::redirect(BASE_URL . "customer"); } elseif ($_SERVER["REQUEST_METHOD"] == "POST") { CustomerController::check(); } else { CustomerController::login(); } }, "customer/logout" => function () { session_unset(); ViewHelper::redirect(BASE_URL); }, "product/detail" => function () { if (isset($_SESSION["active"]) && $_SESSION["role"] == "customer") { ViewHelper::redirect(BASE_URL . "customer"); } else { AnonymousController::productsDetail(); } }, "orders" => function () { if (isset($_SESSION["active"]) && $_SESSION["role"] == "customer") { CustomerController::orders(); } else { ViewHelper::redirect(BASE_URL); } }, "orders/detail" => function () { if (isset($_SESSION["active"]) && $_SESSION["role"] == "customer") { CustomerController::orderDetail(); } else { ViewHelper::redirect(BASE_URL); } }, "orders/canceled" => function () { if (isset($_SESSION["active"]) && $_SESSION["role"] == "customer") {
public function invoke() { parent::invoke(); }