图集1/5

正文 1850字数 1,320,217阅读

<?php namespace Addons\Yaoyiyao\Controller; use Home\Controller\AddonsController; class YaoyiyaoController extends AddonsController{ var $model; function _initialize() { $this->model = $this->getModel ( 'yaoyiyao' ); parent::_initialize (); $act = strtolower ( _ACTION ); $type = I ( 'type' ); $res ['title'] = '列表'; $res ['url'] = addons_url ( 'Yaoyiyao://Yaoyiyao/lists' ); $res ['class'] = $act == 'lists' || $type == 'text' ? 'current' : ''; $nav [] = $res; $res ['title'] = '设置'; $res ['url'] = addons_url ( 'Yaoyiyao://Yaoyiyao/config' ); $res ['class'] = $act == 'config' || $type == 'config' ? 'current' : ''; $nav [] = $res; $res ['title'] = '清零'; $res ['url'] = addons_url ( 'Yaoyiyao://Yaoyiyao/dc' ); $res ['class'] = $act == 'dc' || $type == 'dc' ? 'current' : ''; $nav [] = $res; $this->assign ( 'nav', $nav ); } public function dc() { if($_GET['del']=='ok'){ $map['numm']=0; $mapw['id']=array('gt',0); M('yaoyiyao')->where($mapw)->save($map); header('Location:/index.php?s=/addon/Yaoyiyao/Yaoyiyao/lists.html'); exit; } $templateFile = $this->model ['template_list'] ? $this->model ['template_list'] : ''; $this->display ( $templateFile ); } // 通用插件的列表模型 public function lists() { $map ['token'] = get_token (); $list_data = $this->_get_model_list ( $this->model,0,'numm desc' ); foreach($list_data['list_data'] as &$lv){ $lk++; if($_GET['p']<2) $_GET['p']=0; $lkn=$lk+($_GET['p']*10); $lv['user']=$lv['user'].' (第'.$lkn.'名)'; } $this->assign ( $list_data ); $templateFile = $this->model ['template_list'] ? $this->model ['template_list'] : ''; $this->display ( $templateFile ); } }
Run code
Cut to clipboard