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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
 
class atn_controller extends user_controller{
    //关注的企业列表
    function atncom_action()
    {
        $atnM        =    $this->MODEL('atn');
        $page        =    $_POST['page'];
        $limit        =    $_POST['limit'];
        $limit        =    !$limit?20:$limit;
        
        $where['uid']                =    $this->member['uid'];
        if($_POST['utype']=='company') {
            $where['sc_usertype'] = '2';
            $where['PHPYUNBTWSTART']    =    '' ;
            $where['xjhid'][]            =    array('=',0) ;
            $where['xjhid'][]            =    array('isnull','','OR') ;
            $where['PHPYUNBTWEND']        =    '' ;
        }elseif ($_POST['utype']=='lietou'){
            $where['sc_usertype'] = '3';
        }elseif ($_POST['utype']=='academy'){
            $where['sc_usertype'] = '5';
        }elseif ($_POST['utype']=='xjh'){
            $where['sc_usertype'] = '2';
            $where['xjhid']        =    array('<>','');
        }
 
        $total = $atnM->getatnNum($where);
        $where['orderby']            =    'id,desc';
        if($page){
            $pagenav        =    ($page-1)*$limit;
            $where['limit']    =    array($pagenav,$limit);
        }else{
            $where['limit']    =    array('',$limit);
        }
        $List                =    $atnM->getatnList($where,array('utype'=>$_POST['utype'],'wap'=>$_POST['wap']));
        if(!empty($List)){
            $list            =    count($List)?$List:array();
            $error            =    1;
        }else{
            $error            =    2;
        }
        $this->render_json($error,'',$list,$total);
    }
    //保存关注企业
    function atncompany_action()
    {
        $id                =    (int)$_POST['id'];
        $userinfoM        =    $this->MODEL('userinfo');
 
        $data            =    array(
            'id'            =>    $id,
            'uid'            =>    $this->member['uid'],
            'usertype'        =>    '1',
            'sc_usertype'    =>    '2',
            'utype'            =>    'teacher',
            'username'        =>    $this->member['username']
        );
        $atnM            =    $this->MODEL('atn');
        $return            =    $atnM->addAtnLt($data);
        $data['error']    =    $return['errcode'];
        $data['msg']    =    $return['msg'];
        $this->render_json($data['error'],$data['msg']);
        
    }
    //取消关注企业
    function delatncom_action()
    {
        $utype          =   isset($_POST['utype']) ? $_POST['utype'] : '';
        $cuid            =    intval($_POST['cuid']);
        $id             =    intval($_POST['id']);
        
        $atnM            =    $this->MODEL('atn');
        if ($utype == 'xjh'){
            $return     =    $atnM->delAtnAll($id,array('sc_usertype'=>2,'xjh'=>1,'uid'=>$this->member['uid'],'usertype'=>'1'));
        }else{
            if ($utype == 'lietou'){
                $sc_usertype = 3;
            }elseif ($utype == 'academy'){
                $sc_usertype = 5;
            }else{
                $sc_usertype = 2;
            }
            $return     =    $atnM->delAtnAll($id,array('sc_uid'=>$cuid,'sc_usertype'=>$sc_usertype,'uid'=>$this->member['uid'],'usertype'=>'1'));
        }
        $data['error']    =    $return['errcode'];
        $data['msg']    =    $return['msg'];
        $this->render_json($data['error'],$data['msg'],'');
    }
    
}