public function downloadFile(\proto\DownloadParam $param) { $filename = $param->filepath; $offer_set = $param->offerset; $token = $param->token; $token_c = new \lib\Token_Core(); $token = $token_c->grante_key(); $ret_h = new \proto\RetHead(array('ret' => 0, 'errmsg' => 'downloadFile=>' . $token . '|' . filepath)); $bin = 'file read bin'; $ret_arr = array('result' => $ret_h, 'offerset' => 512, 'token' => $token, 'bin' => $bin); $ret_d = new DownloadResult($ret_arr); return $ret_d; }
public function GetMobileNumber($token) { $ret = array('ret' => 4, 'msg' => 'query mobile number token invalid!'); $token_c = new \lib\Token_Core(); $req_phone = ''; $proxy = "http://182.92.97.3:13128"; if ($token_c->is_token($token)) { $json_file = session('user_upload_path') . DIRECTORY_SEPARATOR . $token . DIRECTORY_SEPARATOR . "get_net.json"; $json_data = file_get_contents($json_file); $json_Array = json_decode($json_data, true); $err_code = $json_Array['ErrCode']; $hand_desc = $json_Array['Description']; $hand_appkey = $json_Array['appkey']; $hand_token = $json_Array['token']; $hand_url = $json_Array['Url']; $hand_unikey = $json_Array['unikey']; $astring = "appKey=\"" . $hand_appkey . "\",token=\"" . $hand_token . "\""; $req_header[0] = "Accept: text/plain"; $req_header[] = "Content-Type: text/plain;charset=UTF-8"; $req_header[] = "Connection: keep-alive"; $req_header[] = "Keep-Alive: 300"; $req_header[] = "Authorization: " . $astring; $req_header[] = "Accept-Language: en-us,en;q=0.5"; $req_url_3 = $hand_url . '/' . $hand_unikey; $req_phone = get_proxy($req_url_3, $proxy, $req_header); $ret['ret'] = 0; $ret['msg'] = ''; } $ret_h = new \proto\RetHead($ret); $ret_net = new NetMobileNumberResult(array('result' => $ret_h, 'url' => $req_phone)); return $ret_net; }
public function DeleteBucketAllObj($token, $ftype) { $ret = array('ret' => 4, 'msg' => 'delete user bucket all object token invalid!'); $token_c = new \lib\Token_Core(); $ualias = ''; if ($token_c->is_token($token)) { $host = CEPH_HOST; $aws_key = session('user_key'); $aws_secret_key = session('user_secret_key'); $conn = new cephService($host, $aws_key, $aws_secret_key); $bucket_name = self::_get_bucket_name_by_ftype($ftype); $del_ret = $conn->deleteAllObjectByBucket($bucket_name); if ($del_ret) { $ret = array('ret' => 0, 'msg' => ''); } else { $ret = array('ret' => 2, 'msg' => 'delete all object failed!'); } } $ret_h = new \proto\RetHead($ret); return $ret_h; }