chengkun
2025-04-18 1bb985f32f2efe0f9dd69f3cf29a1c809b1cf96d
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
<?php
/* *
* $Author :PHPYUN开发团队
*
* 官网: http://www.phpyun.com
*
* 版权所有 2009-2021 宿迁鑫潮信息技术有限公司,并保留所有权利。
*
* 软件声明:未经授权前提下,不得用于商业运营、二次开发以及任何形式的再次发布。
*/
class forgetpw_controller extends wxapp_controller{
    function sendcode_action(){
        $sendtype     = $_POST['sendtype'];
        $noticeM     = $this->MODEL('notice');
        if ($sendtype=='moblie') {
            $sended = $_POST['moblie'];
            $type    = 'msg';
            
            $this->checkMcsdk($sended);
            
        }elseif ($sendtype=='email'){
            $sended = $_POST['email'];
            $type    = 'email';
        }
        $port        =    $this->plat == 'mini' ? '3' : '4';    // 短信发送端口$port : 3-小程序  4-APP
        $result     =   $noticeM->sendCode($sended, 'getpass', $port, array(), 6 , 120, $type);
        if($result['error']==1){
            $errcode    =    1;
        }else{
            $errcode    =    2;
            $msg        =    $result['msg'];
        }
        $this->render_json($errcode,$msg);
    }
    function checksendcode_action(){
        $moblie        =    $_POST['moblie'];
        $email        =    $_POST['email'];
        
        $userinfoM    =    $this->MODEL("userinfo");
        $companyM    =    $this->MODEL("company");
        $noticeM    =    $this->MODEL("notice");
        
        if($_POST['sendtype']=='email'){
            $info    =     $userinfoM->getInfo(array('email'=>$email),array("field"=>"`uid`,`username`,`email`"));
            $check    =    $info['email'];
        }elseif($_POST['sendtype']=='moblie'){
            $info    =     $userinfoM->getInfo(array('moblie'=>$moblie),array("field"=>"`uid`,`username`,`moblie`"));
            $check    =    $info['moblie'];
        }
        $cert        =     $companyM->getCertInfo(array("uid"=>$info['uid'],"type"=>"7","check"=>$check,'orderby'=>'ctime,desc'));
        $codeTime   =   $noticeM -> checkTime($cert['ctime']);
        
        if (!$codeTime) {
            $msg    =    "验证码验证超时,请重新验证!";
            $error    =    2;
        }else if(($_POST['mobliecode']!=$cert['check2'])||(!$cert)){
            $msg    =    "验证码错误";
            $error    =    2;
        }else{
            $error    =    1;
            $data['user']    =    array('uid'=>$info['uid'],'username'=>$info['username']);
        }
        $this->render_json($error,$msg,$data['user']);
    }
    function checklink_action(){
        
        $username        =    $_POST['username'];
        $userinfoM        =    $this->MODEL("userinfo");
        $member         =     $userinfoM->getInfo(array('username'=>$username),array("field"=>"`uid`,`username`"));
        
        if($member['username']==""){
            $msg        =    "用户名不存在!";
            $error        =    2;
        }else if(CheckRegUser($username)==false && CheckRegEmail($username)==false){
            $msg        =    "用户名包含特殊字符!";
            $error        =    2;
        }else{
            $shensu        =    $_POST['linkman'].'-'.$_POST['linkphone'].'-'.$_POST['linkemail'];
            $nid         =     $userinfoM->upInfo(array('username'=>$username),array('appeal'=>$shensu,'appealtime'=>time(),'appealstate'=>'1'));
            if ($nid){
                $error    =    1;
            }
        }
        $this->render_json($error,$msg);
        
    }
    function editpw_action(){
        $username    =    $_POST['username'];
        $uid        =    $_POST['uid'];
        
        $moblie        =    $_POST['moblie'];
        $email        =    $_POST['email'];
        $code        =    $_POST['code'];
 
        if($username!=''&&$uid!=''){
            
            $userinfoM        =    $this->MODEL("userinfo");
            $companyM        =    $this->MODEL("company");
            $noticeM        =    $this->MODEL("notice");
            if(!empty($email)){
                $info         =     $userinfoM->getInfo(array('email'=>$email),array("field"=>"`uid`,`username`,`email`"));
                $check        =    $info['email'];
            }elseif(!empty($moblie)){
                $info         =     $userinfoM->getInfo(array('moblie'=>$moblie),array("field"=>"`uid`,`username`,`moblie`"));
                $check        =    $info['moblie'];
            }
            
            $cert             =     $companyM->getCertInfo(array("uid"=>$info['uid'],"type"=>"7","check"=>$check,'orderby'=>'ctime,desc'),array("field"=>"`uid`,`check2`,`ctime`,`id`"));
            
            $codeTime       =   $noticeM -> checkTime($cert['ctime']);
            
            $pwmsg                =   regPassWordComplex($_POST['password']);
 
            if (!$codeTime) {
                $msg        =    "短信验证码验证超时,请重新验证!";
                $error        =    2;
            }else  if(($code!=$cert['check2'])||(!$cert)){
                $msg        =    "验证码错误";
                $error        =    2;
            }else if($pwmsg!=''){
                $msg        =    $pwmsg;
                $error        =    2;
            }else{
                $info         =     $userinfoM->getInfo(array('uid'=>$uid),array("field"=>"`uid`,`username`,`email`,`moblie`,`name_repeat`"));
                
                if ($username==$info['username']){
                    $password     =     $_POST['password'];
                    $userinfoM  ->  upInfo(array("uid"=>$uid),array("password"=>$password));
                    
                    $msg        =    "密码修改成功";
                    $error        =    1;
                }else{
                    $msg        =    "对不起,没有该用户";
                    $error        =    2;
                }
            }
        }else{
            $msg        =    "对不起,没有该用户";
            $error        =    2;
        }
        $this->render_json($error,$msg);
    }
    
    function getTel_action(){
        $data    =    array(
            'telphone'    =>    $this->config['sy_freewebtel'],
            'reg_pw_sp' =>  $this->config['reg_pw_sp'],
            'reg_pw_zm' =>  $this->config['reg_pw_zm'],
            'reg_pw_num'=>  $this->config['reg_pw_num'],
        );
        $this->render_json(1,'',$data);
    }
}
?>