chengkun
2025-05-23 a6f7b382623096b6a00924f418447cf5204e825e
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
 
 
/**
 * 订阅管理
 * @date    2019-10-25
 */
class subscribe_controller extends user
{
 
    function index_action()
    {
        $this -> public_action();
 
        $subscribeM =   $this->MODEL('subscribe');
 
        $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']  =   1;
 
        $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'];
            $List               =   $subscribeM->getList($where);
        }
        $this->yunset('rows', $List);
        $this->yunset("js_def", 3);
        $this->user_tpl('subscribe');
    }
    //发送记录
    function record_action()
    {
        $this->public_action();
        $where['uid']   =   $this->uid;
        $where['type']  =   1;
        $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->yunset("js_def", 3);
        $this->user_tpl('subscriberecord');
    }
    //删除职位订阅
    function del_action()
    {
        $subscribeM     =   $this->MODEL('subscribe');
        if ($_GET['del'] || $_GET['id']) {
            
            if ($_GET['id']) {
            
                $id =   intval($_GET['id']);
            } elseif ($_POST['del']) {
                
                $id =   $_POST['del'];
            }
            
            $return =   $subscribeM->del($id, array('uid' => $this->uid, 'usertype' => $this->usertype));
            $this->layer_msg($return['msg'], $return['errcode'], $return['layertype'], $_SERVER['HTTP_REFERER']);
        }
    }
    //订阅前检查
    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();
        }
    }
}
?>