Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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-Cn-Ko-En
Commits
1416c0c5
Commit
1416c0c5
authored
Jun 30, 2025
by
wangfugui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
卡组批量推送pai
parent
74ec32cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
33 deletions
+45
-33
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
...va/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
+37
-24
mobile/src/main/java/cn/garymb/ygomobile/deck_square/api_response/PushMultiDeck.java
...ymb/ygomobile/deck_square/api_response/PushMultiDeck.java
+7
-8
mobile/src/main/java/cn/garymb/ygomobile/deck_square/api_response/PushSingleDeck.java
...mb/ygomobile/deck_square/api_response/PushSingleDeck.java
+1
-1
No files found.
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
View file @
1416c0c5
...
...
@@ -23,11 +23,11 @@ import cn.garymb.ygomobile.deck_square.api_response.LoginResponse;
import
cn.garymb.ygomobile.deck_square.api_response.LoginToken
;
import
cn.garymb.ygomobile.deck_square.api_response.MyDeckResponse
;
import
cn.garymb.ygomobile.deck_square.api_response.MyOnlineDeckDetail
;
import
cn.garymb.ygomobile.deck_square.api_response.Push
CardJson
;
import
cn.garymb.ygomobile.deck_square.api_response.Push
SingleDeck
;
import
cn.garymb.ygomobile.deck_square.api_response.PushDeckPublicState
;
import
cn.garymb.ygomobile.deck_square.api_response.PushDeckResponse
;
import
cn.garymb.ygomobile.deck_square.api_response.SquareDeckResponse
;
import
cn.garymb.ygomobile.deck_square.api_response.
SyncDeckReq
;
import
cn.garymb.ygomobile.deck_square.api_response.
PushMultiDeck
;
import
cn.garymb.ygomobile.deck_square.api_response.SyncDecksResponse
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.utils.LogUtil
;
...
...
@@ -73,6 +73,12 @@ public class DeckSquareApiUtil {
}
/**
* 根据条件,分页查询卡组的列表(不查询卡组的内容,只查询卡组名、卡组id等概括性信息)
* @param condition
* @return
* @throws IOException
*/
public
static
SquareDeckResponse
getSquareDecks
(
GetSquareDeckCondition
condition
)
throws
IOException
{
SquareDeckResponse
result
=
null
;
...
...
@@ -133,7 +139,7 @@ public class DeckSquareApiUtil {
/**
* 阻塞方法
* 根据卡组ID查询一个卡组,不需要传入token,可以查询已登录用户或其它未登录用户的卡组
* 根据卡组ID查询一个卡组
的内容
,不需要传入token,可以查询已登录用户或其它未登录用户的卡组
*
* @param deckId
* @return
...
...
@@ -161,8 +167,8 @@ public class DeckSquareApiUtil {
/**
* 阻塞方法,
用于推送新卡组
。首先从服务器请求一个新的卡组id,之后将卡组上传到服务器
*
先同步推送,之后异步推送。
首先调用服务端api获取卡组id,之后将卡组id设置到ydk中,之后调用服务器api将卡组上传
* 阻塞方法,
推送新卡组的内容时使用
。首先从服务器请求一个新的卡组id,之后将卡组上传到服务器
* 首先调用服务端api获取卡组id,之后将卡组id设置到ydk中,之后调用服务器api将卡组上传
*
* @param deckFile
* @param loginToken
...
...
@@ -203,7 +209,7 @@ public class DeckSquareApiUtil {
}
/**
* 将对应于deckId、deckName的卡组内容json推送到服务器。
*
阻塞方法,
将对应于deckId、deckName的卡组内容json推送到服务器。
* 如果在服务器上不存在deckId、deckName对应的记录,则创建新卡组
* 如果在服务器存在deckId相同的记录,则更新卡组,deckName会覆盖服务器上的卡组名
* 如果在服务器存在deckName相同、deckId不同的记录,则更新失败
...
...
@@ -225,19 +231,19 @@ public class DeckSquareApiUtil {
Gson
gson
=
new
Gson
();
Push
CardJson
pushCardJson
=
new
PushCardJson
();
push
CardJson
.
setDeckContributor
(
loginToken
.
getUserId
().
toString
());
push
CardJson
.
setUserId
(
loginToken
.
getUserId
());
Push
CardJson
.
DeckData
deckData
=
new
PushCardJson
.
DeckData
();
Push
SingleDeck
pushSingleDeck
=
new
PushSingleDeck
();
push
SingleDeck
.
setDeckContributor
(
loginToken
.
getUserId
().
toString
());
push
SingleDeck
.
setUserId
(
loginToken
.
getUserId
());
Push
SingleDeck
.
DeckData
deckData
=
new
PushSingleDeck
.
DeckData
();
deckData
.
setDeckId
(
deckId
);
deckData
.
setDeckName
(
deckfile
.
getName
());
deckData
.
setDeckCoverCard1
(
deckfile
.
getFirstCode
());
deckData
.
setDelete
(
false
);
deckData
.
setDeckYdk
(
deckContent
);
push
CardJson
.
setDeck
(
deckData
);
push
SingleDeck
.
setDeck
(
deckData
);
String
json
=
gson
.
toJson
(
push
CardJson
);
String
json
=
gson
.
toJson
(
push
SingleDeck
);
Response
response
=
OkhttpUtil
.
postJson
(
url
,
json
,
headers
,
1000
);
String
responseBodyString
=
response
.
body
().
string
();
...
...
@@ -246,20 +252,27 @@ public class DeckSquareApiUtil {
return
result
;
}
public
static
SyncDecksResponse
syncDecks
(
List
<
PushCardJson
.
DeckData
>
deckDataList
,
LoginToken
loginToken
)
throws
IOException
{
/**
*
* @param deckDataList
* @param loginToken
* @return
* @throws IOException
*/
public
static
SyncDecksResponse
syncDecks
(
List
<
PushSingleDeck
.
DeckData
>
deckDataList
,
LoginToken
loginToken
)
throws
IOException
{
SyncDecksResponse
result
=
null
;
String
url
=
"http://rarnu.xyz:38383/api/mdpro3/sync/multi"
;
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
headers
.
put
(
"ReqSource"
,
"MDPro3"
);
headers
.
put
(
"token"
,
loginToken
.
getServerToken
());
Gson
gson
=
new
Gson
();
SyncDeckReq
syncDeckReq
=
new
SyncDeckReq
();
syncDeckReq
.
setDeckContributor
(
loginToken
.
getUserId
().
toString
());
syncDeckReq
.
setUserId
(
loginToken
.
getUserId
());
syncDeckReq
.
setDeckDataList
(
deckDataList
);
PushMultiDeck
pushMultiDeck
=
new
PushMultiDeck
();
pushMultiDeck
.
setDeckContributor
(
loginToken
.
getUserId
().
toString
());
pushMultiDeck
.
setUserId
(
loginToken
.
getUserId
());
pushMultiDeck
.
setDecks
(
deckDataList
);
String
json
=
gson
.
toJson
(
syncDeckReq
);
String
json
=
gson
.
toJson
(
pushMultiDeck
);
Response
response
=
OkhttpUtil
.
postJson
(
url
,
json
,
headers
,
1000
);
String
responseBodyString
=
response
.
body
().
string
();
...
...
@@ -380,16 +393,16 @@ public class DeckSquareApiUtil {
Gson
gson
=
new
Gson
();
Push
CardJson
pushCardJson
=
new
PushCardJson
();
Push
CardJson
.
DeckData
deckData
=
new
PushCardJson
.
DeckData
();
Push
SingleDeck
pushSingleDeck
=
new
PushSingleDeck
();
Push
SingleDeck
.
DeckData
deckData
=
new
PushSingleDeck
.
DeckData
();
deckData
.
setDeckId
(
deckId
);
deckData
.
setDelete
(
true
);
push
CardJson
.
setDeck
(
deckData
);
push
CardJson
.
setUserId
(
loginToken
.
getUserId
());
push
SingleDeck
.
setDeck
(
deckData
);
push
SingleDeck
.
setUserId
(
loginToken
.
getUserId
());
String
json
=
gson
.
toJson
(
push
CardJson
);
String
json
=
gson
.
toJson
(
push
SingleDeck
);
Response
response
=
OkhttpUtil
.
postJson
(
url
,
json
,
headers
,
1000
);
String
responseBodyString
=
response
.
body
().
string
();
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/api_response/
SyncDeckReq
.java
→
mobile/src/main/java/cn/garymb/ygomobile/deck_square/api_response/
PushMultiDeck
.java
View file @
1416c0c5
package
cn.garymb.ygomobile.deck_square.api_response
;
import
java.util.ArrayList
;
import
java.util.List
;
import
cn.garymb.ygomobile.deck_square.api_response.Push
CardJson
.DeckData
;
import
cn.garymb.ygomobile.deck_square.api_response.Push
SingleDeck
.DeckData
;
/*卡组同步请求类*/
public
class
SyncDeckReq
{
public
class
PushMultiDeck
{
private
String
deckContributor
;
private
Integer
userId
;
private
List
<
DeckData
>
deck
DataList
;
private
List
<
DeckData
>
deck
s
;
public
String
getDeckContributor
()
{
return
deckContributor
;
...
...
@@ -27,11 +26,11 @@ public class SyncDeckReq {
this
.
userId
=
userId
;
}
public
List
<
DeckData
>
getDeck
DataList
()
{
return
deck
DataList
;
public
List
<
DeckData
>
getDeck
s
()
{
return
deck
s
;
}
public
void
setDeck
DataList
(
List
<
DeckData
>
_deckDataList
)
{
this
.
deck
DataList
=
_deckDataList
;
public
void
setDeck
s
(
List
<
DeckData
>
_deckDataList
)
{
this
.
deck
s
=
_deckDataList
;
}
}
mobile/src/main/java/cn/garymb/ygomobile/deck_square/api_response/Push
CardJson
.java
→
mobile/src/main/java/cn/garymb/ygomobile/deck_square/api_response/Push
SingleDeck
.java
View file @
1416c0c5
package
cn.garymb.ygomobile.deck_square.api_response
;
public
class
Push
CardJson
{
public
class
Push
SingleDeck
{
private
String
deckContributor
;
private
Integer
userId
;
...
...
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