Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
50efd703
Commit
50efd703
authored
Feb 26, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抖音用户验卷接口调试
parent
0967fa7d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
27 deletions
+13
-27
TiktokServiceImpl.java
...ain/java/share/system/service/impl/TiktokServiceImpl.java
+13
-27
No files found.
share-system/src/main/java/share/system/service/impl/TiktokServiceImpl.java
View file @
50efd703
...
@@ -76,32 +76,15 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -76,32 +76,15 @@ public class TiktokServiceImpl implements TiktokService {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
TiktokServiceImpl
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
TiktokServiceImpl
.
class
);
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
result
=
HttpRequest
.
get
(
TiktokUrlEnum
.
POI_QUERY
.
getUrl
())
// String result = HttpRequest.get(TiktokUrlEnum.CERTIFICATE_PREPARE.getUrl())
.
contentType
(
"application/json"
)
// .contentType("application/json")
.
header
(
"access-token"
,
"clt.ba984ee2aebdd450c9254d8da380dfbeRoKWll1pEG34qWF0ph9kgR6EpexC"
)
// .header("access-token", "clt.535c504322d5cda164387eddbd878ddcGuefIe0UR368DkctG9ZzVehCOTMi")
.
form
(
"account_id"
,
"7325762036464355343"
)
// .form("code", "102003486992130").form("poiId", "7315287081226340378").execute().body();
.
form
(
"page"
,
1
)
// JSONObject entries = new JSONObject(result);
.
form
(
"size"
,
50
)
// JSONObject data = entries.getJSONObject("data");
.
execute
().
body
();
// System.out.println(data);
JSONObject
entries
=
new
JSONObject
(
result
);
Integer
expireTime
=
1737388799
;
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
System
.
out
.
println
(
new
Date
(
expireTime
*
1000L
));
if
(!
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
throw
new
RuntimeException
(
data
.
getStr
(
"description"
));
}
JSONArray
pois
=
data
.
getJSONArray
(
"pois"
);
List
<
TiktokPoi
>
tiktokPois
=
new
ArrayList
<>();
List
<
JSONObject
>
list
=
pois
.
toList
(
JSONObject
.
class
);
list
.
stream
().
forEach
(
e
->
{
JSONObject
poi
=
e
.
getJSONObject
(
"poi"
);
TiktokPoi
tiktokPoi
=
new
TiktokPoi
();
tiktokPoi
.
setPoiId
(
poi
.
getStr
(
"poi_id"
));
tiktokPoi
.
setPoiName
(
poi
.
getStr
(
"poi_name"
));
tiktokPoi
.
setAddress
(
poi
.
getStr
(
"address"
));
tiktokPoi
.
setLatitude
(
poi
.
getFloat
(
"latitude"
));
tiktokPoi
.
setLongitude
(
poi
.
getFloat
(
"longitude"
));
tiktokPois
.
add
(
tiktokPoi
);
});
System
.
out
.
println
(
tiktokPois
);
}
}
@Override
@Override
public
void
clientToken
()
{
public
void
clientToken
()
{
...
@@ -320,6 +303,9 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -320,6 +303,9 @@ public class TiktokServiceImpl implements TiktokService {
tiktokCouponDto
.
setPoiId
(
sStore
.
getTiktokPoiId
());
tiktokCouponDto
.
setPoiId
(
sStore
.
getTiktokPoiId
());
JSONObject
prepare
=
prepare
(
tiktokCouponDto
);
JSONObject
prepare
=
prepare
(
tiktokCouponDto
);
JSONArray
certificates
=
prepare
.
getJSONArray
(
"certificates"
);
JSONArray
certificates
=
prepare
.
getJSONArray
(
"certificates"
);
if
(
CollectionUtils
.
isEmpty
(
certificates
))
{
throw
new
RuntimeException
(
"该券码已被使用"
);
}
Object
o
=
certificates
.
get
(
0
);
Object
o
=
certificates
.
get
(
0
);
JSONObject
entries
=
new
JSONObject
(
o
);
JSONObject
entries
=
new
JSONObject
(
o
);
JSONObject
sku
=
entries
.
getJSONObject
(
"sku"
);
JSONObject
sku
=
entries
.
getJSONObject
(
"sku"
);
...
@@ -347,7 +333,7 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -347,7 +333,7 @@ public class TiktokServiceImpl implements TiktokService {
Integer
originalAmount
=
amount
.
getInt
(
"original_amount"
);
Integer
originalAmount
=
amount
.
getInt
(
"original_amount"
);
sConsumerCoupon
.
setSubPrice
(
BigDecimal
.
valueOf
(
originalAmount
/
100
));
sConsumerCoupon
.
setSubPrice
(
BigDecimal
.
valueOf
(
originalAmount
/
100
));
//时间戳转年月日时分秒
//时间戳转年月日时分秒
sConsumerCoupon
.
setEndDate
(
DateUtil
.
date
(
entries
.
getInt
(
"expire_time"
)
*
1000
));
sConsumerCoupon
.
setEndDate
(
new
Date
(
entries
.
getInt
(
"expire_time"
)
*
1000L
));
sConsumerCoupon
.
setStartDate
(
new
Date
());
sConsumerCoupon
.
setStartDate
(
new
Date
());
LambdaQueryWrapper
<
SCoupon
>
sCouponLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SCoupon
>
sCouponLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
sCouponLambdaQueryWrapper
.
eq
(
SCoupon:
:
getTiktokSkuId
,
sku
.
getStr
(
"sku_id"
));
sCouponLambdaQueryWrapper
.
eq
(
SCoupon:
:
getTiktokSkuId
,
sku
.
getStr
(
"sku_id"
));
...
...
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