IndexController.class.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace Home\Controller;
  3. class IndexController extends HomeController
  4. {
  5. protected function _initialize()
  6. {
  7. parent::_initialize();
  8. $allow_action = array("index","gglist","gginfo");
  9. if (!in_array(ACTION_NAME,$allow_action)) {
  10. $this->error("非法操作!");
  11. }
  12. }
  13. //网站首页面
  14. public function index(){
  15. $list = M("ctmarket")->where(array('status'=>1))->field("coinname,id")->select();
  16. $this->assign("market",$list);
  17. $this->display();
  18. }
  19. //公告中心
  20. public function gglist(){
  21. $list = M("content")->where(array('status'=>1))->select();
  22. $this->assign("list",$list);
  23. $this->display();
  24. }
  25. //公告详情
  26. public function gginfo($id = null){
  27. if (checkstr($id)) {
  28. $this->error(L('您输入的信息有误'));
  29. }
  30. $info = M("content")->where(array('id'=>$id))->find();
  31. if(empty($info)){
  32. redirect('/Index/gglist.html');
  33. }
  34. $this->assign("info",$info);
  35. $this->display();
  36. }
  37. }
  38. ?>