Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile
Commits
37d157cd
Commit
37d157cd
authored
Dec 07, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传本地卡组时,将在线卡组的deckid直接存入ydk文件中,以免重复申请导致在线备份重复增加
parent
15628f06
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck_square/DeckSquareApiUtil.java
...ymb/ygomobile/ui/cards/deck_square/DeckSquareApiUtil.java
+11
-5
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck_square/DeckSquareMyDeckFragment.java
...mobile/ui/cards/deck_square/DeckSquareMyDeckFragment.java
+1
-1
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck_square/DeckSquareApiUtil.java
View file @
37d157cd
package
cn.garymb.ygomobile.ui.cards.deck_square
;
package
cn.garymb.ygomobile.ui.cards.deck_square
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
cards
.
deck_square
.
DeckSquareFileUtil
.
saveFile
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
cards
.
deck_square
.
DeckSquareFileUtil
.
saveFileToPath
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
cards
.
deck_square
.
DeckSquareFileUtil
.
toDeckItemList
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
cards
.
deck_square
.
DeckSquareFileUtil
.
toDeckItemList
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
@@ -190,6 +192,7 @@ public class DeckSquareApiUtil {
...
@@ -190,6 +192,7 @@ public class DeckSquareApiUtil {
for
(
int
i
=
0
;
i
<
deckDataList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
deckDataList
.
size
();
i
++)
{
MyDeckItem
myDeckItem
=
deckDataList
.
get
(
i
);
MyDeckItem
myDeckItem
=
deckDataList
.
get
(
i
);
String
deckContent
=
DeckSquareFileUtil
.
setDeckId
(
myDeckItem
.
getDeckPath
(),
loginToken
.
getUserId
(),
deckIdList
.
get
(
i
));
String
deckContent
=
DeckSquareFileUtil
.
setDeckId
(
myDeckItem
.
getDeckPath
(),
loginToken
.
getUserId
(),
deckIdList
.
get
(
i
));
saveFileToPath
(
myDeckItem
.
getDeckPath
(),
deckContent
,
myDeckItem
.
getUpdateTimestamp
());
//用于将新申请的deckid写入对应的本地卡组中,以免下次重复申请
PushMultiDeck
.
DeckData
data
=
new
PushMultiDeck
.
DeckData
();
PushMultiDeck
.
DeckData
data
=
new
PushMultiDeck
.
DeckData
();
data
.
setDeckYdk
(
deckContent
);
data
.
setDeckYdk
(
deckContent
);
data
.
setDeckType
(
myDeckItem
.
getDeckType
());
data
.
setDeckType
(
myDeckItem
.
getDeckType
());
...
@@ -255,7 +258,7 @@ public class DeckSquareApiUtil {
...
@@ -255,7 +258,7 @@ public class DeckSquareApiUtil {
* @return
* @return
* @throws IOException
* @throws IOException
*/
*/
public
static
PushMultiResponse
sync
MyDecks
(
List
<
MyDeckItem
>
deckItems
,
LoginToken
loginToken
)
throws
IOException
{
public
static
PushMultiResponse
Upload
MyDecks
(
List
<
MyDeckItem
>
deckItems
,
LoginToken
loginToken
)
throws
IOException
{
if
(
deckItems
==
null
||
deckItems
.
isEmpty
())
{
if
(
deckItems
==
null
||
deckItems
.
isEmpty
())
{
return
null
;
return
null
;
}
}
...
@@ -274,6 +277,7 @@ public class DeckSquareApiUtil {
...
@@ -274,6 +277,7 @@ public class DeckSquareApiUtil {
}
else
{
}
else
{
deckContent
=
DeckSquareFileUtil
.
setDeckId
(
item
.
getDeckPath
(),
loginToken
.
getUserId
(),
item
.
getDeckId
());
deckContent
=
DeckSquareFileUtil
.
setDeckId
(
item
.
getDeckPath
(),
loginToken
.
getUserId
(),
item
.
getDeckId
());
saveFileToPath
(
item
.
getDeckPath
(),
deckContent
,
item
.
getUpdateTimestamp
());
// 用于将新申请的deckid写入对应的本地卡组中,方便同步时进行比较
}
}
data
.
setDeckYdk
(
deckContent
);
data
.
setDeckYdk
(
deckContent
);
LogUtil
.
w
(
TAG
,
"*要上传的* 本地卡组:"
+
data
.
getDeckType
()
+
"、"
+
data
.
getDeckName
()
+
"++id: "
+
data
.
getDeckId
()
+
" "
+
data
.
isDelete
());
LogUtil
.
w
(
TAG
,
"*要上传的* 本地卡组:"
+
data
.
getDeckType
()
+
"、"
+
data
.
getDeckName
()
+
"++id: "
+
data
.
getDeckId
()
+
" "
+
data
.
isDelete
());
...
@@ -469,13 +473,15 @@ public class DeckSquareApiUtil {
...
@@ -469,13 +473,15 @@ public class DeckSquareApiUtil {
// 上传本地卡组覆盖在线卡组
// 上传本地卡组覆盖在线卡组
LogUtil
.
w
(
TAG
,
"+同步的 本地卡组: "
+
syncUploadDecks
.
size
());
LogUtil
.
w
(
TAG
,
"+同步的 本地卡组: "
+
syncUploadDecks
.
size
());
syncMyDecks
(
syncUploadDecks
,
loginToken
);
if
(!
syncUploadDecks
.
isEmpty
())
{
PushMultiResponse
result
=
UploadMyDecks
(
syncUploadDecks
,
loginToken
);
LogUtil
.
w
(
TAG
,
"本地已有卡组 上传结果数:"
+
result
.
getData
());
}
// 剩余的本地卡组都是新增卡组(本地独有,需要上传)
// 剩余的本地卡组都是新增卡组(本地独有,需要上传)
LogUtil
.
w
(
TAG
,
"+上传新增的 本地卡组: "
+
localDecks
.
size
());
LogUtil
.
w
(
TAG
,
"+上传新增的 本地卡组: "
+
localDecks
.
size
());
if
(!
localDecks
.
isEmpty
())
{
if
(!
localDecks
.
isEmpty
())
{
PushMultiResponse
result
=
requestIdAndPushNewDecks
(
localDecks
,
loginToken
);
PushMultiResponse
result
=
requestIdAndPushNewDecks
(
localDecks
,
loginToken
);
LogUtil
.
w
(
TAG
,
"上传结果数:"
+
result
.
getData
());
LogUtil
.
w
(
TAG
,
"
本地新增卡组
上传结果数:"
+
result
.
getData
());
}
}
// 剩余的在线卡组都是云端独有,需要下载
// 剩余的在线卡组都是云端独有,需要下载
...
@@ -560,7 +566,7 @@ public class DeckSquareApiUtil {
...
@@ -560,7 +566,7 @@ public class DeckSquareApiUtil {
}
}
}
}
sync
MyDecks
(
toDeckItemList
(
originalData
),
loginToken
);
Upload
MyDecks
(
toDeckItemList
(
originalData
),
loginToken
);
return
true
;
return
true
;
}).
fail
((
e
)
->
{
}).
fail
((
e
)
->
{
LogUtil
.
e
(
TAG
,
"删除卡组失败!"
,
e
);
LogUtil
.
e
(
TAG
,
"删除卡组失败!"
,
e
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck_square/DeckSquareMyDeckFragment.java
View file @
37d157cd
...
@@ -195,7 +195,7 @@ public class DeckSquareMyDeckFragment extends Fragment {
...
@@ -195,7 +195,7 @@ public class DeckSquareMyDeckFragment extends Fragment {
}
}
});
});
/*
*
自动同步 */
/* 自动同步 */
VUiKit
.
defer
().
when
(()
->
{
VUiKit
.
defer
().
when
(()
->
{
try
{
try
{
DeckSquareApiUtil
.
synchronizeDecks
();
DeckSquareApiUtil
.
synchronizeDecks
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment