Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
DoraemonKit
提交
eb7e3b16
D
DoraemonKit
项目概览
DiDi
/
DoraemonKit
大约 1 年 前同步成功
通知
166
Star
19623
Fork
3062
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DoraemonKit
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eb7e3b16
编写于
9月 17, 2020
作者:
M
mizikoi53
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
文件助手功能完成
上级
0413d4c6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
14 deletion
+49
-14
iOS/DoraemonKit/Src/Core/Plugin/Platform/FileSync/Function/DoraemonFileSyncManager.m
...ugin/Platform/FileSync/Function/DoraemonFileSyncManager.m
+49
-14
未找到文件。
iOS/DoraemonKit/Src/Core/Plugin/Platform/FileSync/Function/DoraemonFileSyncManager.m
浏览文件 @
eb7e3b16
...
...
@@ -191,6 +191,9 @@
-
(
GCDWebServerResponse
*
)
deleteRow
:(
GCDWebServerDataRequest
*
)
request
{
NSDictionary
*
data
=
[
NSJSONSerialization
JSONObjectWithData
:
request
.
data
options
:
0
error
:
nil
];
NSString
*
dirPath
=
data
[
@"dirPath"
];
if
([
dirPath
hasPrefix
:
@"/root"
])
{
dirPath
=
[
dirPath
substringFromIndex
:
5
];
}
NSString
*
fileName
=
data
[
@"fileName"
];
NSString
*
tableName
=
data
[
@"tableName"
];
NSArray
*
rowDatas
=
data
[
@"rowDatas"
];
...
...
@@ -241,6 +244,9 @@
-
(
GCDWebServerResponse
*
)
updateRow
:(
GCDWebServerDataRequest
*
)
request
{
NSDictionary
*
data
=
[
NSJSONSerialization
JSONObjectWithData
:
request
.
data
options
:
0
error
:
nil
];
NSString
*
dirPath
=
data
[
@"dirPath"
];
if
([
dirPath
hasPrefix
:
@"/root"
])
{
dirPath
=
[
dirPath
substringFromIndex
:
5
];
}
NSString
*
fileName
=
data
[
@"fileName"
];
NSString
*
tableName
=
data
[
@"tableName"
];
NSArray
*
rowDatas
=
data
[
@"rowDatas"
];
...
...
@@ -305,6 +311,9 @@
-
(
GCDWebServerResponse
*
)
getTableData
:(
GCDWebServerRequest
*
)
request
{
NSDictionary
*
query
=
request
.
query
;
NSString
*
dirPath
=
query
[
@"dirPath"
];
if
([
dirPath
hasPrefix
:
@"/root"
])
{
dirPath
=
[
dirPath
substringFromIndex
:
5
];
}
NSString
*
fileName
=
query
[
@"fileName"
];
NSString
*
tableName
=
query
[
@"tableName"
];
NSString
*
rootPath
=
NSHomeDirectory
();
...
...
@@ -351,6 +360,9 @@
-
(
GCDWebServerResponse
*
)
insertRow
:(
GCDWebServerDataRequest
*
)
request
{
NSDictionary
*
data
=
[
NSJSONSerialization
JSONObjectWithData
:
request
.
data
options
:
0
error
:
nil
];
NSString
*
dirPath
=
data
[
@"dirPath"
];
if
([
dirPath
hasPrefix
:
@"/root"
])
{
dirPath
=
[
dirPath
substringFromIndex
:
5
];
}
NSString
*
fileName
=
data
[
@"fileName"
];
NSString
*
tableName
=
data
[
@"tableName"
];
NSArray
*
rowDatas
=
data
[
@"rowDatas"
];
...
...
@@ -390,23 +402,17 @@
tableName(key_1,key_2,key_3)
VALUES
(value_1,value_2,value_3),
(value_4,value_5,value_6);
*/
[
rowDatas
enumerateObjectsUsingBlock
:
^
(
NSDictionary
*
_Nonnull
data
,
NSUInteger
idx
,
BOOL
*
_Nonnull
stop
)
{
NSMutableArray
*
arr
=
@[].
mutableCopy
;
[
colArr
enumerateObjectsUsingBlock
:
^
(
NSString
*
_Nonnull
colName
,
NSUInteger
idx
,
BOOL
*
_Nonnull
stop
)
{
id
value
=
data
[
colName
]
!=
nil
?
data
[
colName
]
:
@"NULL"
;
if
([
value
isKindOfClass
:[
NSString
class
]]
&&
!
[
value
isEqualToString
:
@"NULL"
])
{
value
=
[
NSString
stringWithFormat
:
@"'%@'"
,
value
];
}
[
arr
addObject
:
value
];
}];
NSString
*
values
=
[
arr
componentsJoinedByString
:
@","
];
[
allValues
addObject
:[
NSString
stringWithFormat
:
@"(%@)"
,
values
]];
id
value
=
data
[
@"value"
]
?
:
@"NULL"
;
if
([
value
isKindOfClass
:[
NSString
class
]]
&&
!
[
value
isEqualToString
:
@"NULL"
])
{
value
=
[
NSString
stringWithFormat
:
@"'%@'"
,
value
];
}
[
allValues
addObject
:
value
];
}];
}
NSString
*
allValuesStr
=
[
allValues
componentsJoinedByString
:
@","
];
NSString
*
allValuesStr
=
[
NSString
stringWithFormat
:
@"(%@)"
,
[
allValues
componentsJoinedByString
:
@","
]
];
[
sql
appendString
:
allValuesStr
];
[
sql
appendString
:
@";"
];
...
...
@@ -427,6 +433,9 @@
-
(
GCDWebServerResponse
*
)
getAllTable
:(
GCDWebServerRequest
*
)
request
{
NSDictionary
*
query
=
request
.
query
;
NSString
*
dirPath
=
query
[
@"dirPath"
];
if
([
dirPath
hasPrefix
:
@"/root"
])
{
dirPath
=
[
dirPath
substringFromIndex
:
5
];
}
NSString
*
fileName
=
query
[
@"fileName"
];
NSString
*
rootPath
=
NSHomeDirectory
();
NSString
*
targetPath
=
[
NSString
stringWithFormat
:
@"%@%@%@"
,
rootPath
,
dirPath
,
fileName
];
...
...
@@ -463,6 +472,9 @@
-
(
GCDWebServerResponse
*
)
saveFile
:(
GCDWebServerDataRequest
*
)
request
{
NSDictionary
*
data
=
[
NSJSONSerialization
JSONObjectWithData
:
request
.
data
options
:
0
error
:
nil
];
NSString
*
dirPath
=
data
[
@"dirPath"
];
if
([
dirPath
hasPrefix
:
@"/root"
])
{
dirPath
=
[
dirPath
substringFromIndex
:
5
];
}
NSString
*
fileName
=
data
[
@"fileName"
];
NSString
*
content
=
data
[
@"content"
];
NSString
*
rootPath
=
NSHomeDirectory
();
...
...
@@ -485,6 +497,9 @@
-
(
GCDWebServerResponse
*
)
deleteFile
:(
GCDWebServerDataRequest
*
)
request
{
NSDictionary
*
data
=
[
NSJSONSerialization
JSONObjectWithData
:
request
.
data
options
:
0
error
:
nil
];
NSString
*
dirPath
=
data
[
@"dirPath"
];
if
([
dirPath
hasPrefix
:
@"/root"
])
{
dirPath
=
[
dirPath
substringFromIndex
:
5
];
}
NSString
*
fileName
=
data
[
@"fileName"
];
NSString
*
rootPath
=
NSHomeDirectory
();
NSString
*
targetPath
=
[
NSString
stringWithFormat
:
@"%@%@%@"
,
rootPath
,
dirPath
,
fileName
];
...
...
@@ -507,6 +522,9 @@
-
(
GCDWebServerResponse
*
)
rename
:(
GCDWebServerDataRequest
*
)
request
{
NSDictionary
*
data
=
[
NSJSONSerialization
JSONObjectWithData
:
request
.
data
options
:
0
error
:
nil
];
NSString
*
dirPath
=
data
[
@"dirPath"
];
if
([
dirPath
hasPrefix
:
@"/root"
])
{
dirPath
=
[
dirPath
substringFromIndex
:
5
];
}
NSString
*
oldName
=
data
[
@"oldName"
];
NSString
*
newName
=
data
[
@"newName"
];
NSString
*
rootPath
=
NSHomeDirectory
();
...
...
@@ -545,8 +563,12 @@
NSDictionary
*
query
=
request
.
query
;
NSString
*
dirPath
=
query
[
@"dirPath"
];
NSString
*
realDirPath
=
dirPath
;
if
([
realDirPath
hasPrefix
:
@"/root"
])
{
realDirPath
=
[
realDirPath
substringFromIndex
:
5
];
}
NSString
*
rootPath
=
NSHomeDirectory
();
NSString
*
targetPath
=
[
NSString
stringWithFormat
:
@"%@%@"
,
rootPath
,
d
irPath
];
NSString
*
targetPath
=
[
NSString
stringWithFormat
:
@"%@%@"
,
rootPath
,
realD
irPath
];
NSMutableArray
*
files
=
@[].
mutableCopy
;
NSError
*
error
=
nil
;
...
...
@@ -589,6 +611,9 @@
-
(
GCDWebServerResponse
*
)
uploadFile
:(
GCDWebServerMultiPartFormRequest
*
)
request
{
GCDWebServerMultiPartFile
*
file
=
[
request
firstFileForControlName
:
@"file"
];
NSString
*
dirPath
=
[[
request
firstArgumentForControlName
:
@"dirPath"
]
string
];
if
([
dirPath
hasPrefix
:
@"/root"
])
{
dirPath
=
[
dirPath
substringFromIndex
:
5
];
}
NSString
*
rootPath
=
NSHomeDirectory
();
NSString
*
targetPath
=
[
NSString
stringWithFormat
:
@"%@%@%@"
,
rootPath
,
dirPath
,
file
.
fileName
];
NSError
*
error
=
nil
;
...
...
@@ -614,6 +639,9 @@
-
(
GCDWebServerResponse
*
)
downloadFile
:(
GCDWebServerRequest
*
)
request
{
NSString
*
rootPath
=
NSHomeDirectory
();
NSString
*
dirPath
=
[[
request
query
]
objectForKey
:
@"dirPath"
];
if
([
dirPath
hasPrefix
:
@"/root"
])
{
dirPath
=
[
dirPath
substringFromIndex
:
5
];
}
NSString
*
fileName
=
[[
request
query
]
objectForKey
:
@"fileName"
];
NSString
*
targetPath
=
[
NSString
stringWithFormat
:
@"%@%@%@"
,
rootPath
,
dirPath
,
fileName
];
...
...
@@ -635,12 +663,16 @@
-
(
GCDWebServerResponse
*
)
createFolder
:(
GCDWebServerDataRequest
*
)
request
{
NSDictionary
*
data
=
[
NSJSONSerialization
JSONObjectWithData
:
request
.
data
options
:
0
error
:
nil
];
NSString
*
dirPath
=
data
[
@"dirPath"
];
if
([
dirPath
hasPrefix
:
@"/root"
])
{
dirPath
=
[
dirPath
substringFromIndex
:
5
];
}
NSString
*
fileName
=
data
[
@"fileName"
];
NSString
*
rootPath
=
NSHomeDirectory
();
NSString
*
targetPath
=
[
NSString
stringWithFormat
:
@"%@%@%@"
,
rootPath
,
dirPath
,
fileName
];
NSError
*
error
;
NSDictionary
*
res
;
if
(
!
[[
NSFileManager
defaultManager
]
createDirectoryAtPath
:
targetPath
withIntermediateDirectories
:
YES
attributes
:
nil
error
:
nil
])
{
if
(
!
[[
NSFileManager
defaultManager
]
createDirectoryAtPath
:
targetPath
withIntermediateDirectories
:
YES
attributes
:
nil
error
:
&
error
])
{
NSLog
(
@"Failed creating directory
\"
%@
\"
"
,
targetPath
);
res
=
[
self
getCode
:
0
data
:
nil
];
}
else
{
...
...
@@ -655,6 +687,9 @@
-
(
GCDWebServerResponse
*
)
getFileDetail
:(
GCDWebServerRequest
*
)
request
{
NSString
*
rootPath
=
NSHomeDirectory
();
NSString
*
dirPath
=
[[
request
query
]
objectForKey
:
@"dirPath"
];
if
([
dirPath
hasPrefix
:
@"/root"
])
{
dirPath
=
[
dirPath
substringFromIndex
:
5
];
}
NSString
*
fileName
=
[[
request
query
]
objectForKey
:
@"fileName"
];
NSString
*
targetPath
=
[
NSString
stringWithFormat
:
@"%@%@%@"
,
rootPath
,
dirPath
,
fileName
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录