public function indexAction() { $id = \Comm\Arg::get('id', FILTER_VALIDATE_INT); //获取模板基础内容 $theme = Model\Theme\Main::show($id); if (empty($theme)) { throw new \Exception\Msg('指定模板不存在'); } //权限验证 Model\User::validateAuth($theme['user_id']); //获取资源内容 $resource = Model\Theme\Resource::showByTheme($theme); $this->viewDisplay(array('theme' => $theme, 'resource' => $resource)); }
public function indexAction() { $id = Comm\Arg::get('id', FILTER_VALIDATE_INT); $result = Model\Theme\Resource::show($id); if (empty($result)) { throw new Exception\Msg('指定模板资源不存在'); } //判断是否为只读 $main = Model\Theme\Main::show($result['tpl_id']); try { Model\User::validateAuth($main['user_id']); $readonly = false; } catch (Exception $e) { $readonly = true; } Comm\Response::json(100000, 'succ', array('content' => $result['content'], 'readonly' => $readonly), false); }