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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?php
 
 
class logout_model extends model{
 
    /**
     * @desc   注销账号申请列表
     * @param  $whereData :查询条件
     * @param   string[] $data
     * @return array|bool|false|string|void
     */
    public function getList($whereData , $data = array('utype'=>'')) 
    {  
        
        $List  =  $this->select_all('member_logout',$whereData);
        
        return $List;
    }
    
    public function getInfo($where = array())
    {
        $row  =  $this->select_once('member_logout',$where);
        return $row;
    }
 
    /**
     * 注销账号申请
     * @param array $data
     * @param array $p
     * @return array
     */
    public function apply($data = array(),$p = array())
    {
 
        $return =   array();
        // 验证密码
        $user   =   $this->select_once('member', array('uid' => $data['uid']), '`uid`,`usertype`,`password`,`salt`,`username`,`moblie`');
 
        $res    =   passCheck($p['password'], $user['salt'], $user['password']);
 
        if (!$res) {
 
            $return =   array(
                'msg'       =>  '密码错误',
                'errcode'   =>  8
            );
        } else {
 
            $data['ctime']      =   time();
            $data['status']     =   1;
            $data['username']   =   $user['username'];
            $data['tel']        =   $user['moblie'];
 
            $nid = $this->insert_into('member_logout', $data);
 
            require_once('log.model.php');
            $logM = new log_model($this->db, $this->def);
            $logM->addMemberLog($user['uid'], $user['usertype'], '申请注销账号', 31, 1);
 
            $msg = '注销账号申请';
 
            $return['msg'] = $nid ? $msg . '成功' : $msg . '失败 ';
            $return['errcode'] = $nid ? 9 : 8;
        }
        return $return;
    }
 
    /**
     * 注销账号申请处理
     * @param $where
     * @return array
     */
    public function status($where)
    {
        $return  =  array();
        if (!empty($where)){
            
            $row  =  $this->select_once('member_logout',$where);
            
            if (!empty($row)){
                
                $nid  =  $this->update_once('member_logout',array('status'=>2), $where);
                
                if ($nid){
                    
                    $member  =  $this->select_once('member',array('uid'=>$row['uid']),'`uid`,`username`,`moblie`,`email`');
                    
                    if (!empty($member)){
                        
                        // 用户名/手机号/邮箱,前后加字符串,地方绑定信息清空
                        $str  =  'out';
                        $arr  =  array(
                            'username'     =>  createstr(16),
                            'moblie'       =>  $str.'_'.$member['moblie'].'_'.$str,
                            'email'        =>  $str.'_'.$member['email'].'_'.$str,
                            'status'       =>  2,
                            'pwuid'        =>  0,
                            'pw_repeat'    =>  0,
                            'qqid'         =>  '',
                            'qqunionid'    =>  '',
                            'sinaid'       =>  '',
                            'wxid'         =>  '',
                            'wxopenid'     =>  '',
                            'unionid'      =>  '',
                            'wxname'       =>  '',
                            'wxbindtime'   =>  '',
                            'clientid'     =>  '',
                            'deviceToken'  =>  '',
                            'maguid'       =>  '',
                            'qfyuid'       =>  ''
                        );
 
                        $this->update_once('member',$arr, array('uid'=>$row['uid']));
 
                        $this->commonLock($row['uid'], array('r_status' => 2));
 
                        // 发送短信、邮件通知
                        $sendData  =  array(
                            'email'      =>  $member['email'],
                            'mobile'     =>  $member['moblie'],
                            'uid'        =>  $member['uid'],
                            'username'   =>  $member['username'],
                            'type'       =>  'logouted'
                        );
                        
                        require_once ('notice.model.php');
                        $noticeM   =  new notice_model($this->db, $this->def);
                        $noticeM -> sendEmailType($sendData);
                        $sendData['port']    =    '5';
                        $noticeM -> sendSMSType($sendData);
                    }
                    
                    $return['msg']      =  '注销账号申请(ID:'.$row['id'].')处理成功';
                    $return['errcode']  =  9;
                    
                }else{
                    
                    $return['msg']      =  '注销账号申请处理失败 ';
                    $return['errcode']  =  8;
                }
            }else{
                
                $return['msg']      =  '没有该注销申请';
                $return['errcode']  =  8;
            }
        }else{
            
            $return['msg']      =  '请选择需要处理的申请';
            $return['errcode']  =  8;
        }
        return $return;
    }
 
    private function commonLock($uid, $up)
    {
        $where = array('uid' => $uid);
 
        include_once('resume.model.php');
        $resumeM   =   new resume_model($this->db, $this->def);
 
        $this->update_once('resume', $up, $where);
        $this->update_once('company', $up, $where);
        $this->update_once('lt_info', $up, $where);
        $this->update_once('px_train', $up, $where);
 
        $expectdata = $up;
        if($up['r_status']!=1){
            $expectdata['state'] = 0;
        }
        $resumeM->setExpectState($expectdata,$where);
 
        $this->update_once('company_job', $up, $where);
        $this->update_once('partjob', $up, $where);
        $this->update_once('school_xjh', $up, $where);
        $this->update_once('lt_job', $up, $where);
        $this->update_once('px_subject', $up, $where);
        $this->update_once('px_teacher', $up, $where);
        $this->update_once('px_train_news', $up, $where);
        $this->update_once('gq_info', $up, $where);
        $this->update_once('gq_task', $up, $where);
    }
 
    /**
     * 注销账号申请删除
     */
    public function del($delId = null)
    {
        if (empty($delId)) {
            
            $return  =  array('errcode' => 8, 'msg' => '请选择要删除的数据!');
        } else {
            
            if (is_array($delId)) {
                
                $delId                =   pylode(',', $delId);
                
                $return['layertype']  =   1;
            } else {
                
                $return['layertype']  =   0;
            }
             
            $return['id']       =   $this -> delete_all('member_logout', array('id' => array('in', $delId)), '');
            
            $return['errcode']  =   $return['id'] ? 9 : 8;
            
            $msg                =   '注销账号申请(ID:'.pylode(',', $delId).')';
            
            $return['msg']      =   $return['id'] ? $msg.'删除成功!' : '删除失败!';
        }
        return $return;
    }
}
?>