chengkun
2025-05-26 8f3df543230cd4403368b39b9bbe5726d11a0284
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
 
class comnews_controller extends adminCommon{
    function index_action(){
        $CompanyM         =     $this->MODEL('company');
        $where            =    array();
        $urlarr['c']    =    $_GET['c'];
        $urlarr['page']    =    "{{page}}";
        $pageurl        =    Url($_GET['m'],$urlarr,'admin');
        $pageM    =    $this  -> MODEL('page');
        $pages    =    $pageM -> pageList('company_news',$where,$pageurl,$_GET['page']);
        if($pages['total'] > 0){
            $where['orderby']    =    'id';
            $where['limit']        =    $pages['limit'];
            $rows                =    $CompanyM -> getCompanyNewsList($where);
        }
        $this->yunset("rows",$rows);
        $this->yunset('backurl','index.php?c=company');
        $this->yunset("headertitle","企业新闻");
        $this->yuntpl(array('wapadmin/admin_comnews'));
    }
    function show_action(){
        $CompanyM    =    $this->MODEL('company');
        $row        =    $CompanyM->getCompanyNewsLockInfo(intval($_GET['id']));
        $lasturl    =    $_SERVER['HTTP_REFERER'];
        if(strpos($lasturl, 'a=show')===false){
            if(strpos($lasturl, 'c=comnews')!==false){
                $this->cookie->setcookie('lasturl',$lasturl,time()+300);
                $_COOKIE['lasturl']    =    $lasturl;
            }
        }
        $this->yunset('lasturl',$_COOKIE['lasturl']);
        $this->yunset('row',$row);
        $this->yunset("headertitle","企业新闻设置");
        $this->yuntpl(array('wapadmin/admin_comnews_show'));
    }
    function status_action(){
        $CompanyM    =    $this -> MODEL('company');
        $SysmsgM     =     $this -> MODEL('sysmsg');
        if($_POST['id']){
            $statusData        =    array(
                'status'        =>    intval($_POST['status']),
                'statusbody'    =>    trim($_POST['statusbody']),
            );
            $nid    =    $CompanyM -> upCompanyNewsStatus(intval($_POST['id']),$statusData);
             if ($_POST['lasturl']!=''){
                $lasturl    =    $this->post_trim($_POST['lasturl']);
            }else{
                $lasturl    =    $_SERVER['HTTP_REFERER'];
            }
            if($nid){
                $this->layer_msg('企业新闻审核(ID:'.$_POST['id'].')设置成功!',9,0,$lasturl);
            }else{
                $this->layer_msg('设置失败!',8);
            }
        }
    }
    function del_action(){
        $CompanyM    =    $this -> MODEL('company');
        if($_GET['id']){
            $return    =    $CompanyM -> delCompanyNews(intval($_GET['id']),array('uid'=>$this->uid,'usertype'=>$this->usertype));
            if($return['errcode']==9){
                $this->layer_msg($return['msg'],$return['errcode'],$return['layertype'],'index.php?c=comnews');
            }else{
                $this->layer_msg($return['msg'],$return['errcode'],$return['layertype'],$_SERVER['HTTP_REFERER']);
            }
        }
    }
}
?>