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
561312a5
Commit
561312a5
authored
Jan 29, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据商品id查询商品详情
parent
f9c38b04
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
9 deletions
+38
-9
TiktokUrlEnum.java
...ommon/src/main/java/share/common/enums/TiktokUrlEnum.java
+2
-0
TiktokController.java
...in/java/share/web/controller/system/TiktokController.java
+5
-0
TiktokService.java
...tem/src/main/java/share/system/service/TiktokService.java
+2
-0
TiktokServiceImpl.java
...ain/java/share/system/service/impl/TiktokServiceImpl.java
+29
-9
No files found.
share-common/src/main/java/share/common/enums/TiktokUrlEnum.java
View file @
561312a5
...
...
@@ -9,6 +9,8 @@ public enum TiktokUrlEnum {
CERTIFICATE_GET
(
"https://open.douyin.com/goodlife/v1/fulfilment/certificate/get/"
,
"券状态查询"
),
POI_QUERY
(
"https://open.douyin.com/goodlife/v1/shop/poi/query/"
,
"查询门店信息"
),
ONLINE_QUERY
(
"https://open.douyin.com/goodlife/v1/akte/goods/product/online/query/"
,
"查询商品线上数据列表"
),
ONLINE_GET
(
"https://open.douyin.com/goodlife/v1/akte/goods/product/online/get/"
,
"查询商品线上数据"
),
//查询商品线上数据
;
private
String
url
;
private
String
name
;
...
...
share-front/src/main/java/share/web/controller/system/TiktokController.java
View file @
561312a5
...
...
@@ -51,9 +51,14 @@ public class TiktokController {
return
tiktokService
.
poiQuery
(
tiktokCouponDto
);
}
//查询所有线上商品数据列表
@GetMapping
(
"/online/query"
)
public
Object
onlineQuery
(
OnlineQueryDto
onlineQueryDto
)
{
return
tiktokService
.
onlineQuery
(
onlineQueryDto
);
}
@GetMapping
(
"/online/query"
)
public
Object
onlineGet
(
String
productIds
,
String
accountId
)
{
return
tiktokService
.
onlineGet
(
productIds
,
accountId
);
}
}
share-system/src/main/java/share/system/service/TiktokService.java
View file @
561312a5
...
...
@@ -20,4 +20,6 @@ public interface TiktokService {
Object
poiQuery
(
TiktokCouponDto
tiktokCouponDto
);
Object
onlineQuery
(
OnlineQueryDto
onlineQueryDto
);
Object
onlineGet
(
String
productIds
,
String
accountId
);
}
share-system/src/main/java/share/system/service/impl/TiktokServiceImpl.java
View file @
561312a5
...
...
@@ -13,10 +13,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.ErrorCodeEnum
;
import
share.common.enums.ReceiptRdeisEnum
;
import
share.common.enums.TiktokUrlEnum
;
import
share.common.enums.VerifyResultsEnum
;
import
share.common.enums.*
;
import
share.system.domain.vo.OnlineQueryDto
;
import
share.system.domain.vo.TiktokCouponDto
;
import
share.system.service.TiktokService
;
...
...
@@ -211,16 +208,15 @@ public class TiktokServiceImpl implements TiktokService {
@Override
public
Object
onlineQuery
(
OnlineQueryDto
onlineQueryDto
)
{
String
accessToken
=
obtain
();
String
result
=
HttpRequest
.
pos
t
(
TiktokUrlEnum
.
ONLINE_QUERY
.
getUrl
())
String
result
=
HttpRequest
.
ge
t
(
TiktokUrlEnum
.
ONLINE_QUERY
.
getUrl
())
.
contentType
(
"application/json"
)
.
header
(
"access-token"
,
accessToken
)
.
form
(
"cursor"
,
onlineQueryDto
.
getCursor
())
.
form
(
"count"
,
onlineQueryDto
.
getCount
()
)
.
form
(
"count"
,
20
)
.
form
(
"status"
,
onlineQueryDto
.
getStatus
())
.
form
(
"account_id"
,
onlineQueryDto
.
getAccountId
())
.
form
(
"goods_creator_type"
,
onlineQueryDto
.
getGoodsCreatorType
())
.
form
(
"query_all_poi"
,
onlineQueryDto
.
getQueryAllPoi
())
.
form
(
"goods_query_type"
,
onlineQueryDto
.
getGoodsQueryType
())
.
form
(
"goods_creator_type"
,
1
)
.
form
(
"query_all_poi"
,
YesNoEnum
.
yes
.
getFlag
())
.
execute
().
body
();
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
...
...
@@ -248,6 +244,30 @@ public class TiktokServiceImpl implements TiktokService {
return
data
.
getJSONArray
(
"records"
);
}
@Override
public
Object
onlineGet
(
String
productIds
,
String
accountId
)
{
String
accessToken
=
obtain
();
String
result
=
HttpRequest
.
get
(
TiktokUrlEnum
.
ONLINE_QUERY
.
getUrl
())
.
contentType
(
"application/json"
)
.
header
(
"access-token"
,
accessToken
)
.
form
(
"product_ids"
,
productIds
)
.
form
(
"account_id"
,
accountId
)
.
execute
().
body
();
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
JSONArray
productOnlines
=
data
.
getJSONArray
(
"product_onlines"
);
productOnlines
.
forEach
(
e
->
{
JSONObject
product
=
new
JSONObject
(
e
);
//查询在线状态为在线的
if
(
product
.
getInt
(
"online_status"
).
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
JSONObject
jsonObject
=
product
.
getJSONObject
(
"product"
);
}
});
return
null
;
}
public
String
obtain
()
{
String
o
;
o
=
redisUtil
.
get
(
ReceiptRdeisEnum
.
TIKTOK_CLIENT_TOKEN
.
getValue
());
...
...
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