Fix: blocking while get uptoken

pull/141/head
HFO4 7 years ago
parent 422f9d8d6a
commit 65dcedb3ca

@ -170,6 +170,6 @@ class File extends Controller{
}
}
return FileManage::createFolder($dirName,$dirPosition,$this->userObj->uid);
return json(FileManage::createFolder($dirName,$dirPosition,$this->userObj->uid));
}
}

@ -543,7 +543,9 @@ class FileManage extends Model{
$fileList = Db::name('files')->where('upload_user',$uid)->where('dir',$path)->select();
$dirList = Db::name('folders')->where('owner',$uid)->where('position',$path)->select();
$count= 0;
$fileListData=[];
$fileListData=[
"result"=>[],
];
foreach ($dirList as $key => $value) {
$fileListData['result'][$count]['name'] = $value['folder_name'];
$fileListData['result'][$count]['rights'] = "drwxr-xr-x";

@ -301,15 +301,15 @@ class LocalAdapter extends Model{
* @return array
*/
static function getThumbSize($width,$height){
$rate = $width/$height;
$maxWidth = 90;
$maxHeight = 39;
$changeWidth = 39*$rate;
$changeHeight = 90/$rate;
if($changeWidth>=$maxWidth){
return [(int)$changeHeight,90];
}
return [39,(int)$changeWidth];
// $rate = $width/$height;
// $maxWidth = 280;
// $maxHeight = 150;
// $changeWidth = 150*$rate;
// $changeHeight = 280/$rate;
// if($changeWidth>=$maxWidth){
// return [(int)$changeHeight,280];
// }
return [230,200];
}
/**

@ -31,6 +31,9 @@
allowShare:"{$groupData.allow_share}",
allowRemoteDownload:"{:explode(",",$groupData.aria2)[0]}",
allowTorrentDownload:"{:explode(",",$groupData.aria2)[1]}",
};
apiURL={
imgThumb:"/File/Thumb"
};
</script>
</head>

@ -714,7 +714,7 @@ function QiniuJsSDK() {
logger.debug("get uptoken from: ", that.uptoken_url);
// TODO: use mOxie
var ajax = that.createAjax();
ajax.open('GET', that.uptoken_url, false);
ajax.open('GET', that.uptoken_url, true);
ajax.setRequestHeader("If-Modified-Since", "0");
// ajax.onreadystatechange = function() {
// if (ajax.readyState === 4 && ajax.status === 200) {
@ -723,6 +723,7 @@ function QiniuJsSDK() {
// }
// };
ajax.send();
ajax.onload = function (e){
if (ajax.status === 200) {
var res = that.parseJSON(ajax.responseText);
that.token = res.uptoken;
@ -775,6 +776,11 @@ function QiniuJsSDK() {
} else {
logger.error("get uptoken error: ", ajax.responseText);
}
}
ajax.onerror = function (e){
logger.error("get uptoken error: ", ajax.responseText);
}
} else if (op.uptoken_func) {
logger.debug("get uptoken from uptoken_func");
that.token = op.uptoken_func(file);

Loading…
Cancel
Save