Commit d1e3e360 authored by zhangc's avatar zhangc

commit 修复已知bug

parent 51b10b2a
......@@ -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;
/*---------------------------------日志查询--------------------------------*/
/**
......
......@@ -173,8 +173,8 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
if (ApiStatusEnum.EXPIRY.name().equals(apiInterface.getStatus())) {
return Result.of_error("API已失效无法再次操作!");
}
Integer authStat = getAuthCall(apiKey, AuthModeEnum.POWER_CALL_MODE.name(), null);
Integer authDateStat = getAuthCall(apiKey, AuthModeEnum.PERMANENT_TIME_MODE.name(), new Date());
Integer authStat = getAuthCall(apiInterface.getId(), AuthModeEnum.POWER_CALL_MODE.name(), null);
Integer authDateStat = getAuthCall(apiInterface.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(apiKey, AuthModeEnum.PERMANENT_TIME_MODE.name(), null);
Integer call = getAuthCall(apiInterface.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 apiKey
* @param apiId
* @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.getApiKey(), AuthModeEnum.POWER_CALL_MODE.name(), null);
Integer authDateCall = getAuthCall(apiInterface.getApiKey(), AuthModeEnum.PERMANENT_TIME_MODE.name(), new Date());
Integer authCall = getAuthCall(apiInterface.getId(), AuthModeEnum.POWER_CALL_MODE.name(), null);
Integer authDateCall = getAuthCall(apiInterface.getId(), AuthModeEnum.PERMANENT_TIME_MODE.name(), new Date());
return authCall + authDateCall;
}
......
......@@ -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);
}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment