chengkun
2025-04-30 6ab292fb7415be124651e312ec4f21c594568f17
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
 
/**
* 订阅管理
* @author 鑫潮-卢光露
* @date    2015-12-30 
*/
class subscribe_controller extends company{
    function index_action(){
        
        $userinfoM        =    $this -> MODEL('userinfo');
 
        $WxM            =    $this -> MODEL('weixin');
        
        $userInfo        =    $userinfoM -> getInfo(array('uid'=> $this -> uid), array('field' => '`wxid`, `wxopenid`'));
        if(empty($userInfo['wxid']) || empty($userInfo['wxopenid'])){
            $qrcode    =    $WxM -> applyWxQrcode($_COOKIE['wxloginid'], '', $this->uid);
            $this->yunset("qrcode",$qrcode);
        }
        $where['uid']    =  $this->uid;
        $where['type']    =  2;
        $urlarr['c']    =    $_GET['c'];
        $urlarr['page']    =    '{{page}}';
         $pageurl        =    Url('member',$urlarr);
 
        $pageM            =    $this->MODEL('page');
        $pages            =    $pageM->pageList('subscribe',$where,$pageurl,$_GET['page']);
        
        if($pages['total'] > 0){
            $where['orderby']        =    'id';
            $where['limit']            =    $pages['limit'];
            
            $subscribeM  =  $this->MODEL('subscribe');
            
            $List       =  $subscribeM->getList($where);
        }
        
 
        $this->yunset("rows",$List);
        $this->company_satic();
        $this->public_action();
        $this->com_tpl('subscribe');
    }
    function subscribedingyue_action(){
        
        $userinfoM    =    $this -> MODEL('userinfo');
 
        $WxM        =    $this -> MODEL('weixin');
 
        $userInfo   =  $userinfoM -> getInfo(array('uid'=> $this -> uid), array('field' => '`wxid`, `wxopenid`'));
 
        if(empty($userInfo)){
            
            echo 1;die;
        }
        
        if($this->usertype && $this->usertype != 1 && $this->usertype != 2){
            
            echo 2;die;//只有个人和企业用户才可订阅!
        }
        //判断微信是否开启
        if(empty($userInfo['wxid']) && empty($userInfo['wxopenid'])){
            $qrcode    =    $WxM -> applyWxQrcode($_COOKIE['wxloginid'], '', $this->uid);
            if(empty($qrcode)){
                echo 3;die;
            }else{
                echo 4;die;
            }
        }else{
            //直接跳转
            echo 5;die;
        }
 
    }
    function record_action(){
        $where['uid']    =  $this->uid;
        $where['type']    =  2;
        $urlarr['c']    =    $_GET['c'];
        $urlarr['act']    =    $_GET['act'];
        $urlarr['page']    =    '{{page}}';
        $pageurl        =    Url('member',$urlarr);
 
        $pageM            =    $this->MODEL('page');
        $pages            =    $pageM->pageList('subscriberecord',$where,$pageurl,$_GET['page']);
        
        if($pages['total'] > 0){
            $where['orderby']        =    'id';
            $where['limit']            =    $pages['limit'];
            
            $subscribeM  =  $this->MODEL('subscribe');
            
            $List       =  $subscribeM->getRecordList($where);
        } 
        $this->yunset("rows",$List);
        $this->public_action();
        $this->com_tpl('subscriberecord');
    }  
    function del_action(){
        if($_POST['delid']||$_GET['id']){
            if ($_GET['id']){
                $id   =  intval($_GET['id']);
            }elseif ($_POST['delid']){
                $id   =  $_POST['delid'];
            }
            $subscribeM        =  $this->MODEL('subscribe');
            $return           =  $subscribeM -> del($id,array('uid'=>$this->uid,'usertype'=>$this->usertype));
            $this -> layer_msg($return['msg'],$return['errcode'],$return['layertype'],$_SERVER['HTTP_REFERER']);
        }
    }
}
?>