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
4238c280
Commit
4238c280
authored
Mar 04, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抖音tiktok新增自动获取token
parent
12008654
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
35 deletions
+34
-35
CouponLog.java
...e-system/src/main/java/share/system/domain/CouponLog.java
+6
-7
TiktokServiceImpl.java
...ain/java/share/system/service/impl/TiktokServiceImpl.java
+28
-28
No files found.
share-system/src/main/java/share/system/domain/CouponLog.java
View file @
4238c280
package
share
.
system
.
domain
;
package
share
.
system
.
domain
;
import
java.math.BigDecimal
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
share.common.core.domain.BaseEntity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
java.math.BigDecimal
;
import
lombok.Data
;
/**
/**
* 优惠卷操作日志对象 s_coupon_log
* 优惠卷操作日志对象 s_coupon_log
...
@@ -25,6 +23,7 @@ public class CouponLog extends BaseEntity {
...
@@ -25,6 +23,7 @@ public class CouponLog extends BaseEntity {
/**
/**
* 主键
* 主键
*/
*/
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
id
;
private
Long
id
;
/**
/**
...
...
share-system/src/main/java/share/system/service/impl/TiktokServiceImpl.java
View file @
4238c280
...
@@ -156,10 +156,10 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -156,10 +156,10 @@ public class TiktokServiceImpl implements TiktokService {
}
}
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
//
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
if
(
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_INVALID
.
getCode
())
|
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_EXPIRE
.
getCode
()))
{
//
clientToken();
clientToken
();
//
prepare(tiktokCouponDto);
prepare
(
tiktokCouponDto
);
//
}
}
if
(!
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
if
(!
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
logger
.
error
(
"抖音验券准备失败:{}"
,
data
.
getStr
(
"description"
));
logger
.
error
(
"抖音验券准备失败:{}"
,
data
.
getStr
(
"description"
));
throw
new
RuntimeException
(
data
.
getStr
(
"description"
));
throw
new
RuntimeException
(
data
.
getStr
(
"description"
));
...
@@ -182,10 +182,10 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -182,10 +182,10 @@ public class TiktokServiceImpl implements TiktokService {
.
body
(
jsonObject
.
toString
()).
execute
().
body
();
.
body
(
jsonObject
.
toString
()).
execute
().
body
();
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
//
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
if
(
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_INVALID
.
getCode
())
|
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_EXPIRE
.
getCode
()))
{
//
clientToken();
clientToken
();
//
verify(tiktokCouponDto);
verify
(
tiktokCouponDto
);
//
}
}
JSONObject
extra
=
entries
.
getJSONObject
(
"extra"
);
JSONObject
extra
=
entries
.
getJSONObject
(
"extra"
);
if
(
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
())
&&
((
JSONObject
)
data
.
getJSONArray
(
"verify_results"
).
get
(
0
)).
getStr
(
"result"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
if
(
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
())
&&
((
JSONObject
)
data
.
getJSONArray
(
"verify_results"
).
get
(
0
)).
getStr
(
"result"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
return
data
;
return
data
;
...
@@ -211,10 +211,10 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -211,10 +211,10 @@ public class TiktokServiceImpl implements TiktokService {
.
body
(
jsonObject
.
toString
()).
execute
().
body
();
.
body
(
jsonObject
.
toString
()).
execute
().
body
();
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
//
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
if
(
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_INVALID
.
getCode
())
|
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_EXPIRE
.
getCode
()))
{
//
clientToken();
clientToken
();
//
cancel(tiktokCouponDto);
cancel
(
tiktokCouponDto
);
//
}
}
if
(!
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
if
(!
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
logger
.
error
(
"抖音撤销核销失败:{}"
,
data
.
getStr
(
"description"
));
logger
.
error
(
"抖音撤销核销失败:{}"
,
data
.
getStr
(
"description"
));
throw
new
RuntimeException
(
data
.
getStr
(
"description"
));
throw
new
RuntimeException
(
data
.
getStr
(
"description"
));
...
@@ -238,10 +238,10 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -238,10 +238,10 @@ public class TiktokServiceImpl implements TiktokService {
.
form
(
"encrypted_code"
,
encode
).
execute
().
body
();
.
form
(
"encrypted_code"
,
encode
).
execute
().
body
();
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
//
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
if
(
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_INVALID
.
getCode
())
|
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_EXPIRE
.
getCode
()))
{
//
clientToken();
clientToken
();
//
certificateGet(encryptedCode);
certificateGet
(
encryptedCode
);
//
}
}
if
(!
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
if
(!
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
logger
.
error
(
"抖音获取核销信息失败:{}"
,
data
.
getStr
(
"description"
));
logger
.
error
(
"抖音获取核销信息失败:{}"
,
data
.
getStr
(
"description"
));
throw
new
BaseException
(
data
.
getStr
(
"description"
));
throw
new
BaseException
(
data
.
getStr
(
"description"
));
...
@@ -262,10 +262,10 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -262,10 +262,10 @@ public class TiktokServiceImpl implements TiktokService {
.
execute
().
body
();
.
execute
().
body
();
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
//
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
if
(
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_INVALID
.
getCode
())
|
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_EXPIRE
.
getCode
()))
{
//
clientToken();
clientToken
();
//
poiQuery(tiktokCouponDto);
poiQuery
(
tiktokCouponDto
);
//
}
}
if
(!
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
if
(!
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
throw
new
RuntimeException
(
data
.
getStr
(
"description"
));
throw
new
RuntimeException
(
data
.
getStr
(
"description"
));
}
}
...
@@ -299,10 +299,10 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -299,10 +299,10 @@ public class TiktokServiceImpl implements TiktokService {
.
execute
().
body
();
.
execute
().
body
();
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
//
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
if
(
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_INVALID
.
getCode
())
|
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_EXPIRE
.
getCode
()))
{
//
clientToken();
clientToken
();
//
onlineQuery(onlineQueryDto);
onlineQuery
(
onlineQueryDto
);
//
}
}
if
(!
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
if
(!
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
SUCCESS
.
getCode
()))
{
throw
new
RuntimeException
(
data
.
getStr
(
"description"
));
throw
new
RuntimeException
(
data
.
getStr
(
"description"
));
}
}
...
@@ -320,10 +320,10 @@ public class TiktokServiceImpl implements TiktokService {
...
@@ -320,10 +320,10 @@ public class TiktokServiceImpl implements TiktokService {
.
execute
().
body
();
.
execute
().
body
();
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
entries
=
new
JSONObject
(
result
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
JSONObject
data
=
entries
.
getJSONObject
(
"data"
);
//
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
if
(
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_INVALID
.
getCode
())
|
data
.
getStr
(
"error_code"
).
equals
(
ErrorCodeEnum
.
ACCESS_TOKEN_EXPIRE
.
getCode
()))
{
//
clientToken();
clientToken
();
//
onlineGet(productIds, accountId);
onlineGet
(
productIds
,
accountId
);
//
}
}
return
data
;
return
data
;
}
}
...
...
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