コード例 #1
0
ファイル: chdserver.php プロジェクト: hzshark/cloudharddisk
 public function DeleteUser($umobile, $captcha)
 {
     $del_ret = array('ret' => 0, 'msg' => '' . C("NET_ROLES"));
     if ($captcha == C("NET_ROLES")) {
         $user = new UserService();
         $u = $user->queryUser($umobile);
         if ($u) {
             $userid = $u['userid'];
             session('username', $umobile);
             session('userid', $userid);
             $user_ceph = $user->queryCephAuth($userid);
             $host = CEPH_HOST;
             $aws_key = session('user_key');
             $aws_secret_key = session('user_secret_key');
             $del_ret = array('ret' => 2, 'msg' => 'delete userid ' . $userid);
             $conn = new cephService($host, $aws_key, $aws_secret_key);
             $userTypes = self::_get_user_all_ftype();
             foreach ($userTypes as $type) {
                 $bucketname = self::_get_bucket_name_by_ftype($type);
                 $conn = new cephService($host, $aws_key, $aws_secret_key);
                 $cb_ret = $conn->deleteUserBucket($bucketname);
                 if ($cb_ret) {
                     $del_ret['ret'] = 0;
                     $del_ret['msg'] .= 'delete user bucket ' . $bucketname . ' successful!';
                 } else {
                     $del_ret['ret'] = 2;
                     $del_ret['msg'] = 'delete user bucket ' . $bucketname . ' failed!';
                     break;
                 }
             }
             $user->deleteCephAuth($userid);
             $user->deleteUserMobile($userid);
             $user->deleteUserSpace($userid);
             $user->delUser($umobile);
         }
     } else {
         $del_ret['ret'] = 3;
         $del_ret['msg'] = 'captcha value failed!' . C("NET_ROLES");
     }
     $ret_h = new \proto\RetHead($del_ret);
     return $ret_h;
 }