Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
Project
Project
Details
Activity
Releases
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
姚本章
dm_project
Commits
d1e3e360
Commit
d1e3e360
authored
Feb 20, 2021
by
zhangc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit 修复已知bug
parent
51b10b2a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
12 deletions
+25
-12
ApiInterface.java
...y/src/main/java/com/jz/dm/models/domian/ApiInterface.java
+10
-0
ApiInterfaceServiceImpl.java
.../java/com/jz/dm/service/impl/ApiInterfaceServiceImpl.java
+12
-12
ProducerServiceImpl.java
...main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
+1
-0
ApiInterfaceMapper.xml
...igateway/src/main/resources/mapper/ApiInterfaceMapper.xml
+2
-0
No files found.
jz-dm-apigateway/src/main/java/com/jz/dm/models/domian/ApiInterface.java
View file @
d1e3e360
...
...
@@ -153,6 +153,16 @@ public class ApiInterface extends BaseObject implements Serializable {
*/
@TableField
(
exist
=
false
)
private
String
respCode
;
/**
* 最大行数
*/
@TableField
(
exist
=
false
)
private
Integer
maxRow
;
/**
* 每页返回行数
*/
@TableField
(
exist
=
false
)
private
Integer
pageRow
;
/*---------------------------------日志查询--------------------------------*/
/**
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/ApiInterfaceServiceImpl.java
View file @
d1e3e360
...
...
@@ -173,8 +173,8 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
if
(
ApiStatusEnum
.
EXPIRY
.
name
().
equals
(
apiInterface
.
getStatus
()))
{
return
Result
.
of_error
(
"API已失效无法再次操作!"
);
}
Integer
authStat
=
getAuthCall
(
api
Key
,
AuthModeEnum
.
POWER_CALL_MODE
.
name
(),
null
);
Integer
authDateStat
=
getAuthCall
(
api
Key
,
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
(),
new
Date
());
Integer
authStat
=
getAuthCall
(
api
Interface
.
getId
()
,
AuthModeEnum
.
POWER_CALL_MODE
.
name
(),
null
);
Integer
authDateStat
=
getAuthCall
(
api
Interface
.
getId
()
,
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
(),
new
Date
());
UpdateWrapper
<
ApiInterface
>
updateInfo
=
new
UpdateWrapper
<>();
if
(
authStat
+
authDateStat
>
0
)
{
//有已授权未使用的先将状态置为$$ 下架
updateInfo
.
set
(
"status"
,
ApiStatusEnum
.
SOLDOUT
);
//下架状态%%可以调用,但不可以购买
...
...
@@ -197,17 +197,17 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
*/
@Override
public
Result
dmpDeleteAuth
(
String
type
,
String
apiKey
)
{
ApiInterface
apiInterface
=
getApiInfo
(
apiKey
);
if
(
null
==
apiInterface
)
{
return
Result
.
of_error
(
ResultMsg
.
DATA_NOT_EXIST
);
}
if
(
"0"
.
equals
(
type
))
{
//确认是否删除
Integer
call
=
getAuthCall
(
api
Key
,
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
(),
null
);
Integer
call
=
getAuthCall
(
api
Interface
.
getId
()
,
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
(),
null
);
if
(
call
>
0
)
{
return
Result
.
of_error
(
"已存在授权用户,是否要删除!"
);
}
return
Result
.
of_success
(
ResultMsg
.
SUCCESS
);
}
else
if
(
"1"
.
equals
(
type
))
{
//正式删除
ApiInterface
apiInterface
=
getApiInfo
(
apiKey
);
if
(
null
==
apiInterface
)
{
return
Result
.
of_error
(
ResultMsg
.
DATA_NOT_EXIST
);
}
if
(
ApiStatusEnum
.
EXPIRY
.
name
().
equals
(
apiInterface
.
getStatus
()))
{
return
Result
.
of_error
(
"API已失效无法再次操作!"
);
}
...
...
@@ -244,15 +244,15 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
/**
* 获取单次调用有效授权
*
* @param api
Key
* @param api
Id
* @param modeType
* @param date
* @return
*/
private
Integer
getAuthCall
(
String
apiKey
,
String
modeType
,
Date
date
)
{
private
Integer
getAuthCall
(
Long
apiId
,
String
modeType
,
Date
date
)
{
//按次调用统计
QueryWrapper
<
ApiAuth
>
query
=
new
QueryWrapper
<>();
query
.
eq
(
"api_
key"
,
apiKey
);
query
.
eq
(
"api_
interface_id"
,
apiId
);
query
.
eq
(
"handler"
,
0
);
//主要是确认单次调用是否调用
query
.
eq
(
"auth_mode"
,
modeType
);
if
(
null
!=
date
)
{
...
...
@@ -272,8 +272,8 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
*/
@Override
public
Integer
getValidAuthStatus
(
ApiInterface
apiInterface
)
{
Integer
authCall
=
getAuthCall
(
apiInterface
.
get
ApiKey
(),
AuthModeEnum
.
POWER_CALL_MODE
.
name
(),
null
);
Integer
authDateCall
=
getAuthCall
(
apiInterface
.
get
ApiKey
(),
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
(),
new
Date
());
Integer
authCall
=
getAuthCall
(
apiInterface
.
get
Id
(),
AuthModeEnum
.
POWER_CALL_MODE
.
name
(),
null
);
Integer
authDateCall
=
getAuthCall
(
apiInterface
.
get
Id
(),
AuthModeEnum
.
PERMANENT_TIME_MODE
.
name
(),
new
Date
());
return
authCall
+
authDateCall
;
}
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/ProducerServiceImpl.java
View file @
d1e3e360
...
...
@@ -239,6 +239,7 @@ public class ProducerServiceImpl implements ProducerService {
}
UpdateWrapper
<
ApiInterface
>
updateWra
=
new
UpdateWrapper
<>();
updateWra
.
set
(
"is_send_bank"
,
1
);
updateWra
.
eq
(
"id"
,
id
);
if
(
apiInterfaceMapper
.
update
(
null
,
updateWra
)
==
0
){
return
Result
.
of_error
(
ResultMsg
.
UPDATE_FAIL
);
}
...
...
jz-dm-apigateway/src/main/resources/mapper/ApiInterfaceMapper.xml
View file @
d1e3e360
...
...
@@ -31,6 +31,8 @@
aic.inbox_param AS inboxParam,
aic.request_param AS requestParam,
aic.response_param AS responseParam,
aic.max_row AS maxRow,
aic.page_row AS pageRow,
aic.resp_code AS respCode
FROM t_api_interface AS ai
LEFT JOIN t_api_interface_custom AS aic ON ai.id = aic.api_interface_id AND aic.is_deleted =0
...
...
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