chengkun
2025-05-22 1a8aea45ebb1582c9f65d9e8dcd520002f83ae12
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
<?php
 
 
class binding_controller extends company{
    /*
    查看认证和绑定页面
    **/
    function index_action(){
        
        $this   ->  company_satic();
        $this   ->  public_action();
 
        $company    =    $this -> comInfo['info'];
        $this -> yunset("company", $company);
        
        $uid        =   intval($this->uid);
        
        $UserinfoM  =   $this -> MODEL('userinfo');
        $member     =   $UserinfoM -> getInfo(array('uid'=> $uid), array('setname'=>'1'));
        $this -> yunset("member", $member);
        
        $comM        =   $this -> MODEL('company');
        $cert       =   $comM -> getCertInfo(array('uid'=>$uid, 'type'=>'3'));
        $this ->  yunset("cert",$cert);
        
        $this ->  com_tpl("binding");
    }
    
    /**
     * @desc 企业会员中心绑定手机
     */
    function save_action(){
        
        $CookieM   =   $this->MODEL('cookie');
        $CookieM   ->  SetCookie('delay', '', time() - 60);
        
        $ComapnyM  =   $this->MODEL('company');
        
        $data      =   array(
            'uid'        =>    $this->uid,
            'usertype'    =>    $this->usertype,
            'moblie'    =>    $_POST['moblie']
        );
        if(!$this -> comInfo['uid']){
            $userinfoM    =   $this->MODEL("userinfo");
            $userinfoM -> activUser($this->uid,2);
        }
        $errCode   =   $ComapnyM -> upCertInfo(array('uid'=>$this->uid, 'check2'=>$_POST['code']), array('status'=>'1'), $data);
 
        echo $errCode; die;
    }
    /**
    查看企业资质认证页面
    */
    function comcert_action(){
 
 
        $this   ->  company_satic();
        $this   ->  public_action();
        
        $uid        =   intval($this->uid);
 
        $company    =   $this -> comInfo['info'];
        $this -> yunset("company", $company);
        $comM       =   $this -> MODEL('company');
        $cert       =   $comM -> getCertInfo(array('uid'=>$uid, 'type'=>'3'));
        $this ->  yunset("cert",$cert);
 
        $this ->  com_tpl("comcert");
    }
    
    /**
     * @desc 企业会员中心,企业认证
     */
    function savecert_action(){
        
        $_POST = $this->post_trim($_POST);
 
        $ComapnyM  =   $this->MODEL('company');
 
        $CookieM   =   $this->MODEL('cookie');
        $CookieM   ->  SetCookie('delay', '', time() - 60);
        
        $uid       =   intval($this->uid);
        $usertype  =   intval($this->usertype);
 
        $row       =   $ComapnyM -> getCertInfo(array('uid'=>$uid, 'type' => '3'));
        
        if($this ->comInfo['r_status']==0){
            $status=   0;
        }else{
            $status=   $this->config['com_cert_status'] == '1' ? 0 : 1;
        }
        /* 更新企业资质参数整理 */
        $upData    =   array(
            'status'    =>  $status,
            'ctime'     =>  time()
        );
        //判断是否上传必要资质
        $errcode     =   0;
        $msg         =   '必须上传';
        $douhao      =   false;
 
        if($this->config['com_social_credit']==1 && !$_POST['social_credit']){
            if($douhao){
                $msg     .= ',';
            }
            $douhao  =   true;
            $msg     .=  '统一社会信用代码';
            $errcode =   8;
        }
 
        if($this->config['com_cert_owner']==1 && !$_FILES['owner_cert']['tmp_name'] && !$row['owner_cert']){
            if($douhao){
                $msg     .= ',';
            }
            $douhao  =   true;
            $msg     .=  '经办人身份证';
            $errcode =   8;
        }
        
        if($this->config['com_cert_wt']==1 && !$_FILES['wt_cert']['tmp_name'] && !$row['wt_cert']){
            if($douhao){
                $msg     .= ',';
            }
            $douhao  =   true;
            $msg     .=   '委托函';
            $errcode =   8;
        }
        
        if($errcode==8){
            $this->ACT_layer_msg($msg,8,$_SERVER['HTTP_REFERER']);
        }
        //判断是否上传必要资质end
        if($_POST['social_credit']){
            $upData['social_credit'] = $_POST['social_credit'];
        }
        if($_FILES['check'] && $_FILES['check']['tmp_name']){
            $upData['check'] = $_FILES['check'];
        }
        if($_FILES['owner_cert'] && $_FILES['owner_cert']['tmp_name']){
            $upData['owner_cert'] = $_FILES['owner_cert'];
        }
        if($_FILES['wt_cert'] && $_FILES['wt_cert']['tmp_name']){
            $upData['wt_cert'] = $_FILES['wt_cert'];
        }
        if($_FILES['other_cert'] && $_FILES['other_cert']['tmp_name']){
            $upData['other_cert'] = $_FILES['other_cert'];
        }
        
        if (!empty($row) && is_array($row) && $row['ctime']) {
            
            $err   =   $ComapnyM -> upCertInfo(array('id'=>intval($row['id']), 'uid' => $uid), $upData, array('yyzz' => '1', 'usertype' => $usertype, 'com_name'=>trim($_POST['company_name']),'type'=>'3'));
            
        }else{
            
            /* 新增企业资质认证参数整理,包含自定义查询参数  */
            $postData  =   array(
                
                'uid'      =>  $uid,
                'type'     =>  '3',
                'step'     =>  '1',
                'did'      =>  $this->userdid,
                'usertype' =>  $usertype,
                'com_name' =>  trim($_POST['company_name'])
            );
            
            $postData  =   array_merge($postData, $upData);
            //容错机制,在未生成企业身份时提前企业资质认证会出错
            if(!$this -> comInfo['info']['uid']){
                $userinfoM    =   $this->MODEL("userinfo");
                $userinfoM -> activUser($uid,2);
            }
            $err       =   $ComapnyM -> addCertInfo($postData);
        }
        
        
        $this->ACT_layer_msg($err['msg'],$err['errcode'],$_SERVER['HTTP_REFERER']);
        
    }
    /**
     * @desc 解除绑定   
     */
    function del_action(){
        
        $companyM    =    $this->MODEL('company');
        
        $return     =    $companyM->delBd($this->uid,array('type'=>$_GET['type'],'usertype'=>$this->usertype));
        
        $this->layer_msg($return['msg'],$return['errcode'],0,$_SERVER['HTTP_REFERER']);
    }
}
?>